@hecer/yoke 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +494 -0
  3. package/canon/AGENTS.md +28 -0
  4. package/canon/context/DECISIONS.md +4 -0
  5. package/canon/context/KNOWLEDGE.md +4 -0
  6. package/canon/context/PROJECT.md +15 -0
  7. package/canon/loop/loop-spec.md +30 -0
  8. package/canon/loop/prd.schema.md +14 -0
  9. package/canon/manifest.yaml +47 -0
  10. package/canon/policy/gates.md +7 -0
  11. package/canon/policy/roles.md +9 -0
  12. package/canon/skills/ATTRIBUTION.md +71 -0
  13. package/canon/skills/authoring-prd/SKILL.md +44 -0
  14. package/canon/skills/brainstorming/SKILL.md +164 -0
  15. package/canon/skills/dispatching-parallel-agents/SKILL.md +182 -0
  16. package/canon/skills/document-release/SKILL.md +297 -0
  17. package/canon/skills/executing-plans/SKILL.md +70 -0
  18. package/canon/skills/finishing-a-development-branch/SKILL.md +200 -0
  19. package/canon/skills/health/SKILL.md +177 -0
  20. package/canon/skills/maintaining-context/SKILL.md +34 -0
  21. package/canon/skills/minimal-code/SKILL.md +21 -0
  22. package/canon/skills/plan-ceo-review/SKILL.md +541 -0
  23. package/canon/skills/plan-eng-review/SKILL.md +362 -0
  24. package/canon/skills/receiving-code-review/SKILL.md +213 -0
  25. package/canon/skills/requesting-code-review/SKILL.md +105 -0
  26. package/canon/skills/retro/SKILL.md +397 -0
  27. package/canon/skills/review/SKILL.md +246 -0
  28. package/canon/skills/ship/SKILL.md +696 -0
  29. package/canon/skills/subagent-driven-development/SKILL.md +277 -0
  30. package/canon/skills/systematic-debugging/SKILL.md +296 -0
  31. package/canon/skills/tdd/SKILL.md +371 -0
  32. package/canon/skills/unslop-ui/SKILL.md +34 -0
  33. package/canon/skills/using-git-worktrees/SKILL.md +218 -0
  34. package/canon/skills/verification-before-completion/SKILL.md +139 -0
  35. package/canon/skills/visual-verification/SKILL.md +54 -0
  36. package/canon/skills/workflow/SKILL.md +18 -0
  37. package/canon/skills/writing-plans/SKILL.md +152 -0
  38. package/canon/skills/writing-skills/SKILL.md +655 -0
  39. package/canon/skills/yoke-retrofit/SKILL.md +18 -0
  40. package/canon/tools/graphify.md +3 -0
  41. package/canon/tools/playwright-mcp.md +3 -0
  42. package/canon/tools/rtk.md +7 -0
  43. package/canon/tools/serena.md +7 -0
  44. package/dist/canon/frontmatter.js +10 -0
  45. package/dist/canon/manifest.js +26 -0
  46. package/dist/canon/validate.js +73 -0
  47. package/dist/cli.js +244 -0
  48. package/dist/context/command.js +33 -0
  49. package/dist/context/context.js +57 -0
  50. package/dist/loop/cleanup.js +42 -0
  51. package/dist/loop/gates.js +12 -0
  52. package/dist/loop/git.js +25 -0
  53. package/dist/loop/lock.js +45 -0
  54. package/dist/loop/loop.js +190 -0
  55. package/dist/loop/prd.js +29 -0
  56. package/dist/loop/reporter.js +91 -0
  57. package/dist/loop/run-command.js +134 -0
  58. package/dist/loop/runner.js +157 -0
  59. package/dist/loop/verify.js +38 -0
  60. package/dist/loop/watchdog.js +86 -0
  61. package/dist/new/command.js +53 -0
  62. package/dist/prd/command.js +129 -0
  63. package/dist/retrofit/apply.js +54 -0
  64. package/dist/retrofit/canon-dir.js +22 -0
  65. package/dist/retrofit/command.js +37 -0
  66. package/dist/retrofit/config.js +53 -0
  67. package/dist/retrofit/context-actions.js +21 -0
  68. package/dist/retrofit/detect.js +17 -0
  69. package/dist/retrofit/gitignore.js +26 -0
  70. package/dist/retrofit/gstack.js +19 -0
  71. package/dist/retrofit/merge-json.js +38 -0
  72. package/dist/retrofit/plan.js +29 -0
  73. package/dist/retrofit/planners/claude.js +67 -0
  74. package/dist/retrofit/planners/codex.js +36 -0
  75. package/dist/retrofit/planners/gemini.js +54 -0
  76. package/dist/retrofit/report.js +14 -0
  77. package/dist/retrofit/tools.js +23 -0
  78. package/dist/retrofit/wsl.js +15 -0
  79. package/dist/review/command.js +43 -0
  80. package/dist/scan/design.js +79 -0
  81. package/dist/smoke/command.js +141 -0
  82. package/package.json +61 -0
@@ -0,0 +1,47 @@
1
+ name: yoke-canon
2
+ version: 0.1.0
3
+ agents: [claude, codex, gemini]
4
+ skills:
5
+ - { id: tdd, path: skills/tdd, kind: methodology }
6
+ - { id: yoke-retrofit, path: skills/yoke-retrofit, kind: methodology }
7
+ - { id: minimal-code, path: skills/minimal-code, kind: methodology }
8
+ - { id: maintaining-context, path: skills/maintaining-context, kind: methodology }
9
+ # superpowers skills (kind: methodology)
10
+ - { id: brainstorming, path: skills/brainstorming, kind: methodology }
11
+ - { id: writing-plans, path: skills/writing-plans, kind: methodology }
12
+ - { id: executing-plans, path: skills/executing-plans, kind: methodology }
13
+ - { id: subagent-driven-development, path: skills/subagent-driven-development, kind: methodology }
14
+ - { id: systematic-debugging, path: skills/systematic-debugging, kind: methodology }
15
+ - { id: verification-before-completion, path: skills/verification-before-completion, kind: methodology }
16
+ - { id: using-git-worktrees, path: skills/using-git-worktrees, kind: methodology }
17
+ - { id: requesting-code-review, path: skills/requesting-code-review, kind: methodology }
18
+ - { id: receiving-code-review, path: skills/receiving-code-review, kind: methodology }
19
+ - { id: dispatching-parallel-agents, path: skills/dispatching-parallel-agents, kind: methodology }
20
+ - { id: finishing-a-development-branch, path: skills/finishing-a-development-branch, kind: methodology }
21
+ - { id: writing-skills, path: skills/writing-skills, kind: methodology }
22
+ # gstack skills (kind: role)
23
+ - { id: review, path: skills/review, kind: role }
24
+ - { id: ship, path: skills/ship, kind: role }
25
+ - { id: health, path: skills/health, kind: role }
26
+ - { id: retro, path: skills/retro, kind: role }
27
+ - { id: document-release, path: skills/document-release, kind: role }
28
+ - { id: plan-ceo-review, path: skills/plan-ceo-review, kind: role }
29
+ - { id: plan-eng-review, path: skills/plan-eng-review, kind: role }
30
+ # authored workflow skill (kind: methodology)
31
+ - { id: workflow, path: skills/workflow, kind: methodology }
32
+ # visual & design verification (kind: methodology)
33
+ - { id: unslop-ui, path: skills/unslop-ui, kind: methodology }
34
+ - { id: visual-verification, path: skills/visual-verification, kind: methodology }
35
+ # zero-to-100 bootstrap (kind: methodology)
36
+ - { id: authoring-prd, path: skills/authoring-prd, kind: methodology }
37
+ policy:
38
+ - { path: policy/gates.md }
39
+ - { path: policy/roles.md }
40
+ loop:
41
+ spec: loop/loop-spec.md
42
+ prdSchema: loop/prd.schema.md
43
+ tools:
44
+ - { id: rtk, path: tools/rtk.md }
45
+ - { id: graphify, path: tools/graphify.md }
46
+ - { id: playwright-mcp, path: tools/playwright-mcp.md }
47
+ - { id: serena, path: tools/serena.md }
@@ -0,0 +1,7 @@
1
+ # Stop-the-Line Gates
2
+
3
+ These gates are enforced mechanically by the Loop (Baustein C) and expected of every agent run.
4
+
5
+ - **DoD gate:** Implementation may not begin until Definition of Done / Acceptance Criteria for the unit of work exist and are recorded (e.g., in the PRD story).
6
+ - **Green-tests gate:** A unit of work is not complete until its tests pass.
7
+ - **Clean-worktree gate:** No dispatch into a dirty or conflicted git worktree.
@@ -0,0 +1,9 @@
1
+ # Role Separation
2
+
3
+ The agent that performs a role must not also perform a conflicting one:
4
+
5
+ - **Implementer ≠ Reviewer** — implementation is not self-reviewed.
6
+ - **Implementer ≠ Merger** — the implementer does not merge their own change.
7
+ - **Implementer ≠ Security auditor** — security is not self-audited.
8
+
9
+ In the Loop, these map to separate iterations with fresh context.
@@ -0,0 +1,71 @@
1
+ # Attribution
2
+
3
+ The skills in this directory are ported from two MIT-licensed open-source projects.
4
+ Their content is used under the terms of the MIT License reproduced below.
5
+
6
+ ---
7
+
8
+ ## gstack
9
+
10
+ **Source:** https://github.com/garrytan/gstack
11
+
12
+ **Skills ported:** review, ship, health, retro, document-release, plan-ceo-review,
13
+ plan-eng-review
14
+
15
+ ---
16
+
17
+ ## superpowers
18
+
19
+ **Source:** https://github.com/obra/superpowers
20
+
21
+ **Skills ported:** tdd (from test-driven-development), brainstorming, writing-plans,
22
+ executing-plans, subagent-driven-development, systematic-debugging,
23
+ verification-before-completion, using-git-worktrees, requesting-code-review,
24
+ receiving-code-review, dispatching-parallel-agents, finishing-a-development-branch,
25
+ writing-skills
26
+
27
+ ---
28
+
29
+ ## vibecoded-design-tells (research credit)
30
+
31
+ **Source:** https://github.com/JCarterJohnson/vibecoded-design-tells (MIT © 2026 Carter Johnson)
32
+
33
+ The `unslop-ui` rubric and the `yoke design-scan` tell set are **informed by** this data-ranked
34
+ study of AI-generated-UI tells. Yoke implements the idea **natively in TypeScript** and copies no
35
+ code or data — credited here in the spirit of the MIT license.
36
+
37
+ ---
38
+
39
+ ### gstack (cross-model review, idea credit)
40
+
41
+ The interactive `yoke review` command is inspired by gstack's `/codex` skill
42
+ (https://github.com/garrytan/gstack, MIT © Garry Tan) — an independent second-model
43
+ review with a pass/fail gate. Yoke's implementation is native and cross-agent; no code
44
+ or data was copied.
45
+
46
+ Likewise, the browser-QA-as-gate idea behind gstack's `/qa` skill is natively
47
+ re-implemented as `yoke flow-smoke` — cross-agent, with a proof-artifact contract
48
+ (screenshots always, video kept on failure, under `.yoke/proof/<story>/`); no code
49
+ was copied.
50
+
51
+ ---
52
+
53
+ ## MIT License
54
+
55
+ Permission is hereby granted, free of charge, to any person obtaining a copy
56
+ of this software and associated documentation files (the "Software"), to deal
57
+ in the Software without restriction, including without limitation the rights
58
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
59
+ copies of the Software, and to permit persons to whom the Software is
60
+ furnished to do so, subject to the following conditions:
61
+
62
+ The above copyright notice and this permission notice shall be included in all
63
+ copies or substantial portions of the Software.
64
+
65
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
66
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
67
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
68
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
69
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
70
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
71
+ SOFTWARE.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: authoring-prd
3
+ description: Use when turning a product idea into a loop-ready .yoke/prd.yaml — slice the idea into small, independently shippable stories with testable behavioral acceptance criteria; greenfield STORY-1 scaffolds the project and wires verify.command.
4
+ ---
5
+
6
+ # Authoring a PRD
7
+
8
+ The Yoke loop is only as good as its stories. Bad stories ("build the app") stall it;
9
+ good stories (small, testable, ordered) let it run overnight.
10
+
11
+ ## Story rules
12
+
13
+ 1. **One iteration per story.** If you can't imagine an agent finishing it in one sitting,
14
+ split it. Prefer 5-12 stories over 3 epics.
15
+ 2. **Independently shippable.** After any story, the project builds and tests pass.
16
+ 3. **Acceptance = observable behavior**, never implementation:
17
+ - Good: "GET /health returns 200", "the CLI prints the sum of its arguments"
18
+ - Bad: "create a HealthController class", "use express"
19
+ 2-5 criteria per story. Each must be checkable by a test or a command.
20
+ 4. **Dense priorities from 1**; lower runs first. Order by dependency, then by risk.
21
+ 5. **Greenfield: STORY-1 scaffolds.** Project skeleton + runnable test suite + a criterion
22
+ that the verify command (`verify.command` in `.yoke/config.yaml`) exits 0. Every later
23
+ story stands on a green pipeline.
24
+
25
+ ## Format (`.yoke/prd.yaml`)
26
+
27
+ ```yaml
28
+ - id: STORY-1
29
+ title: scaffold a TypeScript CLI with vitest
30
+ priority: 1
31
+ acceptance:
32
+ - "npm test exits 0 with at least one passing test"
33
+ - "verify.command is set in .yoke/config.yaml"
34
+ passes: false
35
+ - id: STORY-2
36
+ title: add the sum command
37
+ priority: 2
38
+ acceptance:
39
+ - "cli sum 1 2 prints 3"
40
+ - "non-numeric input exits 1 with an error message"
41
+ passes: false
42
+ ```
43
+
44
+ `passes` is owned by the loop — always start `false`. Validate with `yoke prd check`.
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: brainstorming
3
+ description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
4
+ ---
5
+
6
+ # Brainstorming Ideas Into Designs
7
+
8
+ Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
9
+
10
+ Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
11
+
12
+ <HARD-GATE>
13
+ Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
14
+ </HARD-GATE>
15
+
16
+ ## Anti-Pattern: "This Is Too Simple To Need A Design"
17
+
18
+ Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
19
+
20
+ ## Checklist
21
+
22
+ You MUST create a task for each of these items and complete them in order:
23
+
24
+ 1. **Explore project context** — check files, docs, recent commits
25
+ 2. **Offer visual companion** (if topic will involve visual questions) — this is its own message, not combined with a clarifying question. See the Visual Companion section below.
26
+ 3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
27
+ 4. **Propose 2-3 approaches** — with trade-offs and your recommendation
28
+ 5. **Present design** — in sections scaled to their complexity, get user approval after each section
29
+ 6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
30
+ 7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
31
+ 8. **User reviews written spec** — ask user to review the spec file before proceeding
32
+ 9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
33
+
34
+ ## Process Flow
35
+
36
+ ```dot
37
+ digraph brainstorming {
38
+ "Explore project context" [shape=box];
39
+ "Visual questions ahead?" [shape=diamond];
40
+ "Offer Visual Companion\n(own message, no other content)" [shape=box];
41
+ "Ask clarifying questions" [shape=box];
42
+ "Propose 2-3 approaches" [shape=box];
43
+ "Present design sections" [shape=box];
44
+ "User approves design?" [shape=diamond];
45
+ "Write design doc" [shape=box];
46
+ "Spec self-review\n(fix inline)" [shape=box];
47
+ "User reviews spec?" [shape=diamond];
48
+ "Invoke writing-plans skill" [shape=doublecircle];
49
+
50
+ "Explore project context" -> "Visual questions ahead?";
51
+ "Visual questions ahead?" -> "Offer Visual Companion\n(own message, no other content)" [label="yes"];
52
+ "Visual questions ahead?" -> "Ask clarifying questions" [label="no"];
53
+ "Offer Visual Companion\n(own message, no other content)" -> "Ask clarifying questions";
54
+ "Ask clarifying questions" -> "Propose 2-3 approaches";
55
+ "Propose 2-3 approaches" -> "Present design sections";
56
+ "Present design sections" -> "User approves design?";
57
+ "User approves design?" -> "Present design sections" [label="no, revise"];
58
+ "User approves design?" -> "Write design doc" [label="yes"];
59
+ "Write design doc" -> "Spec self-review\n(fix inline)";
60
+ "Spec self-review\n(fix inline)" -> "User reviews spec?";
61
+ "User reviews spec?" -> "Write design doc" [label="changes requested"];
62
+ "User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
63
+ }
64
+ ```
65
+
66
+ **The terminal state is invoking writing-plans.** Do NOT invoke frontend-design, mcp-builder, or any other implementation skill. The ONLY skill you invoke after brainstorming is writing-plans.
67
+
68
+ ## The Process
69
+
70
+ **Understanding the idea:**
71
+
72
+ - Check out the current project state first (files, docs, recent commits)
73
+ - Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
74
+ - If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
75
+ - For appropriately-scoped projects, ask questions one at a time to refine the idea
76
+ - Prefer multiple choice questions when possible, but open-ended is fine too
77
+ - Only one question per message - if a topic needs more exploration, break it into multiple questions
78
+ - Focus on understanding: purpose, constraints, success criteria
79
+
80
+ **Exploring approaches:**
81
+
82
+ - Propose 2-3 different approaches with trade-offs
83
+ - Present options conversationally with your recommendation and reasoning
84
+ - Lead with your recommended option and explain why
85
+
86
+ **Presenting the design:**
87
+
88
+ - Once you believe you understand what you're building, present the design
89
+ - Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
90
+ - Ask after each section whether it looks right so far
91
+ - Cover: architecture, components, data flow, error handling, testing
92
+ - Be ready to go back and clarify if something doesn't make sense
93
+
94
+ **Design for isolation and clarity:**
95
+
96
+ - Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
97
+ - For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
98
+ - Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
99
+ - Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
100
+
101
+ **Working in existing codebases:**
102
+
103
+ - Explore the current structure before proposing changes. Follow existing patterns.
104
+ - Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
105
+ - Don't propose unrelated refactoring. Stay focused on what serves the current goal.
106
+
107
+ ## After the Design
108
+
109
+ **Documentation:**
110
+
111
+ - Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
112
+ - (User preferences for spec location override this default)
113
+ - Use elements-of-style:writing-clearly-and-concisely skill if available
114
+ - Commit the design document to git
115
+
116
+ **Spec Self-Review:**
117
+ After writing the spec document, look at it with fresh eyes:
118
+
119
+ 1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
120
+ 2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
121
+ 3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
122
+ 4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
123
+
124
+ Fix any issues inline. No need to re-review — just fix and move on.
125
+
126
+ **User Review Gate:**
127
+ After the spec review loop passes, ask the user to review the written spec before proceeding:
128
+
129
+ > "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
130
+
131
+ Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
132
+
133
+ **Implementation:**
134
+
135
+ - Invoke the writing-plans skill to create a detailed implementation plan
136
+ - Do NOT invoke any other skill. writing-plans is the next step.
137
+
138
+ ## Key Principles
139
+
140
+ - **One question at a time** - Don't overwhelm with multiple questions
141
+ - **Multiple choice preferred** - Easier to answer than open-ended when possible
142
+ - **YAGNI ruthlessly** - Remove unnecessary features from all designs
143
+ - **Explore alternatives** - Always propose 2-3 approaches before settling
144
+ - **Incremental validation** - Present design, get approval before moving on
145
+ - **Be flexible** - Go back and clarify when something doesn't make sense
146
+
147
+ ## Visual Companion
148
+
149
+ A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
150
+
151
+ **Offering the companion:** When you anticipate that upcoming questions will involve visual content (mockups, layouts, diagrams), offer it once for consent:
152
+ > "Some of what we're working on might be easier to explain if I can show it to you in a web browser. I can put together mockups, diagrams, comparisons, and other visuals as we go. This feature is still new and can be token-intensive. Want to try it? (Requires opening a local URL)"
153
+
154
+ **This offer MUST be its own message.** Do not combine it with clarifying questions, context summaries, or any other content. The message should contain ONLY the offer above and nothing else. Wait for the user's response before continuing. If they decline, proceed with text-only brainstorming.
155
+
156
+ **Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
157
+
158
+ - **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
159
+ - **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
160
+
161
+ A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.
162
+
163
+ If they agree to the companion, read the detailed guide before proceeding:
164
+ `skills/brainstorming/visual-companion.md`
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: dispatching-parallel-agents
3
+ description: Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
4
+ ---
5
+
6
+ # Dispatching Parallel Agents
7
+
8
+ ## Overview
9
+
10
+ You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.
11
+
12
+ When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel.
13
+
14
+ **Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently.
15
+
16
+ ## When to Use
17
+
18
+ ```dot
19
+ digraph when_to_use {
20
+ "Multiple failures?" [shape=diamond];
21
+ "Are they independent?" [shape=diamond];
22
+ "Single agent investigates all" [shape=box];
23
+ "One agent per problem domain" [shape=box];
24
+ "Can they work in parallel?" [shape=diamond];
25
+ "Sequential agents" [shape=box];
26
+ "Parallel dispatch" [shape=box];
27
+
28
+ "Multiple failures?" -> "Are they independent?" [label="yes"];
29
+ "Are they independent?" -> "Single agent investigates all" [label="no - related"];
30
+ "Are they independent?" -> "Can they work in parallel?" [label="yes"];
31
+ "Can they work in parallel?" -> "Parallel dispatch" [label="yes"];
32
+ "Can they work in parallel?" -> "Sequential agents" [label="no - shared state"];
33
+ }
34
+ ```
35
+
36
+ **Use when:**
37
+ - 3+ test files failing with different root causes
38
+ - Multiple subsystems broken independently
39
+ - Each problem can be understood without context from others
40
+ - No shared state between investigations
41
+
42
+ **Don't use when:**
43
+ - Failures are related (fix one might fix others)
44
+ - Need to understand full system state
45
+ - Agents would interfere with each other
46
+
47
+ ## The Pattern
48
+
49
+ ### 1. Identify Independent Domains
50
+
51
+ Group failures by what's broken:
52
+ - File A tests: Tool approval flow
53
+ - File B tests: Batch completion behavior
54
+ - File C tests: Abort functionality
55
+
56
+ Each domain is independent - fixing tool approval doesn't affect abort tests.
57
+
58
+ ### 2. Create Focused Agent Tasks
59
+
60
+ Each agent gets:
61
+ - **Specific scope:** One test file or subsystem
62
+ - **Clear goal:** Make these tests pass
63
+ - **Constraints:** Don't change other code
64
+ - **Expected output:** Summary of what you found and fixed
65
+
66
+ ### 3. Dispatch in Parallel
67
+
68
+ ```typescript
69
+ // In Claude Code / AI environment
70
+ Task("Fix agent-tool-abort.test.ts failures")
71
+ Task("Fix batch-completion-behavior.test.ts failures")
72
+ Task("Fix tool-approval-race-conditions.test.ts failures")
73
+ // All three run concurrently
74
+ ```
75
+
76
+ ### 4. Review and Integrate
77
+
78
+ When agents return:
79
+ - Read each summary
80
+ - Verify fixes don't conflict
81
+ - Run full test suite
82
+ - Integrate all changes
83
+
84
+ ## Agent Prompt Structure
85
+
86
+ Good agent prompts are:
87
+ 1. **Focused** - One clear problem domain
88
+ 2. **Self-contained** - All context needed to understand the problem
89
+ 3. **Specific about output** - What should the agent return?
90
+
91
+ ```markdown
92
+ Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
93
+
94
+ 1. "should abort tool with partial output capture" - expects 'interrupted at' in message
95
+ 2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
96
+ 3. "should properly track pendingToolCount" - expects 3 results but gets 0
97
+
98
+ These are timing/race condition issues. Your task:
99
+
100
+ 1. Read the test file and understand what each test verifies
101
+ 2. Identify root cause - timing issues or actual bugs?
102
+ 3. Fix by:
103
+ - Replacing arbitrary timeouts with event-based waiting
104
+ - Fixing bugs in abort implementation if found
105
+ - Adjusting test expectations if testing changed behavior
106
+
107
+ Do NOT just increase timeouts - find the real issue.
108
+
109
+ Return: Summary of what you found and what you fixed.
110
+ ```
111
+
112
+ ## Common Mistakes
113
+
114
+ **❌ Too broad:** "Fix all the tests" - agent gets lost
115
+ **✅ Specific:** "Fix agent-tool-abort.test.ts" - focused scope
116
+
117
+ **❌ No context:** "Fix the race condition" - agent doesn't know where
118
+ **✅ Context:** Paste the error messages and test names
119
+
120
+ **❌ No constraints:** Agent might refactor everything
121
+ **✅ Constraints:** "Do NOT change production code" or "Fix tests only"
122
+
123
+ **❌ Vague output:** "Fix it" - you don't know what changed
124
+ **✅ Specific:** "Return summary of root cause and changes"
125
+
126
+ ## When NOT to Use
127
+
128
+ **Related failures:** Fixing one might fix others - investigate together first
129
+ **Need full context:** Understanding requires seeing entire system
130
+ **Exploratory debugging:** You don't know what's broken yet
131
+ **Shared state:** Agents would interfere (editing same files, using same resources)
132
+
133
+ ## Real Example from Session
134
+
135
+ **Scenario:** 6 test failures across 3 files after major refactoring
136
+
137
+ **Failures:**
138
+ - agent-tool-abort.test.ts: 3 failures (timing issues)
139
+ - batch-completion-behavior.test.ts: 2 failures (tools not executing)
140
+ - tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)
141
+
142
+ **Decision:** Independent domains - abort logic separate from batch completion separate from race conditions
143
+
144
+ **Dispatch:**
145
+ ```
146
+ Agent 1 → Fix agent-tool-abort.test.ts
147
+ Agent 2 → Fix batch-completion-behavior.test.ts
148
+ Agent 3 → Fix tool-approval-race-conditions.test.ts
149
+ ```
150
+
151
+ **Results:**
152
+ - Agent 1: Replaced timeouts with event-based waiting
153
+ - Agent 2: Fixed event structure bug (threadId in wrong place)
154
+ - Agent 3: Added wait for async tool execution to complete
155
+
156
+ **Integration:** All fixes independent, no conflicts, full suite green
157
+
158
+ **Time saved:** 3 problems solved in parallel vs sequentially
159
+
160
+ ## Key Benefits
161
+
162
+ 1. **Parallelization** - Multiple investigations happen simultaneously
163
+ 2. **Focus** - Each agent has narrow scope, less context to track
164
+ 3. **Independence** - Agents don't interfere with each other
165
+ 4. **Speed** - 3 problems solved in time of 1
166
+
167
+ ## Verification
168
+
169
+ After agents return:
170
+ 1. **Review each summary** - Understand what changed
171
+ 2. **Check for conflicts** - Did agents edit same code?
172
+ 3. **Run full suite** - Verify all fixes work together
173
+ 4. **Spot check** - Agents can make systematic errors
174
+
175
+ ## Real-World Impact
176
+
177
+ From debugging session (2025-10-03):
178
+ - 6 failures across 3 files
179
+ - 3 agents dispatched in parallel
180
+ - All investigations completed concurrently
181
+ - All fixes integrated successfully
182
+ - Zero conflicts between agent changes