Get the FREE Ultimate OpenClaw Setup Guide →

mcts-expand

Scanned
npx machina-cli add skill NewJerseyStyle/plugin-mcts/mcts-expand --openclaw
Files (1)
SKILL.md
2.2 KB

MCTS Expansion Phase

You are executing the EXPANSION phase of Monte Carlo Tree Search.

LLM as World Model

Use your knowledge to predict:

  1. Valid actions from the current state
  2. Resulting states from each action
  3. Transition probabilities (if applicable)
  4. Prior probabilities for action quality

Expansion Algorithm

  1. Identify the node to expand (from selection phase)
  2. Generate possible actions:
    • What are the valid next steps?
    • What knowledge/constraints apply?
    • What has worked in similar situations?
  3. Predict outcomes:
    • For each action, what state results?
    • What is the likelihood of success?
    • What are potential issues?
  4. Create child nodes for promising actions

Using MCP Tools

Call mcts_expand with:

  • node_id: The node to expand
  • actions: List of actions to add as children
  • states: Resulting states for each action
  • priors: 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:

  1. Number of children added
  2. Brief description of each action
  3. Prior probabilities and reasoning
  4. 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

  1. Step 1: Identify the node to expand from the selection phase
  2. Step 2: Generate possible actions and predicted states using the LLM world model; apply pruning rules to drop invalid or low-prior options
  3. 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

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers