opencode-thrum-pro 0.1.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 (101) hide show
  1. package/assets/commands/thrum-_deviations-protocol.md +87 -0
  2. package/assets/commands/thrum-_generator-idempotency-protocol.md +15 -0
  3. package/assets/commands/thrum-_project-rules-protocol.md +18 -0
  4. package/assets/commands/thrum-_snapshot-protocol.md +265 -0
  5. package/assets/commands/thrum-_stamp-protocol.md +112 -0
  6. package/assets/commands/thrum-_verify-before-write-protocol.md +27 -0
  7. package/assets/commands/thrum-inbox.md +22 -0
  8. package/assets/commands/thrum-load-context.md +17 -0
  9. package/assets/commands/thrum-overview.md +17 -0
  10. package/assets/commands/thrum-prime.md +30 -0
  11. package/assets/commands/thrum-quickstart.md +14 -0
  12. package/assets/commands/thrum-reply.md +28 -0
  13. package/assets/commands/thrum-restart-extended.md +195 -0
  14. package/assets/commands/thrum-restart.md +293 -0
  15. package/assets/commands/thrum-send.md +31 -0
  16. package/assets/commands/thrum-sleep-extended.md +186 -0
  17. package/assets/commands/thrum-sleep.md +212 -0
  18. package/assets/commands/thrum-team.md +12 -0
  19. package/assets/commands/thrum-update-project.md +259 -0
  20. package/assets/commands/thrum-wait.md +14 -0
  21. package/assets/skills/adversarial-critique/SKILL.md +242 -0
  22. package/assets/skills/brainstorm-queue-aware/SKILL.md +167 -0
  23. package/assets/skills/brainstorm-steward/SKILL.md +181 -0
  24. package/assets/skills/choosing-subagent-models/SKILL.md +244 -0
  25. package/assets/skills/closing-findings-while-warm/SKILL.md +104 -0
  26. package/assets/skills/configure-roles/SKILL.md +229 -0
  27. package/assets/skills/coordinator-assessing-agent-completion/SKILL.md +205 -0
  28. package/assets/skills/coordinator-assessing-agent-completion/scan.py +117 -0
  29. package/assets/skills/coordinator-branch-split-on-block/SKILL.md +168 -0
  30. package/assets/skills/coordinator-context-monitoring/SKILL.md +674 -0
  31. package/assets/skills/coordinator-dispatching-work/SKILL.md +288 -0
  32. package/assets/skills/coordinator-hotpath-merge-gate/SKILL.md +522 -0
  33. package/assets/skills/coordinator-interacting-with-the-owner/SKILL.md +171 -0
  34. package/assets/skills/coordinator-maintaining-memory/SKILL.md +89 -0
  35. package/assets/skills/coordinator-managing-state-and-lifecycle/SKILL.md +192 -0
  36. package/assets/skills/coordinator-merging-code/SKILL.md +331 -0
  37. package/assets/skills/coordinator-philosophy-merge-gate/SKILL.md +442 -0
  38. package/assets/skills/coordinator-plan-reconcile-gate/SKILL.md +198 -0
  39. package/assets/skills/coordinator-post-restart-sweep/SKILL.md +135 -0
  40. package/assets/skills/coordinator-running-autonomous-feature-development/SKILL.md +199 -0
  41. package/assets/skills/coordinator-running-brainstorm-cycles/SKILL.md +654 -0
  42. package/assets/skills/coordinator-running-review-cycles/SKILL.md +153 -0
  43. package/assets/skills/coordinator-single-responsibility-merge-gate/SKILL.md +14 -0
  44. package/assets/skills/diagnosing-fleet-and-daemon/SKILL.md +255 -0
  45. package/assets/skills/efficient-multi-agent-research/SKILL.md +177 -0
  46. package/assets/skills/fixing-documentation-errors/SKILL.md +258 -0
  47. package/assets/skills/implementer-maintaining-memory/SKILL.md +84 -0
  48. package/assets/skills/implementer-orchestrating-execution/SKILL.md +125 -0
  49. package/assets/skills/implementer-receiving-dispatch/SKILL.md +127 -0
  50. package/assets/skills/implementer-receiving-review-feedback/SKILL.md +125 -0
  51. package/assets/skills/implementer-status-and-handoff/SKILL.md +150 -0
  52. package/assets/skills/implementer-tdd-and-quality/SKILL.md +99 -0
  53. package/assets/skills/memory-audit-recover/SKILL.md +153 -0
  54. package/assets/skills/memory-curate/SKILL.md +139 -0
  55. package/assets/skills/memory-maintenance/SKILL.md +87 -0
  56. package/assets/skills/memory-read-discipline/SKILL.md +164 -0
  57. package/assets/skills/memory-search-advanced/SKILL.md +217 -0
  58. package/assets/skills/memory-write-discipline/SKILL.md +135 -0
  59. package/assets/skills/orchestrate/SKILL.md +795 -0
  60. package/assets/skills/persistent-watcher-archetype/SKILL.md +225 -0
  61. package/assets/skills/prime-agent/SKILL.md +92 -0
  62. package/assets/skills/project-hotpath-gate/SKILL.md +255 -0
  63. package/assets/skills/project-philosophy/SKILL.md +418 -0
  64. package/assets/skills/project-philosophy/resources/philosophy-template.md +155 -0
  65. package/assets/skills/project-philosophy/resources/reliability-class-library.md +653 -0
  66. package/assets/skills/project-setup/SKILL.md +1007 -0
  67. package/assets/skills/project-setup/resources/implementation-agent.md +826 -0
  68. package/assets/skills/researcher-answering-queries/SKILL.md +100 -0
  69. package/assets/skills/researcher-investigating/SKILL.md +152 -0
  70. package/assets/skills/researcher-maintaining-memory/SKILL.md +176 -0
  71. package/assets/skills/state-migration/SKILL.md +54 -0
  72. package/assets/skills/thrum/SKILL.md +161 -0
  73. package/assets/skills/thrum/resources/ANTI_PATTERNS.md +132 -0
  74. package/assets/skills/thrum/resources/BOUNDARIES.md +56 -0
  75. package/assets/skills/thrum/resources/CLI_REFERENCE.md +1066 -0
  76. package/assets/skills/thrum/resources/IDENTITY.md +49 -0
  77. package/assets/skills/thrum/resources/LISTENER_PATTERN.md +64 -0
  78. package/assets/skills/thrum/resources/MESSAGING.md +163 -0
  79. package/assets/skills/thrum/resources/TMUX_SESSIONS.md +118 -0
  80. package/assets/skills/thrum/resources/WORKTREES.md +117 -0
  81. package/assets/skills/thrum-memory/SKILL.md +138 -0
  82. package/assets/skills/trace-spec-to-plan/SKILL.md +104 -0
  83. package/assets/skills/trace-spec-to-plan/resources/sweep-agent-prompt.md +57 -0
  84. package/assets/skills/update-queue/SKILL.md +149 -0
  85. package/assets/skills/using-the-queue/SKILL.md +172 -0
  86. package/assets/skills/using-thrum-state/SKILL.md +104 -0
  87. package/assets/skills/verify-against-plan/SKILL.md +323 -0
  88. package/assets/skills/verify-against-source/SKILL.md +237 -0
  89. package/assets/skills/watcher-archetype/SKILL.md +84 -0
  90. package/assets/skills/writing-durable-markdown/SKILL.md +66 -0
  91. package/dist/hooks/block-sync-cd.d.ts +9 -0
  92. package/dist/hooks/block-sync-cd.js +71 -0
  93. package/dist/hooks/block-sync-cd.test.d.ts +1 -0
  94. package/dist/hooks/block-sync-cd.test.js +61 -0
  95. package/dist/hooks/shell-env.d.ts +8 -0
  96. package/dist/hooks/shell-env.js +22 -0
  97. package/dist/index.d.ts +6 -0
  98. package/dist/index.js +25 -0
  99. package/dist/installer.d.ts +2 -0
  100. package/dist/installer.js +86 -0
  101. package/package.json +49 -0
@@ -0,0 +1,654 @@
1
+ ---
2
+ name: coordinator-running-brainstorm-cycles
3
+ description: "Use when starting a brainstorm for a bug fix, feature, or architectural decision the coordinator can't trivially decide alone — spawns a researcher in an isolated worktree, runs the brainstorm interactively with the user, iterates dual-review cycles to ready-to-merge, optionally drives an overarching coherence pass when multiple sibling brainstorms close, then hands off to project-setup. Saves coordinator context by isolating brainstorm work in a sub-agent worktree rather than burning main-context tokens on Q-by-Q dialog."
4
+ ---
5
+
6
+ # Coordinator: Running Brainstorm Cycles
7
+
8
+ ## When to use
9
+
10
+ A coordinator-orchestrated brainstorm is the right shape when:
11
+
12
+ - The user wants to settle the **architecture / design** of a non-trivial bug
13
+ fix or feature before any code is written.
14
+ - The decision space has **multiple defensible options** and the user wants to
15
+ explore them dialectically rather than just be told "I picked X."
16
+ - The coordinator would otherwise be running the Q-by-Q dialog directly, burning
17
+ main-context tokens that should stay reserved for coordination.
18
+ - Multiple parallel brainstorms are valuable (one researcher per topic) and the
19
+ coordinator needs to keep them moving without serializing on its own
20
+ attention.
21
+
22
+ **Don't use when:**
23
+
24
+ - The decision is small and the coordinator can just decide and act
25
+ (single-paragraph note, no protocol changes).
26
+ - The user explicitly wants the coordinator to do the brainstorm in main context
27
+ (rare; respect it).
28
+ - The work is mid-implementation and a researcher would just slow it down — use
29
+ the `adversarial-critique` skill for in-flight design forks instead.
30
+
31
+ ## What this skill does (and what it hands off)
32
+
33
+ This skill owns the **entire researcher-side design pipeline** with review gates
34
+ at every stage:
35
+
36
+ 1. Spawn researcher → 2. Brainstorm interactively with user → 3. **Dual-review
37
+ the brainstorm** → 4. Iterate to LOCK → 5. (Optional) Overarching coherence
38
+ pass when sibling brainstorms close → 6. Researcher writes plan +
39
+ **dual-review the plan** → 7. Researcher runs `project-setup` + **dual-review
40
+ the impl prompt** → 8. Hand off to coord for implementer dispatch.
41
+
42
+ **Three explicit review gates** at stages 3, 6, and 7 — same dual-axis pattern
43
+ each time (`verify-against-source` + a prose-quality reviewer, sonnet sub-agents
44
+ in parallel — see "Review-loop mechanics" below). Skipping any review gate is a
45
+ documented anti-pattern. The brainstorm review catches design issues; the plan
46
+ review catches contract-drift and quality issues `writing-plans`' internal
47
+ reviewer misses; the prompt review catches plan→prompt translation errors before
48
+ the implementer executes against them.
49
+
50
+ ## Subagent model selection
51
+
52
+ > **Model tiers:** pass an explicit `model:` on every dispatch — `sonnet`
53
+ > (low effort) mechanical, `sonnet` (medium effort) judgment, Opus only on
54
+ > operator-ask or a skill step that names it. See the
55
+ > `choosing-subagent-models` skill for the full policy.
56
+
57
+ ### Prefer `efficient-multi-agent-research` for multi-part research
58
+
59
+ When a research or investigation task has independent parts, reach for the
60
+ `efficient-multi-agent-research` skill FIRST — it partitions the work across
61
+ many cheap parallel subagents (sonnet-low gatherers, sonnet-medium synthesizers) instead of
62
+ one expensive serial subagent. It is the preferred research path: cheaper,
63
+ faster, and it keeps each subagent's context tight.
64
+
65
+ ## Review-loop mechanics (applies to Phases 3, 6, 7)
66
+
67
+ Every prose gate uses the SAME machinery. Define it once here; each phase below
68
+ names only its stage-specific source.
69
+
70
+ ### The two reviewers (parallel, per gate)
71
+
72
+ | Axis | Reviewer | Notes |
73
+ | --------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
74
+ | **Conformance** | `verify-against-source` (thrum-owned skill) | Does the artifact honor its INPUT(s)? Replaces `verify-against-plan` at prose gates — `verify-against-plan` BAILS without a code diff + a File-Structure table, so it cannot run on a brainstorm/plan/prompt. `verify-against-source` accepts a prose artifact + source doc with neither. |
75
+ | **Quality** | general-purpose sonnet + prose-quality rubric (PRIMARY) ∥ `superpowers:requesting-code-review` (SUPPLEMENTARY) | The general-purpose prose-quality pass (internal consistency, gaps, contradiction, ambiguity, scope creep) is AUTHORITATIVE. `requesting-code-review` runs on a DIFF, so point it at the artifact's own commit range (`HEAD~1..HEAD`) — gated on the skill being resolvable; skip gracefully if absent. ⚠️ **That is the diff of the `.md` file, NOT a diff against the production code the artifact describes** — this row does NOT cover the code axis. Prose-vs-code is Conformance's job (see `verify-against-source` § "Second comparison unit"). |
76
+
77
+ Both are `general-purpose`, `model: "sonnet"`, `run_in_background: true`. Wait
78
+ for BOTH before consolidating. Verify each BLOCKING against source before
79
+ forwarding.
80
+
81
+ ### Footer → commit → stamp (per stage)
82
+
83
+ 1. After the artifact is written, append the gate footer:
84
+ `<!-- THRUM-GATE: stage=<brainstorm|plan|prompt> next=<dual-review|writing-plans|project-setup|dispatch> -->`
85
+ 2. **Commit the artifact (WIP) including the footer** — this gives the
86
+ supplementary `requesting-code-review` pass a real `HEAD~1..HEAD` range.
87
+ 3. Run the dual review against that range; each fix cycle commits its changes
88
+ (giving the supplementary reviewer a fresh diff).
89
+ 4. On terminate, append the verdict stamp. Use the **canonical, fixed-key-order
90
+ form** (keys always in the order `stage=`, `verdict=`, `cycle=`, `date=`,
91
+ `verify=`, optional `by=`/`reason=`; **case-sensitive** — exactly
92
+ `Ready:Yes` / `OVERRIDE`; never `grep -i`) so the readers' **anchored**
93
+ `grep -E '…verdict=Ready:Yes([[:space:]]|-->|$)'` matches — the gates no
94
+ longer use `grep -F`, because a bare substring accepts
95
+ `verdict=Ready:Yes-with-residual`:
96
+ `<!-- THRUM-REVIEW: stage=<S> verdict=<Ready:Yes|OVERRIDE> cycle=<N> date=<YYYY-MM-DD> verify=<Ready:Yes|OVERRIDE|PREDATES> [by=<agent> reason="..."] -->`
97
+
98
+ **`verify=` is REQUIRED (not optional) for `stage=plan` stamps going
99
+ forward** — it records whether `verify-against-source` specifically ran
100
+ this cycle (as opposed to some other reviewer stamping the artifact), and
101
+ it must be PRESENT with one of exactly three values:
102
+ - `Ready:Yes` — `verify-against-source` ran this cycle and came back clean.
103
+ - `OVERRIDE` — a coordinator deliberately waived `verify-against-source`
104
+ for THIS specific cycle (an active, in-the-moment decision, with a
105
+ reason, same as the outer stamp's `OVERRIDE`).
106
+ - `PREDATES` — this plan/stamp predates the `verify=` convention
107
+ entirely; the legacy case. This is NOT the same as omitting the field
108
+ — omission still fails `project-setup` Phase 0's mechanical gate. A
109
+ plan from before this convention must be RE-STAMPED with
110
+ `verify=PREDATES` (an explicit, checkable claim) to pass, not silently
111
+ pass by having no `verify=` key at all.
112
+
113
+ For other stages (`brainstorm`, `prompt`) `verify=` remains optional until
114
+ those gates grow their own mechanical enforcement.
115
+
116
+ 5. **Authored-against stamp (required, top of every artifact):** Before writing
117
+ a brainstorm.md or plan.md, derive and emit the stamp per
118
+ `claude-plugin/commands/_stamp-protocol.md` § "Stamp format" — the canonical
119
+ format, derivation commands, and never-type rule.
120
+
121
+ ### Soft pre-flight greps (the SOFT enforcement tier)
122
+
123
+ Before invoking `writing-plans` (Phase 6) and before `project-setup` (Phase 7),
124
+ grep the prior artifact for `THRUM-REVIEW: stage=<S> verdict=Ready:Yes` (or
125
+ `verdict=OVERRIDE`); absent → STOP and run the review first. Anchor the match —
126
+ `grep -E '...verdict=Ready:Yes([[:space:]]|-->|$)'`, never `grep -F` — or an
127
+ invented `verdict=Ready:Yes-with-residual` passes as a substring. This is a STRONG
128
+ BEHAVIORAL guardrail, NOT a mechanical gate — an agent can ignore it. The only
129
+ structurally-enforceable gate is `project-setup` Phase 0 (it hard-bails).
130
+
131
+ ### Loop semantics
132
+
133
+ - `Ready:Yes` = ZERO BLOCKING findings remain. IMPORTANT/MINOR may be
134
+ acknowledged-and-deferred without another cycle via a footer line:
135
+ `<!-- THRUM-DEFER: stage=<S> cycle=<N> item="IMPORTANT #2" reason="<why + tracking ref>" -->`
136
+ (any THRUM-DEFER still present at `project-setup` is surfaced in its Phase 0 /
137
+ override audit).
138
+ - **Per-stage cap = 3 cycles**, independent per stage (max 9 across the
139
+ pipeline) — a hard brainstorm does not starve the plan's budget.
140
+ - Cap hit with BLOCKINGs still open → STOP and escalate to the coordinator, who
141
+ logs an override (stamp `verdict=OVERRIDE … reason="…"`) or redirects.
142
+ - **FEASIBILITY findings escalate, they do not reshape.** A FEASIBILITY
143
+ finding (see Severity criteria, `verify-against-source/SKILL.md`) records
144
+ that a reviewer judged a requirement too hard — NOT that the requirement
145
+ should be dropped. The researcher may NOT resolve a FEASIBILITY finding by
146
+ folding it inline into the next plan version as a silent scope cut. STOP
147
+ and escalate to the coordinator as an explicit decision; only the
148
+ coordinator (on the intent-owner's behalf) may rule "so we will not do
149
+ it." The outcome — keep, cut, or weaken — is written into the
150
+ `## Deviations from Source` block with attribution `owner decision`, never
151
+ silently absorbed.
152
+
153
+ ### Superpowers dependency (D6)
154
+
155
+ The wrapper drives `superpowers:brainstorming` / `writing-plans`. Two distinct
156
+ pre-flight behaviors:
157
+
158
+ - `requesting-code-review` not resolvable → SKIP the supplementary quality pass
159
+ gracefully (the loop still runs on the general-purpose primary).
160
+ - `brainstorming` / `writing-plans` not present → **BAIL** with an install
161
+ instruction (`/plugin install superpowers@<marketplace>`).
162
+
163
+ `verify-against-source` carries no superpowers dependency and always works.
164
+
165
+ ### Countermand the superpowers chain (outcome-based)
166
+
167
+ `brainstorming` auto-chains to `writing-plans`, and `writing-plans` defaults
168
+ pull toward subagent-driven execution — both bypass thrum's `project-setup`. At
169
+ each invocation, inject (keyed on the concept, so it survives upstream
170
+ rewording):
171
+
172
+ > Regardless of any execution-handoff, "recommended" sub-skill, or save-location
173
+ > default these skills emit, the ONLY downstream path in thrum is the next thrum
174
+ > stage. After the artifact is written, STOP — do not auto-chain. Save to the
175
+ > thrum path, not the superpowers default. For `writing-plans`: remove/replace
176
+ > the plan-header line matching the stable substring
177
+ > `REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development` and ignore
178
+ > the Execution-Handoff offer — the plan feeds `project-setup`.
179
+
180
+ ## Phase 1 — Set up the worktree, branch, and agent
181
+
182
+ ### Reuse an existing relevant brainstormer before spawning a new one
183
+
184
+ Before creating a new worktree, branch, or researcher agent, check whether an
185
+ existing brainstorm researcher is (a) **genuinely idle** — its prior brainstorm
186
+ is fully closed and handed off — AND (b) **domain-relevant** to the new topic. A
187
+ warm idle researcher carries accumulated codebase context that a fresh spawn
188
+ doesn't; reusing it is cheaper and faster when it fits.
189
+
190
+ **Probe (two commands, run in parallel):**
191
+
192
+ ```bash
193
+ thrum team # list active agents; inspect intent + last_seen
194
+ git worktree list # identify *-brainstorm worktrees still open
195
+ ```
196
+
197
+ For each `*-brainstorm` worktree that looks relevant, inspect:
198
+
199
+ - The agent's `--intent` field (from `thrum team`) — does it overlap the new
200
+ topic?
201
+ - `<worktree>/.thrum/agents/<name>/State.md` — one-sentence current status (idle
202
+ / mid-brainstorm / standing-by)?
203
+ - The brainstorm doc in `dev-docs/brainstorms/` — is it stamped
204
+ `verdict=Ready:Yes` or explicitly closed?
205
+
206
+ **Decision:**
207
+
208
+ | Condition | Action |
209
+ | --------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
210
+ | Idle + domain-relevant researcher found | **REUSE** — send the Phase 2 briefing to the existing agent in its current worktree. Skip the rest of Phase 1. |
211
+ | No idle relevant researcher | Fall through → proceed with "Pick the base branch" below. |
212
+
213
+ When reusing, have the agent itself run `thrum agent set-intent "<new one-line
214
+ topic>"` so `thrum team` output stays accurate (there is no command to set
215
+ ANOTHER agent's intent — `set-intent` acts on the caller), then send the Phase 2
216
+ briefing as normal. The existing
217
+ worktree and branch carry over; the agent is already primed.
218
+
219
+ **Scope of reuse:** adjacent topics in the same domain (e.g., a researcher who
220
+ handled scheduler-persistence brainstorm is a good candidate for a
221
+ scheduler-backpressure brainstorm). Cross-domain reuse is not worth the context
222
+ noise — start fresh.
223
+
224
+ > **Clarification vs the "Renaming brainstorm researchers" anti-pattern** (see
225
+ > Anti-patterns below): that anti-pattern forbids _renaming or rebinding_ a
226
+ > researcher to an _unrelated topic_ — especially while it is still busy on
227
+ > active work — because identity is bound to the worktree and mid-flight
228
+ > rebinding loses audit coherence. Reusing a **genuinely idle, domain-relevant**
229
+ > researcher for an adjacent topic in its **own existing worktree** is the
230
+ > ENCOURAGED path; no rename happens, no in-flight work is interrupted. The two
231
+ > rules are complementary: reuse when idle + relevant; tear down and start fresh
232
+ > when unrelated or still busy.
233
+
234
+ ### Pick the base branch
235
+
236
+ | Topic shape | Base branch |
237
+ | ------------------------------------------------------------------------------------ | ----------------------------------------------------- |
238
+ | Bug fix, hardening, infra cleanup belonging to the current line | The configured merge target — `jq -r '.orchestration.merge_target' .thrum/config.json` |
239
+ | Work belonging to a multi-epic version program | The version's long-lived branch |
240
+ | Work tied to an existing feature epic with its own long-lived branch | That branch |
241
+
242
+ When in doubt, ask the user. Don't branch from `upstream/*` (per the global
243
+ git-safety rule).
244
+
245
+ ### Pick a name and module slug
246
+
247
+ - **Worktree dir name:** `<topic>-brainstorm` — kebab-case, descriptive of the
248
+ topic, ends with `-brainstorm` so it's instantly recognizable in
249
+ `git worktree list`. Examples: `auth-flow-brainstorm`, `cache-ttl-brainstorm`,
250
+ `log-rotation-brainstorm`.
251
+ - **Branch name:** `feature/<topic>-brainstorm` (or `fix/<topic>-brainstorm` if
252
+ the topic is a bug fix).
253
+ - **Agent name:** `researcher_<topic_underscore>` — matches the
254
+ `<role>_<module>` convention. Examples: `researcher_auth_flow`,
255
+ `researcher_cache_ttl`.
256
+ - **Module slug:** `<topic_underscore>` — short, lowercase, underscored.
257
+
258
+ ### Create branch + worktree + agent + launch runtime
259
+
260
+ ```bash
261
+ # 1. Branch + worktree
262
+ git worktree add -b feature/<topic>-brainstorm \
263
+ /Users/<you>/.thrum/worktrees/thrum/<topic>-brainstorm \
264
+ <base-branch>
265
+
266
+ # 2. Register the agent and create the tmux session in one call
267
+ thrum tmux create <topic>-brainstorm \
268
+ --cwd /Users/<you>/.thrum/worktrees/thrum/<topic>-brainstorm \
269
+ --role researcher \
270
+ --name researcher_<topic_underscore> \
271
+ --module <topic_underscore> \
272
+ --intent "Brainstorm: <one-line topic description>" \
273
+ --runtime claude
274
+
275
+ # 3. Launch the runtime in the session
276
+ thrum tmux launch <topic>-brainstorm
277
+ ```
278
+
279
+ The runtime auto-primes via the SessionStart hook. Do NOT manually inject
280
+ `/thrum:prime` via send-keys (per `coordinator-dispatching-work` discipline).
281
+
282
+ ## Phase 2 — Send the briefing message
283
+
284
+ The briefing message is a structured handoff. Always send it via `thrum send`,
285
+ not `tmux send-keys` (per `coordinator-dispatching-work`).
286
+
287
+ ### The interactive-with-user brainstorm protocol
288
+
289
+ **Always include this verbatim block at the top of the briefing.** It encodes a
290
+ hard-won lesson, but a NARROW one: the failure mode is a researcher who
291
+ pre-commits the brainstorm's RESOLVED CHOICES (decisions/rulings) without the
292
+ user — those become confident-but-wrong and cost a full review cycle to undo.
293
+ The lesson is NOT "don't research." Brainstorming IS researching all aspects so
294
+ that when the questions come, they are sharp — and most brainstorms exist
295
+ precisely because there is a lot to research. Separate **pre-research (do it
296
+ hard)** from **pre-decision (don't)**: the researcher should aggressively survey
297
+ the landscape, enumerate options + tradeoffs, gather evidence with file:line
298
+ citations, surface the real open questions, and prepare a MEATY working draft of
299
+ the design space BEFORE the user joins — that is design-mode prep, exactly what
300
+ the user wants to walk into. They hold only the final DECISION-LOCK for the
301
+ user.
302
+
303
+ ```text
304
+ ═══ INTERACTIVE BRAINSTORM PROTOCOL ═══
305
+
306
+ Research aggressively + prepare MEATY groundwork BEFORE <user> joins:
307
+ survey the landscape, enumerate options + tradeoffs, gather evidence with
308
+ file:line citations, surface the real open questions, and draft a working
309
+ brainstorm doc of the design SPACE. The goal is that when <user> joins,
310
+ the questions are sharp and there is substance to work on.
311
+
312
+ <user> drives the DECISIONS Q-by-Q. Do NOT pre-commit or pre-write the
313
+ RESOLVED-CHOICES sections ahead of <user> — research + propose, but hold
314
+ the final rulings for them; capture their decisions verbatim. The
315
+ `interactive-brainstorm` role rule applies (search: `thrum memory search
316
+ "interactive-brainstorm"`).
317
+
318
+ Exception: a succinct, well-scoped brainstorm with little to research can
319
+ run capture-mostly; default to aggressive pre-research otherwise.
320
+ ```
321
+
322
+ (Replace `<user>` with the actual user's name. The `interactive-brainstorm` role
323
+ rule (kind `agent_rule`, scope `role`) persists across researcher restarts —
324
+ find it with `thrum memory search "interactive-brainstorm"`, or browse all role
325
+ rules with `thrum memory list --kind agent_rule --scope role`.)
326
+
327
+ ### Briefing structure
328
+
329
+ Every briefing should include these sections (use `═══` headers for visual
330
+ distinction in the inbox display):
331
+
332
+ 1. **Identity reminder** — agent name, worktree, branch, base branch (and that
333
+ it's outside any larger version program if applicable). **Include an explicit
334
+ "you run thrum commands from THIS worktree, not from the main repo or any
335
+ other worktree" instruction** (see "Where the researcher runs thrum" below).
336
+ 2. **Interactive brainstorm protocol** (verbatim block above)
337
+ 3. **The problem** — one paragraph of the user-visible symptom or the feature
338
+ gap
339
+ 4. **What we already diagnosed / decided** — to prevent relitigation. Be
340
+ explicit: "don't relitigate these; start from here."
341
+ 5. **Design space to explore** — bulleted list of the open decisions the user
342
+ will drive Q-by-Q
343
+ 6. **Context to research up front** — concrete file paths + brief relevance
344
+ notes. Tell them to read these AND research the space aggressively (code,
345
+ beads, episodic memory, surveys) so they arrive with grounded options +
346
+ evidence + sharp questions, not generic ones.
347
+ 7. **Deliverable** — exact path the brainstorm doc lands at; convention:
348
+ `dev-docs/brainstorms/<YYYY-MM-DD>-<topic>-brainstorm.md`. Include the
349
+ "Decision Summary table at the bottom is canonical" framing. A meaty
350
+ options/evidence/questions draft IS wanted up front; **explicitly say NOT to
351
+ pre-commit the RESOLVED decisions** ahead of the user (those wait for the
352
+ Q-by-Q + review feedback).
353
+ 8. **Go-deep-then-ready instruction** — one sentence telling them to confirm
354
+ readiness, research aggressively, and have meaty material ready when the user
355
+ joins (not to sit idle waiting).
356
+ 9. **Countermand callout** — `superpowers:brainstorming`'s terminal state is
357
+ "invoke writing-plans". Tell the researcher explicitly: when brainstorming
358
+ reaches that terminal state, STOP at the design doc — do NOT auto-chain to
359
+ `writing-plans`. The brainstorm goes through the Phase 3 review gate first,
360
+ then Phase 6 runs `writing-plans` deliberately (with its own countermand).
361
+ See "Review-loop mechanics → Countermand the superpowers chain."
362
+
363
+ Send the whole thing as one `thrum send` call. The recipient's runtime will
364
+ display it as a single inbox message; structure beats brevity here.
365
+
366
+ ### Where the researcher runs thrum (do not let them inherit the wrong rule)
367
+
368
+ Some users have a global `~/.claude/CLAUDE.md` rule that reads "always run thrum
369
+ commands from the main repo directory." That rule is correct for the
370
+ main-repo-resident coordinator agent — but **it inverts for worktree-resident
371
+ researchers.** A researcher running thrum from the main repo path resolves
372
+ identity to the coordinator's name (e.g. `@your_coordinator`) and sends every
373
+ message under the coordinator's identity, polluting audit trails.
374
+
375
+ The correct rule is: **agents run thrum commands from their OWN home
376
+ directory.** Coordinator from main repo. Researcher from their worktree. **Never
377
+ run thrum from a worktree that isn't yours** (that's the underlying intent the
378
+ buggy global rule was reaching for).
379
+
380
+ Always include an explicit instruction in the Identity-Reminder section of the
381
+ briefing, e.g.:
382
+
383
+ ```text
384
+ ⚠ Run thrum commands from THIS worktree
385
+ (/Users/<you>/.thrum/worktrees/thrum/<topic>-brainstorm), not from the
386
+ main repo or any other worktree. The global CLAUDE.md "main repo only"
387
+ rule is correct for coordinators but inverts for worktree-resident
388
+ agents — your identity file lives in this worktree, and running thrum
389
+ from anywhere else will impersonate whoever owns that path.
390
+ ```
391
+
392
+ Project-local capture: run
393
+ `thrum memory search --kind agent_rule --scope role --tag thrum-from-own-home`
394
+ to see the canonical version of this rule. If your project doesn't have it, the
395
+ researcher's first restart may re-inherit the buggy global rule.
396
+
397
+ ## Phase 3 — Dual-review when the brainstorm closes
398
+
399
+ When the researcher reports the brainstorm is ready for review, run the
400
+ **two-reviewer dual review** per "Review-loop mechanics" above.
401
+
402
+ - **Conformance:** `verify-against-source` — artifact = the brainstorm doc;
403
+ **source(s)** = parent decisions, the feature request, the ticket, and any
404
+ sibling brainstorms.
405
+
406
+ **Code side (REQUIRED):** for every decision naming a field, struct, column, table, RPC parameter, config key, or stored value, also hand the reviewer the ACTUAL definition at the authored-against SHA. Prose sources alone cannot catch an artifact that is wrong about the code. A gap there is a MISSING-STEP in the artifact, never a defect in the source — `IMPOSSIBLE` is not a verdict.
407
+ - **Quality:** general-purpose prose-quality PRIMARY ∥ `requesting-code-review`
408
+ SUPPLEMENTARY (internal consistency, technical soundness, anti-patterns,
409
+ gaps).
410
+
411
+ Both `general-purpose`, `model: "sonnet"`, `run_in_background: true`. **Have the
412
+ researcher append the gate footer and commit (in their own worktree) BEFORE you
413
+ spawn the dual-review sub-agents** — the brainstorm lives in the researcher's
414
+ branch, and the supplementary `requesting-code-review` pass needs a real
415
+ `HEAD~1..HEAD` diff. Wait for BOTH before consolidating; verify each BLOCKING
416
+ against source before forwarding. Apply the footer → commit → stamp protocol and
417
+ the loop semantics (Ready:Yes = 0 BLOCKING, per-stage 3-cap, override) from
418
+ "Review-loop mechanics". On terminate, the researcher stamps the brainstorm:
419
+ `<!-- THRUM-REVIEW: stage=brainstorm verdict=Ready:Yes cycle=<N> date=<YYYY-MM-DD> -->`.
420
+
421
+ ### Consolidated findings format
422
+
423
+ Send ONE numbered list to the researcher per `thrum send`, ordered:
424
+
425
+ 1. BLOCKINGs in detail (severity, location, finding, suggestion)
426
+ 2. IMPORTANTs as one-paragraph each
427
+ 3. MINORs as condensed one-liners
428
+
429
+ Include "no-action positive tick-offs" at the bottom — this gives the researcher
430
+ confidence about what's already correct and prevents over-editing.
431
+
432
+ ## Phase 4 — Iteration cycles
433
+
434
+ When the researcher reports their fixes are done:
435
+
436
+ - Run a **targeted verification sub-agent** (one sub-agent, sonnet) that reads
437
+ the updated doc and confirms each prescribed fix landed correctly. Do NOT
438
+ re-derive the original findings — that's done.
439
+ - For tiny cosmetic fixes (one-line format updates, missing citations), ask
440
+ in-place and spot-verify with a Bash grep — don't run a full verification
441
+ cycle for single-line changes.
442
+ - For a researcher's design refinements that diverged from the literal
443
+ recommendation: evaluate on substance, not literal compliance. Smart
444
+ alternatives that close the original concern AND respect prior decisions
445
+ better are coordinator-accepted territory; flag them for the user only if they
446
+ materially change the user-visible shape.
447
+
448
+ When the verification passes, send the researcher an explicit "APPROVED — ready
449
+ to merge" with stand-down instructions.
450
+
451
+ ## Phase 5 — Overarching coherence pass (when sibling brainstorms close)
452
+
453
+ If the topic is part of a larger program with multiple parallel brainstorms,
454
+ once **all sibling brainstorms reach ready-to-merge**, fire an opus-tier
455
+ coherence + implementability pass over the corpus before specs are written.
456
+
457
+ Two parallel passes (background, opus model — escalate from sonnet because this
458
+ is genuinely cross-cutting reasoning over a large corpus):
459
+
460
+ | Pass | Focus |
461
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
462
+ | **Coherence / Contradiction** | Direct contradictions between brainstorms, hidden cross-doc assumptions, vocabulary drift, reserved-field collisions, lifecycle composition, end-to-end event flows, cumulative parent-honor |
463
+ | **Implementability / Execution** | Realistic ship-cost, critical-path bottlenecks, capability assumptions that may not hold, test surface, operator-experience journeys, sub-epics needing split, sequencing risk |
464
+
465
+ Both passes read the full brainstorm corpus + parent decisions + roadmap + any
466
+ existing companion specs. Their job is NOT to re-derive single-brainstorm
467
+ findings — it's to surface integration-layer issues that no single review could
468
+ see.
469
+
470
+ Findings from this pass go back to the relevant researchers (or to a follow-up
471
+ brainstorm if the issue spans multiple). Do not skip this pass when ≥ 3
472
+ brainstorms close in the same program — the integration layer is where the most
473
+ expensive footguns hide.
474
+
475
+ ## Phase 6 — Researcher writes the plan (with dual-review gate)
476
+
477
+ Once the brainstorm is LOCKED (and any companion design spec is LOCKED), the
478
+ researcher runs `superpowers:writing-plans` to convert brainstorm + spec into
479
+ the implementation plan doc. (First, the soft pre-flight grep: `grep -F` the
480
+ brainstorm for its `THRUM-REVIEW: stage=brainstorm verdict=Ready:Yes` (or
481
+ `OVERRIDE`) stamp — absent → STOP and finish the brainstorm review.) **Inject
482
+ the outcome-based countermand** (see Review-loop mechanics) at the
483
+ `writing-plans` invocation: stop when the plan is written, save to the thrum
484
+ path, and strip the `subagent-driven-development` plan-header line — the plan
485
+ feeds `project-setup`, not superpowers execution.
486
+
487
+ **The plan doc gets the SAME dual-review treatment as the brainstorm.** This
488
+ review step is mandatory — `writing-plans` has an internal reviewer, but real-
489
+ world experience shows that's not sufficient. Independent review catches
490
+ contract-drift and quality issues the internal reviewer misses.
491
+
492
+ **The researcher (not coord) dispatches the dual-review** in their own worktree:
493
+
494
+ 1. Researcher writes plan v1 via `writing-plans` skill (countermand applied).
495
+ 2. Researcher authors the `## Deviations from Source` block per
496
+ `claude-plugin/commands/_deviations-protocol.md`, diffing plan v1 against
497
+ the brainstorm + design spec — BEFORE dual-review, so
498
+ `verify-against-source` validates it as part of conformance. Required even
499
+ when empty ("No deviations from source.").
500
+ 3. Researcher runs the two-reviewer dual review (Review-loop mechanics):
501
+ - **Conformance:** `verify-against-source` — artifact = the plan;
502
+ **source(s)** = the brainstorm + the design spec. Verifies the plan honors
503
+ every LOCKED decision AND that the Deviations block is present and
504
+ accurate; flags missing scope, silent deviation, over-scoping, or an
505
+ absent/inaccurate Deviations block.
506
+ **Code side (REQUIRED):** for every requirement naming a field, struct,
507
+ column, table, RPC parameter, config key, or stored value, hand the
508
+ reviewer the ACTUAL definition at the authored-against SHA and require an
509
+ enumerated SATISFIED / PARTIAL / MISSING-STEP / NOT-ADDRESSED verdict per
510
+ requirement. `IMPOSSIBLE` is not a verdict — absent substrate is a
511
+ MISSING-STEP in the plan, so the plan must ADD it.
512
+ - **Quality:** general-purpose prose-quality PRIMARY ∥
513
+ `requesting-code-review` SUPPLEMENTARY — per-task acceptance-criteria
514
+ precision, anti-pattern enumeration, risk-register completeness, sequencing
515
+ logic.
516
+ 4. Researcher consolidates findings into ONE numbered list (all findings, all
517
+ severities, per the same format Phase 3 uses).
518
+ 5. Researcher folds findings inline → plan v2; applies footer → commit →
519
+ stamp. Any FEASIBILITY finding (see Loop semantics) routes to the
520
+ coordinator instead of being folded inline.
521
+ 6. Researcher repeats only if cycle-1 introduces new design surface (rare for
522
+ bounded mechanical plans); otherwise v2 LOCKED, stamped
523
+ `<!-- THRUM-REVIEW: stage=plan verdict=Ready:Yes cycle=<N> date=<YYYY-MM-DD> verify=Ready:Yes -->`.
524
+ 7. Researcher signals plan LOCKED back to coord, citing both review passes
525
+ and the Deviations block.
526
+
527
+ If the researcher skips this step, send them back. Before Phase 7, the soft
528
+ pre-flight grep (Review-loop mechanics) confirms the plan carries the
529
+ `stage=plan verdict=Ready:Yes` (or `OVERRIDE`) stamp. Don't let them proceed to
530
+ `project-setup` until the plan has passed dual-review.
531
+
532
+ ## Phase 7 — Researcher runs project-setup (with dual-review gate)
533
+
534
+ Plan LOCKED → researcher runs `thrum:project-setup` to produce the bundled
535
+ output: bd tickets + implementer prompt + cross-references.
536
+
537
+ **The implementer-prompt doc gets the SAME dual-review treatment as the plan.**
538
+ The prompt is the artifact the implementer executes against turn-by-turn; errors
539
+ propagate. The plan dual-review caught contract-drift in the plan; the prompt
540
+ review catches translation errors (plan → prompt) plus prompt-specific quality
541
+ (instructions clarity, anti-pattern enumeration, dispatch-readiness).
542
+
543
+ **The researcher (not coord) dispatches the post-setup dual-review**:
544
+
545
+ 1. Researcher runs `project-setup` skill (bd tickets + prompt land together).
546
+ Note: `project-setup` Phase 0 hard-bails unless the plan carries its
547
+ `stage=plan verdict=Ready:Yes`/`OVERRIDE` stamp — Phase 6 must have stamped
548
+ it.
549
+ 2. Researcher runs the two-reviewer dual review on the impl prompt:
550
+ - **Conformance:** `verify-against-source` — artifact = the impl prompt;
551
+ **source(s)** = the LOCKED plan + the bead task descriptions (dump
552
+ `bd show` to a temp file so the sub-agent can read the per-task ACs).
553
+ Verifies the prompt faithfully translates per-task content + ACs + risk
554
+ callouts; flags missing scope, divergent wording, dropped anti-patterns.
555
+ **Code side (REQUIRED):** for every AC naming a field, struct, column,
556
+ table, RPC parameter, config key, or stored value, hand the reviewer the
557
+ ACTUAL definition at the authored-against SHA. An AC the current code
558
+ cannot satisfy is a MISSING-STEP in the prompt/plan — the substrate must
559
+ be ADDED. `IMPOSSIBLE` is not a verdict.
560
+ - **Quality:** general-purpose prose-quality PRIMARY ∥
561
+ `requesting-code-review` SUPPLEMENTARY — clarity, scope language,
562
+ dispatch-readiness, sub-agent model guidance, DONE-shape spec.
563
+ 3. Researcher consolidates → folds inline → re-issues prompt; `project-setup`
564
+ appends the prompt-stage stamps (it OWNS them — see that skill's Step 5):
565
+ first `<!-- THRUM-GATE: stage=prompt next=dispatch -->` immediately after the
566
+ prompt is generated, then
567
+ `<!-- THRUM-REVIEW: stage=prompt verdict=Ready:Yes cycle=<N> date=<YYYY-MM-DD> -->`
568
+ after this review terminates.
569
+ 4. Researcher signals "project-setup complete + post-setup dual-review applied"
570
+ back to coord, citing both review passes + final artifact paths.
571
+
572
+ Reaffirmation (countermand at the prompt stage): `project-setup` is the only
573
+ downstream path — do not adopt `subagent-driven-development` execution even if a
574
+ superpowers skill suggests it.
575
+
576
+ If the researcher signals "project-setup complete" WITHOUT mentioning the
577
+ post-setup reviews, ASK explicitly: "did the post-setup dual-review run on the
578
+ impl prompt?" Send them back if not. The artifact the implementer executes must
579
+ be reviewed.
580
+
581
+ ## Phase 8 — Hand off to coord
582
+
583
+ With plan LOCKED + reviewed AND project-setup complete + reviewed:
584
+
585
+ 1. Researcher provides coord: plan path, prompt path, bd-epic ID, bd-task ID
586
+ list, prereq verifications (philosophy.md, bd version, etc.).
587
+ 2. Coord verifies the artifacts briefly + proceeds to Phase 0 implementer
588
+ dispatch (worktree creation, hard-freeze if applicable, impl dispatch).
589
+ 3. Stand the researcher down at-pane (or keep on standby for impl-time Q&A if
590
+ the user explicitly requests continuity). Don't leave brainstorm researchers
591
+ spinning idle indefinitely; they consume tmux sessions.
592
+
593
+ ## Anti-patterns
594
+
595
+ ❌ **Pre-emptive autonomous DECISIONS.** Researcher pre-commits the brainstorm's
596
+ RESOLVED choices/rulings without the user driving them — those become
597
+ confident-but-wrong and cost a full review cycle to undo. The sin is committing
598
+ DECISIONS, NOT researching: aggressive pre-research + a meaty
599
+ options/evidence/questions draft is wanted (see the brainstorm protocol). The
600
+ `interactive-brainstorm` role memory rule (kind `agent_rule`, scope `role`)
601
+ encodes this; include the verbatim protocol block in every briefing.
602
+
603
+ ❌ **Half-batched findings.** Sending review findings before BOTH dual reviews
604
+ complete. Researcher fixes batch 1 and never sees batch 2.
605
+
606
+ ❌ **Skipping the post-plan dual-review.** Treating `writing-plans` skill's
607
+ internal reviewer as sufficient and proceeding directly to `project-setup`
608
+ without an independent review of the plan doc. The plan and the impl
609
+ prompt MUST get the same dual-axis review treatment the brainstorm gets — Phase
610
+ 6 + Phase 7 explicit.
611
+
612
+ ❌ **Skipping the post-project-setup dual-review on the impl prompt.** The
613
+ prompt is the artifact the implementer executes against turn-by-turn. Errors in
614
+ it propagate into every task. `project-setup` runs the bundle (bd + prompt)
615
+ mechanically; the prompt content is the implementer's spec. Treat it as such and
616
+ review it before dispatch.
617
+
618
+ ❌ **Misread BLOCKINGs forwarded as gospel.** Reviewers (sub-agents) sometimes
619
+ misread cited code or stretch citations. Spot-verify any BLOCKING that names a
620
+ specific file/line/symbol before forwarding.
621
+
622
+ ❌ **`thrum message read --all` mid-brainstorm.** Classic timing bomb: read
623
+ message A → message B arrives during the read → `--all` silently marks B read →
624
+ B is never seen. Use `thrum message read <id> [<id>...]` with specific IDs
625
+ instead, especially when juggling multiple researchers.
626
+
627
+ ❌ **Sub-agents into the researcher's worktree.**
628
+ For code research in the brainstorm worktree, ask the researcher; for broader
629
+ codebase exploration, spawn an `Explore` sub-agent in the main repo path, not
630
+ the worktree path.
631
+
632
+ ❌ **Skipping the coherence pass.** When ≥ 3 sibling brainstorms close in the
633
+ same program, integration-layer issues that no single review can see are
634
+ virtually guaranteed. Fire the opus pass; it's worth the cost.
635
+
636
+ ❌ **Renaming brainstorm researchers between topics.** Identity is bound to the
637
+ worktree. If a topic is done, kill the tmux session and tear down the worktree;
638
+ don't rebind the agent name to a different topic in place.
639
+
640
+ ## See also
641
+
642
+ - `coordinator-plan-reconcile-gate` — when ≥2 plans for one program were
643
+ authored in parallel (Phase 6 output) and must be verified to compose
644
+ before `project-setup` (shared seams, no double-build, no gap).
645
+
646
+ ## Project-specific rules (already loaded)
647
+
648
+ Read the shared partial at the absolute path:
649
+ `claude-plugin/commands/_project-rules-protocol.md`
650
+
651
+ If you accumulate a new rule mid-session about brainstorm orchestration, capture
652
+ it via the `coordinator-maintaining-memory` skill — it references the
653
+ `memory-write-discipline` common for the canonical `thrum memory create` shape.
654
+ Use a `brainstorm-<slug>` tag to keep brainstorm-orchestration rules grouped.