{
  "schemaVersion": "1.0",
  "item": {
    "slug": "tree-of-thoughts",
    "name": "Tree Of Thoughts",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/tobisamaa/tree-of-thoughts",
    "canonicalUrl": "https://clawhub.ai/tobisamaa/tree-of-thoughts",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/tree-of-thoughts",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=tree-of-thoughts",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "PLANNED.md",
      "SKILL.md",
      "unified_wrapper.py"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/tree-of-thoughts"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/tree-of-thoughts",
    "agentPageUrl": "https://openagent3.xyz/skills/tree-of-thoughts/agent",
    "manifestUrl": "https://openagent3.xyz/skills/tree-of-thoughts/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/tree-of-thoughts/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Tree of Thoughts (ToT) Reasoning (Enhanced v2.0.0)",
        "body": "v2.0.0 Enhancement: Parallel execution + intelligent caching (FoT pattern)\nSpeed Improvement: 3-5x faster for complex problems\nCache Benefit: 50-200x faster for similar cached problems\n\nAdvanced reasoning through systematic exploration of solution spaces."
      },
      {
        "title": "What is Tree of Thoughts?",
        "body": "Traditional reasoning (Chain of Thought):\n\nProblem → Step 1 → Step 2 → Step 3 → Solution\n(Single linear path)\n\nTree of Thoughts:\n\nProblem\n                   /   |   \\\n              Path A Path B Path C\n               /  \\    |    /  \\\n            A1   A2   B1  C1   C2\n             |    |    |   |    |\n          [eval] [eval] ... [eval]\n             \\    |    |   /    /\n              \\   |    |  /    /\n               Best Solution\n\nKey differences:\n\nExplores MULTIPLE paths\nEvaluates EACH branch\nCan BACKTRACK from dead ends\nSELECTS optimal solution\nMore robust than linear thinking"
      },
      {
        "title": "When to Use ToT",
        "body": "Use ToT for:\n\nMultiple possible solutions exist\nProblem is ambiguous or complex\nNeed to compare approaches\nHigh cost of failure\nCreative/optimization problems\nUncertain which method works\n\nSkip ToT for:\n\nSimple, clear problems\nSingle obvious solution\nTime-critical decisions\nRoutine operations\nWell-known procedures"
      },
      {
        "title": "Performance Improvements",
        "body": "ScenarioBeforeAfterSpeedup3-branch exploration3.0s1.0s3x5-branch exploration5.0s1.2s4.2xDeep tree (depth 4)8.0s2.0s4xSimilar cached problem5.0s0.025s200x"
      },
      {
        "title": "Parallel Tree Generation",
        "body": "async def parallel_tree_of_thoughts(problem, branches=5, depth=3):\n    \"\"\"\n    Generate and evaluate thought tree in parallel.\n    \n    Benefits:\n    - 3-5x faster than sequential\n    - All branches generated simultaneously\n    - Evaluation parallelized\n    \"\"\"\n    # Step 1: Generate all initial thoughts in parallel\n    initial_thoughts = await asyncio.gather(*[\n        generate_thought_async(problem) for _ in range(branches)\n    ])\n    \n    # Step 2: Evaluate all thoughts in parallel\n    evaluations = await asyncio.gather(*[\n        evaluate_thought_async(thought) for thought in initial_thoughts\n    ])\n    \n    # Step 3: Select top thoughts for expansion\n    top_thoughts = select_top_k(initial_thoughts, evaluations, k=3)\n    \n    # Step 4: Expand in parallel\n    expanded = await asyncio.gather(*[\n        expand_thought_async(thought, depth-1) for thought in top_thoughts\n    ])\n    \n    return select_best_solution(expanded)"
      },
      {
        "title": "Intelligent Caching",
        "body": "def cached_tree_of_thoughts(problem, cache_ttl_hours=24):\n    \"\"\"\n    ToT with semantic caching for similar problems.\n    \n    Cache hits when:\n    - Same problem repeated (exact match)\n    - Similar problem (>85% semantic similarity)\n    - Related problem type (same domain)\n    \"\"\"\n    cache_key = semantic_hash(problem)\n    cached = cache_get(cache_key)\n    \n    if cached and semantic_similarity(problem, cached['problem']) > 0.85:\n        return {\n            \"solution\": cached['solution'],\n            \"from_cache\": True,\n            \"cache_age\": (now - cached['timestamp']).minutes\n        }\n    \n    # Generate fresh solution\n    result = parallel_tree_of_thoughts(problem)\n    \n    # Cache for future\n    cache_set(cache_key, {\n        'problem': problem,\n        'solution': result,\n        'timestamp': now()\n    })\n    \n    return {**result, \"from_cache\": False}"
      },
      {
        "title": "CLI Flags",
        "body": "--parallel         Use parallel execution (default)\n--cached           Enable caching (default)\n--sequential       Disable parallel execution\n--no-cache         Disable caching\n--branches N       Set number of branches (default: 5)\n--depth N          Set tree depth (default: 3)"
      },
      {
        "title": "Step 1: GENERATE Thoughts",
        "body": "Given problem, generate multiple initial approaches:\n- Thought A: [Approach 1]\n- Thought B: [Approach 2]\n- Thought C: [Approach 3]"
      },
      {
        "title": "Step 2: EVALUATE Thoughts",
        "body": "For each thought, assess:\n- Feasibility: Can this work?\n- Quality: How good would result be?\n- Cost: Time/resources needed?\n- Risk: What could fail?"
      },
      {
        "title": "Step 3: EXPAND Promising Thoughts",
        "body": "Take best thoughts and expand:\n- Thought A → A1, A2, A3\n- Thought B → B1, B2\n(Expand only promising branches)"
      },
      {
        "title": "Step 4: EVALUATE Branches",
        "body": "Evaluate each expanded branch:\n- A1: [score/10]\n- A2: [score/10]\n- B1: [score/10]"
      },
      {
        "title": "Step 5: SEARCH for Solution",
        "body": "Strategies:\n- BFS: Explore all branches breadth-first\n- DFS: Dive deep into promising branches\n- Best-First: Always expand highest-rated\n- Beam Search: Keep top-K branches"
      },
      {
        "title": "Step 6: SELECT Optimal Path",
        "body": "Choose path with best expected outcome:\n- Highest evaluation score\n- Most feasible\n- Best cost/benefit ratio"
      },
      {
        "title": "Evaluation Criteria",
        "body": "Feasibility (0-10):\n\n- 10: Definitely possible\n- 7-9: Likely possible\n- 4-6: Maybe possible\n- 1-3: Unlikely to work\n- 0: Impossible\n\nQuality (0-10):\n\n- 10: Perfect solution\n- 7-9: Great solution\n- 4-6: Adequate solution\n- 1-3: Poor solution\n- 0: Doesn't solve problem\n\nCost (0-10, inverse):\n\n- 10: Negligible cost\n- 7-9: Low cost\n- 4-6: Moderate cost\n- 1-3: High cost\n- 0: Prohibitively expensive\n\nRisk (0-10, inverse):\n\n- 10: No risk\n- 7-9: Low risk\n- 4-6: Moderate risk\n- 1-3: High risk\n- 0: Certain failure"
      },
      {
        "title": "Scoring Formula",
        "body": "Score = (Feasibility * 0.3) + (Quality * 0.3) + (Cost * 0.2) + (Risk * 0.2)\n\nAdjust weights based on priorities:\n\nQuality-focused: Quality * 0.5\nSpeed-focused: Cost * 0.5\nSafety-focused: Risk * 0.5"
      },
      {
        "title": "Breadth-First Search (BFS)",
        "body": "Level 1: Explore all initial thoughts\nLevel 2: Expand all promising thoughts\nLevel 3: Continue breadth-wise\nGood for: Comprehensive exploration"
      },
      {
        "title": "Depth-First Search (DFS)",
        "body": "Level 1: Pick most promising thought\nLevel 2: Dive deep into that branch\nLevel 3: Continue depth-wise\nGood for: Quick deep solutions"
      },
      {
        "title": "Best-First Search",
        "body": "Always expand the highest-rated node\nUse priority queue\nGood for: Finding optimal quickly"
      },
      {
        "title": "Beam Search",
        "body": "Keep only top-K branches at each level\nPrune low-rated branches early\nGood for: Efficiency with quality"
      },
      {
        "title": "Decision Problem",
        "body": "## Problem: [Decision to make]\n\n### Initial Thoughts\n1. **Option A**: [Description]\n   - Feasibility: 8/10\n   - Quality: 7/10\n   - Cost: 9/10\n   - Risk: 8/10\n   - **Score**: 7.9/10\n\n2. **Option B**: [Description]\n   - Feasibility: 9/10\n   - Quality: 6/10\n   - Cost: 7/10\n   - Risk: 6/10\n   - **Score**: 7.1/10\n\n3. **Option C**: [Description]\n   - Feasibility: 6/10\n   - Quality: 9/10\n   - Cost: 5/10\n   - Risk: 4/10\n   - **Score**: 6.3/10\n\n### Expansion (Top 2)\n**Option A** → A1: [Refinement] (Score: 8.5/10)\n**Option B** → B1: [Refinement] (Score: 7.8/10)\n\n### Selected Path: A1\nReason: Highest score, good balance of feasibility and quality"
      },
      {
        "title": "Creative Problem",
        "body": "## Problem: [Creative challenge]\n\n### Thought Branches\n1. **Creative A**: [Idea]\n   - Novelty: 9/10\n   - Feasibility: 5/10\n   - Impact: 8/10\n   - **Score**: 7.4/10\n\n2. **Creative B**: [Idea]\n   - Novelty: 7/10\n   - Feasibility: 8/10\n   - Impact: 7/10\n   - **Score**: 7.3/10\n\n3. **Safe C**: [Conservative idea]\n   - Novelty: 4/10\n   - Feasibility: 9/10\n   - Impact: 6/10\n   - **Score**: 6.3/10\n\n### Hybrid Approach: A + B\nCombine novelty of A with feasibility of B\nScore: 8.2/10"
      },
      {
        "title": "ToT + Task Decomposition",
        "body": "1. Use ToT to choose decomposition strategy\n2. Compare different breakdown approaches\n3. Select optimal decomposition"
      },
      {
        "title": "ToT + Error Recovery",
        "body": "1. When error occurs\n2. Generate multiple recovery options via ToT\n3. Evaluate each recovery path\n4. Select best recovery strategy"
      },
      {
        "title": "ToT + Self-Reflection",
        "body": "1. After completing task\n2. Reflect: Did I consider enough options?\n3. Should I have used ToT?\n4. Was my evaluation accurate?"
      },
      {
        "title": "Backtracking",
        "body": "When a path fails:\n\n1. Mark branch as dead end\n2. Record why it failed\n3. Backtrack to decision point\n4. Try next best alternative\n5. Learn from failure\n\nExample:\n\nPath A → A1 → A1a [FAILED: X didn't work]\nBacktrack to A\nPath A → A2 → A2a [SUCCESS]"
      },
      {
        "title": "Pruning Strategies",
        "body": "Early pruning:\n\nScore < 3/10: Drop immediately\nInfeasible: Drop immediately\nHigh risk + low quality: Drop\n\nContinuous pruning:\n\nAfter expansion, keep only top 50%\nRemove redundant branches\nMerge similar thoughts"
      },
      {
        "title": "Example 1: Choose Architecture",
        "body": "## Problem: Design system architecture\n\n### Thoughts\n1. Monolith: Simple, fast to build, hard to scale\n   Score: 6/10 (good for MVP, bad for scale)\n\n2. Microservices: Scalable, complex, slow to build\n   Score: 7/10 (good for scale, overkill now)\n\n3. Modular Monolith: Balanced, medium complexity\n   Score: 8/10 (best of both)\n\n### Expansion\nModular Monolith →\n  - M1: Start modular, split later (8.5/10)\n  - M2: Full modules from start (7/10)\n\n### Decision: M1\nStart with modular monolith, design for future split"
      },
      {
        "title": "Example 2: Fix Performance Bug",
        "body": "## Problem: API too slow\n\n### Thoughts\n1. Cache everything: Fast, memory-heavy, stale data risk\n   Score: 6/10\n\n2. Optimize queries: Moderate speedup, accurate data\n   Score: 8/10\n\n3. Add indexes: Quick win, limited impact\n   Score: 7/10\n\n4. Rewrite in faster language: High impact, high cost\n   Score: 5/10\n\n### Expansion\nOptimize + Indexes → Combined approach\nScore: 9/10 (synergy)\n\n### Decision: Optimize queries + Add strategic indexes"
      },
      {
        "title": "ToT Reasoning Log",
        "body": "Track ToT sessions in: memory/tot-sessions.md\n\n## [Date] ToT Session: [Problem]\n\n### Options Considered: [N]\n### Paths Explored: [N]\n### Depth: [N levels]\n### Decision: [Chosen path]\n### Rationale: [Why this won]\n### Outcome: [Did it work?]\n### Lesson: [What was learned]"
      },
      {
        "title": "Metrics",
        "body": "Average thoughts generated per problem\nSearch depth average\nBacktrack rate\nDecision quality (outcomes)\nTime to decision\nSolution diversity"
      },
      {
        "title": "Quick Actions",
        "body": "tot [problem] - Run ToT reasoning\ncompare [options] - Evaluate multiple options\ndecide [decision] - Make decision with ToT\nbranches - Show current ToT tree"
      },
      {
        "title": "Best Practices",
        "body": "Generate many thoughts initially (5-10)\nEvaluate objectively (use criteria)\nPrune aggressively (don't explore poor options)\nExpand gradually (depth vs breadth balance)\nBacktrack when stuck (dead ends happen)\nDocument reasoning (learn from decisions)\nReview outcomes (improve evaluation accuracy)\n\nRemember: The best solution is rarely the first one you think of. Explore, evaluate, select."
      },
      {
        "title": "Real Usage Example",
        "body": "Scenario: Choosing the best system improvement to implement"
      },
      {
        "title": "Problem",
        "body": "\"What ONE improvement should I make to the OpenClaw system today?\""
      },
      {
        "title": "Initial Thoughts (Generated 5 options)",
        "body": "OptionDescriptionFeasibilityQualityCostRiskScoreAAuto-create log files97998.3BAdd quick-action triggers48355.0CAdd integration examples96897.6DCreate error pattern detection79677.4ECreate skill test runner69566.5"
      },
      {
        "title": "Scoring Formula",
        "body": "Score = (Feasibility × 0.3) + (Quality × 0.3) + (Cost × 0.2) + (Risk × 0.2)"
      },
      {
        "title": "Expansion (Top 2)",
        "body": "A → A1: Auto-create all log files AND error folder → Score: 8.5\nD → D1: Simple regex-based error classifier → Score: 7.8"
      },
      {
        "title": "Decision: A1 (Auto-create log files)",
        "body": "Rationale: Highest score, lowest risk, immediate usability improvement"
      },
      {
        "title": "Outcome",
        "body": "Created:\n\nmemory/criticism-log.md\nmemory/tot-sessions.md\nmemory/errors/error-log.md\n\nLesson: Simple infrastructure improvements often beat complex features."
      }
    ],
    "body": "Tree of Thoughts (ToT) Reasoning (Enhanced v2.0.0)\n\nv2.0.0 Enhancement: Parallel execution + intelligent caching (FoT pattern) Speed Improvement: 3-5x faster for complex problems Cache Benefit: 50-200x faster for similar cached problems\n\nAdvanced reasoning through systematic exploration of solution spaces.\n\nWhat is Tree of Thoughts?\n\nTraditional reasoning (Chain of Thought):\n\nProblem → Step 1 → Step 2 → Step 3 → Solution\n(Single linear path)\n\n\nTree of Thoughts:\n\n                    Problem\n                   /   |   \\\n              Path A Path B Path C\n               /  \\    |    /  \\\n            A1   A2   B1  C1   C2\n             |    |    |   |    |\n          [eval] [eval] ... [eval]\n             \\    |    |   /    /\n              \\   |    |  /    /\n               Best Solution\n\n\nKey differences:\n\nExplores MULTIPLE paths\nEvaluates EACH branch\nCan BACKTRACK from dead ends\nSELECTS optimal solution\nMore robust than linear thinking\nWhen to Use ToT\n\nUse ToT for:\n\nMultiple possible solutions exist\nProblem is ambiguous or complex\nNeed to compare approaches\nHigh cost of failure\nCreative/optimization problems\nUncertain which method works\n\nSkip ToT for:\n\nSimple, clear problems\nSingle obvious solution\nTime-critical decisions\nRoutine operations\nWell-known procedures\nParallel Execution + Caching (v2.0.0)\nPerformance Improvements\nScenario\tBefore\tAfter\tSpeedup\n3-branch exploration\t3.0s\t1.0s\t3x\n5-branch exploration\t5.0s\t1.2s\t4.2x\nDeep tree (depth 4)\t8.0s\t2.0s\t4x\nSimilar cached problem\t5.0s\t0.025s\t200x\nParallel Tree Generation\nasync def parallel_tree_of_thoughts(problem, branches=5, depth=3):\n    \"\"\"\n    Generate and evaluate thought tree in parallel.\n    \n    Benefits:\n    - 3-5x faster than sequential\n    - All branches generated simultaneously\n    - Evaluation parallelized\n    \"\"\"\n    # Step 1: Generate all initial thoughts in parallel\n    initial_thoughts = await asyncio.gather(*[\n        generate_thought_async(problem) for _ in range(branches)\n    ])\n    \n    # Step 2: Evaluate all thoughts in parallel\n    evaluations = await asyncio.gather(*[\n        evaluate_thought_async(thought) for thought in initial_thoughts\n    ])\n    \n    # Step 3: Select top thoughts for expansion\n    top_thoughts = select_top_k(initial_thoughts, evaluations, k=3)\n    \n    # Step 4: Expand in parallel\n    expanded = await asyncio.gather(*[\n        expand_thought_async(thought, depth-1) for thought in top_thoughts\n    ])\n    \n    return select_best_solution(expanded)\n\nIntelligent Caching\ndef cached_tree_of_thoughts(problem, cache_ttl_hours=24):\n    \"\"\"\n    ToT with semantic caching for similar problems.\n    \n    Cache hits when:\n    - Same problem repeated (exact match)\n    - Similar problem (>85% semantic similarity)\n    - Related problem type (same domain)\n    \"\"\"\n    cache_key = semantic_hash(problem)\n    cached = cache_get(cache_key)\n    \n    if cached and semantic_similarity(problem, cached['problem']) > 0.85:\n        return {\n            \"solution\": cached['solution'],\n            \"from_cache\": True,\n            \"cache_age\": (now - cached['timestamp']).minutes\n        }\n    \n    # Generate fresh solution\n    result = parallel_tree_of_thoughts(problem)\n    \n    # Cache for future\n    cache_set(cache_key, {\n        'problem': problem,\n        'solution': result,\n        'timestamp': now()\n    })\n    \n    return {**result, \"from_cache\": False}\n\nCLI Flags\n--parallel         Use parallel execution (default)\n--cached           Enable caching (default)\n--sequential       Disable parallel execution\n--no-cache         Disable caching\n--branches N       Set number of branches (default: 5)\n--depth N          Set tree depth (default: 3)\n\nToT Process\nStep 1: GENERATE Thoughts\nGiven problem, generate multiple initial approaches:\n- Thought A: [Approach 1]\n- Thought B: [Approach 2]\n- Thought C: [Approach 3]\n\nStep 2: EVALUATE Thoughts\nFor each thought, assess:\n- Feasibility: Can this work?\n- Quality: How good would result be?\n- Cost: Time/resources needed?\n- Risk: What could fail?\n\nStep 3: EXPAND Promising Thoughts\nTake best thoughts and expand:\n- Thought A → A1, A2, A3\n- Thought B → B1, B2\n(Expand only promising branches)\n\nStep 4: EVALUATE Branches\nEvaluate each expanded branch:\n- A1: [score/10]\n- A2: [score/10]\n- B1: [score/10]\n\nStep 5: SEARCH for Solution\nStrategies:\n- BFS: Explore all branches breadth-first\n- DFS: Dive deep into promising branches\n- Best-First: Always expand highest-rated\n- Beam Search: Keep top-K branches\n\nStep 6: SELECT Optimal Path\nChoose path with best expected outcome:\n- Highest evaluation score\n- Most feasible\n- Best cost/benefit ratio\n\nThought Evaluation\nEvaluation Criteria\n\nFeasibility (0-10):\n\n- 10: Definitely possible\n- 7-9: Likely possible\n- 4-6: Maybe possible\n- 1-3: Unlikely to work\n- 0: Impossible\n\n\nQuality (0-10):\n\n- 10: Perfect solution\n- 7-9: Great solution\n- 4-6: Adequate solution\n- 1-3: Poor solution\n- 0: Doesn't solve problem\n\n\nCost (0-10, inverse):\n\n- 10: Negligible cost\n- 7-9: Low cost\n- 4-6: Moderate cost\n- 1-3: High cost\n- 0: Prohibitively expensive\n\n\nRisk (0-10, inverse):\n\n- 10: No risk\n- 7-9: Low risk\n- 4-6: Moderate risk\n- 1-3: High risk\n- 0: Certain failure\n\nScoring Formula\nScore = (Feasibility * 0.3) + (Quality * 0.3) + (Cost * 0.2) + (Risk * 0.2)\n\n\nAdjust weights based on priorities:\n\nQuality-focused: Quality * 0.5\nSpeed-focused: Cost * 0.5\nSafety-focused: Risk * 0.5\nSearch Strategies\nBreadth-First Search (BFS)\nLevel 1: Explore all initial thoughts\nLevel 2: Expand all promising thoughts\nLevel 3: Continue breadth-wise\nGood for: Comprehensive exploration\n\nDepth-First Search (DFS)\nLevel 1: Pick most promising thought\nLevel 2: Dive deep into that branch\nLevel 3: Continue depth-wise\nGood for: Quick deep solutions\n\nBest-First Search\nAlways expand the highest-rated node\nUse priority queue\nGood for: Finding optimal quickly\n\nBeam Search\nKeep only top-K branches at each level\nPrune low-rated branches early\nGood for: Efficiency with quality\n\nToT Templates\nDecision Problem\n## Problem: [Decision to make]\n\n### Initial Thoughts\n1. **Option A**: [Description]\n   - Feasibility: 8/10\n   - Quality: 7/10\n   - Cost: 9/10\n   - Risk: 8/10\n   - **Score**: 7.9/10\n\n2. **Option B**: [Description]\n   - Feasibility: 9/10\n   - Quality: 6/10\n   - Cost: 7/10\n   - Risk: 6/10\n   - **Score**: 7.1/10\n\n3. **Option C**: [Description]\n   - Feasibility: 6/10\n   - Quality: 9/10\n   - Cost: 5/10\n   - Risk: 4/10\n   - **Score**: 6.3/10\n\n### Expansion (Top 2)\n**Option A** → A1: [Refinement] (Score: 8.5/10)\n**Option B** → B1: [Refinement] (Score: 7.8/10)\n\n### Selected Path: A1\nReason: Highest score, good balance of feasibility and quality\n\nCreative Problem\n## Problem: [Creative challenge]\n\n### Thought Branches\n1. **Creative A**: [Idea]\n   - Novelty: 9/10\n   - Feasibility: 5/10\n   - Impact: 8/10\n   - **Score**: 7.4/10\n\n2. **Creative B**: [Idea]\n   - Novelty: 7/10\n   - Feasibility: 8/10\n   - Impact: 7/10\n   - **Score**: 7.3/10\n\n3. **Safe C**: [Conservative idea]\n   - Novelty: 4/10\n   - Feasibility: 9/10\n   - Impact: 6/10\n   - **Score**: 6.3/10\n\n### Hybrid Approach: A + B\nCombine novelty of A with feasibility of B\nScore: 8.2/10\n\nIntegration Patterns\nToT + Task Decomposition\n1. Use ToT to choose decomposition strategy\n2. Compare different breakdown approaches\n3. Select optimal decomposition\n\nToT + Error Recovery\n1. When error occurs\n2. Generate multiple recovery options via ToT\n3. Evaluate each recovery path\n4. Select best recovery strategy\n\nToT + Self-Reflection\n1. After completing task\n2. Reflect: Did I consider enough options?\n3. Should I have used ToT?\n4. Was my evaluation accurate?\n\nBacktracking\n\nWhen a path fails:\n\n1. Mark branch as dead end\n2. Record why it failed\n3. Backtrack to decision point\n4. Try next best alternative\n5. Learn from failure\n\n\nExample:\n\nPath A → A1 → A1a [FAILED: X didn't work]\nBacktrack to A\nPath A → A2 → A2a [SUCCESS]\n\nPruning Strategies\n\nEarly pruning:\n\nScore < 3/10: Drop immediately\nInfeasible: Drop immediately\nHigh risk + low quality: Drop\n\nContinuous pruning:\n\nAfter expansion, keep only top 50%\nRemove redundant branches\nMerge similar thoughts\nPractical Examples\nExample 1: Choose Architecture\n## Problem: Design system architecture\n\n### Thoughts\n1. Monolith: Simple, fast to build, hard to scale\n   Score: 6/10 (good for MVP, bad for scale)\n\n2. Microservices: Scalable, complex, slow to build\n   Score: 7/10 (good for scale, overkill now)\n\n3. Modular Monolith: Balanced, medium complexity\n   Score: 8/10 (best of both)\n\n### Expansion\nModular Monolith →\n  - M1: Start modular, split later (8.5/10)\n  - M2: Full modules from start (7/10)\n\n### Decision: M1\nStart with modular monolith, design for future split\n\nExample 2: Fix Performance Bug\n## Problem: API too slow\n\n### Thoughts\n1. Cache everything: Fast, memory-heavy, stale data risk\n   Score: 6/10\n\n2. Optimize queries: Moderate speedup, accurate data\n   Score: 8/10\n\n3. Add indexes: Quick win, limited impact\n   Score: 7/10\n\n4. Rewrite in faster language: High impact, high cost\n   Score: 5/10\n\n### Expansion\nOptimize + Indexes → Combined approach\nScore: 9/10 (synergy)\n\n### Decision: Optimize queries + Add strategic indexes\n\nToT Reasoning Log\n\nTrack ToT sessions in: memory/tot-sessions.md\n\n## [Date] ToT Session: [Problem]\n\n### Options Considered: [N]\n### Paths Explored: [N]\n### Depth: [N levels]\n### Decision: [Chosen path]\n### Rationale: [Why this won]\n### Outcome: [Did it work?]\n### Lesson: [What was learned]\n\nMetrics\nAverage thoughts generated per problem\nSearch depth average\nBacktrack rate\nDecision quality (outcomes)\nTime to decision\nSolution diversity\nQuick Actions\ntot [problem] - Run ToT reasoning\ncompare [options] - Evaluate multiple options\ndecide [decision] - Make decision with ToT\nbranches - Show current ToT tree\nBest Practices\nGenerate many thoughts initially (5-10)\nEvaluate objectively (use criteria)\nPrune aggressively (don't explore poor options)\nExpand gradually (depth vs breadth balance)\nBacktrack when stuck (dead ends happen)\nDocument reasoning (learn from decisions)\nReview outcomes (improve evaluation accuracy)\n\nRemember: The best solution is rarely the first one you think of. Explore, evaluate, select.\n\nReal Usage Example\n\nScenario: Choosing the best system improvement to implement\n\nProblem\n\n\"What ONE improvement should I make to the OpenClaw system today?\"\n\nInitial Thoughts (Generated 5 options)\nOption\tDescription\tFeasibility\tQuality\tCost\tRisk\tScore\nA\tAuto-create log files\t9\t7\t9\t9\t8.3\nB\tAdd quick-action triggers\t4\t8\t3\t5\t5.0\nC\tAdd integration examples\t9\t6\t8\t9\t7.6\nD\tCreate error pattern detection\t7\t9\t6\t7\t7.4\nE\tCreate skill test runner\t6\t9\t5\t6\t6.5\nScoring Formula\nScore = (Feasibility × 0.3) + (Quality × 0.3) + (Cost × 0.2) + (Risk × 0.2)\n\nExpansion (Top 2)\nA → A1: Auto-create all log files AND error folder → Score: 8.5\nD → D1: Simple regex-based error classifier → Score: 7.8\nDecision: A1 (Auto-create log files)\n\nRationale: Highest score, lowest risk, immediate usability improvement\n\nOutcome\n\nCreated:\n\nmemory/criticism-log.md\nmemory/tot-sessions.md\nmemory/errors/error-log.md\n\nLesson: Simple infrastructure improvements often beat complex features."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/tobisamaa/tree-of-thoughts",
    "publisherUrl": "https://clawhub.ai/tobisamaa/tree-of-thoughts",
    "owner": "tobisamaa",
    "version": "2.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/tree-of-thoughts",
    "downloadUrl": "https://openagent3.xyz/downloads/tree-of-thoughts",
    "agentUrl": "https://openagent3.xyz/skills/tree-of-thoughts/agent",
    "manifestUrl": "https://openagent3.xyz/skills/tree-of-thoughts/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/tree-of-thoughts/agent.md"
  }
}