@polderlabs/bizar 10.23.21 → 10.23.23

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 (159) hide show
  1. package/AGENTS.md +17 -14
  2. package/README.md +209 -67
  3. package/cli/banner.mjs +1 -1
  4. package/cli/commands/models.mjs +44 -3
  5. package/cli/commands/validate.mjs +6 -7
  6. package/cli/install/banner.mjs +1 -1
  7. package/cli/install/interactive-setup.mjs +13 -1
  8. package/cli/install/paths.mjs +2 -10
  9. package/cli/provision.mjs +21 -14
  10. package/cli/utils.mjs +2 -11
  11. package/config/claude/CLAUDE.md +17 -14
  12. package/config/claude/agents/bizar-accessibility-architect.md +153 -0
  13. package/config/claude/agents/bizar-agent-evaluator.md +210 -0
  14. package/config/claude/agents/bizar-architect.md +224 -0
  15. package/config/claude/agents/bizar-build-error-resolver.md +127 -0
  16. package/config/claude/agents/bizar-chief-of-staff.md +164 -0
  17. package/config/claude/agents/bizar-code-architect.md +84 -0
  18. package/config/claude/agents/bizar-code-explorer.md +82 -0
  19. package/config/claude/agents/bizar-code-reviewer.md +327 -0
  20. package/config/claude/agents/bizar-code-simplifier.md +60 -0
  21. package/config/claude/agents/bizar-comment-analyzer.md +58 -0
  22. package/config/claude/agents/bizar-conversation-analyzer.md +65 -0
  23. package/config/claude/agents/bizar-cpp-build-resolver.md +103 -0
  24. package/config/claude/agents/bizar-cpp-reviewer.md +85 -0
  25. package/config/claude/agents/bizar-csharp-reviewer.md +114 -0
  26. package/config/claude/agents/bizar-dart-build-resolver.md +214 -0
  27. package/config/claude/agents/bizar-database-reviewer.md +104 -0
  28. package/config/claude/agents/bizar-django-build-resolver.md +256 -0
  29. package/config/claude/agents/bizar-django-reviewer.md +173 -0
  30. package/config/claude/agents/bizar-doc-updater.md +120 -0
  31. package/config/claude/agents/bizar-docs-lookup.md +81 -0
  32. package/config/claude/agents/bizar-end-to-end-runner.md +120 -0
  33. package/config/claude/agents/bizar-fastapi-reviewer.md +83 -0
  34. package/config/claude/agents/bizar-flutter-reviewer.md +256 -0
  35. package/config/claude/agents/bizar-fsharp-reviewer.md +113 -0
  36. package/config/claude/agents/bizar-gan-evaluator.md +236 -0
  37. package/config/claude/agents/bizar-gan-generator.md +144 -0
  38. package/config/claude/agents/bizar-gan-planner.md +112 -0
  39. package/config/claude/agents/bizar-go-build-resolver.md +107 -0
  40. package/config/claude/agents/bizar-go-reviewer.md +89 -0
  41. package/config/claude/agents/bizar-harmonyos-app-resolver.md +186 -0
  42. package/config/claude/agents/bizar-harness-optimizer.md +59 -0
  43. package/config/claude/agents/bizar-healthcare-reviewer.md +96 -0
  44. package/config/claude/agents/bizar-homelab-architect.md +111 -0
  45. package/config/claude/agents/bizar-java-build-resolver.md +279 -0
  46. package/config/claude/agents/bizar-java-reviewer.md +194 -0
  47. package/config/claude/agents/bizar-kotlin-build-resolver.md +131 -0
  48. package/config/claude/agents/bizar-kotlin-reviewer.md +172 -0
  49. package/config/claude/agents/bizar-loop-operator.md +49 -0
  50. package/config/claude/agents/bizar-marketing-agent.md +163 -0
  51. package/config/claude/agents/bizar-mle-reviewer.md +166 -0
  52. package/config/claude/agents/bizar-network-architect.md +110 -0
  53. package/config/claude/agents/bizar-network-config-reviewer.md +110 -0
  54. package/config/claude/agents/bizar-network-troubleshooter.md +132 -0
  55. package/config/claude/agents/bizar-opensource-forker.md +211 -0
  56. package/config/claude/agents/bizar-opensource-packager.md +262 -0
  57. package/config/claude/agents/bizar-opensource-sanitizer.md +201 -0
  58. package/config/claude/agents/bizar-performance-optimizer.md +459 -0
  59. package/config/claude/agents/bizar-php-reviewer.md +113 -0
  60. package/config/claude/agents/bizar-planner.md +225 -0
  61. package/config/claude/agents/bizar-pr-test-analyzer.md +58 -0
  62. package/config/claude/agents/bizar-python-reviewer.md +111 -0
  63. package/config/claude/agents/bizar-pytorch-build-resolver.md +133 -0
  64. package/config/claude/agents/bizar-rag-pipeline-reviewer.md +71 -0
  65. package/config/claude/agents/bizar-react-build-resolver.md +219 -0
  66. package/config/claude/agents/bizar-react-reviewer.md +171 -0
  67. package/config/claude/agents/bizar-refactor-cleaner.md +98 -0
  68. package/config/claude/agents/bizar-rust-build-resolver.md +161 -0
  69. package/config/claude/agents/bizar-rust-reviewer.md +107 -0
  70. package/config/claude/agents/bizar-security-reviewer.md +121 -0
  71. package/config/claude/agents/bizar-seo-specialist.md +75 -0
  72. package/config/claude/agents/bizar-silent-failure-hunter.md +63 -0
  73. package/config/claude/agents/bizar-spec-miner.md +221 -0
  74. package/config/claude/agents/bizar-swift-build-resolver.md +174 -0
  75. package/config/claude/agents/bizar-swift-reviewer.md +120 -0
  76. package/config/claude/agents/bizar-tdd-guide.md +104 -0
  77. package/config/claude/agents/bizar-type-design-analyzer.md +54 -0
  78. package/config/claude/agents/bizar-typescript-reviewer.md +128 -0
  79. package/config/claude/agents/bizar-vue-reviewer.md +210 -0
  80. package/config/claude/agents/office-manager.md +13 -15
  81. package/config/claude/commands/bizar.md +6 -5
  82. package/config/claude/commands/plow-through.md +3 -2
  83. package/config/claude/commands/quick.md +14 -14
  84. package/config/claude/commands/team.md +5 -2
  85. package/config/claude/hooks/agent-model-guard.mjs +2 -2
  86. package/config/claude/hooks/sessionend-recall.mjs +1 -9
  87. package/config/claude/hooks/sessionstart-prime.mjs +2 -2
  88. package/config/claude/hooks/thinking-route.mjs +0 -1
  89. package/config/claude/hooks/worker-suggest.mjs +12 -24
  90. package/config/claude/hooks/workflow-route-guard.mjs +4 -3
  91. package/config/claude/hooks/workflow-route-state.mjs +1 -1
  92. package/config/skills/brainstorming/SKILL.md +253 -0
  93. package/config/skills/brainstorming/scripts/frame-template.html +213 -0
  94. package/config/skills/brainstorming/scripts/helper.js +167 -0
  95. package/config/skills/brainstorming/scripts/server.cjs +723 -0
  96. package/config/skills/brainstorming/scripts/start-server.sh +209 -0
  97. package/config/skills/brainstorming/scripts/stop-server.sh +120 -0
  98. package/config/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  99. package/config/skills/brainstorming/visual-companion.md +299 -0
  100. package/config/skills/dispatching-parallel-agents/SKILL.md +170 -0
  101. package/config/skills/executing-plans/SKILL.md +67 -0
  102. package/config/skills/finishing-a-development-branch/SKILL.md +228 -0
  103. package/config/skills/receiving-code-review/SKILL.md +208 -0
  104. package/config/skills/requesting-code-review/SKILL.md +98 -0
  105. package/config/skills/requesting-code-review/code-reviewer.md +181 -0
  106. package/config/skills/subagent-driven-development/SKILL.md +571 -0
  107. package/config/skills/subagent-driven-development/implementer-prompt.md +154 -0
  108. package/config/skills/subagent-driven-development/re-review-prompt.md +115 -0
  109. package/config/skills/subagent-driven-development/scripts/review-package +46 -0
  110. package/config/skills/subagent-driven-development/scripts/sdd-workspace +40 -0
  111. package/config/skills/subagent-driven-development/scripts/task-brief +41 -0
  112. package/config/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
  113. package/config/skills/systematic-debugging/CREATION-LOG.md +119 -0
  114. package/config/skills/systematic-debugging/SKILL.md +286 -0
  115. package/config/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  116. package/config/skills/systematic-debugging/condition-based-waiting.md +115 -0
  117. package/config/skills/systematic-debugging/defense-in-depth.md +122 -0
  118. package/config/skills/systematic-debugging/find-polluter.sh +72 -0
  119. package/config/skills/systematic-debugging/root-cause-tracing.md +169 -0
  120. package/config/skills/systematic-debugging/test-academic.md +14 -0
  121. package/config/skills/systematic-debugging/test-pressure-1.md +58 -0
  122. package/config/skills/systematic-debugging/test-pressure-2.md +68 -0
  123. package/config/skills/systematic-debugging/test-pressure-3.md +69 -0
  124. package/config/skills/test-driven-development/SKILL.md +323 -0
  125. package/config/skills/test-driven-development/writing-good-tests.md +198 -0
  126. package/config/skills/using-git-worktrees/SKILL.md +170 -0
  127. package/config/skills/using-superpowers/SKILL.md +66 -0
  128. package/config/skills/using-superpowers/references/antigravity-tools.md +23 -0
  129. package/config/skills/using-superpowers/references/codex-tools.md +108 -0
  130. package/config/skills/using-superpowers/references/gemini-tools.md +63 -0
  131. package/config/skills/using-superpowers/references/hermes-tools.md +56 -0
  132. package/config/skills/using-superpowers/references/pi-tools.md +16 -0
  133. package/config/skills/verification-before-completion/SKILL.md +123 -0
  134. package/config/skills/writing-plans/SKILL.md +174 -0
  135. package/config/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  136. package/config/skills/writing-skills/SKILL.md +682 -0
  137. package/config/skills/writing-skills/anthropic-best-practices.md +1150 -0
  138. package/config/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  139. package/config/skills/writing-skills/graphviz-conventions.dot +172 -0
  140. package/config/skills/writing-skills/persuasion-principles.md +187 -0
  141. package/config/skills/writing-skills/render-graphs.js +169 -0
  142. package/config/skills/writing-skills/testing-skills-with-subagents.md +384 -0
  143. package/config/trigger-patterns.json +1 -1
  144. package/config/workflows/bizar-debug.js +1 -0
  145. package/config/workflows/bizar-implement.js +1 -0
  146. package/config/workflows/bizar-research.js +1 -0
  147. package/config/workflows/ultracode-research.js +1 -0
  148. package/config/workflows/ultracode-review.js +1 -0
  149. package/config/workflows/ultracode.js +1 -0
  150. package/package.json +1 -1
  151. package/packages/sdk/dist/version.d.ts +1 -1
  152. package/packages/sdk/dist/version.js +1 -1
  153. package/packages/sdk/package.json +1 -1
  154. package/config/claude/commands/migrate.md +0 -18
  155. package/config/claude/commands/tailscale-serve.md +0 -14
  156. package/config/claude/commands/tier.md +0 -31
  157. package/config/claude/commands/upgrade-defaults.md +0 -34
  158. package/config/claude/commands/use-default.md +0 -12
  159. package/config/claude/commands/use-premium.md +0 -12
@@ -0,0 +1,253 @@
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
+ > **Bizar compatibility:** This procedure is fully integrated into Bizar. Bizar system, repository, model-routing, autonomy, and approval policy control whenever they differ. Do not add a separate mandatory approval gate, recurse into dispatch, or override the active Bizar workflow.
7
+
8
+
9
+ # Brainstorming Ideas Into Designs
10
+
11
+ Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
12
+
13
+ Start by classifying how much process the request needs, then work
14
+ through your path: understand the context, refine the idea, present a
15
+ design, and get your human partner's approval.
16
+
17
+ <HARD-GATE>
18
+ Do NOT invoke any implementation skill, write any code, scaffold any
19
+ project, or take any implementation action until you have told your
20
+ human partner what you intend and they have approved it. This applies
21
+ to EVERY task on EVERY path below — the ceremony scales with the task;
22
+ the approval gate never does.
23
+ </HARD-GATE>
24
+
25
+ ## Three Paths
26
+
27
+ Before your first question, classify the request and say the
28
+ classification out loud — "this looks bounded, so I'll present a short
29
+ design here rather than write a spec" — so your human partner can
30
+ override it:
31
+
32
+ - **Spike** — a feasibility question ("can we...", "is it possible...",
33
+ "quick and dirty is fine") whose output is an answer, not code you
34
+ keep. Present the question and what you'll try in 2-3 sentences, get
35
+ a nod, then find out as cheaply as correctness allows. No design
36
+ doc, no spec file. Report findings as a recommendation; anything you
37
+ built stays labeled throwaway.
38
+ - **Bounded** — a well-scoped change to code that already exists in
39
+ this repo: a new flag, a small endpoint, a one-file fix.
40
+ Understanding the kind of app is not enough — bounded means the flow
41
+ you are changing is already here to read. If there is no existing
42
+ flow to change, the task is not bounded. Ask the clarifying
43
+ questions that matter, present a short design IN CHAT (a few
44
+ sentences to a few short paragraphs), and STOP. Implementation
45
+ starts only after your human partner says yes to that design — a
46
+ bounded task's approval is as hard a gate as an architectural
47
+ one. No spec file, no implementation plan document.
48
+ - **Architectural** — new projects, new subsystems, changes that
49
+ restructure how components fit together or alter interfaces others
50
+ depend on. Follow the full process: questions, approaches, sectioned
51
+ design, written spec, then the writing-plans skill.
52
+
53
+ When in doubt between two paths, take the heavier one. The ratchet is
54
+ one-way: hidden complexity discovered mid-task upgrades the path —
55
+ stop, say so, and step up. Nothing downgrades mid-task.
56
+
57
+ ## Anti-Pattern: "Too Simple To Need Approval"
58
+
59
+ Every path ends with your human partner approving your intent before
60
+ implementation. A todo list, a single-function utility, a config
61
+ change — the design may be two sentences in chat, but you MUST present
62
+ it and get approval. "Simple" tasks are where unexamined assumptions
63
+ cause the most wasted work. What scales with simplicity is the
64
+ artifact, never the approval.
65
+
66
+ ## Red Flags
67
+
68
+ | Thought | Reality |
69
+ |---------|---------|
70
+ | "This is too simple to need a design" | Simple means a short design, not no design. Two sentences in chat, then approval. |
71
+ | "I'll call it bounded and skip the spec" | Reaching for a label to skip work IS the doubt — take the heavier path. |
72
+ | "It's bounded and the design is obvious — I'll start while they read it" | The gate is the approval, not the design's length. Present, then stop until you hear yes. |
73
+ | "I understand this kind of app, so it's bounded" | Bounded measures the repo, not your familiarity. A new project has no existing flow — it is architectural. |
74
+ | "The spike works, so I'll keep the code" | A spike's output is an answer. Keeping the code is a new request — classify it. |
75
+ | "It grew, but I'm almost done — no need to re-classify" | Hidden complexity upgrades the path mid-task. Stop and say so. |
76
+ | "They approved the spike, so the follow-up change is approved too" | Each task gets its own classification and its own approval. |
77
+
78
+ ## Checklist
79
+
80
+ Classify first, announce the path, then create a task for each item on
81
+ your path and complete them in order.
82
+
83
+ **Spike:**
84
+ 1. **Explore project context** — enough to frame the probe
85
+ 2. **Present question + probe plan** — 2-3 sentences
86
+ 3. **Get approval** — a nod is enough
87
+ 4. **Investigate** — as cheaply as correctness allows
88
+ 5. **Report findings** — a recommendation; label anything built as throwaway
89
+
90
+ **Bounded:**
91
+ 1. **Explore project context** — check files, docs, recent commits
92
+ 2. **Ask clarifying questions** — one at a time, the ones that matter
93
+ 3. **Present short design in chat** — approach, files touched, testing
94
+ 4. **Get approval** — STOP and wait for an explicit yes; presenting the design and starting in the same breath is skipping the gate
95
+ 5. **Implement** — proceed with the normal development workflow (TDD applies); no plan document
96
+
97
+ **Architectural:**
98
+ 1. **Explore project context** — check files, docs, recent commits
99
+ 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.
100
+ 3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
101
+ 4. **Propose 2-3 approaches** — with trade-offs and your recommendation
102
+ 5. **Present design** — in sections scaled to their complexity, get user approval after each section
103
+ 6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
104
+ 7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
105
+ 8. **User reviews written spec** — ask user to review the spec file before proceeding
106
+ 9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
107
+
108
+ ## Process Flow
109
+
110
+ ```dot
111
+ digraph brainstorming {
112
+ "Classify: spike / bounded / architectural" [shape=diamond];
113
+ "Present question + probe (2-3 sentences)" [shape=box];
114
+ "Ask clarifying questions (bounded)" [shape=box];
115
+ "Present short design in chat" [shape=box];
116
+ "Human approves?" [shape=diamond];
117
+ "Investigate; report recommendation" [shape=doublecircle];
118
+ "Implement via normal workflow (no plan doc)" [shape=doublecircle];
119
+ "Explore project context" [shape=box];
120
+ "Ask clarifying questions" [shape=box];
121
+ "Propose 2-3 approaches" [shape=box];
122
+ "Present design sections" [shape=box];
123
+ "User approves design?" [shape=diamond];
124
+ "Write design doc" [shape=box];
125
+ "Spec self-review\n(fix inline)" [shape=box];
126
+ "User reviews spec?" [shape=diamond];
127
+ "Invoke writing-plans skill" [shape=doublecircle];
128
+ "Hidden complexity? Upgrade path" [shape=box];
129
+
130
+ "Classify: spike / bounded / architectural" -> "Present question + probe (2-3 sentences)" [label="spike"];
131
+ "Classify: spike / bounded / architectural" -> "Ask clarifying questions (bounded)" [label="bounded"];
132
+ "Classify: spike / bounded / architectural" -> "Explore project context" [label="architectural"];
133
+ "Present question + probe (2-3 sentences)" -> "Human approves?";
134
+ "Ask clarifying questions (bounded)" -> "Present short design in chat";
135
+ "Present short design in chat" -> "Human approves?";
136
+ "Human approves?" -> "Investigate; report recommendation" [label="spike: yes"];
137
+ "Human approves?" -> "Implement via normal workflow (no plan doc)" [label="bounded: yes"];
138
+ "Hidden complexity? Upgrade path" -> "Classify: spike / bounded / architectural";
139
+ "Explore project context" -> "Ask clarifying questions";
140
+ "Ask clarifying questions" -> "Propose 2-3 approaches";
141
+ "Propose 2-3 approaches" -> "Present design sections";
142
+ "Present design sections" -> "User approves design?";
143
+ "User approves design?" -> "Present design sections" [label="no, revise"];
144
+ "User approves design?" -> "Write design doc" [label="yes"];
145
+ "Write design doc" -> "Spec self-review\n(fix inline)";
146
+ "Spec self-review\n(fix inline)" -> "User reviews spec?";
147
+ "User reviews spec?" -> "Write design doc" [label="changes requested"];
148
+ "User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
149
+ }
150
+ ```
151
+
152
+ **Terminal states are path-bound.** Architectural: the ONLY skill you
153
+ invoke after brainstorming is writing-plans — never frontend-design,
154
+ mcp-builder, or any other implementation skill. Bounded: after
155
+ approval, implementation proceeds directly through the normal
156
+ development workflow; no plan document. Spike: the terminal state is a
157
+ reported recommendation.
158
+
159
+ ## The Process
160
+
161
+ The subsections below serve the bounded and architectural paths (a
162
+ spike stops at "present the probe, get a nod"). Sections from
163
+ **Exploring approaches** onward are architectural-path depth — for
164
+ bounded work, context plus a few questions plus a short in-chat design
165
+ is the whole process.
166
+
167
+ **Understanding the idea:**
168
+
169
+ - Check out the current project state first (files, docs, recent commits)
170
+ - 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.
171
+ - 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.
172
+ - For appropriately-scoped projects, ask questions one at a time to refine the idea
173
+ - Prefer multiple choice questions when possible, but open-ended is fine too
174
+ - Only one question per message - if a topic needs more exploration, break it into multiple questions
175
+ - Focus on understanding: purpose, constraints, success criteria
176
+
177
+ **Exploring approaches:**
178
+
179
+ - Propose 2-3 different approaches with trade-offs
180
+ - Present options conversationally with your recommendation and reasoning
181
+ - Lead with your recommended option and explain why
182
+ - YAGNI ruthlessly - remove unnecessary features from every approach and design
183
+
184
+ **Presenting the design:**
185
+
186
+ - Once you believe you understand what you're building, present the design
187
+ - Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
188
+ - Ask after each section whether it looks right so far
189
+ - Cover: architecture, components, data flow, error handling, testing
190
+ - Be ready to go back and clarify if something doesn't make sense
191
+
192
+ **Design for isolation and clarity:**
193
+
194
+ - Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
195
+ - For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
196
+ - 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.
197
+ - 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.
198
+
199
+ **Working in existing codebases:**
200
+
201
+ - Explore the current structure before proposing changes. Follow existing patterns.
202
+ - 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.
203
+ - Don't propose unrelated refactoring. Stay focused on what serves the current goal.
204
+
205
+ ## After the Design (architectural path)
206
+
207
+ **Documentation:**
208
+
209
+ - Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
210
+ - (User preferences for spec location override this default)
211
+ - Use elements-of-style:writing-clearly-and-concisely skill if available
212
+ - Commit the design document to git
213
+
214
+ **Spec Self-Review:**
215
+ After writing the spec document, look at it with fresh eyes:
216
+
217
+ 1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
218
+ 2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
219
+ 3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
220
+ 4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
221
+
222
+ Fix any issues inline. No need to re-review — just fix and move on.
223
+
224
+ **User Review Gate:**
225
+ After the spec review loop passes, ask the user to review the written spec before proceeding:
226
+
227
+ > "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."
228
+
229
+ 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.
230
+
231
+ **Implementation:**
232
+
233
+ - Invoke the writing-plans skill to create a detailed implementation plan
234
+ - Do NOT invoke any other skill. writing-plans is the next step.
235
+
236
+ ## Visual Companion
237
+
238
+ 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.
239
+
240
+ **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:
241
+ > "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."
242
+
243
+ **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.
244
+
245
+ **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?**
246
+
247
+ - **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
248
+ - **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
249
+
250
+ 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.
251
+
252
+ If they agree to the companion, read the detailed guide before proceeding:
253
+ `skills/brainstorming/visual-companion.md`
@@ -0,0 +1,213 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Superpowers Brainstorming</title>
6
+ <style>
7
+ /*
8
+ * BRAINSTORM COMPANION FRAME TEMPLATE
9
+ *
10
+ * This template provides a consistent frame with:
11
+ * - OS-aware light/dark theming
12
+ * - Header branding and connection status
13
+ * - Scrollable main content area
14
+ * - CSS helpers for common UI patterns
15
+ *
16
+ * Content is injected via placeholder comment in #frame-content.
17
+ */
18
+
19
+ * { box-sizing: border-box; margin: 0; padding: 0; }
20
+ html, body { height: 100%; overflow: hidden; }
21
+
22
+ /* ===== THEME VARIABLES ===== */
23
+ :root {
24
+ --bg-primary: #f5f5f7;
25
+ --bg-secondary: #ffffff;
26
+ --bg-tertiary: #e5e5e7;
27
+ --border: #d1d1d6;
28
+ --text-primary: #1d1d1f;
29
+ --text-secondary: #86868b;
30
+ --text-tertiary: #aeaeb2;
31
+ --accent: #0071e3;
32
+ --accent-hover: #0077ed;
33
+ --success: #34c759;
34
+ --warning: #ff9f0a;
35
+ --error: #ff3b30;
36
+ --selected-bg: #e8f4fd;
37
+ --selected-border: #0071e3;
38
+ }
39
+
40
+ @media (prefers-color-scheme: dark) {
41
+ :root {
42
+ --bg-primary: #1d1d1f;
43
+ --bg-secondary: #2d2d2f;
44
+ --bg-tertiary: #3d3d3f;
45
+ --border: #424245;
46
+ --text-primary: #f5f5f7;
47
+ --text-secondary: #86868b;
48
+ --text-tertiary: #636366;
49
+ --accent: #0a84ff;
50
+ --accent-hover: #409cff;
51
+ --selected-bg: rgba(10, 132, 255, 0.15);
52
+ --selected-border: #0a84ff;
53
+ }
54
+ }
55
+
56
+ body {
57
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
58
+ background: var(--bg-primary);
59
+ color: var(--text-primary);
60
+ display: flex;
61
+ flex-direction: column;
62
+ line-height: 1.5;
63
+ }
64
+
65
+ /* ===== FRAME STRUCTURE ===== */
66
+ .brand { display: flex; align-items: center; min-width: 0; overflow: hidden; color: var(--text-secondary); line-height: 1; }
67
+ .brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1; }
68
+ .brand-copy { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; transform: translateY(-1px); }
69
+ .brand-logo { display: block; height: 1em; width: auto; max-width: 180px; flex-shrink: 0; filter: invert(1); }
70
+ @media (prefers-color-scheme: dark) {
71
+ .brand-logo { filter: none; }
72
+ }
73
+ .status { font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex; align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1; }
74
+ .status::before { content: ''; width: 6px; height: 6px; background: var(--status-color, var(--success)); border-radius: 50%; }
75
+
76
+ .main { flex: 1; overflow-y: auto; }
77
+ #frame-content { padding: 2rem; min-height: 100%; }
78
+
79
+ .header {
80
+ background: var(--bg-secondary);
81
+ border-bottom: 1px solid var(--border);
82
+ padding: 0.5rem 1.5rem;
83
+ flex-shrink: 0;
84
+ display: grid;
85
+ grid-template-columns: minmax(0, 1fr) auto;
86
+ align-items: center;
87
+ gap: 1rem;
88
+ min-height: 42px;
89
+ }
90
+ .header .brand { justify-self: start; width: 100%; font-size: 0.75rem; line-height: 1; }
91
+ .header .status { grid-column: 2; line-height: 1; }
92
+ .header span {
93
+ font-size: 0.75rem;
94
+ color: var(--text-secondary);
95
+ }
96
+ .header .selected-text {
97
+ color: var(--accent);
98
+ font-weight: 500;
99
+ }
100
+
101
+ /* ===== TYPOGRAPHY ===== */
102
+ h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
103
+ h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
104
+ .subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
105
+ .section { margin-bottom: 2rem; }
106
+ .label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
107
+
108
+ /* ===== OPTIONS (for A/B/C choices) ===== */
109
+ .options { display: flex; flex-direction: column; gap: 0.75rem; }
110
+ .option {
111
+ background: var(--bg-secondary);
112
+ border: 2px solid var(--border);
113
+ border-radius: 12px;
114
+ padding: 1rem 1.25rem;
115
+ cursor: pointer;
116
+ transition: all 0.15s ease;
117
+ display: flex;
118
+ align-items: flex-start;
119
+ gap: 1rem;
120
+ }
121
+ .option:hover { border-color: var(--accent); }
122
+ .option.selected { background: var(--selected-bg); border-color: var(--selected-border); }
123
+ .option .letter {
124
+ background: var(--bg-tertiary);
125
+ color: var(--text-secondary);
126
+ width: 1.75rem; height: 1.75rem;
127
+ border-radius: 6px;
128
+ display: flex; align-items: center; justify-content: center;
129
+ font-weight: 600; font-size: 0.85rem; flex-shrink: 0;
130
+ }
131
+ .option.selected .letter { background: var(--accent); color: white; }
132
+ .option .content { flex: 1; }
133
+ .option .content h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }
134
+ .option .content p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; }
135
+
136
+ /* ===== CARDS (for showing designs/mockups) ===== */
137
+ .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
138
+ .card {
139
+ background: var(--bg-secondary);
140
+ border: 1px solid var(--border);
141
+ border-radius: 12px;
142
+ overflow: hidden;
143
+ cursor: pointer;
144
+ transition: all 0.15s ease;
145
+ }
146
+ .card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
147
+ .card.selected { border-color: var(--selected-border); border-width: 2px; }
148
+ .card-image { background: var(--bg-tertiary); aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; }
149
+ .card-body { padding: 1rem; }
150
+ .card-body h3 { margin-bottom: 0.25rem; }
151
+ .card-body p { color: var(--text-secondary); font-size: 0.85rem; }
152
+
153
+ /* ===== MOCKUP CONTAINER ===== */
154
+ .mockup {
155
+ background: var(--bg-secondary);
156
+ border: 1px solid var(--border);
157
+ border-radius: 12px;
158
+ overflow: hidden;
159
+ margin-bottom: 1.5rem;
160
+ }
161
+ .mockup-header {
162
+ background: var(--bg-tertiary);
163
+ padding: 0.5rem 1rem;
164
+ font-size: 0.75rem;
165
+ color: var(--text-secondary);
166
+ border-bottom: 1px solid var(--border);
167
+ }
168
+ .mockup-body { padding: 1.5rem; }
169
+
170
+ /* ===== SPLIT VIEW (side-by-side comparison) ===== */
171
+ .split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
172
+ @media (max-width: 700px) { .split { grid-template-columns: 1fr; } }
173
+
174
+ /* ===== PROS/CONS ===== */
175
+ .pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
176
+ .pros, .cons { background: var(--bg-secondary); border-radius: 8px; padding: 1rem; }
177
+ .pros h4 { color: var(--success); font-size: 0.85rem; margin-bottom: 0.5rem; }
178
+ .cons h4 { color: var(--error); font-size: 0.85rem; margin-bottom: 0.5rem; }
179
+ .pros ul, .cons ul { margin-left: 1.25rem; font-size: 0.85rem; color: var(--text-secondary); }
180
+ .pros li, .cons li { margin-bottom: 0.25rem; }
181
+
182
+ /* ===== PLACEHOLDER (for mockup areas) ===== */
183
+ .placeholder {
184
+ background: var(--bg-tertiary);
185
+ border: 2px dashed var(--border);
186
+ border-radius: 8px;
187
+ padding: 2rem;
188
+ text-align: center;
189
+ color: var(--text-tertiary);
190
+ }
191
+
192
+ /* ===== INLINE MOCKUP ELEMENTS ===== */
193
+ .mock-nav { background: var(--accent); color: white; padding: 0.75rem 1rem; display: flex; gap: 1.5rem; font-size: 0.9rem; }
194
+ .mock-sidebar { background: var(--bg-tertiary); padding: 1rem; min-width: 180px; }
195
+ .mock-content { padding: 1.5rem; flex: 1; }
196
+ .mock-button { background: var(--accent); color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; }
197
+ .mock-input { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; width: 100%; }
198
+ </style>
199
+ </head>
200
+ <body>
201
+ <div class="header">
202
+ <!-- BRANDING -->
203
+ <div class="status">Connecting…</div>
204
+ </div>
205
+
206
+ <div class="main">
207
+ <div id="frame-content">
208
+ <!-- CONTENT -->
209
+ </div>
210
+ </div>
211
+
212
+ </body>
213
+ </html>
@@ -0,0 +1,167 @@
1
+ (function() {
2
+ const MIN_RECONNECT_MS = 500;
3
+ const MAX_RECONNECT_MS = 30000;
4
+ const TOMBSTONE_AFTER_MS = 15000; // show the "paused" overlay after this long disconnected
5
+
6
+ // Pure: next backoff delay (doubles, capped). Exported for unit tests.
7
+ function nextReconnectDelay(current, max) {
8
+ return Math.min(current * 2, max);
9
+ }
10
+ if (typeof module !== 'undefined' && module.exports) {
11
+ module.exports = { nextReconnectDelay, MIN_RECONNECT_MS, MAX_RECONNECT_MS, TOMBSTONE_AFTER_MS };
12
+ }
13
+
14
+ // Everything below is browser-only; bail out when loaded in Node (tests).
15
+ if (typeof window === 'undefined') return;
16
+
17
+ let ws = null;
18
+ let eventQueue = [];
19
+ let reconnectDelay = MIN_RECONNECT_MS;
20
+ let reconnectTimer = null;
21
+ let disconnectedSince = null;
22
+ let everConnected = false;
23
+ let tombstoneShown = false;
24
+
25
+ function sessionKey() {
26
+ try {
27
+ return window.sessionStorage && window.sessionStorage.getItem('brainstorm-session-key');
28
+ } catch (e) {}
29
+ return null;
30
+ }
31
+
32
+ function websocketUrl() {
33
+ const key = sessionKey();
34
+ return 'ws://' + window.location.host + (key ? '/?key=' + encodeURIComponent(key) : '');
35
+ }
36
+
37
+ function reloadAfterRecovery() {
38
+ const key = sessionKey();
39
+ if (key) {
40
+ window.location.replace('/?key=' + encodeURIComponent(key));
41
+ } else {
42
+ window.location.reload();
43
+ }
44
+ }
45
+
46
+ // Reflect connection state in the frame's status pill (absent on full-doc screens).
47
+ function setStatus(state) {
48
+ const el = document.querySelector('.status');
49
+ if (!el) return;
50
+ const map = {
51
+ connecting: ['Connecting…', 'var(--text-tertiary)'],
52
+ connected: ['Connected', 'var(--success)'],
53
+ reconnecting: ['Reconnecting…', 'var(--warning)'],
54
+ disconnected: ['Disconnected', 'var(--error)']
55
+ };
56
+ const [text, color] = map[state] || map.disconnected;
57
+ el.textContent = text;
58
+ el.style.setProperty('--status-color', color);
59
+ }
60
+
61
+ // Self-styled so it works on framed and full-document screens alike.
62
+ function showTombstone() {
63
+ if (tombstoneShown) return;
64
+ tombstoneShown = true;
65
+ const el = document.createElement('div');
66
+ el.id = 'bs-tombstone';
67
+ el.style.cssText = 'position:fixed;inset:0;z-index:99999;display:flex;' +
68
+ 'align-items:center;justify-content:center;padding:2rem;text-align:center;' +
69
+ 'background:rgba(20,20,22,0.92);color:#f5f5f7;font-family:system-ui,sans-serif';
70
+ el.innerHTML = '<div style="max-width:480px">' +
71
+ '<h2 style="margin:0 0 .5rem;font-weight:600">Companion paused</h2>' +
72
+ '<p style="margin:0;opacity:.85">This brainstorm companion has stopped. ' +
73
+ 'Ask your coding agent to bring it back — this page reconnects automatically.</p></div>';
74
+ if (document.body) document.body.appendChild(el);
75
+ }
76
+
77
+ function connect() {
78
+ if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
79
+ setStatus(everConnected ? 'reconnecting' : 'connecting');
80
+ ws = new WebSocket(websocketUrl());
81
+
82
+ ws.onopen = () => {
83
+ const recovered = tombstoneShown;
84
+ everConnected = true;
85
+ disconnectedSince = null;
86
+ reconnectDelay = MIN_RECONNECT_MS;
87
+ tombstoneShown = false;
88
+ setStatus('connected');
89
+ eventQueue.forEach(e => ws.send(JSON.stringify(e)));
90
+ eventQueue = [];
91
+ // Recovered from a tombstoned outage (e.g. the server restarted on the same
92
+ // port) — reload through the keyed bootstrap when possible so the cookie is
93
+ // refreshed before the visible URL returns to bare /.
94
+ if (recovered) reloadAfterRecovery();
95
+ };
96
+
97
+ ws.onmessage = (msg) => {
98
+ let data;
99
+ try { data = JSON.parse(msg.data); } catch (e) { return; }
100
+ if (data.type === 'reload') window.location.reload();
101
+ };
102
+
103
+ ws.onclose = () => {
104
+ ws = null;
105
+ if (disconnectedSince === null) disconnectedSince = Date.now();
106
+ if (Date.now() - disconnectedSince >= TOMBSTONE_AFTER_MS) {
107
+ setStatus('disconnected');
108
+ showTombstone();
109
+ } else {
110
+ setStatus('reconnecting');
111
+ }
112
+ reconnectTimer = setTimeout(connect, reconnectDelay);
113
+ reconnectDelay = nextReconnectDelay(reconnectDelay, MAX_RECONNECT_MS);
114
+ };
115
+
116
+ // Let onclose own reconnection so we don't schedule it twice.
117
+ ws.onerror = () => { try { ws.close(); } catch (e) {} };
118
+ }
119
+
120
+ function sendEvent(event) {
121
+ event.timestamp = Date.now();
122
+ if (ws && ws.readyState === WebSocket.OPEN) {
123
+ ws.send(JSON.stringify(event));
124
+ } else {
125
+ eventQueue.push(event);
126
+ }
127
+ }
128
+
129
+ // Capture clicks on choice elements
130
+ document.addEventListener('click', (e) => {
131
+ const target = e.target.closest('[data-choice]');
132
+ if (!target) return;
133
+
134
+ sendEvent({
135
+ type: 'click',
136
+ text: target.textContent.trim(),
137
+ choice: target.dataset.choice,
138
+ id: target.id || null
139
+ });
140
+
141
+ });
142
+
143
+ // Frame UI: selection tracking
144
+ window.selectedChoice = null;
145
+
146
+ window.toggleSelect = function(el) {
147
+ const container = el.closest('.options') || el.closest('.cards');
148
+ const multi = container && container.dataset.multiselect !== undefined;
149
+ if (container && !multi) {
150
+ container.querySelectorAll('.option, .card').forEach(o => o.classList.remove('selected'));
151
+ }
152
+ if (multi) {
153
+ el.classList.toggle('selected');
154
+ } else {
155
+ el.classList.add('selected');
156
+ }
157
+ window.selectedChoice = el.dataset.choice;
158
+ };
159
+
160
+ // Expose API for explicit use
161
+ window.brainstorm = {
162
+ send: sendEvent,
163
+ choice: (value, metadata = {}) => sendEvent({ type: 'choice', value, ...metadata })
164
+ };
165
+
166
+ connect();
167
+ })();