mcts-expand
Scannednpx machina-cli add skill NewJerseyStyle/plugin-mcts/mcts-expand --openclawMCTS Expansion Phase
You are executing the EXPANSION phase of Monte Carlo Tree Search.
LLM as World Model
Use your knowledge to predict:
- Valid actions from the current state
- Resulting states from each action
- Transition probabilities (if applicable)
- Prior probabilities for action quality
Expansion Algorithm
- Identify the node to expand (from selection phase)
- Generate possible actions:
- What are the valid next steps?
- What knowledge/constraints apply?
- What has worked in similar situations?
- Predict outcomes:
- For each action, what state results?
- What is the likelihood of success?
- What are potential issues?
- Create child nodes for promising actions
Using MCP Tools
Call mcts_expand with:
node_id: The node to expandactions: List of actions to add as childrenstates: Resulting states for each actionpriors: Prior probability estimates for each action
Each action should include:
{
"action": "description of action",
"state": "resulting state description",
"prior": 0.3,
"metadata": {"reasoning": "why this action"}
}
Expansion Strategy
For the current context: $ARGUMENTS
For Research Problems:
- Actions = different hypotheses or investigation paths
- States = knowledge states after investigation
- Priors = based on domain knowledge
For Planning Problems:
- Actions = possible decisions or steps
- States = situation after each decision
- Priors = based on feasibility and expected outcomes
For Coding Problems:
- Actions = implementation approaches or fixes
- States = code states after changes
- Priors = based on best practices and complexity
Pruning Considerations
Don't expand:
- Obviously invalid actions
- Duplicate states (detected via state hashing)
- Actions with extremely low prior probability
Output
After expansion, report:
- Number of children added
- Brief description of each action
- Prior probabilities and reasoning
- Which child looks most promising for simulation
Proceed to SIMULATION phase with one of the new child nodes.
Source
git clone https://github.com/NewJerseyStyle/plugin-mcts/blob/main/skills/mcts-expand/SKILL.mdView on GitHub Overview
This skill implements the EXPANSION phase of Monte Carlo Tree Search by using an LLM as the world model to propose valid actions, predict resulting states, and assign priors. It creates new child nodes for promising actions and prunes obviously invalid or duplicate states to keep the search focused.
How This Skill Works
From the selected node, generate valid next actions using the LLM as a world model, incorporating constraints and prior knowledge. For each action, predict the resulting state, estimate the likelihood of success, and surface potential issues. Assemble child candidates as action/state/prior/metadata records and call mcts_expand to materialize the new nodes, applying pruning rules to remove invalid or duplicate states.
When to Use It
- Expanding a node in a research problem to explore hypotheses and knowledge states
- Enumerating feasible decisions or steps in planning problems
- Trying different implementation approaches in coding problems
- Investigating alternate knowledge states after an action in uncertain domains
- Pruning obviously invalid or low-prior actions before running simulations
Quick Start
- Step 1: Identify the node to expand from the selection phase
- Step 2: Generate possible actions and predicted states using the LLM world model; apply pruning rules to drop invalid or low-prior options
- Step 3: Call mcts_expand with node_id, actions, states, priors; review the number of children added and which is most promising for simulation
Best Practices
- Always identify the node to expand from the selection phase before generating actions
- Generate only valid, constraint-aware actions (avoid obviously invalid moves)
- Predict outcomes for each action and assign meaningful priors based on knowledge
- Hash resulting states to detect duplicates and prune duplicates efficiently
- Record concise metadata explaining why each action was chosen and which appears most promising
Example Use Cases
- Expanding a game-tree node to test new move candidates with predicted outcomes
- Building a hypothesis tree in a research assistant to compare investigation paths
- Evaluating coding approaches by expanding a node with alternative implementations
- Planning robot tasks by expanding decisions and forecasting resulting states
- Assessing logistics routes by expanding options with priors and predicted states