opencode-ship 0.9.0 → 0.10.0-rc.18

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 (137) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +3 -1
  3. package/THIRD_PARTY_NOTICES.md +77 -19
  4. package/assets/agents/ship-controller.md +122 -0
  5. package/assets/agents/ship-final-spec-reviewer.md +87 -0
  6. package/assets/agents/ship-final-standards-reviewer.md +83 -0
  7. package/assets/agents/ship-planner.md +78 -0
  8. package/assets/agents/ship-task-builder.md +91 -0
  9. package/assets/agents/ship-task-reviewer.md +78 -0
  10. package/assets/commands/ship-deliver.md +30 -0
  11. package/assets/commands/ship-resume.md +28 -0
  12. package/assets/commands/ship-status.md +25 -0
  13. package/assets/skills/brainstorming/SKILL.md +160 -0
  14. package/assets/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  15. package/assets/skills/brainstorming/visual-companion.md +298 -0
  16. package/assets/skills/code-review/SKILL.md +98 -0
  17. package/assets/skills/codebase-design/DEEPENING.md +37 -0
  18. package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  19. package/assets/skills/codebase-design/SKILL.md +123 -0
  20. package/assets/skills/dispatching-parallel-agents/SKILL.md +176 -0
  21. package/assets/skills/domain-modeling/ADR-FORMAT.md +47 -0
  22. package/assets/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  23. package/assets/skills/domain-modeling/SKILL.md +83 -0
  24. package/assets/skills/engineering-workflow/SKILL.md +125 -0
  25. package/assets/skills/engineering-workflow/domain.md +51 -0
  26. package/assets/skills/engineering-workflow/issue-tracker-github.md +45 -0
  27. package/assets/skills/engineering-workflow/issue-tracker-gitlab.md +46 -0
  28. package/assets/skills/engineering-workflow/issue-tracker-local.md +30 -0
  29. package/assets/skills/engineering-workflow/triage-labels.md +15 -0
  30. package/assets/skills/executing-plans/SKILL.md +73 -0
  31. package/assets/skills/grill-with-docs/SKILL.md +10 -14
  32. package/assets/skills/grilling/SKILL.md +21 -0
  33. package/assets/skills/handoff/SKILL.md +25 -0
  34. package/assets/skills/prototype/LOGIC.md +79 -0
  35. package/assets/skills/prototype/SKILL.md +35 -0
  36. package/assets/skills/prototype/UI.md +112 -0
  37. package/assets/skills/receiving-code-review/SKILL.md +214 -0
  38. package/assets/skills/requesting-code-review/SKILL.md +104 -0
  39. package/assets/skills/requesting-code-review/code-reviewer.md +172 -0
  40. package/assets/skills/research/SKILL.md +21 -0
  41. package/assets/skills/setup-engineering-workflow/SKILL.md +125 -0
  42. package/assets/skills/setup-engineering-workflow/domain.md +51 -0
  43. package/assets/skills/setup-engineering-workflow/issue-tracker-github.md +45 -0
  44. package/assets/skills/setup-engineering-workflow/issue-tracker-gitlab.md +46 -0
  45. package/assets/skills/setup-engineering-workflow/issue-tracker-local.md +30 -0
  46. package/assets/skills/setup-engineering-workflow/triage-labels.md +15 -0
  47. package/assets/skills/subagent-driven-development/SKILL.md +512 -0
  48. package/assets/skills/subagent-driven-development/implementer-prompt.md +142 -0
  49. package/assets/skills/subagent-driven-development/re-review-prompt.md +106 -0
  50. package/assets/skills/subagent-driven-development/task-reviewer-prompt.md +185 -0
  51. package/assets/skills/systematic-debugging/CREATION-LOG.md +119 -0
  52. package/assets/skills/systematic-debugging/SKILL.md +292 -0
  53. package/assets/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  54. package/assets/skills/systematic-debugging/condition-based-waiting.md +115 -0
  55. package/assets/skills/systematic-debugging/defense-in-depth.md +122 -0
  56. package/assets/skills/systematic-debugging/find-polluter.sh +72 -0
  57. package/assets/skills/systematic-debugging/root-cause-tracing.md +169 -0
  58. package/assets/skills/systematic-debugging/test-academic.md +14 -0
  59. package/assets/skills/systematic-debugging/test-pressure-1.md +58 -0
  60. package/assets/skills/systematic-debugging/test-pressure-2.md +68 -0
  61. package/assets/skills/systematic-debugging/test-pressure-3.md +69 -0
  62. package/assets/skills/test-driven-development/SKILL.md +329 -0
  63. package/assets/skills/test-driven-development/writing-good-tests.md +198 -0
  64. package/assets/skills/to-spec/SKILL.md +84 -0
  65. package/assets/skills/to-tickets/SKILL.md +114 -0
  66. package/assets/skills/triage/AGENT-BRIEF.md +207 -0
  67. package/assets/skills/triage/OUT-OF-SCOPE.md +105 -0
  68. package/assets/skills/triage/SKILL.md +114 -15
  69. package/assets/skills/verification-before-completion/SKILL.md +129 -0
  70. package/assets/skills/wayfinder/SKILL.md +137 -0
  71. package/assets/skills/writing-plans/SKILL.md +177 -0
  72. package/assets/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  73. package/dist/cli.js +1146 -435
  74. package/dist/core.js +210 -61
  75. package/dist/plugin.js +2368 -230
  76. package/package.json +3 -1
  77. package/schema/ship-config.schema.json +63 -2
  78. package/schema/ship-lock.schema.json +5 -3
  79. package/tests/plugin/plugin-load.test.mjs +85 -0
  80. package/vendor/mattpocock/LICENSE +30 -0
  81. package/vendor/obra/LICENSE +30 -0
  82. package/vendor/sources.json +976 -0
  83. package/vendor/superpowers/LICENSE +30 -0
  84. package/vendor/upstreams/mattpocock/skills/engineering/code-review/SKILL.md +89 -0
  85. package/vendor/upstreams/mattpocock/skills/engineering/codebase-design/DEEPENING.md +37 -0
  86. package/vendor/upstreams/mattpocock/skills/engineering/codebase-design/DESIGN-IT-TWICE.md +44 -0
  87. package/vendor/upstreams/mattpocock/skills/engineering/codebase-design/SKILL.md +114 -0
  88. package/vendor/upstreams/mattpocock/skills/engineering/domain-modeling/ADR-FORMAT.md +47 -0
  89. package/vendor/upstreams/mattpocock/skills/engineering/domain-modeling/CONTEXT-FORMAT.md +60 -0
  90. package/vendor/upstreams/mattpocock/skills/engineering/domain-modeling/SKILL.md +74 -0
  91. package/vendor/upstreams/mattpocock/skills/engineering/grill-with-docs/SKILL.md +7 -0
  92. package/vendor/upstreams/mattpocock/skills/engineering/prototype/LOGIC.md +79 -0
  93. package/vendor/upstreams/mattpocock/skills/engineering/prototype/SKILL.md +26 -0
  94. package/vendor/upstreams/mattpocock/skills/engineering/prototype/UI.md +112 -0
  95. package/vendor/upstreams/mattpocock/skills/engineering/research/SKILL.md +12 -0
  96. package/vendor/upstreams/mattpocock/skills/engineering/setup-matt-pocock-skills/SKILL.md +116 -0
  97. package/vendor/upstreams/mattpocock/skills/engineering/setup-matt-pocock-skills/domain.md +51 -0
  98. package/vendor/upstreams/mattpocock/skills/engineering/setup-matt-pocock-skills/issue-tracker-github.md +45 -0
  99. package/vendor/upstreams/mattpocock/skills/engineering/setup-matt-pocock-skills/issue-tracker-gitlab.md +46 -0
  100. package/vendor/upstreams/mattpocock/skills/engineering/setup-matt-pocock-skills/issue-tracker-local.md +30 -0
  101. package/vendor/upstreams/mattpocock/skills/engineering/setup-matt-pocock-skills/triage-labels.md +15 -0
  102. package/vendor/upstreams/mattpocock/skills/engineering/to-spec/SKILL.md +75 -0
  103. package/vendor/upstreams/mattpocock/skills/engineering/to-tickets/SKILL.md +105 -0
  104. package/vendor/upstreams/mattpocock/skills/engineering/triage/AGENT-BRIEF.md +207 -0
  105. package/vendor/upstreams/mattpocock/skills/engineering/triage/OUT-OF-SCOPE.md +105 -0
  106. package/vendor/upstreams/mattpocock/skills/engineering/triage/SKILL.md +112 -0
  107. package/vendor/upstreams/mattpocock/skills/engineering/wayfinder/SKILL.md +128 -0
  108. package/vendor/upstreams/mattpocock/skills/productivity/grilling/SKILL.md +12 -0
  109. package/vendor/upstreams/mattpocock/skills/productivity/handoff/SKILL.md +16 -0
  110. package/vendor/upstreams/obra/skills/brainstorming/SKILL.md +151 -0
  111. package/vendor/upstreams/obra/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  112. package/vendor/upstreams/obra/skills/brainstorming/visual-companion.md +298 -0
  113. package/vendor/upstreams/obra/skills/dispatching-parallel-agents/SKILL.md +167 -0
  114. package/vendor/upstreams/obra/skills/executing-plans/SKILL.md +64 -0
  115. package/vendor/upstreams/obra/skills/receiving-code-review/SKILL.md +205 -0
  116. package/vendor/upstreams/obra/skills/requesting-code-review/SKILL.md +95 -0
  117. package/vendor/upstreams/obra/skills/requesting-code-review/code-reviewer.md +172 -0
  118. package/vendor/upstreams/obra/skills/subagent-driven-development/SKILL.md +503 -0
  119. package/vendor/upstreams/obra/skills/subagent-driven-development/implementer-prompt.md +142 -0
  120. package/vendor/upstreams/obra/skills/subagent-driven-development/re-review-prompt.md +106 -0
  121. package/vendor/upstreams/obra/skills/subagent-driven-development/task-reviewer-prompt.md +185 -0
  122. package/vendor/upstreams/obra/skills/systematic-debugging/CREATION-LOG.md +119 -0
  123. package/vendor/upstreams/obra/skills/systematic-debugging/SKILL.md +283 -0
  124. package/vendor/upstreams/obra/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  125. package/vendor/upstreams/obra/skills/systematic-debugging/condition-based-waiting.md +115 -0
  126. package/vendor/upstreams/obra/skills/systematic-debugging/defense-in-depth.md +122 -0
  127. package/vendor/upstreams/obra/skills/systematic-debugging/find-polluter.sh +72 -0
  128. package/vendor/upstreams/obra/skills/systematic-debugging/root-cause-tracing.md +169 -0
  129. package/vendor/upstreams/obra/skills/systematic-debugging/test-academic.md +14 -0
  130. package/vendor/upstreams/obra/skills/systematic-debugging/test-pressure-1.md +58 -0
  131. package/vendor/upstreams/obra/skills/systematic-debugging/test-pressure-2.md +68 -0
  132. package/vendor/upstreams/obra/skills/systematic-debugging/test-pressure-3.md +69 -0
  133. package/vendor/upstreams/obra/skills/test-driven-development/SKILL.md +320 -0
  134. package/vendor/upstreams/obra/skills/test-driven-development/writing-good-tests.md +198 -0
  135. package/vendor/upstreams/obra/skills/verification-before-completion/SKILL.md +120 -0
  136. package/vendor/upstreams/obra/skills/writing-plans/SKILL.md +168 -0
  137. package/vendor/upstreams/obra/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
@@ -0,0 +1,151 @@
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 the visual companion just-in-time** — NOT upfront. The first time a question would genuinely be clearer shown than described, offer it then (its own message); on approval its browser tab opens for you. If no visual question ever arises, never offer it. 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
+ "Ask clarifying questions" [shape=box];
40
+ "Propose 2-3 approaches" [shape=box];
41
+ "Present design sections" [shape=box];
42
+ "User approves design?" [shape=diamond];
43
+ "Write design doc" [shape=box];
44
+ "Spec self-review\n(fix inline)" [shape=box];
45
+ "User reviews spec?" [shape=diamond];
46
+ "Invoke writing-plans skill" [shape=doublecircle];
47
+
48
+ "Explore project context" -> "Ask clarifying questions";
49
+ "Ask clarifying questions" -> "Propose 2-3 approaches";
50
+ "Propose 2-3 approaches" -> "Present design sections";
51
+ "Present design sections" -> "User approves design?";
52
+ "User approves design?" -> "Present design sections" [label="no, revise"];
53
+ "User approves design?" -> "Write design doc" [label="yes"];
54
+ "Write design doc" -> "Spec self-review\n(fix inline)";
55
+ "Spec self-review\n(fix inline)" -> "User reviews spec?";
56
+ "User reviews spec?" -> "Write design doc" [label="changes requested"];
57
+ "User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
58
+ }
59
+ ```
60
+
61
+ **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.
62
+
63
+ ## The Process
64
+
65
+ **Understanding the idea:**
66
+
67
+ - Check out the current project state first (files, docs, recent commits)
68
+ - 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.
69
+ - 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.
70
+ - For appropriately-scoped projects, ask questions one at a time to refine the idea
71
+ - Prefer multiple choice questions when possible, but open-ended is fine too
72
+ - Only one question per message - if a topic needs more exploration, break it into multiple questions
73
+ - Focus on understanding: purpose, constraints, success criteria
74
+
75
+ **Exploring approaches:**
76
+
77
+ - Propose 2-3 different approaches with trade-offs
78
+ - Present options conversationally with your recommendation and reasoning
79
+ - Lead with your recommended option and explain why
80
+ - YAGNI ruthlessly - remove unnecessary features from every approach and design
81
+
82
+ **Presenting the design:**
83
+
84
+ - Once you believe you understand what you're building, present the design
85
+ - Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
86
+ - Ask after each section whether it looks right so far
87
+ - Cover: architecture, components, data flow, error handling, testing
88
+ - Be ready to go back and clarify if something doesn't make sense
89
+
90
+ **Design for isolation and clarity:**
91
+
92
+ - Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
93
+ - For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
94
+ - 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.
95
+ - 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.
96
+
97
+ **Working in existing codebases:**
98
+
99
+ - Explore the current structure before proposing changes. Follow existing patterns.
100
+ - 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.
101
+ - Don't propose unrelated refactoring. Stay focused on what serves the current goal.
102
+
103
+ ## After the Design
104
+
105
+ **Documentation:**
106
+
107
+ - Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
108
+ - (User preferences for spec location override this default)
109
+ - Use elements-of-style:writing-clearly-and-concisely skill if available
110
+ - Commit the design document to git
111
+
112
+ **Spec Self-Review:**
113
+ After writing the spec document, look at it with fresh eyes:
114
+
115
+ 1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
116
+ 2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
117
+ 3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
118
+ 4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
119
+
120
+ Fix any issues inline. No need to re-review — just fix and move on.
121
+
122
+ **User Review Gate:**
123
+ After the spec review loop passes, ask the user to review the written spec before proceeding:
124
+
125
+ > "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."
126
+
127
+ 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.
128
+
129
+ **Implementation:**
130
+
131
+ - Invoke the writing-plans skill to create a detailed implementation plan
132
+ - Do NOT invoke any other skill. writing-plans is the next step.
133
+
134
+ ## Visual Companion
135
+
136
+ 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.
137
+
138
+ **Offering the companion (just-in-time):** Do NOT offer it upfront. Wait until a question would genuinely be clearer shown than told — a real mockup / layout / diagram question, not merely a UI *topic*. The first time that happens, offer it then, as its own message:
139
+ > "This next part might be easier if I show you — I can put together mockups, diagrams, and comparisons in a browser tab as we go. It's still new and can be token-intensive. Want me to? I'll open it for you."
140
+
141
+ **This offer MUST be its own message.** Only the offer — no clarifying question, summary, or other content. Wait for the user's response. If they accept, start the server with `--open` so their browser opens to the first screen automatically. If they decline, continue text-only and don't offer again unless they raise it.
142
+
143
+ **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?**
144
+
145
+ - **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
146
+ - **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
147
+
148
+ 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.
149
+
150
+ If they agree to the companion, read the detailed guide before proceeding:
151
+ `skills/brainstorming/visual-companion.md`
@@ -0,0 +1,49 @@
1
+ # Spec Document Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a spec document reviewer subagent.
4
+
5
+ **Purpose:** Verify the spec is complete, consistent, and ready for implementation planning.
6
+
7
+ **Dispatch after:** Spec document is written to docs/superpowers/specs/
8
+
9
+ ```
10
+ Subagent (general-purpose):
11
+ description: "Review spec document"
12
+ prompt: |
13
+ You are a spec document reviewer. Verify this spec is complete and ready for planning.
14
+
15
+ **Spec to review:** [SPEC_FILE_PATH]
16
+
17
+ ## What to Check
18
+
19
+ | Category | What to Look For |
20
+ |----------|------------------|
21
+ | Completeness | TODOs, placeholders, "TBD", incomplete sections |
22
+ | Consistency | Internal contradictions, conflicting requirements |
23
+ | Clarity | Requirements ambiguous enough to cause someone to build the wrong thing |
24
+ | Scope | Focused enough for a single plan — not covering multiple independent subsystems |
25
+ | YAGNI | Unrequested features, over-engineering |
26
+
27
+ ## Calibration
28
+
29
+ **Only flag issues that would cause real problems during implementation planning.**
30
+ A missing section, a contradiction, or a requirement so ambiguous it could be
31
+ interpreted two different ways — those are issues. Minor wording improvements,
32
+ stylistic preferences, and "sections less detailed than others" are not.
33
+
34
+ Approve unless there are serious gaps that would lead to a flawed plan.
35
+
36
+ ## Output Format
37
+
38
+ ## Spec Review
39
+
40
+ **Status:** Approved | Issues Found
41
+
42
+ **Issues (if any):**
43
+ - [Section X]: [specific issue] - [why it matters for planning]
44
+
45
+ **Recommendations (advisory, do not block approval):**
46
+ - [suggestions for improvement]
47
+ ```
48
+
49
+ **Reviewer returns:** Status, Issues (if any), Recommendations
@@ -0,0 +1,298 @@
1
+ # Visual Companion Guide
2
+
3
+ Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
4
+
5
+ ## When to Use
6
+
7
+ Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
8
+
9
+ **Use the browser** when the content itself is visual:
10
+
11
+ - **UI mockups** — wireframes, layouts, navigation structures, component designs
12
+ - **Architecture diagrams** — system components, data flow, relationship maps
13
+ - **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
14
+ - **Design polish** — when the question is about look and feel, spacing, visual hierarchy
15
+ - **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
16
+
17
+ **Use the terminal** when the content is text or tabular:
18
+
19
+ - **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
20
+ - **Conceptual A/B/C choices** — picking between approaches described in words
21
+ - **Tradeoff lists** — pros/cons, comparison tables
22
+ - **Technical decisions** — API design, data modeling, architectural approach selection
23
+ - **Clarifying questions** — anything where the answer is words, not a visual preference
24
+
25
+ A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
26
+
27
+ ## How It Works
28
+
29
+ The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content to `screen_dir`, the user sees it in their browser and can click to select options. Selections are recorded to `state_dir/events` that you read on your next turn.
30
+
31
+ **Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, connection status, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
32
+
33
+ ## Starting a Session
34
+
35
+ ```bash
36
+ # Start AFTER the user approves the companion. --open auto-opens their browser on
37
+ # the first screen; --project-dir persists mockups and enables same-port restart.
38
+ scripts/start-server.sh --project-dir /path/to/project --open
39
+
40
+ # Returns: {"type":"server-started","port":52341,
41
+ # "url":"http://localhost:52341/?key=ab12…",
42
+ # "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
43
+ # "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
44
+ ```
45
+
46
+ Save `screen_dir` and `state_dir` from the response. With `--open`, the browser opens itself when you push the first screen — you don't need to ask the user to open it, but still share the URL as a fallback (headless/remote setups won't auto-open).
47
+
48
+ **The URL contains a session key (`?key=…`).** The server rejects any request
49
+ without it, so always give the user the **complete** URL from the `url` field —
50
+ never strip the query string, and never hand out a bare `http://host:port`. The
51
+ key gates HTTP and WebSocket access so a stray browser tab or another machine on
52
+ the network can't read the screens or inject events. After the first load the
53
+ browser remembers the key via a cookie, so reloads and `/files/*` assets work
54
+ without repeating it.
55
+
56
+ **Finding connection info:** The server writes its startup JSON to `$STATE_DIR/server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.superpowers/brainstorm/` for the session directory.
57
+
58
+ **Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
59
+
60
+ **Launching the server by platform:**
61
+
62
+ **Claude Code:**
63
+ ```bash
64
+ # Default mode works — the script backgrounds the server itself.
65
+ scripts/start-server.sh --project-dir /path/to/project --open
66
+ ```
67
+
68
+ On Windows, the script auto-detects and switches to foreground mode (which blocks the tool call). Use `run_in_background: true` on the Bash tool call so the server survives across conversation turns, then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
69
+
70
+ **Codex:**
71
+ ```bash
72
+ # Codex reaps background processes. The script auto-detects CODEX_CI and
73
+ # switches to foreground mode. Run it normally — no extra flags needed.
74
+ scripts/start-server.sh --project-dir /path/to/project --open
75
+ ```
76
+
77
+ **Gemini CLI:**
78
+ ```bash
79
+ # Use --foreground and set is_background: true on your shell tool call
80
+ # so the process survives across turns
81
+ scripts/start-server.sh --project-dir /path/to/project --open --foreground
82
+ ```
83
+
84
+ **Copilot CLI:**
85
+ ```bash
86
+ # Use --foreground and start the server via the bash tool with mode: "async"
87
+ # so the process survives across turns. Capture the returned shellId for
88
+ # read_bash / stop_bash if you need to interact with it later.
89
+ scripts/start-server.sh --project-dir /path/to/project --open --foreground
90
+ ```
91
+
92
+ **Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
93
+
94
+ If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
95
+
96
+ ```bash
97
+ scripts/start-server.sh \
98
+ --project-dir /path/to/project \
99
+ --host 0.0.0.0 \
100
+ --url-host localhost
101
+ ```
102
+
103
+ Use `--url-host` to control what hostname is printed in the returned URL JSON.
104
+
105
+ ## The Loop
106
+
107
+ 1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
108
+ - **Required: confirm the server is alive before referring to the URL or pushing a screen.** Check that `$STATE_DIR/server-info` exists and `$STATE_DIR/server-stopped` does not. If it has shut down, restart it with `start-server.sh` using the **same `--project-dir`** — it reuses the same port, so the user's open tab reconnects on its own (it shows a "paused" overlay while the server is down) and you don't need to send a new URL. The server auto-exits after 4 hours idle (configurable with `--idle-timeout-minutes`).
109
+ - Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
110
+ - **Never reuse filenames** — each screen gets a fresh file
111
+ - Use your file-creation tool — **never use cat/heredoc** (dumps noise into terminal)
112
+ - Server automatically serves the newest file
113
+
114
+ 2. **Tell user what to expect and end your turn:**
115
+ - Remind them of the URL (every step, not just first)
116
+ - Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
117
+ - Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
118
+
119
+ 3. **On your next turn** — after the user responds in the terminal:
120
+ - Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
121
+ - Merge with the user's terminal text to get the full picture
122
+ - The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
123
+
124
+ 4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
125
+
126
+ 5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
127
+
128
+ ```html
129
+ <!-- filename: waiting.html (or waiting-2.html, etc.) -->
130
+ <div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
131
+ <p class="subtitle">Continuing in terminal...</p>
132
+ </div>
133
+ ```
134
+
135
+ This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
136
+
137
+ 6. Repeat until done.
138
+
139
+ ## Writing Content Fragments
140
+
141
+ Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, connection status, and all interactive infrastructure).
142
+
143
+ **Minimal example:**
144
+
145
+ ```html
146
+ <h2>Which layout works better?</h2>
147
+ <p class="subtitle">Consider readability and visual hierarchy</p>
148
+
149
+ <div class="options">
150
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
151
+ <div class="letter">A</div>
152
+ <div class="content">
153
+ <h3>Single Column</h3>
154
+ <p>Clean, focused reading experience</p>
155
+ </div>
156
+ </div>
157
+ <div class="option" data-choice="b" onclick="toggleSelect(this)">
158
+ <div class="letter">B</div>
159
+ <div class="content">
160
+ <h3>Two Column</h3>
161
+ <p>Sidebar navigation with main content</p>
162
+ </div>
163
+ </div>
164
+ </div>
165
+ ```
166
+
167
+ That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
168
+
169
+ ## CSS Classes Available
170
+
171
+ The frame template provides these CSS classes for your content:
172
+
173
+ ### Options (A/B/C choices)
174
+
175
+ ```html
176
+ <div class="options">
177
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
178
+ <div class="letter">A</div>
179
+ <div class="content">
180
+ <h3>Title</h3>
181
+ <p>Description</p>
182
+ </div>
183
+ </div>
184
+ </div>
185
+ ```
186
+
187
+ **Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item's selected styling.
188
+
189
+ ```html
190
+ <div class="options" data-multiselect>
191
+ <!-- same option markup — users can select/deselect multiple -->
192
+ </div>
193
+ ```
194
+
195
+ ### Cards (visual designs)
196
+
197
+ ```html
198
+ <div class="cards">
199
+ <div class="card" data-choice="design1" onclick="toggleSelect(this)">
200
+ <div class="card-image"><!-- mockup content --></div>
201
+ <div class="card-body">
202
+ <h3>Name</h3>
203
+ <p>Description</p>
204
+ </div>
205
+ </div>
206
+ </div>
207
+ ```
208
+
209
+ ### Mockup container
210
+
211
+ ```html
212
+ <div class="mockup">
213
+ <div class="mockup-header">Preview: Dashboard Layout</div>
214
+ <div class="mockup-body"><!-- your mockup HTML --></div>
215
+ </div>
216
+ ```
217
+
218
+ ### Split view (side-by-side)
219
+
220
+ ```html
221
+ <div class="split">
222
+ <div class="mockup"><!-- left --></div>
223
+ <div class="mockup"><!-- right --></div>
224
+ </div>
225
+ ```
226
+
227
+ ### Pros/Cons
228
+
229
+ ```html
230
+ <div class="pros-cons">
231
+ <div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
232
+ <div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
233
+ </div>
234
+ ```
235
+
236
+ ### Mock elements (wireframe building blocks)
237
+
238
+ ```html
239
+ <div class="mock-nav">Logo | Home | About | Contact</div>
240
+ <div style="display: flex;">
241
+ <div class="mock-sidebar">Navigation</div>
242
+ <div class="mock-content">Main content area</div>
243
+ </div>
244
+ <button class="mock-button">Action Button</button>
245
+ <input class="mock-input" placeholder="Input field">
246
+ <div class="placeholder">Placeholder area</div>
247
+ ```
248
+
249
+ ### Typography and sections
250
+
251
+ - `h2` — page title
252
+ - `h3` — section heading
253
+ - `.subtitle` — secondary text below title
254
+ - `.section` — content block with bottom margin
255
+ - `.label` — small uppercase label text
256
+
257
+ ## Browser Events Format
258
+
259
+ When the user clicks options in the browser, their interactions are recorded to `$STATE_DIR/events` (one JSON object per line). The file is cleared automatically when you push a new screen.
260
+
261
+ ```jsonl
262
+ {"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
263
+ {"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
264
+ {"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
265
+ ```
266
+
267
+ The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
268
+
269
+ If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
270
+
271
+ ## Design Tips
272
+
273
+ - **Scale fidelity to the question** — wireframes for layout, polish for polish questions
274
+ - **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
275
+ - **Iterate before advancing** — if feedback changes current screen, write a new version
276
+ - **2-4 options max** per screen
277
+ - **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
278
+ - **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
279
+
280
+ ## File Naming
281
+
282
+ - Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
283
+ - Never reuse filenames — each screen must be a new file
284
+ - For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
285
+ - Server serves newest file by modification time
286
+
287
+ ## Cleaning Up
288
+
289
+ ```bash
290
+ scripts/stop-server.sh $SESSION_DIR
291
+ ```
292
+
293
+ If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
294
+
295
+ ## Reference
296
+
297
+ - Frame template (CSS reference): `scripts/frame-template.html`
298
+ - Helper script (client-side): `scripts/helper.js`
@@ -0,0 +1,167 @@
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
+ Issue all three subagent dispatches in the same response — they run in parallel:
69
+
70
+ ```text
71
+ Subagent (general-purpose): "Fix agent-tool-abort.test.ts failures"
72
+ Subagent (general-purpose): "Fix batch-completion-behavior.test.ts failures"
73
+ Subagent (general-purpose): "Fix tool-approval-race-conditions.test.ts failures"
74
+ # All three run concurrently.
75
+ ```
76
+
77
+ Multiple dispatch calls in one response = parallel execution. One per response = sequential.
78
+
79
+ ### 4. Review and Integrate
80
+
81
+ When agents return:
82
+ - Read each summary
83
+ - Verify fixes don't conflict
84
+ - Run full test suite
85
+ - Integrate all changes
86
+
87
+ ## Agent Prompt Structure
88
+
89
+ Good agent prompts are:
90
+ 1. **Focused** - One clear problem domain
91
+ 2. **Self-contained** - All context needed to understand the problem
92
+ 3. **Specific about output** - What should the agent return?
93
+
94
+ ```markdown
95
+ Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
96
+
97
+ 1. "should abort tool with partial output capture" - expects 'interrupted at' in message
98
+ 2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
99
+ 3. "should properly track pendingToolCount" - expects 3 results but gets 0
100
+
101
+ These are timing/race condition issues. Your task:
102
+
103
+ 1. Read the test file and understand what each test verifies
104
+ 2. Identify root cause - timing issues or actual bugs?
105
+ 3. Fix by:
106
+ - Replacing arbitrary timeouts with event-based waiting
107
+ - Fixing bugs in abort implementation if found
108
+ - Adjusting test expectations if testing changed behavior
109
+
110
+ Do NOT just increase timeouts - find the real issue.
111
+
112
+ Return: Summary of what you found and what you fixed.
113
+ ```
114
+
115
+ ## Common Mistakes
116
+
117
+ **❌ Too broad:** "Fix all the tests" - agent gets lost
118
+ **✅ Specific:** "Fix agent-tool-abort.test.ts" - focused scope
119
+
120
+ **❌ No context:** "Fix the race condition" - agent doesn't know where
121
+ **✅ Context:** Paste the error messages and test names
122
+
123
+ **❌ No constraints:** Agent might refactor everything
124
+ **✅ Constraints:** "Do NOT change production code" or "Fix tests only"
125
+
126
+ **❌ Vague output:** "Fix it" - you don't know what changed
127
+ **✅ Specific:** "Return summary of root cause and changes"
128
+
129
+ ## When NOT to Use
130
+
131
+ **Related failures:** Fixing one might fix others - investigate together first
132
+ **Need full context:** Understanding requires seeing entire system
133
+ **Exploratory debugging:** You don't know what's broken yet
134
+ **Shared state:** Agents would interfere (editing same files, using same resources)
135
+
136
+ ## Real Example from Session
137
+
138
+ **Scenario:** 6 test failures across 3 files after major refactoring
139
+
140
+ **Failures:**
141
+ - agent-tool-abort.test.ts: 3 failures (timing issues)
142
+ - batch-completion-behavior.test.ts: 2 failures (tools not executing)
143
+ - tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)
144
+
145
+ **Decision:** Independent domains - abort logic separate from batch completion separate from race conditions
146
+
147
+ **Dispatch:**
148
+ ```
149
+ Agent 1 → Fix agent-tool-abort.test.ts
150
+ Agent 2 → Fix batch-completion-behavior.test.ts
151
+ Agent 3 → Fix tool-approval-race-conditions.test.ts
152
+ ```
153
+
154
+ **Results:**
155
+ - Agent 1: Replaced timeouts with event-based waiting
156
+ - Agent 2: Fixed event structure bug (threadId in wrong place)
157
+ - Agent 3: Added wait for async tool execution to complete
158
+
159
+ **Integration:** All fixes independent, no conflicts, full suite green
160
+
161
+ ## Verification
162
+
163
+ After agents return:
164
+ 1. **Review each summary** - Understand what changed
165
+ 2. **Check for conflicts** - Did agents edit same code?
166
+ 3. **Run full suite** - Verify all fixes work together
167
+ 4. **Spot check** - Agents can make systematic errors