@nurix/etna 0.14.0 → 0.15.2

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 (43) hide show
  1. package/README.md +28 -7
  2. package/bin/etna.js +58 -1
  3. package/data/harnesses/code/CLAUDE.md +11 -16
  4. package/data/harnesses/code/agents/brainstorm.md +13 -20
  5. package/data/harnesses/code/agents/change-review.md +5 -5
  6. package/data/harnesses/code/agents/harness-manager.md +49 -9
  7. package/data/harnesses/code/agents/maintenance.md +42 -5
  8. package/data/harnesses/code/agents/spec-mode.md +1 -1
  9. package/data/harnesses/code/harness.json +6 -0
  10. package/data/harnesses/code/hooks/hooks.json +41 -0
  11. package/data/harnesses/code/hooks/lib/redact.js +37 -0
  12. package/data/harnesses/code/hooks/post-commit.js +136 -0
  13. package/data/harnesses/code/hooks/post-tool-failure.js +136 -0
  14. package/data/harnesses/code/hooks/session-stop.js +207 -0
  15. package/data/harnesses/code/skills/boundary/SKILL.md +21 -3
  16. package/data/harnesses/code/skills/boundary/references/boundary-taxonomy.md +229 -161
  17. package/data/harnesses/code/skills/brainstorm/README.md +76 -227
  18. package/data/harnesses/code/skills/brainstorm/SKILL.md +78 -566
  19. package/data/harnesses/code/skills/brainstorm/harvest.md +26 -0
  20. package/data/harnesses/code/skills/brainstorm/templates/build.md +37 -0
  21. package/data/harnesses/code/skills/brainstorm/templates/decisions.md +12 -25
  22. package/data/harnesses/code/skills/brainstorm/templates/domain-model.md +25 -0
  23. package/data/harnesses/code/skills/brainstorm/templates/non-goals.md +2 -2
  24. package/data/harnesses/code/skills/brainstorm/templates/questions.md +18 -67
  25. package/data/harnesses/code/skills/brainstorm/templates/state.md +5 -5
  26. package/data/harnesses/code/skills/brainstorm/templates/tech.md +23 -0
  27. package/data/harnesses/code/skills/brainstorm/templates/thesis.md +21 -0
  28. package/data/harnesses/code/skills/distiller/SKILL.md +218 -0
  29. package/data/harnesses/code/skills/distiller/references/docs-mode.md +526 -0
  30. package/data/harnesses/code/skills/distiller/references/method.md +166 -0
  31. package/data/harnesses/code/skills/documentation/references/templates.md +78 -5
  32. package/data/harnesses/kb-agi/CLAUDE.md +1 -1
  33. package/data/harnesses/kb-agi/agents/kb-agi-init.md +2 -2
  34. package/data/harnesses/kb-agi/agents/kb-catch-stale.md +1 -1
  35. package/data/harnesses/kb-agi/agents/kb-find-gaps.md +2 -2
  36. package/data/harnesses/kb-agi/agents/kb-fix-links.md +1 -1
  37. package/data/harnesses/kb-agi/agents/kb-refresh-frontdoor.md +1 -1
  38. package/data/harnesses/kb-agi/agents/kb-refresh-summaries.md +1 -1
  39. package/data/harnesses/kb-agi/agents/kb-sync-metadata.md +1 -1
  40. package/data/harnesses/kb-agi/harness.json +6 -0
  41. package/package.json +1 -1
  42. package/data/harnesses/code/skills/brainstorm/greenfield.md +0 -99
  43. package/data/harnesses/code/skills/brainstorm/templates/inventory.md +0 -44
@@ -1,624 +1,136 @@
1
1
  ---
2
2
  name: brainstorm
3
- description: Structured planning/design session for software that hasn't been built yet. Invoked ONLY by explicit slash commands `/brainstorm start` and `/brainstorm stop`. Do NOT auto-invoke on natural-language phrases like "let's plan", "let's design", "let's think through X", or any other phrasing — those are not triggers. The skill maintains 10 pillar documents (questions, decisions, doctrine, glossary, inventory, non-goals, references, rejected, milestones, backlog) inside a `pillars/` subfolder, plus a top-level `state.md` tracking session open/closed AND the active mode (explore / decide / step-back). Refuses to write production code outside the brainstorm folder while a session is active.
3
+ description: Thinking-partner session for designing software. Invoked ONLY by explicit slash commands `/brainstorm start` and `/brainstorm stop` — never auto-invoke on natural-language phrases like "let's plan", "let's design", or "let's think through X". Entry requires a basis (a reference document or a one-shot brain dump); drip-fed action items are rejected as too small. Runs one constant loop (distill → abstract → sync → record) across four modes (dump / interview / probe / converge). Coherence = zero open questions after a fresh pillar sync. Pillar count scales with a complexity dial; refuses production code outside the session folder while open.
4
4
  argument-hint: "start | stop"
5
5
  plugins: [code]
6
6
  ---
7
7
 
8
8
  # Brainstorm
9
9
 
10
- Plan and design before building. While a session is active, capture concerns, hypotheses, and decisions into a registry of pillar documents that survives across conversations.
10
+ Think with the user, then file — never the reverse. The artifacts exist to serve the conversation; the conversation never exists to populate artifacts. The constant across every scale of idea is **the loop**; everything else — pillar count, ceremony, harvest — scales with complexity.
11
11
 
12
- The user's job is to prevent eager coding. The skill's job is to make the planning conversation feel like a conversation — not an interview, not a decision-extraction funnel.
12
+ ## The loop — every turn, every mode
13
13
 
14
- **This skill is self-contained.** It runs a complete brainstorming session on its own through the two subcommands below — the `brainstorm` agent is an optional *thin orchestrator* that recognizes when to enter Brainstorming Mode and otherwise defers entirely here. Everything a session needs lives in this file and its `templates/` + `greenfield.md` siblings: the three modes, the tentative→committed lifecycle, the realignment cascade, the scope-routed harvest, the 10 pillar templates, the greenfield rules, and strategy memory. Nothing here depends on the agent.
14
+ 1. **Distill.** Fold what the user just said into the pillars, in *their* framing, during the same turn.
15
+ 2. **Abstract.** Name the latent structure they implied but didn't state — entities and relationships ("an account has many leads" → `domain-model.md`), invariants, principles, terms. Offer at most one abstraction per exchange; it's a contribution, not a lecture.
16
+ 3. **Sync.** Keep the pillars consistent with each other and with the basis (see **The sync agent**).
17
+ 4. **Record.** Writes happen in the turn that produced the information — never accumulated for a session-end dump.
15
18
 
16
- ## Two subcommands. That's it.
17
-
18
- - `/brainstorm start` — open a session
19
- - `/brainstorm stop` — stop a session
20
-
21
- Everything else happens **within** an active session, as natural conversation. There is no `sweep`, `check`, `resolve`, `init`, `reinforce`, `commit`, or `rescind` subcommand. The skill behaves correctly without ceremony — it reads `state.md` on every turn to know whether a session is open and what mode it is in, and adapts its voice and tool-use posture accordingly.
22
-
23
- ## Folder layout
24
-
25
- ### Persistent pillars vs. session workspace (v9)
26
-
27
- In a v9-harnessed repo there is **no repo-wide `docs/pillars/`**. The persistent home of pillars is **dispersed by scope**: module-local doctrine / glossary / decisions live in each `docs/modules/{m}/pillars/`, and cross-module steering lives in `docs/architecture/` (`domain-model.md`, `glossary.md`, `non-goals.md`, `references.md`, `open-questions.md`). A change to the information architecture is captured as the `domain` boundary in `docs/boundaries/` (owned by the `boundary` skill, not written here).
28
-
29
- Each brainstorming session still opens a **transient working copy** at `./brainstorm/pillars/` (repo root, not inside `docs/`) holding all ten pillar files — **that workspace and its templates are unchanged from v8**. On `/start` the working copy is *primed* from whatever dispersed v9 homes already exist (read the module pillars + the `docs/architecture/` steering files). The conversation mutates the working copy. On `/stop`, the harvest diffs the session pillars against the live docs and writes each change back **by scope** (see Harvest destinations in `## stop` below).
30
-
31
- If none of those v9 homes exist yet (a freshly-baselined repo, or first-time use), the skill still runs the session from this skill's `templates/` folder; the harvest **creates** each destination file on `/stop`, so nothing needs to pre-exist.
32
-
33
- ### Session folder
34
-
35
- Every brainstorm session lives in a single folder (`./plan/`, `./brainstorm/`, `./design/`, or a custom path picked at session start). Inside that folder:
36
-
37
- ```
38
- ./plan/ # session anchor
39
- ├── state.md # session lifecycle + mode — TOP LEVEL (never inside pillars/)
40
- ├── pillars/ # all pillar docs
41
- │ ├── questions.md
42
- │ ├── decisions.md
43
- │ ├── doctrine.md
44
- │ ├── glossary.md
45
- │ ├── inventory.md
46
- │ ├── non-goals.md
47
- │ ├── references.md
48
- │ ├── rejected.md
49
- │ ├── milestones.md
50
- │ └── backlog.md
51
- ├── sources/ # optional — source materials copied in for the session
52
- ├── samples/ # optional — load-bearing code snippets (illustrative)
53
- ├── 01-foo.md # plan docs (numbered by domain)
54
- ├── 02-bar.md
55
- └── 01-foo-v0.1.md / 01-foo-v0.2.md # plan-doc version drafts (see "Plan-doc versioning")
56
- ```
57
-
58
- **`state.md` stays at the top level.** It is the session-lifecycle gate the skill reads every turn — folder-scan logic uses it to detect an active session. It is not a pillar.
59
-
60
- **All 10 pillars live in `pillars/`.** Cross-references inside session docs use `pillars/<name>.md` paths.
61
-
62
- Three of the pillars handle related-but-distinct scope concerns; mixing them is a common mistake:
63
-
64
- | Pillar | Semantics |
65
- |---|---|
66
- | `pillars/rejected.md` | "We **considered** this path and chose another." Past-tense alternative. |
67
- | `pillars/non-goals.md` | "We deliberately are **not** building this." Scope guard. May never be built. |
68
- | `pillars/backlog.md` | "We **will** build this, just **later**." Roadmap forward to a known future milestone. |
69
-
70
- If you can't tell where a new item belongs, ask: *"Is the plan to build this eventually?"* Yes → `backlog.md`. No but circumstances could change → `non-goals.md`. We already weighed it against an alternative → `rejected.md`.
71
-
72
- **Plan docs (`01-foo.md`, `02-bar.md`, ...) live at the top level** alongside the optional folders. Each owns one domain.
73
-
74
- ---
19
+ Modes change *who drives* and *how much gets asked*. The loop never stops.
75
20
 
76
21
  ## Modes
77
22
 
78
- The session has three modes. The mode is tracked in `state.md` (`MODE: explore | decide | step-back`) and gates the skill's behavior on every turn.
79
-
80
- | Mode | Voice | Tool-use | When it applies |
23
+ | Mode | Who drives | When | Behavior |
81
24
  |---|---|---|---|
82
- | **explore** (default) | Facilitator + Scribe | No `AskUserQuestion` for picking options. Prose conversation. Pillar writes capture user-stated concerns in user's framing. | After intake, and any time the user signals they want to think rather than decide. |
83
- | **decide** | Sparring partner + Architect-mentor (opt-in) | `AskUserQuestion` allowed when the user has explicitly invoked a resolution flow. Decisions written as `STATUS: tentative`. Cascades suppressed. | User signals: "let's resolve Q-N", "I want to decide X", "let's lock down Y". |
84
- | **step-back** | Critic | Read-only across pillars. Present cumulative effect of decisions; offer rescind/commit on tentative items. | User signals: "step back", "review where we are", "what have we decided", "is this going the right direction". |
85
-
86
- ### Mode transitions
87
-
88
- The mode changes only on **explicit user signal**, not on skill judgment. Read the user's words; do not infer mode shifts from topic shifts.
89
-
90
- - **explore → decide**: user says "decide X" / "resolve Q-N" / "let's pick" / "lock this in" / similar. Write `MODE: decide` and the in-flight question to `state.md`. Stay in decide only as long as the active resolution requires; revert to explore the moment the resolution ends (committed, tentatively-written, or abandoned).
91
- - **decide → explore**: user says "park this" / "let's just talk" / "explore mode" / "actually I don't want to decide yet" / similar. Or: the resolution flow naturally ends.
92
- - **any → step-back**: user says "step back" / "review" / "let me see where we are" / "is this overall direction right" / similar.
93
- - **step-back → explore or decide**: user signals what to do next after reviewing.
94
-
95
- When entering a mode, **announce the shift** in one line — naming the topic in plain English, not by code — e.g., *"Switching to decide mode to settle whether a user-type can change answer depth. Stop me with 'park' if you want to keep thinking."* This makes the mode change observable.
25
+ | **dump** | user | idea is in their head | No questions mid-stream. Distill live. After each chunk, reflect back: the shape, contradictions, implications. Distillation + reconciliation **is** active listening — never sit silent. |
26
+ | **interview** | skill | idea is fuzzy | Question batches of 2–3 via `AskUserQuestion`, scoped to **one aspect at a time**. Distill each answer immediately. Questions derive from the basis and the pillars — never from a template inventory. |
27
+ | **probe** | skill | idea is drafted, needs stress | Challenge it: flaws, edge cases, conflicts with `tech.md` / `doctrine.md` / the domain model. Each finding becomes a question (`Raised by: probe`) — file it and move on; don't demand resolution. |
28
+ | **converge** | shared | closing in | Burn down open questions. `AskUserQuestion` allowed for picks. Each resolution → a decision with **Why** + **How to apply**, or an explicit park (backlog / non-goals). Ends with a mandatory fresh sync. |
96
29
 
97
- ### Behavior in explore mode (the default)
30
+ **Switching** is an explicit user word ("let me dump", "ask me questions", "poke holes", "let's converge"). On a strong signal — the user starts monologuing mid-interview, or answers every probe with "I haven't thought about it" — **offer** the switch in one line. Never seize it. Announce every shift in plain English: *"Switching to probe — I'll push on the sync-layer design. Say 'park' anytime."*
98
31
 
99
- This is where the skill spends most of its time. The shape:
32
+ ## `start`
100
33
 
101
- - **Listen first.** When the user names a concern, capture it as a `pillars/questions.md` entry in *their* framing. Repeat what you heard back in writing; don't restructure into a multi-option choice unless they ask.
102
- - **No proactive recommendations.** Do not emit `Claude's take:` on questions, do not suggest "option A vs B", do not push toward resolution. The Architect-mentor voice activates only when the user asks something like "what should I be considering here?" or "what do you recommend?"
103
- - **No `AskUserQuestion` for picking options.** Prose. If you need a clarification, ask in plain text. `AskUserQuestion` is reserved for intake (Step 1, Step 4) and explicit decide-mode resolutions.
104
- - **Don't extract questions unprompted from source material.** If `./plan/sources/` has a draft doc, do not generate a list of questions from it on first read. Wait for the user to point at something or name a concern.
105
- - **Mirror, summarize, capture.** When the user thinks out loud, paraphrase back, ask clarifying questions, and offer to write the result into a pillar. The user picks whether to capture.
106
- - **Pillar-reinforcement prompts at topic shifts** still apply (see below) — those are conversational, not directive.
34
+ ### 1. The entry gate
107
35
 
108
- ### Behavior in decide mode
36
+ A session needs substance before it opens. Ask for a **basis**: a reference document (path or URL), or a one-shot brain dump of the whole idea, right now, in prose.
109
37
 
110
- User has signaled they want to resolve something. Even here, the skill is not in a hurry.
38
+ - Basis arrives → copy/save it into `<folder>/basis/` and proceed.
39
+ - The user offers drip-sized input — a bug fix, a single button, small action items — say this skill is the wrong tool, recommend stopping, and **do not open the session** unless the user explicitly overrides.
40
+ - No basis and no dump → no session.
111
41
 
112
- 1. **Confirm the scope.** Restate the question in plain English (not "we're resolving Q-N"): "We're settling [the actual question, in your words]. Talk through it first, or go straight to picking options?" Prose response.
113
- 2. **If talk-through:** discuss the question + tradeoffs in prose. Pull in references, prior art, related decisions. Don't push toward picking. The user signals readiness ("OK, let's pick" / "I'll go with B" / "I've decided").
114
- 3. **If pick-now:** use `AskUserQuestion` with the options as written in `pillars/questions.md`. **Do not pre-lean an answer** unless the user already stated their pick in chat (in which case present it pre-leaned with a confirm step).
115
- 4. **Sparring once.** If the user picks something with weak rationale, push back once: name the unstated tradeoff. If they hold firm, accept. Don't push twice.
116
- 5. **Write the decision as `STATUS: tentative`** in `pillars/decisions.md`. Do NOT delete the question from `pillars/questions.md` yet — keep it in a "tentatively answered" state. Do NOT dispatch a cascade.
117
- 6. **Return to explore mode** after the write. State the mode shift. The decision sits as tentative until the user commits or rescinds.
42
+ ### 2. Read the basis, propose the frame
118
43
 
119
- ### Behavior in step-back mode
44
+ Distill the basis *first* — this seeds `thesis.md` and the initial questions. Then one `AskUserQuestion` batch:
120
45
 
121
- User wants to see the cumulative effect of what's been decided.
46
+ - **Complexity** — low / medium / high. The skill proposes from the basis; the user confirms. This sets the default pillar surface (see **Pillars**) and ceremony depth.
47
+ - **Build mode** — "Is this greenfield, or are we changing something that exists?" (greenfield / brownfield / hybrid). The answer lands in `build.md` and opens or closes its execution sections — migration strategy and gotchas are brainstorm-phase concerns; surfacing them in plan mode is too late.
48
+ - **Mode** — "Where is this idea right now — fully in your head (dump it), half-formed (I'll interview), or drafted and needing stress (I'll probe)?"
122
49
 
123
- 1. Read all decisions in `pillars/decisions.md` in chronological order.
124
- 2. Group by milestone (M0, M1, M2, ...) and by status (committed / tentative / rescinded).
125
- 3. Present:
126
- - Cumulative scope of each milestone (compared to the original goal if captured in `pillars/milestones.md`).
127
- - Decisions that depend on or amend other decisions (chain reactions).
128
- - Tentative decisions awaiting commit.
129
- - Any contradictions or smell-words (see `greenfield.md`).
130
- 4. Ask in prose: *"Anything to reverse? Anything tentative to commit? Or back to explore?"*
131
- 5. User can rescind decisions, commit tentative ones, or return to explore mode. Do not transition out of step-back until the user signals.
50
+ Then propose the **aspect map**: the thinking dimensions for *this specific idea* (e.g., for a product: users/jobs, domain model, architecture, tech, risks; for a small tool: behavior, interface, failure modes). Derive it from the basis — there is no fixed list. The user edits it; write it into `thesis.md`. The map is the coverage source for the sync audit.
132
51
 
133
- ---
134
-
135
- ## Tentative vs committed decisions
136
-
137
- This is what gives the user breathing room. New decisions land as **tentative** by default. They are visible, they are real, but their downstream effects do not fire until the user commits.
52
+ ### 3. Bootstrap
138
53
 
139
- ### State machine
54
+ Session folder: `./brainstorm/` by default (or `./plan/`, `./design/`, custom — reuse any folder containing `state.md`; confirm in one line). Create only the pillars the complexity calls for, from `templates/` (never overwrite existing files; if a template is missing, create the file from the field lists in **Pillars**). Write top-level `state.md`:
140
55
 
141
- ```
142
- resolution flow
143
- │
144
- ▼
145
- ┌─────────┐
146
- │tentative│ ← new decisions land here
147
- └────┬────┘
148
- user says │ user says
149
- "commit" │ "rescind"
150
- ┌─────┴─────┐
151
- ▼ ▼
152
- ┌─────────┐ ┌──────────┐
153
- │committed│ │ rescinded│
154
- └─────────┘ └──────────┘
155
- ```
156
-
157
- ### What's different between tentative and committed
158
-
159
- | | Tentative | Committed |
160
- |---|---|---|
161
- | Visible in `decisions.md` | Yes | Yes |
162
- | Question deleted from `questions.md` | No (still listed) | Yes |
163
- | Cascade audit dispatched | No | Yes |
164
- | Other pillars reference this decision | Allowed (just don't apply mechanical ripples) | Yes, fully |
165
- | User can reverse easily | Yes, just rescind | Yes, but requires cascade reversal |
166
-
167
- ### Commit flow
168
-
169
- User says "commit D-N" or "commit all tentative" or "commit the recent ones":
170
-
171
- 1. Read the named decision(s) from `pillars/decisions.md`.
172
- 2. Change `STATUS:` from `tentative` to `committed`. Record `**Committed on.** YYYY-MM-DD`.
173
- 3. Delete the resolved question from `pillars/questions.md`.
174
- 4. Dispatch the cascade audit (see "Live pillar realignment" below).
175
- 5. Return to explore mode.
176
-
177
- ### Rescind flow
178
-
179
- User says "rescind D-N" / "undo D-N" / "actually I want to reverse that":
180
-
181
- 1. Read D-N from `pillars/decisions.md`.
182
- 2. **If `STATUS: tentative`** — the easy case:
183
- - Change `STATUS:` to `rescinded`. Record `**Rescinded on.** YYYY-MM-DD with reason "<one-line>"`.
184
- - The question never left `questions.md`, so nothing to restore there.
185
- - No cascade was ever dispatched, so no ripples to undo.
186
- - State: "D-N rescinded. The original question is still open in `pillars/questions.md`."
187
- 3. **If `STATUS: committed`** — harder:
188
- - Read the cascade-ripples that fired for this decision. Search the brainstorm folder for references to `D-N` and identify the mechanical edits the cascade applied (the cascade reports its applied items in your conversation history; if you cannot reconstruct, ask the user which ripples to reverse).
189
- - Present the reversal punch list to the user. Wait for approval per item.
190
- - Apply reversals.
191
- - Restore the original question to `questions.md` from D-N's "Resolves Q-N" reference + the alternatives that were offered.
192
- - Mark D-N as `STATUS: rescinded`.
193
- - Flag any *downstream* decisions that referenced D-N as potentially needing review.
194
-
195
- Rescinded decisions stay in `pillars/decisions.md` as historical record. They are one of the four places where past tense is allowed (the others: live `decisions.md` entries, `rejected.md`, `references.md`).
196
-
197
- ---
198
-
199
- ## `start` — opening a session
200
-
201
- ### Step 1. Qualification (Facilitator voice)
202
-
203
- Before doing anything else, ask 2–4 qualifying questions via `AskUserQuestion`. This is one of the few legitimate uses of `AskUserQuestion` — scope clarification:
204
-
205
- - **What are you designing?** (new system / new feature on an unbuilt system / migration / refactor / something smaller)
206
- - **What's built so far?** (nothing / scaffolding only / partial / mostly done)
207
- - **What's the rough scope?** (single service / multi-service / cross-team / one-day spike)
208
- - **Is the goal to lock decisions before code, or something else?**
209
-
210
- If the answers indicate the skill is a **poor fit** — debugging an existing bug, writing a one-day script, adding a single button, fixing a typo, working in an established codebase that doesn't need design — say so explicitly:
211
-
212
- > "This skill is for structured design of unbuilt systems. Your problem sounds more like [X] — [other skill / direct action] would fit better. Want me to dump the conversation so far into a markdown file you can pick up there? Or, if you still want to run a brainstorm here, say so and I'll continue."
213
-
214
- **Do not exit unilaterally.** The user decides.
215
-
216
- ### Step 2. Folder selection
217
-
218
- Decide where the session lives. **Detect first, ask only if ambiguous.**
219
-
220
- 1. Scan the working directory for candidate folders:
221
- - Conventional names: `./plan/`, `./brainstorm/`, `./design/`.
222
- - Any other folder containing `state.md` plus a `pillars/` subfolder. Limit the scan to one level deep.
223
- - **Backward compatibility:** if you find a folder with `state.md` at top level AND pillar files at top level (pre-`pillars/` layout), treat it as a legacy session and continue working in that layout.
224
- 2. Resolve:
225
- - **Exactly one candidate** → confirm in a single line: *"Resuming in `./<folder>/` — OK?"* Default yes.
226
- - **Multiple candidates** → present them via `AskUserQuestion`, plus "Other" for a custom path.
227
- - **None found** → ask via `AskUserQuestion`: propose `./plan/`, `./brainstorm/`, `./design/`, or "Other".
228
- 3. **Anchor the session to the chosen folder.** From this point on, every reference in this document to `./plan/` resolves to the folder selected here.
229
-
230
- If the chosen folder doesn't exist yet, it's created during Step 3 along with the pillar bootstrap.
231
-
232
- ### Step 3. Bootstrap if needed
233
-
234
- If the session folder doesn't have `pillars/` populated, copy templates from this skill's templates directory into `<folder>/pillars/`. Skip any file that already exists — never overwrite.
235
-
236
- ```bash
237
- mkdir -p <folder>/pillars
238
- cp <skill-dir>/templates/{questions,decisions,doctrine,glossary,inventory,non-goals,references,rejected,milestones,backlog}.md <folder>/pillars/
239
- ```
240
-
241
- Write `state.md` at the **top level** (overwriting is OK):
242
56
  ```
243
57
  STATE: open
244
- MODE: explore
58
+ MODE: dump | interview | probe | converge
59
+ COMPLEXITY: low | medium | high
245
60
  SESSION STARTED: <ISO date>
246
- CURRENT TOPIC: <one-line summary from intake>
247
- LAST UPDATED: <ISO date>
61
+ CURRENT TOPIC: <one line>
62
+ LAST SYNC: <ISO datetime or never>
63
+ SYNC IN FLIGHT: no
248
64
  ```
249
65
 
250
- ### Step 3.5. Source materials (optional)
251
-
252
- A brainstorm is rarely a blank slate. Before intake, ask in prose:
253
-
254
- > "Are there existing documents or projects whose technical design you want to improve in this session? If yes, point me at paths or URLs and I'll copy them into `./plan/sources/` so we don't have to re-read from their original locations."
255
-
256
- If yes:
257
- - Create `./plan/sources/` and copy each file in (or `WebFetch` if URL → save as markdown).
258
- - Write `./plan/sources/README.md` with a single line: `delete after brainstorm is over`.
259
- - Add an entry to `pillars/references.md` for each source pointing at `./plan/sources/<filename>` with a one-line note on what it's for.
260
-
261
- **Important:** copying a source into `sources/` does **not** authorize you to extract questions from it. Source material is reference, not a question-generation prompt. Wait for the user to point at concerns inside the source.
262
-
263
- ### Step 4. Intake interview (Facilitator voice, `AskUserQuestion` for scope only)
264
-
265
- Use `AskUserQuestion` in topical bundles (2–4 questions per batch) **only for genuine scope clarifications**:
266
-
267
- - What's the system for, who uses it, what does it ship? → seeds `pillars/inventory.md` + `pillars/milestones.md` M0 goal
268
- - What are you explicitly NOT building? → seeds `pillars/non-goals.md`
269
- - What's next-phase work you already know about but aren't building now? → seeds `pillars/backlog.md`
270
- - Any reference implementations or prior art you already know? → seeds `pillars/references.md`
271
- - Any hard constraints (cloud, language, deploy target, vendor preferences)? → seeds `pillars/doctrine.md`
272
-
273
- **Note what is NOT in this list:** "What are the obvious open questions?" That seeding belongs in explore mode, driven by the user's actual concerns, not extracted by the skill.
274
-
275
- Write each answer directly to the relevant pillar as it comes in. Don't accumulate in conversation then dump at the end.
276
-
277
- ### Step 5. First-pass review (Facilitator voice)
278
-
279
- Once intake is seeded, show the user:
280
- - The list of pillars with one-line summaries of what was captured in each.
281
- - A note that `pillars/questions.md` is empty (and that's fine — questions enter as the user names them).
282
-
283
- Then ask, in prose (no `AskUserQuestion`):
284
-
285
- > "What would you like to explore? You can name a topic you're worried about, name a concern, point at something in a source doc, ask me to talk through something, or step back if anything captured so far feels off."
286
-
287
- The session is now in **Explore mode**. Resolution-style flows are opt-in from here. The skill is reactive — it captures what the user surfaces, and only proposes when invited.
288
-
289
- ---
290
-
291
- ## `stop` — stopping a session
292
-
293
- 0. **Drain in-flight cascades.** Read `state.md`'s `CASCADE LOCKS` section. If any locks are active, wait for the corresponding sub-agents to finish before proceeding. Drain the `CASCADE QUEUE` too. Goal: no half-applied cascades when the session closes.
294
-
295
- 1. Read all pillars (`pillars/*.md`) and plan docs (numbered docs at the top level).
296
-
297
- 2. Run gap detection:
298
- - Greenfield smell-words grep across plan docs and pillar docs (see `greenfield.md`).
299
- - Decisions in `pillars/decisions.md` with `STATUS: tentative` — these are uncommitted; the user should commit or rescind before closing.
300
- - Decisions missing **Why** or **How to apply**.
301
- - Questions in `pillars/questions.md` with no `Blocks.` field.
302
- - Pillars that haven't been touched since `start`.
303
- - Plan docs with their own "Open Questions" section instead of a pointer to `pillars/questions.md`.
304
- - Versioned plan-doc drafts (`*-v0.X.md`) where the latest version isn't marked stable.
305
- - Items in `pillars/non-goals.md` that look like deferred-but-planned work (have a concrete target milestone in their re-evaluate clause) — these belong in `pillars/backlog.md`.
306
- - Items in `pillars/backlog.md` with no **Target milestone** field.
307
-
308
- 3. Report gaps; do not auto-fix.
309
-
310
- 4. Ask the user if they want to address gaps now or stop anyway. Tentative decisions in particular: surface them and ask "commit / rescind / leave as tentative for resume?"
311
-
312
- 5. On confirmation, write `STATE: closed` to `state.md` with a one-line reason (milestone reached / paused / scope cut / handing off). Keep the `MODE:` field at its last value for resume.
313
-
314
- 6. **Refuse close on tentative (v8).** If step 4 didn't resolve every `STATUS: tentative` decision (commit / rescind / convert-to-backlog), block close and return to the conversation. Harvest does not run with unresolved tentatives.
315
-
316
- 7. **Harvest into the v9 doc tree.** The harvest is a structured diff between the session pillars (`./brainstorm/pillars/*`) and the live docs, **routed by scope** — module-local findings to `docs/modules/{m}/pillars/`, cross-module to `docs/architecture/`, IA/contract changes to `docs/boundaries/` (via the `boundary` skill), backlog to `docs/history/`. There is no single target and no repo-wide `docs/pillars/`. For each kind of mutation, write to the matching destination:
317
-
318
- | Session source | v9 destination(s) |
319
- |---|---|
320
- | `./brainstorm/pillars/doctrine.md` (additions / amendments) | module-local → `docs/modules/{m}/pillars/doctrine.md`; cross-module → `docs/architecture/domain-model.md` |
321
- | `./brainstorm/pillars/glossary.md` | module-local → `docs/modules/{m}/pillars/glossary.md`; cross-module → `docs/architecture/glossary.md` |
322
- | `./brainstorm/pillars/non-goals.md` | `docs/architecture/non-goals.md` |
323
- | `./brainstorm/pillars/references.md` | `docs/architecture/references.md` |
324
- | `./brainstorm/pillars/inventory.md` | `docs/architecture/` |
325
- | Committed decisions (`STATUS: committed` in `./brainstorm/pillars/decisions.md`) | 2+-module → new `docs/architecture/adr/NNN-{slug}.md` (one ADR per cohesive theme); module-local → `docs/modules/{m}/pillars/decisions.md`. Rejected alternatives flow to ADR §Alternatives. |
326
- | IA / entity-model change, or a new cross-cutting contract, surfaced by a committed decision | the `domain` boundary `docs/boundaries/information-architecture.md` (or a new typed boundary) — **flag for the `boundary` skill (`create`); don't hand-write the boundary file** |
327
- | `./brainstorm/pillars/backlog.md` (new items) | `docs/history/backlog.md` (P0–P3, full operational tracking) |
328
- | `./brainstorm/pillars/rejected.md` | ADR §Alternatives when tied to a committed decision; else `docs/modules/{m}/pillars/rejected.md` |
329
- | `./brainstorm/pillars/milestones.md` | `docs/architecture/` (mirror in `docs/structure.md §Health log` if the milestone is a structural change) |
330
- | `./brainstorm/pillars/questions.md` (still-open) | `docs/architecture/open-questions.md` (each carries a *Resolution lands in* pointer) |
331
- | Plan docs (`NN-*.md` in session root) | `docs/history/plans/YYYY-MM-DD-{slug}.md` (Status: Draft), using the `documentation` skill's §8 Plan template |
66
+ Initial questions come from the basis distillation **only** — contradictions in the dump, gaps the aspect map exposes. Never interview to fill empty templates.
332
67
 
333
- Append a harvest changelog entry at `docs/history/changelog/YYYY-MM-DD-brainstorm-harvest-{slug}.md` listing what got written where.
68
+ ## Pillars — substance first, lazy by default
334
69
 
335
- 8. **If `./plan/sources/` exists,** offer to delete it (per its README marker). Default to keep if unclear.
336
-
337
- 9. **If versioned plan-doc drafts exist,** offer to prune older drafts. Default to keep.
338
-
339
- 10. Delete the session folder (`./brainstorm/` or `./plan/` — whichever was used). The dispersed homes (`docs/modules/*/pillars/`, `docs/architecture/`, and any `docs/boundaries/` flagged for the `boundary` skill) are now updated; the next session primes from them.
340
-
341
- 11. Print: "Run `/brainstorm start` to resume."
342
-
343
- ---
344
-
345
- ## In-session behavior
346
-
347
- ### Speak English in the conversation; codes live in the files
348
-
349
- The pillar codes — `Q3`, `D7`, `P2`, `M1`, `R1` — are addressing labels for the **files**, where they enable stable, self-contained cross-references. They are **not** a language for talking to the user.
350
-
351
- When you write to the user in the conversation, assume they are **not** looking at the pillar files. They are in a terminal, talking to you. A message like *"Q6a is still open; D3 tentatively answers Q1 but conflicts with P3"* is unreadable to someone who isn't staring at `questions.md` and `decisions.md` — it forces them to stop, open files, and search for each code. That is the opposite of a conversation, and it is a real failure even if every code is technically correct.
352
-
353
- **The rule:** in every user-facing message, refer to a pillar item by **what it is** — a few plain words — not by its code alone.
354
-
355
- - ❌ "Q6a is the last residual before we can commit D1–D3."
356
- - ✅ "One open thread before we lock these in: can a user-type change *how deep* an answer goes, or only its tone?"
357
- - ❌ "This conflicts with P3 and re-opens R1."
358
- - ✅ "This clashes with our read-only-agent principle, and it risks reviving the audience-altitude idea we already threw out."
359
-
360
- If you genuinely need the code for traceability, **append it in parentheses after the plain-English statement** — never lead with it, never use it alone:
361
-
362
- - ✅ "…can a user-type tune answer *depth*? (open question, tracked as Q6a)"
363
-
364
- This holds for questions, decisions, doctrine, milestones, rejected items — every coded entry, and for lists of them too: don't hand the user a table of bare codes to go decode. The files stay terse and code-cross-referenced; the conversation stays human. The user should never have to open a pillar file to understand what you just said.
365
-
366
- ### Voices, by mode
367
-
368
- | Mode | Default voice | When voice shifts |
70
+ | Pillar | Holds | Exists |
369
71
  |---|---|---|
370
- | Intake | Facilitator | Always |
371
- | **Explore** (default) | Facilitator + Scribe | Architect-mentor only when user explicitly asks "what should I consider?" / "any prior art?" / "what would you recommend?" |
372
- | **Decide** | Sparring partner | Architect-mentor when surfacing tradeoffs the user hasn't named |
373
- | **Step-back** | Critic | The whole mode |
374
- | `stop` and gap detection | Critic | Always |
375
-
376
- Voice shifts happen only on explicit signal from the user. The skill does not pre-emptively switch into Architect-mentor or Sparring-partner. If the user is just talking through a worry, you listen; you don't offer alternatives unless asked.
377
-
378
- ### Writing recommendations on open questions
379
-
380
- The `Claude's take:` field in `pillars/questions.md` is **opt-in**.
381
-
382
- - **Default: do not write it.** Capture the question, options (if the user named them), and lean (if the user has one). Stop there.
383
- - **Emit only when asked.** When the user says "what's your take?" / "what would you recommend?" / "if you had to pick" / similar, write a one-line take. Mark it as a separate paragraph; never inline with the user's framing.
384
- - **Stale takes:** if the question changes shape (new option added, scope shifts), delete the existing take. Don't leave a stale recommendation.
72
+ | `thesis.md` | What we're designing — running narrative, kept current + the aspect map | always |
73
+ | `questions.md` | The **single convergence currency** — every unresolved design call, whoever raised it | always |
74
+ | `decisions.md` | Resolved calls with **Why** + **How to apply** | always |
75
+ | `build.md` | How the work gets executed: build mode (greenfield default / brownfield / hybrid), migration strategy, gotchas, rollout. Greenfield closes the execution sections; brownfield opens them | always |
76
+ | `domain-model.md` | Entities, relationships, cardinalities, state ownership | medium+ |
77
+ | `tech.md` | Stack choices, seeded from harness rules (e.g. `.claude/rules/general.md`) at bootstrap; deviations recorded with whys | medium+ |
78
+ | `doctrine` / `glossary` / `non-goals` / `backlog` / `rejected` / `references` / `milestones` | as their templates describe | **lazy** — materialize on first real content, any complexity |
385
79
 
386
- `Claude's take:` is not the same as the in-conversation Sparring-partner pushback during decide mode — that's verbal. The field is a written artifact and exists only when asked.
80
+ The complexity dial sets *defaults*, not a cage: any lazy pillar materializes mid-session the moment the conversation produces content for it, and at **low** complexity the always-four may even live as sections of a single file if the user prefers.
387
81
 
388
- ### Capturing user concerns as questions (Explore mode)
82
+ **Question entries** (`questions.md`): self-contained full prose in the user's framing, plus —
389
83
 
390
- The most important capture flow. When the user says something like *"I'm worried about how Bluetooth headphones break the experience"* or *"I don't know what the right way to handle X is"*:
84
+ - **Raised by.** user | sync | probe
85
+ - **Closes when.** What resolution looks like — a pick, a confirmed fact, an accepted risk. Every question must be closeable.
86
+ - **Options / Lean / Claude's take** — optional; *Claude's take* remains opt-in (only when the user asks for a recommendation).
391
87
 
392
- 1. **Mirror it back.** "Sounds like the concern is [restated in your words] — is that right?"
393
- 2. **Offer to capture.** "Want me to add this as an open question?"
394
- 3. **If yes**, write it to `pillars/questions.md` in the user's framing:
395
- ```
396
- ## Q-N — [Title in user's words]
88
+ **Decision entries** (`decisions.md`): append-only; **Decision**, **Why**, **How to apply**, **Resolves Q-N**. There is no tentative/committed state machine. Reversing a decision = append a new decision that names what it reverses, mark the old entry "Reversed by D-M", and let the next sync handle the ripples.
397
89
 
398
- **Question.** [Full prose — paraphrase what the user said, not what you would have asked.]
90
+ ## The sync agent
399
91
 
400
- **Resolution lands in.** [Plan doc + section if known, otherwise leave blank.]
92
+ The background reconciler that replaces ceremony with consistency. **One sync in flight at a time; queue at most one behind it.**
401
93
 
402
- **Blocks.** [Milestone if known, otherwise leave blank.]
403
- ```
404
- Do **not** generate Options, Lean, or Claude's take fields at capture time. Those land later if/when the user moves the question into decide mode.
94
+ **When:** after a distillation batch lands substantive pillar writes (at the turn break, not mid-sentence); mandatorily on entering converge and at `stop`; on demand. At **low** complexity, run it inline yourself; at **medium+**, dispatch a background `general-purpose` agent (read/write access to the session folder only).
405
95
 
406
- 4. **Stay in explore.** Don't pivot to "shall we resolve this now?" — the user will say so when ready.
96
+ **Contract — audit exactly four sources:**
407
97
 
408
- ### When the user shifts topics — pillar reinforcement
409
-
410
- When the conversation moves from one design topic to another (e.g., "OK we're done thinking about auth, let's talk about the event bus"), pause **before** entering the new topic:
411
-
412
- > "I see we're moving from [previous topic] to [next topic]. Before we shift — looking at what we just covered, do any of these belong in the load-bearing pillars?
413
- > - [Candidate 1] → could go in `pillars/glossary.md` because [reason]
414
- > - [Candidate 2] → could go in `pillars/doctrine.md` because [reason]
415
- > - [Candidate 3] → could go in `pillars/rejected.md` because [reason]
416
- > - [Candidate 4] → could go in `pillars/backlog.md` because [reason]
417
- >
418
- > Promote any of them?"
419
-
420
- The user picks what to promote. Update the named pillars, then update `state.md`'s `CURRENT TOPIC` field. Then proceed with the new topic.
421
-
422
- This is the **only** periodic prompt. There is no scheduled "checkpoint" or "review" — pillar reinforcement happens at natural topic boundaries because that's when the closing context is fresh.
423
-
424
- ### Live pillar realignment (background cascade) — only on commit
425
-
426
- A brainstorm session that lets pillars drift between committed decisions accumulates stale entries. The cascade mechanism keeps the brainstorm folder consistent **between** decisions instead of catching up at the end.
427
-
428
- **Critical change from older versions of this skill:** cascades fire **only on `STATUS: committed` decisions**, not on `tentative` ones. New decisions land tentative; cascade dispatch is part of the commit flow, not the write flow.
429
-
430
- **The cascade mechanism.** When a decision transitions to committed (or when another load-bearing pillar is directly written: `doctrine.md`, `rejected.md`, `non-goals.md`, `milestones.md`, or a plan doc), the skill **dispatches a read-only sub-agent in the background** to audit cascading impact on other pillars and plan docs. The sub-agent produces a punch list of follow-on edits. The main agent keeps talking to the user. When the sub-agent reports back, the main agent applies the mechanical items silently and surfaces the judgment items at the next natural turn break.
431
-
432
- **What triggers a cascade:**
433
-
434
- | Event | Triggers cascade |
435
- |---|---|
436
- | Decision committed (STATUS: tentative → committed) | Yes |
437
- | Direct write to `pillars/doctrine.md` | Yes |
438
- | Direct write to `pillars/rejected.md` | Yes |
439
- | Direct write to `pillars/non-goals.md` | Yes |
440
- | Direct write to `pillars/milestones.md` | Yes |
441
- | Plan-doc write (`NN-*.md`) | Yes |
442
- | Tentative decision written | **No** |
443
- | `questions.md` / `glossary.md` / `inventory.md` / `references.md` / `backlog.md` write | **No** (downstream pillars; ripple captured by their source decision) |
444
- | `state.md` / `sources/*` / `samples/*` | No (administrative) |
445
-
446
- **The cascade sub-agent.** Dispatched via `Agent` tool with `subagent_type: "general-purpose"` and `run_in_background: true`. The prompt template:
447
-
448
- > Brainstorm cascade audit for folder `<brainstorm-folder>`.
449
- >
450
- > A change just landed at `<changed-file>`. The new content (full text or relevant section) is below. Your job: audit all OTHER pillars and plan docs in the brainstorm folder for follow-on edits this change requires.
451
- >
452
- > Check:
453
- > - `pillars/rejected.md` — does any rejected entry need a "Partially superseded by <decision-id>" annotation?
454
- > - `pillars/non-goals.md` — does any non-goal item have a re-evaluate trigger that this change fired?
455
- > - `pillars/doctrine.md` — does this change reverse, amend, or supersede any doctrine entry?
456
- > - `pillars/inventory.md` — does the change introduce new artifacts that need cataloguing?
457
- > - `pillars/backlog.md` — does the change defer something that needs a new backlog entry with target milestone?
458
- > - `pillars/glossary.md` — does the change introduce or rename terms that need definition?
459
- > - `pillars/references.md` — does the change cite new external sources?
460
- > - `pillars/milestones.md` — does the change affect milestone scope, dependencies, or open-question lists?
461
- > - Plan docs (`NN-*.md`) — does the change contradict, supersede, or extend a plan-doc section?
462
- >
463
- > Output a structured punch list. For each file needing an edit: file path / section / type (ANNOTATE / DELETE / AMEND / EXTEND / NEW-ENTRY) / category (MECHANICAL — auto-applicable from the source change's How-to-apply field; or JUDGMENT — needs user input) / proposed new text (for MECHANICAL) OR question (for JUDGMENT).
464
- >
465
- > Do NOT make edits. Read-only audit. Report under 400 words.
466
-
467
- **Race condition guard.** Each cascade lock is keyed by **source pillar file**. Before dispatching a cascade for source `<file>`, check `state.md` for an active `CASCADE LOCK`:
468
-
469
- - **No active lock** → dispatch immediately; write a `CASCADE LOCK` entry to `state.md`.
470
- - **Active lock for the same source** → do NOT dispatch. Append to `CASCADE QUEUE`. Drain when the active lock clears.
471
- - **Active lock on a different source** → fine, dispatch concurrently.
472
-
473
- **Integration of cascade output.** When a sub-agent finishes:
474
-
475
- 1. Read the punch list.
476
- 2. **MECHANICAL items** — apply directly. Note silent application in the next user-facing message: *"Cascade applied: rejected.md R1/R2/R7 annotated; non-goals.md 3 entries deleted."*
477
- 3. **JUDGMENT items** — surface to user: *"Cascade audit found 2 items needing your call: [item 1], [item 2]. Apply now or defer?"*
478
- 4. Remove the lock from `state.md`. Drain any queued cascade for the same source pillar.
479
-
480
- **Stale lock detection.** A cascade sub-agent that takes longer than 5 minutes is presumed stuck. Surface to the user and clear on confirmation.
481
-
482
- ---
98
+ 1. **Cross-pillar contradiction** — thesis vs domain model vs decisions vs doctrine vs build (a decision that implies migration work with no `build.md` entry is a contradiction).
99
+ 2. **Aspect coverage** — any aspect on the map with no content anywhere → emit a question.
100
+ 3. **Basis drift** — does the thesis still agree with `basis/`? Divergence is fine if decided; accidental divergence → emit a question.
101
+ 4. **Tech conflicts** — anything that violates `tech.md` without a recorded deviation.
483
102
 
484
- ### When the user asks to "update the docs" / "propagate this"
103
+ **Output:** direct pillar edits for **scribe-calls**, new questions for **design-calls**, and a one-line report.
485
104
 
486
- Run a **semantic sweep**, not a grep:
105
+ **The line:** a *scribe-call* is anything whose resolution doesn't change the design — wording, annotations, obvious bookkeeping. Just do it; list it in the report (the user can veto). A *design-call* is anything whose resolution changes the idea — file it as a question (`Raised by: sync`) and move on. **Never** interrupt the conversation to ask "apply now or defer?" — file and continue.
487
106
 
488
- 1. List all numbered plan docs and any pillar files that might be affected.
489
- 2. Read each end-to-end, looking for sections that reference the just-changed concept.
490
- 3. Present a punch list grouped by file: file → section → proposed edit.
491
- 4. Wait for approval before editing.
107
+ **The report is the status line.** Deliver it at the next natural turn break:
492
108
 
493
- Sweeps are **never automatic**. They are user-requested.
109
+ > Sync: 4 edits applied · 2 new questions · **6 open** · untouched aspects: risks
494
110
 
495
- ### Plan-doc versioning (preserving evolution)
111
+ There is no separate dashboard, no scheduled checkpoint. This line is the only ambient convergence pressure the skill applies.
496
112
 
497
- Plan docs (`01-foo.md`, `02-bar.md`, ...) sometimes go through substantial rewrites mid-session. **Preserve the evolution** by using version suffixes rather than overwriting in place:
113
+ ## Coherence
498
114
 
499
115
  ```
500
- 01-architecture-v0.1.md ← initial draft
501
- 01-architecture-v0.2.md ← second draft after a big decision change
502
- 01-architecture-v0.3.md ← current draft
116
+ coherent ⇔ open_questions == 0 ∧ last sync ran after the last pillar write
503
117
  ```
504
118
 
505
- **When to version:**
506
- - A major decision reversal forces a structural rewrite.
507
- - ≥3 sections of the plan doc need synchronized changes that don't fit neatly in targeted edits.
508
- - The user explicitly asks for a "v0.X" or "next draft".
119
+ Zero means *"audited against the four sources and clean"* — never *"nothing came to mind."* Don't declare the idea coherent on any other basis. Distance-to-coherent is always visible in the sync report; the **user** decides when to converge and when to close. The skill never says "let's decide now."
509
120
 
510
- **When NOT to version (just edit in place):**
511
- - Typo, paragraph polish, single-section update, adding a missing detail.
512
- - Renaming a variable / consistent find-and-replace across the doc.
513
- - Small additions that don't change the doc's structural shape.
121
+ ## `stop`
514
122
 
515
- **Numbering scheme:**
516
- - The leading number (`01-`, `02-`, ...) identifies the **domain**. Same domain across versions.
517
- - The `v0.X` suffix identifies the **draft iteration**.
518
-
519
- Plan-doc evolution is in addition to the pillar files. Pillars are append-only ledgers; plan docs may go through visible drafting iterations.
520
-
521
- ### When the user asks for code
522
-
523
- The skill **refuses to write production code** outside the brainstorm folder while a session is open. This includes source files in `src/`, `apps/`, `packages/`, or any code directory the project owns.
524
-
525
- **Carve-out:** small load-bearing snippets that anchor a design decision are allowed **inside the brainstorm folder** as illustration. Put them in `./plan/samples/` or inline in the relevant plan doc as fenced code blocks. They are documentation, not production.
526
-
527
- If the user asks for production code, say:
528
-
529
- > "We're in an active brainstorm session. I can sketch this inside `./plan/` as illustration, or you can run `/brainstorm stop` first if you want to start building. Which do you want?"
530
-
531
- ---
532
-
533
- ## Hard rules
534
-
535
- These hold for the entire session.
536
-
537
- 1. **No production code outside the brainstorm folder.** Small load-bearing snippets go in `./plan/samples/` or inline in plan docs. Never touch `src/`, `apps/`, `packages/`.
538
- 2. **Resolved (committed) questions get DELETED, not struck through.** No `~~`, no "(resolved)", no "previously planned". Tentative questions stay in `questions.md` until commit.
539
- 3. **Self-contained registry.** Full text in `pillars/questions.md`. Never `08 §5` cross-references.
540
- 4. **Every decision carries Why + How to apply.** Without the *why*, future-you can't judge edge cases.
541
- 5. **Reference implementations beat invented solutions.** If prior art exists, link in `pillars/references.md` and use it. Don't re-derive.
542
- 6. **`AskUserQuestion` is for explicit decide-mode flows and intake-scope clarifications only.** In explore mode, use prose. Never bundle structured options into `AskUserQuestion` when the user is exploring, not deciding.
543
- 7. **Greenfield writing rules apply** to all docs in the brainstorm folder. See `greenfield.md`.
544
- 8. **No past tense for software that doesn't exist yet.** Architecture docs are present-tense. The past lives only in `pillars/decisions.md`, `pillars/rejected.md`, `pillars/references.md`, versioned older drafts, and git history.
545
- 9. **`state.md` stays at the top level.** Never move it into `pillars/`. It is the session-lifecycle + mode gate.
546
- 10. **Tentative decisions don't cascade.** Cascades fire on commit, not on tentative write. This gives the user reversible state.
547
- 11. **Mode shifts are user-initiated.** The skill does not transition explore → decide on its own judgment. The user must signal.
548
- 12. **Claude's take field is opt-in.** Default off. Only emit when the user asks for a recommendation on a specific question.
549
- 13. **Speak English to the user; codes are for files.** In conversation, name every pillar item by what it *is* (a few plain words), never by its bare code (`Q3`, `D7`, `P2`). Append the code in parentheses only when traceability needs it — never lead with it or use it alone. The user is not looking at the files. See "Speak English in the conversation; codes live in the files."
550
-
551
- ---
552
-
553
- ## State file
554
-
555
- `state.md` is the source of truth for session lifecycle and mode. Read it at the start of every turn.
556
-
557
- ```
558
- STATE: open | closed
559
- MODE: explore | decide | step-back
560
- SESSION STARTED: <ISO date>
561
- SESSION CLOSED: <ISO date or absent>
562
- CURRENT TOPIC: <one-line>
563
- LAST UPDATED: <ISO date>
564
- CASCADE LOCKS:
565
- - <source-pillar-file> (sub-agent <id>, started <ISO timestamp>)
566
- CASCADE QUEUE:
567
- - <source-pillar-file> (queued at <ISO timestamp>)
568
- ```
569
-
570
- - `STATE: open` → in-session behavior applies.
571
- - `STATE: closed` → the skill does nothing on its own; `/brainstorm start` re-opens it.
572
- - `MODE:` gates voice and tool-use posture (see "Modes" section).
573
- - Update `CURRENT TOPIC` on every detected topic shift.
574
- - Update `LAST UPDATED` on every pillar write.
575
- - `MODE` updates on every transition; announce the transition in the user-facing message.
576
- - When `CASCADE LOCKS` and `CASCADE QUEUE` are empty, render them as `CASCADE LOCKS: none` and `CASCADE QUEUE: none`.
577
-
578
- ---
579
-
580
- ## The 10 pillars (+ plan docs)
581
-
582
- All pillars live in `<session-folder>/pillars/`. Each template carries a full prose introduction. Read the template, not this table, when you need format details.
583
-
584
- | File | One-line role |
585
- |---|---|
586
- | `pillars/questions.md` | Live ledger of unresolved concerns and pending decisions. User's framing, not the skill's. |
587
- | `pillars/decisions.md` | Resolved decisions with **Status** (tentative / committed / rescinded), **Why**, **How to apply**. Append-only. |
588
- | `pillars/doctrine.md` | Stable principles that pre-answer future questions. |
589
- | `pillars/glossary.md` | Project-specific terms. |
590
- | `pillars/inventory.md` | What exists / is being built / is external / is reference-only. |
591
- | `pillars/non-goals.md` | Explicit "not building" list, each with a reason. May never be built. |
592
- | `pillars/references.md` | External prior art with one-line "what we use it for". |
593
- | `pillars/rejected.md` | Alternatives considered and rejected, with reasons + re-evaluate conditions. |
594
- | `pillars/milestones.md` | Sequencing only. Each milestone names its blocking questions and dependencies. |
595
- | `pillars/backlog.md` | Deferred-but-planned items. **Will** be built, just not now. |
596
-
597
- Plus **plan docs** at the top level — `01-foo.md`, `02-bar.md`, ... — domain-by-domain architecture, present-tense.
598
-
599
- ---
600
-
601
- ## Strategy memory
602
-
603
- After a session you may append to `docs/memory/brainstorm.md` (git-tracked) to make future brainstorming on this project more effective. This is the brainstorming process's own memory — it applies whether the session was driven standalone or via the `brainstorm` agent.
604
-
605
- **Record (project-strategy facts):**
606
-
607
- - **Doctrine drift zones** — topics where the user repeatedly proposes things that brush an existing principle (e.g. "drift concentrates around the `audience` vocabulary — surface the read-only-agent principle early here").
608
- - **Productive framings** — interview shapes that converged a question quickly (e.g. "for IA questions, walking the entity from a user's mental model clarifies faster than starting from schema").
609
- - **Pillar-challenge patterns** — phrasings that reliably signal a challenge vs. a clarification.
610
- - **Harvest pitfalls** — where the scope-routed harvest needed manual intervention (e.g. a genuinely cross-module doctrine update must land in `docs/architecture/domain-model.md`, not a single module's pillar).
611
-
612
- **Never record:** user preferences / communication style (those are `~/.claude/`); per-decision content (that's the ADR or pillar file); anything tied to a single conversation or transient state.
613
-
614
- Format each entry oldest-at-bottom, and read the file first so you update in place rather than duplicating:
615
-
616
- ```
617
- ## YYYY-MM-DD — {topic}
618
-
619
- {1–3 lines of strategy fact, with pillar references where relevant}
620
- ```
123
+ 1. Run a final sync (wait for any in-flight sync first).
124
+ 2. **Coherent** → say so and proceed. **Questions open** → list them plainly (English first, codes in parentheses) and offer per question: resolve now (mini-converge) / park explicitly (backlog or non-goals, with reason) / leave open and stop anyway — the folder keeps full state and resumes exactly where it left off.
125
+ 3. **Harvest** — see `harvest.md`. Standalone by default: the session folder *is* the product. If the repo is v9-harnessed (`docs/architecture/` + `docs/modules/` exist), offer the adapter routing; never assume it.
126
+ 4. Write `STATE: closed` + one-line reason. Print: *"Run `/brainstorm start` to resume."*
621
127
 
622
- ## Greenfield doctrine
128
+ ## Conduct — holds for the whole session
623
129
 
624
- Loaded separately at `<skill-dir>/greenfield.md`. Read it before any sweep, gap detection, or stop — that's where the smell-words grep and the banned-patterns table live.
130
+ 1. **Speak English; codes live in files.** In conversation, name every pillar item by what it *is* in plain words. Append the code in parentheses only when traceability needs it (*"…can a user change answer depth? (tracked as Q6)"*). Never lead with a bare `Q3`/`D7`. The user is not looking at the files.
131
+ 2. **No production code outside the session folder.** Illustrative load-bearing snippets are fine inside it (`samples/` or fenced in pillars). If asked for production code: offer a sketch inside the folder, or `/brainstorm stop` first.
132
+ 3. **The writing posture comes from `build.md`'s mode.** Greenfield: every pillar describes the system as it *will be*, present tense, as though the chosen design was always the plan — no migration vocabulary, no phantom history (banned list in `templates/build.md`). Brownfield/hybrid: migration vocabulary is legitimate, and `build.md` is its home; other pillars still describe the *target* state.
133
+ 4. **`AskUserQuestion` appears in exactly three places:** the intake frame batch, interview mode, and converge picks. Everywhere else: prose.
134
+ 5. **Suggested, never seized.** Mode shifts, abstractions, probes — one offer each, accept refusal without re-litigating.
135
+ 6. **Questions are the only convergence currency.** Flaws, gaps, contradictions, uncovered aspects — everything unresolved funnels into `questions.md` or it doesn't exist. Nothing pending may live only in the conversation transcript.
136
+ 7. **No auto-invocation.** Only `/brainstorm start` and `/brainstorm stop` enter or leave a session. Read `state.md` at the start of every turn while a session folder exists.