$npx -y skills add NeoLabHQ/context-engineering-kit --skill tree-of-thoughtsExecute tasks through systematic exploration, pruning, and expansion using Tree of Thoughts methodology with meta-judge evaluation specifications and multi-agent evaluation
| 1 | # tree-of-thoughts |
| 2 | |
| 3 | <task> |
| 4 | Execute complex reasoning tasks through systematic exploration of solution space, pruning unpromising branches, expanding viable approaches, and synthesizing the best solution. |
| 5 | </task> |
| 6 | |
| 7 | <context> |
| 8 | This command implements the Tree of Thoughts (ToT) pattern for tasks requiring exploration of multiple solution paths before committing to full implementation. It combines creative sampling, meta-judge-generated evaluation specifications, multi-perspective evaluation, adaptive strategy selection, and evidence-based synthesis to produce superior outcomes. |
| 9 | |
| 10 | Key benefits: |
| 11 | |
| 12 | - **Systematic exploration** - Multiple agents explore different regions of the solution space |
| 13 | - **Structured evaluation** - Meta-judges produce tailored rubrics and criteria before judging |
| 14 | - **Independent verification** - Judges apply meta-judge specifications mechanically, reducing bias |
| 15 | - **Adaptive strategy** - Clear winners get polished, split decisions get synthesized, failures get redesigned |
| 16 | </context> |
| 17 | |
| 18 | ## Pattern: Tree of Thoughts (ToT) |
| 19 | |
| 20 | This command implements an eight-phase systematic reasoning pattern with meta-judge evaluation and adaptive strategy selection: |
| 21 | |
| 22 | ``` |
| 23 | Phase 1: Exploration (Propose Approaches) |
| 24 | ┌─ Agent A → Proposals A1, A2 (with probabilities) ─┐ |
| 25 | Task ───┼─ Agent B → Proposals B1, B2 (with probabilities) ─┼─┐ |
| 26 | └─ Agent C → Proposals C1, C2 (with probabilities) ─┘ │ |
| 27 | │ |
| 28 | Phase 1.5: Pruning Meta-Judge (runs in parallel with Phase 1) │ |
| 29 | Meta-Judge → Pruning Evaluation Specification YAML ───┤ |
| 30 | │ |
| 31 | Phase 2: Pruning (Vote for Best 3) │ |
| 32 | ┌─ Judge 1 → Votes + Rationale ─┐ │ |
| 33 | ├─ Judge 2 → Votes + Rationale ─┼─────────────────────┤ |
| 34 | └─ Judge 3 → Votes + Rationale ─┘ │ |
| 35 | │ │ |
| 36 | ├─→ Select Top 3 Proposals │ |
| 37 | │ │ |
| 38 | Phase 3: Expansion (Develop Full Solutions) │ |
| 39 | ┌─ Agent A → Solution A (from proposal X) ─┐ │ |
| 40 | ├─ Agent B → Solution B (from proposal Y) ─┼──────────┤ |
| 41 | └─ Agent C → Solution C (from proposal Z) ─┘ │ |
| 42 | │ |
| 43 | Phase 3.5: Evaluation Meta-Judge (runs in parallel w/ Phase 3)│ |
| 44 | Meta-Judge → Evaluation Specification YAML ───────────┤ |
| 45 | │ |
| 46 | Phase 4: Evaluation (Judge Full Solutions) │ |
| 47 | ┌─ Judge 1 → Report 1 ─┐ │ |
| 48 | ├─ Judge 2 → Report 2 ─┼──────────────────────────────┤ |
| 49 | └─ Judge 3 → Report 3 ─┘ │ |
| 50 | │ |
| 51 | Phase 4.5: Adaptive Strategy Selection │ |
| 52 | Analyze Consensus ────────────────────────────────────┤ |
| 53 | ├─ Clear Winner? → SELECT_AND_POLISH │ |
| 54 | ├─ All Flawed (<3.0)? → REDESIGN (Phase 3) │ |
| 55 | └─ Split Decision? → FULL_SYNTHESIS │ |
| 56 | │ │ |
| 57 | Phase 5: Synthesis (Only if FULL_SYNTHESIS) │ |
| 58 | Synthesizer ────────────────────┴──────────────────────┴─→ Final Solution |
| 59 | ``` |
| 60 | |
| 61 | ## Process |
| 62 | |
| 63 | ### Setup: Create Directory Structure |
| 64 | |
| 65 | Before starting, ensure the directory structure exists: |
| 66 | |
| 67 | ```bash |
| 68 | mkdir -p .specs/research .specs/reports |
| 69 | ``` |
| 70 | |
| 71 | **Naming conventions:** |
| 72 | - Proposals: `.specs/research/{solution-name}-{YYYY-MM-DD}.proposals.[a|b|c].md` |
| 73 | - Pruning: `.specs/research/{solution-name}-{YYYY-MM-DD}.pruning.[1|2|3].md` |
| 74 | - Selection: `.specs/research/{solution-name}-{YYYY-MM-DD}.selection.md` |
| 75 | - Evaluation: `.specs/reports/{solution-name}-{YYYY-MM-DD}.[1|2|3].md` |
| 76 | |
| 77 | Where: |
| 78 | - `{solution-name}` - Derived from output path (e.g., `users-api` from output `specs/api/users.md`) |
| 79 | - `{YYYY-MM-DD}` - Current date |
| 80 | |
| 81 | **Note:** Solutions remain in their specified output locations; only research and evaluation files go to `.specs/` |
| 82 | |
| 83 | ### Phase 1: Exploration (Propose Approaches) |
| 84 | |
| 85 | Launch **3 independent agents in parallel** (recommended: Sonnet for speed): |
| 86 | |
| 87 | 1. Each agent receives **identical task description and context** |
| 88 | 2. Each agent **generates 6 high-level approaches** (not full implementations) |
| 89 | 3. For each approach, agent provides: |
| 90 | - **Approach description** (2-3 paragraphs) |
| 91 | - **Key design decisions** and trade-offs |
| 92 | - **Probability estimate** (0.0-1.0) |
| 93 | - **Est |