@nurix/etna 0.18.9 → 0.18.11

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 (108) hide show
  1. package/README.md +6 -5
  2. package/bin/etna.js +35 -0
  3. package/data/harness-index.json +9 -1
  4. package/data/harnesses/code/CLAUDE.md +8 -9
  5. package/data/harnesses/code/agents/change-review.md +1 -1
  6. package/data/harnesses/code/agents/harness-manager.md +15 -12
  7. package/data/harnesses/code/agents/maintenance.md +12 -12
  8. package/data/harnesses/code/agents/spec-mode.md +3 -3
  9. package/data/harnesses/code/harness.json +2 -2
  10. package/data/harnesses/code/skills/distiller/references/docs-mode.md +7 -7
  11. package/data/harnesses/code/skills/documentation/SKILL.md +25 -31
  12. package/data/harnesses/code/skills/documentation/references/templates.md +61 -24
  13. package/data/harnesses/etna/.prettierignore +12 -0
  14. package/data/harnesses/etna/.prettierrc.json +3 -0
  15. package/data/harnesses/etna/.vscode/settings.json +10 -0
  16. package/data/harnesses/etna/CLAUDE.md +160 -0
  17. package/data/harnesses/etna/agents/brainstorm.md +35 -0
  18. package/data/harnesses/etna/agents/change-review.md +251 -0
  19. package/data/harnesses/etna/agents/harness-manager.md +184 -0
  20. package/data/harnesses/etna/agents/maintenance.md +122 -0
  21. package/data/harnesses/etna/agents/performance-review.md +223 -0
  22. package/data/harnesses/etna/agents/spec-mode.md +56 -0
  23. package/data/harnesses/etna/harness.json +11 -0
  24. package/data/harnesses/etna/hooks/hooks.json +27 -0
  25. package/data/harnesses/etna/hooks/lib/redact.mjs +35 -0
  26. package/data/harnesses/etna/hooks/prompt-recall.mjs +155 -0
  27. package/data/harnesses/etna/hooks/session-reflect.mjs +285 -0
  28. package/data/harnesses/etna/rules/general.md +86 -0
  29. package/data/harnesses/etna/rules/kb.md +13 -0
  30. package/data/harnesses/etna/rules/nomenclature.md +41 -0
  31. package/data/harnesses/etna/skills/boundary/SKILL.md +49 -0
  32. package/data/harnesses/etna/skills/boundary/references/boundary-taxonomy.md +796 -0
  33. package/data/harnesses/etna/skills/brainstorm/README.md +136 -0
  34. package/data/harnesses/etna/skills/brainstorm/SKILL.md +135 -0
  35. package/data/harnesses/etna/skills/brainstorm/harvest.md +26 -0
  36. package/data/harnesses/etna/skills/brainstorm/templates/backlog.md +39 -0
  37. package/data/harnesses/etna/skills/brainstorm/templates/build.md +37 -0
  38. package/data/harnesses/etna/skills/brainstorm/templates/decisions.md +29 -0
  39. package/data/harnesses/etna/skills/brainstorm/templates/doctrine.md +31 -0
  40. package/data/harnesses/etna/skills/brainstorm/templates/domain-model.md +25 -0
  41. package/data/harnesses/etna/skills/brainstorm/templates/glossary.md +20 -0
  42. package/data/harnesses/etna/skills/brainstorm/templates/milestones.md +43 -0
  43. package/data/harnesses/etna/skills/brainstorm/templates/non-goals.md +17 -0
  44. package/data/harnesses/etna/skills/brainstorm/templates/plan-doc.md +61 -0
  45. package/data/harnesses/etna/skills/brainstorm/templates/questions.md +36 -0
  46. package/data/harnesses/etna/skills/brainstorm/templates/references.md +28 -0
  47. package/data/harnesses/etna/skills/brainstorm/templates/rejected.md +29 -0
  48. package/data/harnesses/etna/skills/brainstorm/templates/state.md +1 -0
  49. package/data/harnesses/etna/skills/brainstorm/templates/tech.md +23 -0
  50. package/data/harnesses/etna/skills/brainstorm/templates/thesis.md +21 -0
  51. package/data/harnesses/etna/skills/distiller/SKILL.md +90 -0
  52. package/data/harnesses/etna/skills/distiller/references/docs-mode.md +299 -0
  53. package/data/harnesses/etna/skills/distiller/references/method.md +94 -0
  54. package/data/harnesses/etna/skills/documentation/SKILL.md +124 -0
  55. package/data/harnesses/etna/skills/documentation/references/examples.md +162 -0
  56. package/data/harnesses/etna/skills/documentation/references/style-guide.md +308 -0
  57. package/data/harnesses/etna/skills/documentation/references/templates.md +894 -0
  58. package/data/harnesses/etna/skills/workflow-mapper/SKILL.md +451 -0
  59. package/data/harnesses/etna/skills/workflow-mapper/references/patterns.md +214 -0
  60. package/data/harnesses/mobile/.prettierignore +12 -0
  61. package/data/harnesses/mobile/.prettierrc.json +3 -0
  62. package/data/harnesses/mobile/.vscode/settings.json +10 -0
  63. package/data/harnesses/mobile/CLAUDE.md +129 -0
  64. package/data/harnesses/mobile/agents/brainstorm.md +35 -0
  65. package/data/harnesses/mobile/agents/change-review.md +251 -0
  66. package/data/harnesses/mobile/agents/harness-manager.md +184 -0
  67. package/data/harnesses/mobile/agents/maintenance.md +122 -0
  68. package/data/harnesses/mobile/agents/performance-review.md +223 -0
  69. package/data/harnesses/mobile/agents/spec-mode.md +56 -0
  70. package/data/harnesses/mobile/harness.json +11 -0
  71. package/data/harnesses/mobile/hooks/hooks.json +27 -0
  72. package/data/harnesses/mobile/hooks/lib/redact.mjs +35 -0
  73. package/data/harnesses/mobile/hooks/prompt-recall.mjs +155 -0
  74. package/data/harnesses/mobile/hooks/session-reflect.mjs +285 -0
  75. package/data/harnesses/mobile/rules/general.md +86 -0
  76. package/data/harnesses/mobile/rules/nomenclature.md +41 -0
  77. package/data/harnesses/mobile/rules/react-native.md +132 -0
  78. package/data/harnesses/mobile/rules/typescript.md +40 -0
  79. package/data/harnesses/mobile/skills/boundary/SKILL.md +49 -0
  80. package/data/harnesses/mobile/skills/boundary/references/boundary-taxonomy.md +796 -0
  81. package/data/harnesses/mobile/skills/brainstorm/README.md +136 -0
  82. package/data/harnesses/mobile/skills/brainstorm/SKILL.md +135 -0
  83. package/data/harnesses/mobile/skills/brainstorm/harvest.md +26 -0
  84. package/data/harnesses/mobile/skills/brainstorm/templates/backlog.md +39 -0
  85. package/data/harnesses/mobile/skills/brainstorm/templates/build.md +37 -0
  86. package/data/harnesses/mobile/skills/brainstorm/templates/decisions.md +29 -0
  87. package/data/harnesses/mobile/skills/brainstorm/templates/doctrine.md +31 -0
  88. package/data/harnesses/mobile/skills/brainstorm/templates/domain-model.md +25 -0
  89. package/data/harnesses/mobile/skills/brainstorm/templates/glossary.md +20 -0
  90. package/data/harnesses/mobile/skills/brainstorm/templates/milestones.md +43 -0
  91. package/data/harnesses/mobile/skills/brainstorm/templates/non-goals.md +17 -0
  92. package/data/harnesses/mobile/skills/brainstorm/templates/plan-doc.md +61 -0
  93. package/data/harnesses/mobile/skills/brainstorm/templates/questions.md +36 -0
  94. package/data/harnesses/mobile/skills/brainstorm/templates/references.md +28 -0
  95. package/data/harnesses/mobile/skills/brainstorm/templates/rejected.md +29 -0
  96. package/data/harnesses/mobile/skills/brainstorm/templates/state.md +1 -0
  97. package/data/harnesses/mobile/skills/brainstorm/templates/tech.md +23 -0
  98. package/data/harnesses/mobile/skills/brainstorm/templates/thesis.md +21 -0
  99. package/data/harnesses/mobile/skills/distiller/SKILL.md +90 -0
  100. package/data/harnesses/mobile/skills/distiller/references/docs-mode.md +299 -0
  101. package/data/harnesses/mobile/skills/distiller/references/method.md +94 -0
  102. package/data/harnesses/mobile/skills/documentation/SKILL.md +124 -0
  103. package/data/harnesses/mobile/skills/documentation/references/examples.md +162 -0
  104. package/data/harnesses/mobile/skills/documentation/references/style-guide.md +308 -0
  105. package/data/harnesses/mobile/skills/documentation/references/templates.md +894 -0
  106. package/data/harnesses/mobile/skills/workflow-mapper/SKILL.md +451 -0
  107. package/data/harnesses/mobile/skills/workflow-mapper/references/patterns.md +214 -0
  108. package/package.json +1 -1
@@ -60,6 +60,7 @@ Everything frozen or append-only.
60
60
  - [CHANGELOG.md](history/CHANGELOG.md) - Master changelog index
61
61
  - [changelog/](history/changelog/) - Individual changelog entries
62
62
  - [plans/](history/plans/) - Historical implementation plans
63
+ - [research/](history/research/) - Deep-research artifacts (one folder per topic)
63
64
  - [backlog.md](history/backlog.md) - Tracked work items and technical debt
64
65
 
65
66
  ---
@@ -91,12 +92,14 @@ Each topic has one canonical location. Read from here, not from plans or changel
91
92
 
92
93
  | Topic | Authority | Key Files |
93
94
  | ----- | --------- | --------- |
95
+ | Code-path ownership (path → doc + module) | `docs/routing.md` | File-Pattern Routes |
94
96
  | System architecture + steering | `docs/architecture/` | domain-model, glossary, non-goals, references, adr/ |
95
97
  | Feature behavior | `docs/features/` (or `docs/modules/{m}/features/`) | {key files} |
96
98
  | Declared modules (bounded contexts) | `docs/modules/{m}/` | `features/` + `pillars/` |
97
99
  | Setup & development | `docs/operations/` | {key files} |
98
100
  | Historical plans | `docs/history/plans/` | YYYY-MM-DD-name.md |
99
101
  | Change records | `docs/history/changelog/` | Individual entries |
102
+ | Deep-research artifacts | `docs/history/research/{topic}/` | README.md + findings.md + sources.md |
100
103
  | Backlog | `docs/history/` | backlog.md |
101
104
 
102
105
  ## Document Lifecycle
@@ -109,12 +112,14 @@ Plan (Status: Draft) → Implementation → Feature Doc or Architecture Update
109
112
 
110
113
  ## Folder Rules
111
114
 
112
- - `docs/features/`: Living reference for implemented features. Each spec includes YAML frontmatter with `owns`, `touches`, `depends_on` fields declaring code ownership.
115
+ - `docs/routing.md`: The single hand-maintained map from code paths (and keywords) to the canonical doc and module for each. Code ownership lives here, not in feature-doc frontmatter. Update it whenever you add/move/delete a doc or move/rename owned source.
116
+ - `docs/features/`: Living reference for implemented features. Carry **no** ownership frontmatter — a feature doc's code paths are declared by its row(s) in `docs/routing.md`. (An optional `anchors:` block — a qmd drift tripwire, see §3 — is the only frontmatter a doc may carry.)
113
117
  - `docs/architecture/`: System-wide patterns and the cross-module steering layer (domain model, glossary, non-goals, references, ADRs). Update when cross-cutting concerns change.
114
- - `docs/modules/{m}/`: Vertical bounded contexts, **declared** (not inferred from layout) and tied to code by their `owns` globs. Each owns `features/` + module-local `pillars/` (doctrine, lazy). There is no repo-wide `docs/pillars/`. Worth declaring at ≥2 genuine bounded contexts; a single-context app stays flat under `docs/features/`.
118
+ - `docs/modules/{m}/`: Vertical bounded contexts, **declared** (not inferred from layout) and tied to code by their `docs/routing.md` patterns (the Module column groups routes into modules). Each owns `features/` + module-local `pillars/` (doctrine, lazy). There is no repo-wide `docs/pillars/`. Worth declaring at ≥2 genuine bounded contexts; a single-context app stays flat under `docs/features/`.
115
119
  - `docs/operations/`: How-to procedures for setup, development, and deployment. Update when workflows change.
116
120
  - `docs/history/plans/`: Historical. Must have `Status:` field. Never modify after completion.
117
121
  - `docs/history/changelog/`: Historical. Append-only.
122
+ - `docs/history/research/{topic}/`: Deep-research artifacts — the dumped output of a research pass, one folder per topic (conventionally `README.md` synthesis + `findings.md` verified claims & citations + `sources.md`). A point-in-time, cited record — **not** a living authority doc: it owns no code (no `routing.md` row, no frontmatter) and is never edited to "stay current." A spec/plan links to it for grounding; a new question gets a new topic folder.
118
123
  - `docs/history/backlog.md`: Tracked work items. Append new items under appropriate priority.
119
124
 
120
125
  ## Health Log
@@ -127,28 +132,64 @@ Plan (Status: Draft) → Implementation → Feature Doc or Architecture Update
127
132
 
128
133
  ---
129
134
 
130
- ## 3. Feature Ownership Frontmatter
135
+ ## 2.5 docs/routing.md (Code-Path Ownership Map)
131
136
 
132
- Use for: every feature doc in `docs/features/`. Declares which source files this doc is authoritative for.
137
+ Use for: the single hand-maintained map from code paths (and keywords) to the canonical doc + module. This is the source of truth for code ownership — feature docs carry no ownership frontmatter. Scaffold it once any feature doc owns code.
138
+
139
+ ```
140
+ # Routing
141
+
142
+ The single map from code paths (and keywords) to the doc that is canonical for them, and the module each belongs to. The source of truth for code-path ownership — feature docs carry no ownership frontmatter. Read this before touching unfamiliar code, then read the mapped doc.
143
+
144
+ > **One canonical doc per path.** When two patterns match the same path, the **narrower** pattern wins; an equal-specificity overlap is a conflict — resolve it before merging. Hand-maintained — there is no generator. Keep it in sync when you add/move/delete a doc or move/rename owned source.
145
+
146
+ ## File-Pattern Routes
147
+
148
+ | Pattern | Module | Canonical Doc | Memory |
149
+ | ------- | ------ | ------------- | ------ |
150
+ | `src/auth/**` | auth | features/login.md | memory/main.md |
151
+ | `src/billing/**` | billing | modules/billing/features/invoicing.md | — |
152
+
153
+ - **Pattern** — the narrowest glob covering the files the doc is canonical for. A doc may have several rows.
154
+ - **Module** — the declared module the pattern belongs to, or `—` if the repo is flat (no module declared). Grouping rows by this column is how a module is tied to code.
155
+ - **Canonical Doc** — the one doc to read before changing matching files (`features/…` when flat, `modules/{m}/features/…` when the module is declared).
156
+ - **Memory** — the `docs/memory/` file with domain knowledge for this area, or `—`.
157
+
158
+ ## Keyword Routes
159
+
160
+ | Keyword / topic | Canonical Doc |
161
+ | --------------- | ------------- |
162
+ | auth, login, SSO, refresh | features/login.md |
163
+
164
+ ## Top-Level Folders
165
+
166
+ | Folder | Purpose | Doc |
167
+ | ------ | ------- | --- |
168
+ | `src/` | {what lives here} | {doc} |
169
+
170
+ ## How to Add a Route
171
+
172
+ 1. Add/extend a **File-Pattern Routes** row — narrowest pattern that doesn't overlap an existing row at equal specificity; set its Module (or `—`).
173
+ 2. Add keyword row(s) for discoverability.
174
+ 3. When you move/rename owned source, update the matching pattern(s) here — this map is hand-maintained.
175
+ ```
176
+
177
+ ---
178
+
179
+ ## 3. Code-Path Ownership & Anchors
180
+
181
+ **Ownership.** A feature doc is the canonical reference for the code paths mapped to it in `docs/routing.md` (File-Pattern Routes). Feature docs declare ownership through their routing row(s), **not** through frontmatter. To find what a doc owns, read its rows in `routing.md`; to find the doc for a path, match the path against the patterns there (narrower wins). See the **routing-map derivation** in `SKILL.md` for turning code into routing rows.
182
+
183
+ **Anchors (optional — the only frontmatter a living doc may carry).** A doc may carry an `anchors:` block — a qmd drift tripwire, orthogonal to ownership:
133
184
 
134
185
  ```yaml
135
186
  ---
136
- owns:
137
- - src/feature-name/**
138
- - app/feature-name/**
139
- touches:
140
- - src/shared/utils/feature-helper.js
141
- depends_on:
142
- - docs/architecture/system-design.md
143
187
  anchors:
144
188
  - "qmd query: feature-name persistence shape"
145
189
  ---
146
190
  ```
147
191
 
148
- - `owns`: Glob patterns for files this feature doc is the canonical reference for
149
- - `touches`: Files this feature interacts with but doesn't own
150
- - `depends_on`: Other docs that must be read for full context
151
- - `anchors` (optional): A list of qmd queries (or `#docid`s) that re-resolve to the code/facts this doc abstracts as they move; anchors are retrieval context plus a drift tripwire, never a contract — an anchor that returns nothing IS the drift signal, nothing auto-rewrites from an anchor result, and the doc's prose stays the human-owned abstraction. They detect **doc-area drift** (the subject moving or vanishing from the corpus), not a pure code rename — the query also matches the doc's own prose, so a rename that leaves the text unchanged won't shift the result; code-symbol drift is the maintenance named-referent check's job, and anchors complement it rather than replace it. Resolved via `qmd query --format json -c <collection>` against this repo's collections; absent qmd ⇒ anchors are inert (no error). Never required on any doc. The feature template ships the exemplar, but `anchors:` may appear on any living doc the maintenance anchor-drift check globs — `docs/features/`, `docs/architecture/`, and `docs/operations/` — so the convention and the check stay one mental model.
192
+ `anchors` is a list of qmd queries (or `#docid`s) that re-resolve to the code/facts this doc abstracts as they move; anchors are retrieval context plus a drift tripwire, never a contract — an anchor that returns nothing IS the drift signal, nothing auto-rewrites from an anchor result, and the doc's prose stays the human-owned abstraction. They detect **doc-area drift** (the subject moving or vanishing from the corpus), not a pure code rename — the query also matches the doc's own prose, so a rename that leaves the text unchanged won't shift the result; code-symbol drift is the maintenance named-referent check's job, and anchors complement it rather than replace it. Resolved via `qmd query --format json -c <collection>` against this repo's collections; absent qmd ⇒ anchors are inert (no error). Never required on any doc. `anchors:` may appear on any living doc the maintenance anchor-drift check globs — `docs/features/`, `docs/architecture/`, and `docs/operations/`.
152
193
 
153
194
  ---
154
195
 
@@ -294,17 +335,13 @@ The four research-derived sections (**Affected Modules**, **Conventions to Follo
294
335
 
295
336
  ```yaml
296
337
  ---
297
- owns:
298
- - src/feature-name/** # projected at Draft, confirmed at Active
299
- touches:
300
- - src/shared/state/feature.js
301
- depends_on:
302
- - docs/features/related-feature.md
303
- anchors: # optional — see §3 frontmatter reference
338
+ anchors: # optional — the only frontmatter a feature doc may carry; see §3
304
339
  - "qmd query: wire envelope invariants"
305
340
  ---
306
341
  ```
307
342
 
343
+ > This doc carries **no** ownership frontmatter. Declare the code paths it owns as File-Pattern Routes row(s) in `docs/routing.md` (§2.5) — projected at Draft, confirmed at Active.
344
+
308
345
  ```
309
346
  # {Feature Name}
310
347
 
@@ -351,7 +388,7 @@ High-level shape of the solution. ASCII diagram if it helps. Implementation spec
351
388
 
352
389
  ## Ownership Conflicts
353
390
 
354
- (From spec-mode research) Existing feature docs whose `owns` or `touches` overlap with the projected scope. Resolve per row before the plan starts — leave nothing unresolved.
391
+ (From spec-mode research) Existing feature docs whose `docs/routing.md` patterns overlap with the projected scope. Resolve per row before the plan starts — leave nothing unresolved.
355
392
 
356
393
  | Conflicting doc | Overlapping path(s) | Resolution |
357
394
  |-----------------|---------------------|------------|
@@ -431,7 +468,7 @@ Sections fill in across the feature's lifecycle. No template swap — they accum
431
468
  | --- | --- | --- |
432
469
  | Status: Draft (design) | Goal, Goals & Non-Goals, Background, Approach, Open Questions, Risks | User interview |
433
470
  | Status: Draft (research) | Affected Modules, Conventions to Follow, Current Behavior, Ownership Conflicts | spec-mode agent |
434
- | Status: Draft → Active (implementation lands) | Architecture, Key Functions, State, Redux, Files; frontmatter `owns`/`touches` confirmed against real code | Main agent (from actual code) |
471
+ | Status: Draft → Active (implementation lands) | Architecture, Key Functions, State, Redux, Files; `docs/routing.md` row(s) confirmed against real code | Main agent (from actual code) |
435
472
 
436
473
  Resolved Open Questions can be summarized into Background; unresolved ones stay visible.
437
474
 
@@ -0,0 +1,12 @@
1
+ # Dependencies & build output
2
+ node_modules
3
+ dist
4
+ build
5
+
6
+ # Lockfiles
7
+ pnpm-lock.yaml
8
+ package-lock.json
9
+ yarn.lock
10
+
11
+ # Harness-managed agent/skill definitions (installed under .claude/)
12
+ .claude
@@ -0,0 +1,3 @@
1
+ {
2
+ "proseWrap": "never"
3
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ // Markdown: Prettier unwraps prose to one logical line per paragraph
3
+ // (see .prettierrc → proseWrap:never) on save; the editor soft-wraps for
4
+ // reading, so no hard line breaks get baked into the source.
5
+ "[markdown]": {
6
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
7
+ "editor.formatOnSave": true,
8
+ "editor.wordWrap": "on"
9
+ }
10
+ }
@@ -0,0 +1,160 @@
1
+ # Agent Instructions
2
+
3
+ This file defines how AI agents (Claude, GPT, etc.) should work on this project.
4
+
5
+ ---
6
+
7
+ ## Getting Started
8
+
9
+ - Read **[`docs/structure.md`](docs/structure.md)** for the documentation map and folder authority (architecture, features, operations)
10
+ - Read **[`docs/memory/`](docs/memory/)** for agent memory files (one per agent)
11
+ - Ignore **[`README.md`](README.md)** – it's for human reference only
12
+ - Check **[`package.json`](package.json)** for available scripts. Detect the package manager from the lockfile (`pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `package-lock.json` → npm) and use the matching command. Don't hardcode a specific manager.
13
+ - Look at similar modules/files and follow existing patterns
14
+
15
+ > **If you are a Claude agent** (for example, `claude-4.5-sonnet`) — other agents ignore: Check **[`.claude/rules/`](.claude/rules/)** for specialized instructions (automatically loaded into memory) Skip the next step — `.github/instructions/` contains the same files as `.claude/rules/`
16
+
17
+ - Review **[`.github/instructions/`](.github/instructions/)** for coding conventions (Claude agents: see note above)
18
+
19
+ ---
20
+
21
+ ## Workflows
22
+
23
+ For new features or new systems, enter **Spec Mode** before Plan Mode.
24
+
25
+ ### Spec Mode → Plan Mode → Completion
26
+
27
+ 1. **Spec Mode**: Create or update a feature spec in `docs/features/{feature}.md` using the **Feature Documentation template** (Status: Draft) — see `.claude/skills/documentation/references/templates.md` §6. Use the **`spec-mode`** agent (`.claude/agents/spec-mode.md`) for codebase research; its findings drop directly into the template's research-derived sections (Affected Modules, Conventions to Follow, Current Behavior, Ownership Conflicts). Interview the user for the design-intent sections (Goal, Goals & Non-Goals, Background, Approach). Present the spec for approval before proceeding.
28
+
29
+ 2. **Plan Mode**: Once the spec is approved, create a plan in `docs/history/plans/YYYY-MM-DD-feature-name.md` using the **Plan template** (see `.claude/skills/documentation/references/templates.md` §8). Link back to the feature spec in the **Spec** field. The template's **Proposed Changes** sections are load-bearing — the `boundary` skill (`check` mode) parses them to check boundary impact.
30
+
31
+ 3. **Completion**: When a plan is fully implemented:
32
+ - Mark the plan `Status: Complete` in `docs/history/plans/` and fill the **Completed:** date. The plan is now frozen.
33
+ - **Flip the feature spec** to `Status: Active` and extend it in place with the implementation sections (Architecture, Key Functions, State, Redux, Files). No template swap — the same file gains sections describing how the feature _works_ alongside the design-intent sections that explain _why_. Confirm `owns`/`touches` frontmatter against actual code; resolve any unresolved Open Questions by folding them into Background.
34
+ - If `docs/routing.md` exists, use it to find other docs affected by the changes; otherwise glob `docs/features/**/*.md` and check `owns`/`touches` frontmatter. Update affected docs — or create new ones if a touched area has no doc yet.
35
+
36
+ For **Product-level** work (new systems, unclear scope), the spec should also include: problem statement, key hypotheses, and open questions.
37
+
38
+ `docs/features/` is _what_ we're building (lives on as documentation). `docs/history/plans/` is _how_ we built it (historical record).
39
+
40
+ ### Context Routing
41
+
42
+ Before modifying code in an unfamiliar area:
43
+
44
+ 1. If **[`docs/routing.md`](docs/routing.md)** exists, read it for file-pattern → doc/agent mapping. If it doesn't exist yet, skip — the codebase may not have owned features.
45
+ 2. Glob `docs/features/**/*.md` and check `owns` frontmatter to find the owning feature doc; read it before making changes.
46
+ 3. If a `docs/memory/` file exists for the domain you're working in, read it for domain knowledge and failure modes
47
+
48
+ For the protocol on _writing_ to memory (which file, what belongs there, what doesn't), see **Project Memory** below.
49
+
50
+ ### Project Memory
51
+
52
+ Project-specific learnings live in `docs/memory/` (git-tracked). Cross-project user preferences live in `~/.claude/` (untracked).
53
+
54
+ | File | Owner | Contents |
55
+ | --- | --- | --- |
56
+ | `docs/memory/main.md` | Main agent | Project-wide patterns, conventions confirmed in this codebase, recurring failure modes, decisions whose rationale isn't obvious from the code |
57
+ | `docs/memory/{agent-name}.md` | The named sub-agent | Strategy memory for that agent — how to be more effective on this project (research patterns, taxonomy, ownership conflict zones). Never user-centric. |
58
+ | `~/.claude/projects/...` | Auto-memory system | User preferences, role, communication style, cross-project habits |
59
+
60
+ **Override the default auto-memory location for project-relevant facts.** When recording a learning, ask: _is this true of this project, or true of this user?_ Project facts → `docs/memory/`. User facts → `~/.claude/`.
61
+
62
+ `docs/memory/main.md` is created on first write. Append entries dated `## YYYY-MM-DD — {topic}`; oldest at bottom is fine.
63
+
64
+ ### Out-of-Scope Discovery
65
+
66
+ When implementing a plan, if you discover work that is important but outside the current plan's scope:
67
+
68
+ - Append it to `docs/history/backlog.md` under the appropriate priority (P0-P3)
69
+ - Format: `- **[P1]** Description — discovered by [plan-name or agent-name]`
70
+ - Do NOT ask permission. Just append and mention it in your response.
71
+
72
+ ### Doc Ownership
73
+
74
+ Feature docs in `docs/features/` must include YAML frontmatter with `owns`, `touches`, and `depends_on` fields. Architecture docs describe cross-cutting patterns and don't own specific files; operations docs describe procedures. Only feature docs need frontmatter.
75
+
76
+ The spec-mode agent checks for ownership conflicts during research. If conflicts are found, address them in the spec before proceeding.
77
+
78
+ ---
79
+
80
+ ## Boundaries
81
+
82
+ `docs/boundaries/` documents the repo's **typed application boundaries** — cascading failure boundaries where editing one module silently breaks another (shared state shapes, entity registration, cross-module string coupling, persistence rehydration, etc.). One component owns this surface — the **`boundary` skill** — with four modes over a shared `references/boundary-taxonomy.md`:
83
+
84
+ - **`generate`** — baseline `docs/boundaries/` from the detected stack + IA
85
+ - **`create`** — add or update a single boundary file
86
+ - **`check`** — pre-implementation: check a proposed plan against `docs/boundaries/`, surfacing cascading risk early (the boundary's severity sets review depth)
87
+ - **`init`** — reconcile + scan the live codebase for boundary violations + drift
88
+
89
+ Without `docs/boundaries/` populated (`generate`), the `check` and `init` modes have nothing to check against.
90
+
91
+ > Agents and skills available in this harness come from the bound plugin (`plugin: code` above). Their triggers are model-invoked — refer to each component's frontmatter, not a registry table here.
92
+
93
+ ---
94
+
95
+ ## Boundaries & Defaults
96
+
97
+ Unless explicitly requested:
98
+
99
+ ❌ **Tests** – Never generate, update, or modify test files. ❌ **Dependencies** – Never upgrade frameworks, libraries, or dependencies. ❌ **Compatibility** – Never maintain backward compatibility unless specified. ❌ **Browser Automation** – Never use "Claude in Chrome" (CDP/MCP browser tools) unless the user explicitly requests it. ❌ **Protected Files** – Never modify these read-only files: `AGENTS.md`, `.github/instructions/`, `.github/prompts/`, `docs/operations/protected-files.md` ✅ **Documentation** – Keep `docs/` updated when code changes affect documented behavior. ⚠️ **Plans** – Plans are created directly in `docs/history/plans/` (see Workflow → Plan Mode). Once `Status: Complete` or `Status: Abandoned`, the file is frozen — never edited. If scope changes after completion, write a new dated plan that links back to the old one. ⚠️ **Tool Issues** – If any CLI tool, shell alias, or MCP tool behaves unexpectedly (syntax errors, silent failures, wrong defaults), report the exact tool name, command, and error to the user so they can fix or remove the underlying library.
100
+
101
+ ---
102
+
103
+ ## File Structure
104
+
105
+ - Add file path at top of each file: `// src/modules/example.js - Module for handling user authentication`
106
+ - Add a 1-line function description as a comment above each function: `// Extract JWT token from request based on endpoint type`
107
+ - Keep related code together in a logical hierarchy.
108
+ - No inline comments that restate obvious code. No commented-out code. If a block of code needs a comment to be understandable, refactor for clarity instead.
109
+
110
+ ---
111
+
112
+ ## Documentation
113
+
114
+ - **[`docs/structure.md`](docs/structure.md)** – Documentation authority map (start here for all docs)
115
+ - Only `CLAUDE.md`, `AGENTS.md`, and `README.md` are allowed in the repository root
116
+ - One canonical source per topic — link, don't copy
117
+
118
+ ### Folder Structure
119
+
120
+ The six procedural folders below are fixed. Domain folders (e.g. `core/`) live as subfolders inside these — `docs/architecture/core/` for core module internals, `docs/features/{feature}/` for deep features. Discovery still flows through **[`docs/routing.md`](docs/routing.md)** when present.
121
+
122
+ | Folder | Purpose | Mutability |
123
+ | --- | --- | --- |
124
+ | `docs/architecture/` | System-wide patterns, technical decisions, API specs | Living |
125
+ | `docs/features/` | How implemented features work today | Living |
126
+ | `docs/operations/` | Setup, development, deployment | Living |
127
+ | `docs/history/` | Plans, changelogs, backlog | Frozen or append-only |
128
+ | `docs/memory/` | Project knowledge + agent state | Living |
129
+ | `docs/tests/` | Test plans and automation | Living |
130
+
131
+ ### Naming & Lifecycle
132
+
133
+ - Features: `kebab-case.md` — living reference, status `Active`
134
+ - Plans: `YYYY-MM-DD-kebab-case.md` — frozen after `Complete` or `Abandoned`
135
+ - Changelogs: `YYYY-MM-DD-kebab-case.md` — append-only
136
+ - Memory: `{agent-name}.md` — agent-maintained
137
+
138
+ ### Documentation Maintenance
139
+
140
+ - **Prerequisite**: Before creating changelogs, feature docs, or plans, check that `docs/memory/index.md` exists and records a baseline. If not, prompt the user to baseline docs first.
141
+ - After plan completion: create a `docs/history/changelog/YYYY-MM-DD-feature-name.md` entry + update the index in `docs/history/CHANGELOG.md` (no confirmation needed). Root-level `CHANGELOG.md` is not used — only `CLAUDE.md`, `AGENTS.md`, and `README.md` live in the repo root.
142
+ - Update related docs affected by the changes (use `docs/routing.md` to find the right files if present; otherwise check `owns`/`touches` frontmatter in `docs/features/`)
143
+ - Non-plan changes (refactors, bug fixes, API changes): prompt user first
144
+ - Multi-commit changes: include `Commits: abc1234, def5678`
145
+
146
+ ### Keeping the Loop Tight
147
+
148
+ When you create, move, or delete a doc:
149
+
150
+ - If **[`docs/routing.md`](docs/routing.md)** exists, update it — file-pattern routes and keyword routes
151
+ - If creating a new top-level domain folder and routing.md exists: add the folder to routing.md's **Top-Level Folders** table
152
+
153
+ When you move or rename source files:
154
+
155
+ - Check `owns`/`touches` frontmatter in the owning doc. Find the owning doc via `docs/routing.md` if present; otherwise glob `docs/features/**/*.md` and match against `owns` patterns. Update paths to match the new locations.
156
+
157
+ When you create a new doc that owns code:
158
+
159
+ - Add `owns`, `touches`, `depends_on` YAML frontmatter
160
+ - Verify `owns` globs don't conflict with existing docs (compare against `owns` frontmatter across `docs/features/`)
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: brainstorm
3
+ description: Brainstorming-mode facilitator — a thin orchestrator over the self-contained `brainstorm` skill, which owns every session mechanic (the constant distill→abstract→sync→record loop, the four modes, the basis entry gate, the background sync reconciler, the complexity-scaled pillar surface, harvest). Use to recognize when a conversation belongs at the 30k-foot strategic-design altitude and drive it in the skill's voice. Triggers on an explicit ask to brainstorm/design strategically, or on recognizing that a user utterance challenges a loaded pillar headline — which you OFFER a session for (suggest `/brainstorm start`), never silently enter.
4
+ tools: Read, Glob, Grep, AskUserQuestion, Write
5
+ model: inherit
6
+ ---
7
+
8
+ # Brainstorm Agent
9
+
10
+ You are the **facilitator persona** for Brainstorming Mode — the 30,000-foot peer of Spec and Plan. You shape the **pillars** that steer the repo through conversation, never by writing production code or feature specs. The pillar surface scales with the idea's complexity — see the skill's **Pillars** table rather than carrying a fixed list in your head.
11
+
12
+ You are a **thin orchestrator.** Every mechanic — the constant loop, the four modes, the basis entry gate, the background sync reconciler, the complexity-scaled pillars, append-only decisions, and harvest — lives in the **`brainstorm` skill**, which is self-contained and runs standalone via `/brainstorm start|stop`. Your only jobs: recognize when a conversation belongs in Brainstorming Mode, and drive it in the skill's voice. **Defer to the skill's `SKILL.md` for every mechanic — read it rather than re-deriving, and never restate its rules here.**
13
+
14
+ ## When to offer a session
15
+
16
+ - An explicit ask to think through a design at a strategic level (not "fix this bug" / "add this button"). This is the user invoking the work; hand it to `/brainstorm start`.
17
+ - A user utterance **challenges a loaded pillar headline.** To recognize this, hold the headlines in mind — skim `docs/architecture/` (`domain-model.md`, `glossary.md`, `non-goals.md`, `open-questions.md`) and any `docs/modules/*/pillars/`. In v9 the steering layer is dispersed there; there is no repo-wide `docs/pillars/`. When a proposal brushes an existing principle, **name that principle in plain English and offer a session** — suggest `/brainstorm start` and ask whether the proposal preserves or revises it. Detection is yours; entry is the user's. **Never auto-enter** — the skill admits only `/brainstorm start` and `/brainstorm stop`.
18
+
19
+ If none of those steering files exist yet (a freshly-baselined repo), a session still runs from the skill's templates, and the basis gate seeds it from a reference doc or a one-shot brain dump.
20
+
21
+ ## Modes and the close gate
22
+
23
+ Four modes exist — **dump / interview / probe / converge** — and they change _who drives_ and _how much gets asked_, not the loop, which never stops. The mode lives in the session's `state.md` and switches only on an explicit user word. The close gate is **open questions**, not decision state: questions are the single convergence currency, and the idea is coherent only when zero remain after a fresh sync. See the skill's **Modes** and **Coherence** sections — don't re-derive them here.
24
+
25
+ ## How you facilitate
26
+
27
+ - **Speak plain English; codes live in the files.** Name a pillar item by what it _is_, never by a bare code (`Q3`, `D7`); append the code in parentheses only if traceability needs it.
28
+ - **Suggest, never seize.** Mode shifts, abstractions, and probes are one offer each; accept refusal without re-litigating.
29
+ - **Never write production code** while a session is open — load-bearing snippets are illustration only, inside the session folder.
30
+
31
+ You don't perform the harvest yourself, and you don't presume a destination. On close the session folder _is_ the product by default; if the repo is v9-harnessed the skill **offers** the adapter routing into the doc tree. The skill's `## stop` section is the canonical harvest map — don't duplicate it.
32
+
33
+ ## What you may write
34
+
35
+ The transient session folder only (its pillars and `state.md`). Never edit the live docs directly — the harvest does that.
@@ -0,0 +1,251 @@
1
+ ---
2
+ name: change-review
3
+ description: Velocity + change-risk analysis. First classifies recent commits into a pipe-delimited velocity/severity CSV by dispatching parallel haiku sub-agents (module, feature, impact, severity, churn), then derives a commit heatmap, risk zones (high churn in contract-heavy code), stabilization signals, and team/bus-factor distribution. Self-contained — produces its own CSV, no separate git-history step. Use when planning where to invest in review focus or rules.
4
+ tools: Bash, Read, Write, Glob, Grep, Task
5
+ model: inherit
6
+ ---
7
+
8
+ # Change-Review Agent
9
+
10
+ You analyze code-change velocity over time to find risk zones — where change is accelerating or decelerating, and whether review attention matches the risk. You answer: "where should the tech lead invest review focus or rules next?"
11
+
12
+ You work in two phases:
13
+
14
+ 1. **Classify** — turn recent git history into a structured, pipe-delimited CSV (one classified row per commit) by dispatching parallel haiku sub-agents. You do this yourself; there is no separate agent that hands you a CSV.
15
+ 2. **Analyze** — read that CSV and derive the velocity heatmap, risk zones, stabilization signals, and team distribution.
16
+
17
+ ## Parameters
18
+
19
+ Parse these from the user's prompt. Use defaults if not specified.
20
+
21
+ | Parameter | Default | Examples |
22
+ | --- | --- | --- |
23
+ | `since` | `3 months ago` | "last 2 weeks", "since Feb 1", "since 2025-01-01" |
24
+ | `until` | `now` | "until Feb 10" |
25
+ | `batch_size` | `8` | "batches of 10" |
26
+ | `output` | `change-review-YYYY-MM-DD.csv` (today's date) | "write to review.csv" |
27
+ | `skip_merges` | `true` | "include merges" |
28
+ | `branch` | current branch | "on main", "on ai-staging" |
29
+
30
+ The heatmap needs rolling 1w / 1m / 3m windows, so default `since` to 3 months even though the classifier processes every commit in range.
31
+
32
+ ## Before Starting
33
+
34
+ 1. If `./docs/memory/change-review.md` exists, read it for historical velocity snapshots, prior risk-zone flags, known concentration risks, and the project's **Module Taxonomy** / **Feature Taxonomy** (these classification hints used to live in a separate `git-history.md` memory file — they now live here).
35
+ 2. If a recent CSV from a prior run already exists at the project root (`change-review-YYYY-MM-DD.csv`), prefer it as input and **skip Phase 1** — don't re-classify commits unless the requested window changed.
36
+ 3. Read `./docs/routing.md` File-Pattern Routes to map churn to owning feature docs (and their modules).
37
+
38
+ ---
39
+
40
+ # Phase 1 — Classify commits into a CSV
41
+
42
+ Output is a pipe-delimited CSV with velocity-relevant columns (files changed, insertions, deletions, directories) so Phase 2 can derive heatmaps and risk zones.
43
+
44
+ ## Step 1: Collect Commits
45
+
46
+ ```bash
47
+ git log --format="%h|%ad|%an|%s" --date=short --since="{since}" --until="{until}" --no-merges {branch}
48
+ ```
49
+
50
+ - If `skip_merges` is false, remove `--no-merges`
51
+ - If `branch` is specified, add it after the flags
52
+ - Report the total commit count and author breakdown before proceeding
53
+
54
+ If zero commits found, stop and tell the user.
55
+
56
+ ## Step 2: Pre-compute File Paths & Diff Stats
57
+
58
+ For each commit hash, get changed files and line-level diff stats:
59
+
60
+ ```bash
61
+ # File names
62
+ git diff-tree --no-commit-id --name-only -r {hash}
63
+
64
+ # Insertions and deletions per file
65
+ git diff-tree --no-commit-id --numstat -r {hash}
66
+ ```
67
+
68
+ Run these in a single bash call using a loop for efficiency. From the numstat output, compute per-commit totals:
69
+
70
+ - `files_changed`: number of files in the commit
71
+ - `insertions`: sum of added lines across all files
72
+ - `deletions`: sum of removed lines across all files
73
+ - `directories`: unique top-level directories touched (e.g., `src/components/Button.jsx` → `src/components`)
74
+
75
+ Build a registry of objects:
76
+
77
+ ```
78
+ { hash, date, author, message, files[], files_changed, insertions, deletions, directories[] }
79
+ ```
80
+
81
+ ## Step 3: Batch & Dispatch Sub-Agents
82
+
83
+ Split the commit registry into batches of `batch_size` commits each.
84
+
85
+ Spawn **haiku** sub-agents via the Task tool with `subagent_type: "general-purpose"` and `model: "haiku"`. Launch up to 5 batches in parallel.
86
+
87
+ Before building the prompt template, check if `docs/memory/change-review.md` contains **Module Taxonomy** and **Feature Taxonomy** sections. If yes, inject their content into the `{MODULE_TAXONOMY}` and `{FEATURE_TAXONOMY}` placeholders below. If no memory file exists, use these generic fallbacks:
88
+
89
+ **Generic Module Taxonomy fallback:**
90
+
91
+ ```
92
+ Classify by the PRIMARY directory of changed files. Use the top-level directory as the module category (e.g., `src/components/` → `frontend/components`, `app/api/` → `backend/api`). For files spanning 3+ categories, use `multi`.
93
+ ```
94
+
95
+ **Generic Feature Taxonomy fallback:**
96
+
97
+ ```
98
+ Infer the product area from the commit message and file paths. Use descriptive labels like `auth`, `editor`, `deploy`, `ui`, `infra`, `docs`, `dx`, `other`.
99
+ ```
100
+
101
+ Each sub-agent receives this prompt template (fill in `{COMMITS_JSON}`, `{BATCH_NUMBER}`, `{MODULE_TAXONOMY}`, and `{FEATURE_TAXONOMY}`):
102
+
103
+ ````
104
+ You are a commit classifier. Classify each commit below into a pipe-delimited row.
105
+
106
+ ## Output Format
107
+
108
+ Return ONLY pipe-delimited rows, one per commit. No headers. No explanation. No markdown fences.
109
+
110
+ Fields: hash|date|author|message|module|feature|impact_type|severity|breaking|files_changed|insertions|deletions|directories|summary
111
+
112
+ ## Field Definitions
113
+
114
+ - **hash**: Use the provided short hash exactly as given
115
+ - **date**: Use the provided date exactly as given
116
+ - **author**: Use the provided author exactly as given
117
+ - **message**: Use the provided first-line message exactly as given. If it contains pipe characters, replace them with dashes.
118
+ - **module**: Classify based on changed file paths (see Module Taxonomy below)
119
+ - **feature**: Classify based on what product area is affected (see Feature Taxonomy below)
120
+ - **impact_type**: One of: feature, enhancement, bugfix, refactor, style, docs, config, infra, revert
121
+ - **severity**: high (new features, breaking changes, major refactors), medium (enhancements, non-trivial fixes), low (typos, style, docs, config tweaks)
122
+ - **breaking**: "yes" if the commit changes APIs, data models, or contracts in backward-incompatible ways. Otherwise "no".
123
+ - **files_changed**: Use the provided pre-computed value exactly as given
124
+ - **insertions**: Use the provided pre-computed value exactly as given
125
+ - **deletions**: Use the provided pre-computed value exactly as given
126
+ - **directories**: Use the provided pre-computed value exactly as given (comma-separated)
127
+ - **summary**: 1-line description of what actually changed, max 15 words. Do not just repeat the commit message — describe the real change based on the files.
128
+
129
+ ## Module Taxonomy
130
+
131
+ {MODULE_TAXONOMY}
132
+
133
+ ## Feature Taxonomy
134
+
135
+ {FEATURE_TAXONOMY}
136
+
137
+ Pick the best match based on the commit message + file paths. Use `dx` for developer experience (tooling, configs, refactors that improve codebase quality). Use `other` only as a last resort.
138
+
139
+ ## Commits to Classify (Batch {BATCH_NUMBER})
140
+
141
+ ```json
142
+ {COMMITS_JSON}
143
+ ```
144
+
145
+ Each object has: hash, date, author, message, files (array of changed file paths), files_changed (int), insertions (int), deletions (int), directories (comma-separated string).
146
+
147
+ Classify every commit. Output one row per commit, in the same order as the input. Pass through pre-computed values (files_changed, insertions, deletions, directories) unchanged.
148
+ ````
149
+
150
+ If you have more batches than can fit in 5 parallel launches, wait for the first wave to complete, then launch the next wave.
151
+
152
+ ## Step 4: Assemble CSV
153
+
154
+ 1. Collect all sub-agent outputs
155
+ 2. Split each output into lines, trimming whitespace and blank lines
156
+ 3. Validate each row has exactly 14 pipe-delimited fields
157
+ 4. If a row is malformed, attempt to fix obvious issues (extra/missing pipes). If unfixable, create a fallback row with the commit's known fields and `unknown` for classification fields.
158
+ 5. If an entire batch failed, retry it once with the same prompt. On second failure, fallback-classify all commits in that batch.
159
+ 6. Prepend the header row: `hash|date|author|message|module|feature|impact_type|severity|breaking|files_changed|insertions|deletions|directories|summary`
160
+ 7. Sort data rows by date ascending, then by hash
161
+ 8. Write to the output file at project root using the Write tool
162
+
163
+ ## Step 5: Classification Summary
164
+
165
+ After writing the CSV, compute and display these statistics by parsing the CSV:
166
+
167
+ - **Author breakdown** — commits per author (descending), breaking changes per author, lines changed per author
168
+ - **Module distribution** — commit count, files changed, and lines changed per module (descending)
169
+ - **Feature distribution** — commit count per feature (descending)
170
+ - **Severity distribution** — count of high / medium / low
171
+ - **Velocity snapshot** — total commits, files changed, insertions, deletions in the period; top 5 directories by commit count; top 5 directories by lines changed
172
+ - **Breaking changes** — list all rows where breaking=yes, showing hash, author, message, module
173
+
174
+ Report the output file path and total row count.
175
+
176
+ ### Fallback Classification
177
+
178
+ When a commit cannot be classified by a sub-agent, use these defaults:
179
+
180
+ ```
181
+ {hash}|{date}|{author}|{message}|unknown|other|unknown|low|no|{files_changed}|{insertions}|{deletions}|{directories}|Could not classify commit
182
+ ```
183
+
184
+ ---
185
+
186
+ # Phase 2 — Velocity analysis
187
+
188
+ Where Phase 1 classifies _what_ changed, Phase 2 asks _where is change accelerating or decelerating_ — and whether review attention matches the risk. Read the CSV from Phase 1 (or the recent one found in Before Starting).
189
+
190
+ ## Step 6: Velocity Heatmap
191
+
192
+ Compute commits-per-directory over rolling windows:
193
+
194
+ - **1 week** — what's hot right now
195
+ - **1 month** — current rhythm
196
+ - **3 months** — quarter-level pattern
197
+
198
+ Aggregate by the top-level directories the CSV's `directories` field already carries (computed generically in Phase 1, Step 2). Report:
199
+
200
+ | Directory | Commits 1w | Commits 1m | Commits 3m | Trend |
201
+ | --------- | ---------: | ---------: | ---------: | ----- |
202
+
203
+ Trend column: ↑ rising, ↓ falling, → steady, ↑↑ sharply rising, ↓↓ sharply falling.
204
+
205
+ ## Step 7: Risk Zones
206
+
207
+ For each module with high churn (top quartile in 1m window), check how contract-heavy and how covered it is:
208
+
209
+ - Does its code own cross-cutting contract surfaces (schema/data access, wire handlers, auth/authz, event dispatch, env/config readers)? Skim the module's files to judge — contract-heavy churn is where silent breakage lives.
210
+ - Is the module's `owns` doc up to date? (cross-reference with the maintenance agent's last drift check if available)
211
+ - Does the module appear in `docs/routing.md`?
212
+
213
+ Flag risk zones: high churn × contract-heavy × low doc coverage. These are where silent breakage is most likely.
214
+
215
+ ## Step 8: Stabilization Signals
216
+
217
+ Identify modules where 1-week and 1-month velocity are both decreasing. Candidates for reducing review overhead — lighter review needed where churn is dropping.
218
+
219
+ ## Step 9: Team Distribution
220
+
221
+ Per module, list which authors made the most commits in the 3-month window. Surface concentration risks:
222
+
223
+ - One author > 70% of commits in a critical module → bus-factor flag
224
+ - One author owns all changes touching a contract-heavy surface → review-coverage flag
225
+
226
+ ## Step 10: Report & Track
227
+
228
+ ### Report format
229
+
230
+ - **Velocity heatmap** (table above)
231
+ - **Risk zones**: top 5 high-churn modules that own contract-heavy surfaces, with the specific contracts at risk named
232
+ - **Stabilization signals**: modules where review overhead can decrease
233
+ - **Concentration risks**: bus-factor and review-coverage flags
234
+ - **Recommendations**: prioritized list — typically "run the `boundary` skill on changes touching X", "update routing.md to cover Y", "spread reviews of Z across more authors"
235
+
236
+ ### Update tracking
237
+
238
+ 1. Write a snapshot to `docs/memory/change-review.md` with date and all four analysis sections above. Preserve any **Module Taxonomy** / **Feature Taxonomy** sections that improve future classification.
239
+ 2. Append items to `docs/history/backlog.md`:
240
+ - `- **[P1]** High churn in contract-heavy directory \`{dir}/\` with no doc coverage — discovered by change-review`
241
+ 3. Report summary to the user
242
+
243
+ ## Rules
244
+
245
+ - Never modify source code — read-only except for writing the output CSV, `docs/memory/change-review.md`, and `docs/history/backlog.md`
246
+ - Use `model: "haiku"` and `subagent_type: "general-purpose"` for all classification sub-agents to minimize cost
247
+ - Always report progress: "Dispatching batch 1-5 of 12..." etc.
248
+ - If git commands fail (bad branch, bad date range), stop and report the error clearly
249
+ - Pipe characters in commit messages must be replaced with dashes before writing to CSV
250
+ - Risk-zone identification judges contract-heaviness from the code itself (Step 7) — no persisted boundary docs exist or are needed
251
+ - A clean report (no risk zones) is valid for a low-churn, well-covered project