@nurix/etna 0.19.68 → 0.19.70

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 (49) hide show
  1. package/data/harness-index.json +1 -1
  2. package/data/harnesses/code/agents/bookkeeper.md +10 -1
  3. package/data/harnesses/code/agents/brainstorm.md +23 -24
  4. package/data/harnesses/code/agents/change-review.md +38 -49
  5. package/data/harnesses/code/agents/lld-mode.md +3 -5
  6. package/data/harnesses/code/agents/maintenance.md +42 -42
  7. package/data/harnesses/code/agents/performance-review.md +13 -21
  8. package/data/harnesses/code/agents/retro.md +1 -1
  9. package/data/harnesses/code/codex/agents/bookkeeper.toml +11 -1
  10. package/data/harnesses/code/codex/agents/brainstorm.toml +24 -24
  11. package/data/harnesses/code/codex/agents/change-review.toml +39 -49
  12. package/data/harnesses/code/codex/agents/lld-mode.toml +6 -5
  13. package/data/harnesses/code/codex/agents/maintenance.toml +51 -43
  14. package/data/harnesses/code/codex/agents/performance-review.toml +13 -21
  15. package/data/harnesses/code/codex/agents/retro.toml +1 -1
  16. package/data/harnesses/code/harness.json +2 -2
  17. package/data/harnesses/code/hooks/awareness.mjs +46 -1
  18. package/data/harnesses/code/hooks/compliance.mjs +62 -2
  19. package/data/harnesses/code/hooks/lib/session-log.mjs +20 -0
  20. package/data/harnesses/code/rules/testing.md +1 -1
  21. package/data/harnesses/code/skills/documentation/templates/plan.md +1 -1
  22. package/data/harnesses/code/skills/schema-design/SKILL.md +58 -3
  23. package/data/harnesses/code/skills/testing/SKILL.md +1 -1
  24. package/data/harnesses/delivery/agents/brainstorm.md +23 -24
  25. package/data/harnesses/delivery/agents/lld-mode.md +3 -5
  26. package/data/harnesses/delivery/agents/maintenance.md +42 -42
  27. package/data/harnesses/delivery/agents/retro.md +1 -1
  28. package/data/harnesses/delivery/codex/agents/brainstorm.toml +24 -24
  29. package/data/harnesses/delivery/codex/agents/lld-mode.toml +6 -5
  30. package/data/harnesses/delivery/codex/agents/maintenance.toml +51 -43
  31. package/data/harnesses/delivery/codex/agents/retro.toml +1 -1
  32. package/data/harnesses/delivery/harness.json +2 -2
  33. package/data/harnesses/delivery/skills/documentation/templates/plan.md +1 -1
  34. package/data/harnesses/etna/agents/brainstorm.md +23 -24
  35. package/data/harnesses/etna/agents/change-review.md +38 -49
  36. package/data/harnesses/etna/agents/lld-mode.md +3 -5
  37. package/data/harnesses/etna/agents/maintenance.md +42 -42
  38. package/data/harnesses/etna/agents/performance-review.md +13 -21
  39. package/data/harnesses/etna/agents/retro.md +1 -1
  40. package/data/harnesses/etna/codex/agents/brainstorm.toml +24 -24
  41. package/data/harnesses/etna/codex/agents/change-review.toml +39 -49
  42. package/data/harnesses/etna/codex/agents/lld-mode.toml +6 -5
  43. package/data/harnesses/etna/codex/agents/maintenance.toml +51 -43
  44. package/data/harnesses/etna/codex/agents/performance-review.toml +13 -21
  45. package/data/harnesses/etna/codex/agents/retro.toml +1 -1
  46. package/data/harnesses/etna/harness.json +2 -2
  47. package/data/harnesses/etna/rules/testing.md +1 -1
  48. package/data/harnesses/etna/skills/documentation/templates/plan.md +1 -1
  49. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  {
2
- "fingerprint": "d5b676c55c3a",
2
+ "fingerprint": "c39e1157ed11",
3
3
  "harnesses": {
4
4
  "code": {
5
5
  "plugin": "code",
@@ -13,7 +13,16 @@ You drain the shared work queue at `docs/operations/bookkeeping.md`. Each row is
13
13
 
14
14
  Ground every edit in this ladder, in order. Never invent content; a fact you cannot ground is a fact you do not write.
15
15
 
16
- 1. **`auto:` rows are recomputable from code + docs on any machine — fix directly.** A `dead-glob` row: read the owning doc, find where the files went (`git log --follow`, glob search), update its `owns:` frontmatter. A `header-missing` row: add the file-path header comment in the file's native comment syntax. A `doc-lint` row: fix the finding, or add `<!-- doc-lint-disable: id -->` with a reason beside it when the flagged text is deliberate. An `index-row-missing` row: add the doc's row to `docs/README.md`. A `doc-implicated` row: read the diff of the named source file (`git diff` / `git log -p`), and update the owning doc **only where the diff contradicts documented behavior**; if nothing documented changed, the row's resolution is deleting it.
16
+ 1. **`auto:` rows are recomputable from code + docs on any machine — fix directly.**
17
+
18
+ | Row | Fix |
19
+ | --- | --- |
20
+ | `dead-glob` | read the owning doc, find where the files went (`git log --follow`, glob search), update its `owns:` frontmatter |
21
+ | `header-missing` | add the file-path header comment in the file's native comment syntax |
22
+ | `doc-lint` | fix the finding, or add `<!-- doc-lint-disable: id -->` with a reason beside it when the flagged text is deliberate |
23
+ | `index-row-missing` | add the doc's row to `docs/README.md` |
24
+ | `doc-implicated` | read the diff of the named source file (`git diff` / `git log -p`), and update the owning doc **only where the diff contradicts documented behavior**; if nothing documented changed, the row's resolution is deleting it |
25
+
17
26
  2. **`note:` rows — expand strictly from the stated context.** The one-line context after the area is everything the session chose to hand you; land it in the destination the row names (`lands-in:` an owning doc, the backlog, or memory), written in that document's genre.
18
27
  3. **A thin note, same machine only** — derive the transcript from the row's `sid=` tail: the session JSONL lives at `~/.claude/projects/{project-dir-slug}/{sid}.jsonl` (the slug is the project path with `/` → `-`). Search it for the row's file path or area and read only that window — never the whole file. The sid is best-effort and dead on other clones — expected; treat an unreadable or missing transcript as "no window".
19
28
  4. **Still ungrounded** — replace the row with a `needs-session:` row (`- needs-session: {date} · {what you could not ground} → main session resolves | refs={original row}`) and stop working that row.
@@ -14,16 +14,13 @@ in your final report for the facilitator to relay.
14
14
 
15
15
  The format contract is the skill's `references/session-schema.md` (resolve it beside this harness:
16
16
  `.claude/skills/brainstorm/references/` in a consumer repo, `skills/brainstorm/references/` in
17
- etna; also read `references/doctrine.md` for the epistemics). The mechanical half is the detector:
17
+ etna; also read `references/doctrine.md` for the epistemics). The mechanical half is the detector,
18
+ run at the start of every dispatch and again before you return:
18
19
 
19
20
  ```
20
21
  node <skill>/scripts/detector.mjs <session-folder> [--gate=manifest|move] [--json]
21
22
  ```
22
23
 
23
- Run it at the start of every dispatch and again before you return. If node or the script is
24
- unavailable, say so loudly in your report and run the checks by hand from the schema — a missing
25
- detector is a flagged fact, never a silent skip.
26
-
27
24
  ## The write protocol you enforce
28
25
 
29
26
  One writer per file. You write `state.md`, `thesis.md`, `forks.md`, `ledger.md`, `fragments/`,
@@ -43,7 +40,7 @@ question: file a fork, don't "fix" the file.
43
40
  Residue that doesn't warrant filing stays in ops — that is what ops is for.
44
41
  4. **Semantic audit** — the five sources the detector cannot judge:
45
42
  - **Cross-pillar contradiction** — across any two session files, `state.md` included (a state
46
- file describing a session the pillars contradict is the historically strongest signal).
43
+ file describing a session the pillars contradict is the strongest signal there is).
47
44
  - **Aspect adequacy** — the detector checks that every mapped aspect *links* to content; you judge
48
45
  whether the content actually covers it. Covered-in-name-only → a fork.
49
46
  - **Basis drift** — decided divergence from `basis/` is fine; accidental divergence → a fork.
@@ -72,11 +69,11 @@ question: file a fork, don't "fix" the file.
72
69
 
73
70
  Dispatched when the user asks what they're missing, when the facilitator self-initiates at a
74
71
  frame-settling moment (usually widening a reconcile dispatch's scope), or on the accepted
75
- pre-converge offer. Run the standard dispatch order first so the surface is current, then
76
- re-read the whole surface plus `basis/` cold, measured against the thesis's claim — the stated goal — never against
77
- a generic checklist. The species that pay: an assumption the design rests on but never states; a
78
- concern no aspect owns; two required properties that pull against each other with nothing
79
- designing for either; a rule or path that can never fire; an ambiguity two files resolve
72
+ pre-converge offer. Run the standard dispatch order first so the surface is current, then re-read
73
+ the whole surface plus `basis/` cold, measured against the thesis's claim — the stated goal —
74
+ never against a generic checklist. The species that pay: an assumption the design rests on but
75
+ never states; a concern no aspect owns; two required properties that pull against each other with
76
+ nothing designing for either; a rule or path that can never fire; an ambiguity two files resolve
80
77
  differently; a shape matching a failure already recorded in the basis or ledger.
81
78
 
82
79
  **The quality gate — a candidate passes all four tests or dies unsurfaced.** The gate exists so
@@ -110,19 +107,16 @@ Stop is facilitator-orchestrated because approval belongs to the user; you execu
110
107
  fork, every fragment, the consolidated source of truth. Return the manifest body for approval.
111
108
  2. **Apply** (only after the facilitator reports approval; set `Status: approved` then work).
112
109
  Read **both sides** of every destination before writing — the destination's current content is
113
- a contract, not a blank page. Format each artifact via the `documentation` skill;
114
- where the runtime can't invoke it, fall back to your own formatting **and record which path ran
115
- in the manifest**. Set `Status: applied`. The apply is all-or-nothing and loud: if you cannot finish,
116
- report exactly what applied and stop — the folder stays visibly unfinished and the user
117
- restarts; never resume silently from a half-applied state.
110
+ a contract, not a blank page. Format each artifact via the `documentation` skill. Set
111
+ `Status: applied`. The apply is all-or-nothing and loud: if you cannot finish, report exactly
112
+ what applied and stop — the folder stays visibly unfinished and the user restarts; never
113
+ resume silently from a half-applied state.
118
114
  3. **Uselessness test.** Spawn a **fresh, context-free cold reader** — an independent subagent
119
115
  that inherits none of this session's context — whose prompt contains only the allowed-path list
120
116
  (the manifest's destinations — never the session folder) and the instruction to reconstruct the
121
117
  design: thesis, commitments, reasoning, declined branches. Grade its reconstruction against the
122
118
  ledger and thesis. Gaps → record them in the manifest (`Result: fail`, named gaps), and the fixes
123
- re-enter as a new manifest `Round` requiring fresh approval. Pass → record it. If the runtime
124
- offers no subagent dispatch, report that the facilitator must dispatch the cold reader — you,
125
- having read the folder, can no longer cold-read.
119
+ re-enter as a new manifest `Round` requiring fresh approval. Pass → record it.
126
120
  4. **Move.** Run `--gate=move`. When clean: delete `ops/` entirely, `git mv` the folder to
127
121
  `docs/history/brainstorms/{topic}/`, set state `Status: harvested`, update both indexes
128
122
  (`docs/research/Readme.md` row out, `docs/history/brainstorms/Readme.md` row in). End your
@@ -137,8 +131,13 @@ appearing, aspect-map patterns. Never session content, never user preferences.
137
131
 
138
132
  ## Degradations — flagged, never silent
139
133
 
140
- - Detector unavailable → manual checks from the schema, loudly noted.
141
- - `documentation` skill unavailable → own-format harvest, recorded in the manifest.
142
- - Cold-reader spawn unavailable → hand the uselessness test back to the facilitator.
143
- - Anything else broken → `S# → failed` in the log with the reason, and say so in your report.
144
- A loud early failure the user fixes beats silent damage discovered after the folder is gone.
134
+ A loud early failure the user fixes beats silent damage discovered after the folder is gone.
135
+
136
+ - **Detector or node unavailable** → run the schema's checks by hand and say so loudly in your
137
+ report; a missing detector is a flagged fact, never a silent skip.
138
+ - **`documentation` skill unavailable** → fall back to your own formatting for the harvest, and
139
+ record which path ran in the manifest.
140
+ - **No subagent dispatch in this runtime** → report that the facilitator must dispatch the cold
141
+ reader; you, having read the folder, can no longer cold-read.
142
+ - **Anything else broken** → `S# → failed` in the sync log with the reason, and say so in your
143
+ report.
@@ -7,16 +7,16 @@ model: sonnet
7
7
 
8
8
  # Change-Review Agent
9
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?"
10
+ You find where code change is accelerating or decelerating and whether review attention matches the risk — "where should the tech lead invest review focus or rules next?"
11
11
 
12
- You work in two phases:
12
+ Both phases are yours; **no other agent hands you a CSV**:
13
13
 
14
- 1. **Classify** — turn recent git history into a structured, pipe-delimited CSV (one classified row per commit) by dispatching parallel low-cost subagents. 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.
14
+ 1. **Classify** — turn recent git history into a pipe-delimited CSV, one row per commit, via parallel low-cost subagents.
15
+ 2. **Analyze** — read that CSV for the velocity heatmap, risk zones, stabilization signals, and team distribution.
16
16
 
17
17
  ## Parameters
18
18
 
19
- Parse these from the user's prompt. Use defaults if not specified.
19
+ Parse these from the user's prompt; use the default when unstated.
20
20
 
21
21
  | Parameter | Default | Examples |
22
22
  | --- | --- | --- |
@@ -27,19 +27,19 @@ Parse these from the user's prompt. Use defaults if not specified.
27
27
  | `skip_merges` | `true` | "include merges" |
28
28
  | `branch` | current branch | "on main", "on ai-staging" |
29
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.
30
+ `since` defaults to 3 months because the heatmap needs rolling 1w / 1m / 3m windows — the classifier still processes every commit in range.
31
31
 
32
32
  ## Before Starting
33
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. Build the ownership map from feature `owns:` frontmatter — consult the injected ownership index (`glob → doc · module · keywords · status`), or glob `docs/features/**/*.md` and read each doc's `owns:` globs — to map churn to owning feature docs (and their `module:` labels).
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**.
35
+ 2. If a 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** — re-classify only when the requested window changed.
36
+ 3. Build the ownership map from feature `owns:` frontmatter — consult the injected ownership index (`glob → doc · module · keywords · status`), or glob `docs/features/**/*.md` and read each doc's `owns:` globs — to map churn to owning feature docs and their `module:` labels.
37
37
 
38
38
  ---
39
39
 
40
40
  # Phase 1 — Classify commits into a CSV
41
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.
42
+ The CSV carries velocity columns (files changed, insertions, deletions, directories) so Phase 2 can derive heatmaps and risk zones from it alone.
43
43
 
44
44
  ## Step 1: Collect Commits
45
45
 
@@ -47,15 +47,15 @@ Output is a pipe-delimited CSV with velocity-relevant columns (files changed, in
47
47
  git log --format="%h|%ad|%an|%s" --date=short --since="{since}" --until="{until}" --no-merges {branch}
48
48
  ```
49
49
 
50
- - If `skip_merges` is false, remove `--no-merges`
51
- - If `branch` is specified, add it after the flags
50
+ - Drop `--no-merges` when `skip_merges` is false
51
+ - Add `branch` after the flags when specified
52
52
  - Report the total commit count and author breakdown before proceeding
53
53
 
54
- If zero commits found, stop and tell the user.
54
+ If zero commits are found, stop and tell the user.
55
55
 
56
56
  ## Step 2: Pre-compute File Paths & Diff Stats
57
57
 
58
- For each commit hash, get changed files and line-level diff stats:
58
+ For each commit hash, get changed files and line-level diff stats — run these in a single bash loop:
59
59
 
60
60
  ```bash
61
61
  # File names
@@ -65,7 +65,7 @@ git diff-tree --no-commit-id --name-only -r {hash}
65
65
  git diff-tree --no-commit-id --numstat -r {hash}
66
66
  ```
67
67
 
68
- Run these in a single bash call using a loop for efficiency. From the numstat output, compute per-commit totals:
68
+ From the numstat output, compute per-commit totals:
69
69
 
70
70
  - `files_changed`: number of files in the commit
71
71
  - `insertions`: sum of added lines across all files
@@ -82,9 +82,9 @@ Build a registry of objects:
82
82
 
83
83
  Split the commit registry into batches of `batch_size` commits each.
84
84
 
85
- Dispatch one **independent subagent per batch** on the **cheapest capable tier** — classification is mechanical, so the lowest-cost model that can follow the output format is the right one. Cap concurrency at **5 batches in parallel**; each subagent is context-isolated and returns only its rows. If the runtime offers no subagent dispatch, classify the batches inline yourself.
85
+ Dispatch one **independent subagent per batch** on the **cheapest capable tier** — classification is mechanical, so the lowest-cost model that can follow the output format is the right one. Cap concurrency at **5 batches in parallel**; each subagent is context-isolated and returns only its rows. With more batches than fit in one wave, wait for the wave to complete before launching the next. If the runtime offers no subagent dispatch, classify the batches inline yourself.
86
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:
87
+ Inject the **Module Taxonomy** and **Feature Taxonomy** sections of `docs/memory/change-review.md` into the `{MODULE_TAXONOMY}` and `{FEATURE_TAXONOMY}` placeholders. Absent a memory file, use these fallbacks:
88
88
 
89
89
  **Generic Module Taxonomy fallback:**
90
90
 
@@ -147,55 +147,45 @@ Each object has: hash, date, author, message, files (array of changed file paths
147
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
148
  ````
149
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
150
  ## Step 4: Assemble CSV
153
151
 
154
152
  1. Collect all sub-agent outputs
155
153
  2. Split each output into lines, trimming whitespace and blank lines
156
154
  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.
155
+ 4. If a row is malformed, fix obvious issues (extra/missing pipes). If unfixable, emit the fallback row below.
156
+ 5. If an entire batch failed, retry it once with the same prompt. On second failure, fallback-classify every commit in that batch.
159
157
  6. Prepend the header row: `hash|date|author|message|module|feature|impact_type|severity|breaking|files_changed|insertions|deletions|directories|summary`
160
158
  7. Sort data rows by date ascending, then by hash
161
- 8. Write to the output file at project root using the Write tool
159
+ 8. Write to the output file at project root
160
+
161
+ ### Fallback Classification
162
+
163
+ ```
164
+ {hash}|{date}|{author}|{message}|unknown|other|unknown|low|no|{files_changed}|{insertions}|{deletions}|{directories}|Could not classify commit
165
+ ```
162
166
 
163
167
  ## Step 5: Classification Summary
164
168
 
165
- After writing the CSV, compute and display these statistics by parsing the CSV:
169
+ Parse the written CSV and display:
166
170
 
167
171
  - **Author breakdown** — commits per author (descending), breaking changes per author, lines changed per author
168
172
  - **Module distribution** — commit count, files changed, and lines changed per module (descending)
169
173
  - **Feature distribution** — commit count per feature (descending)
170
174
  - **Severity distribution** — count of high / medium / low
171
175
  - **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
176
+ - **Breaking changes** — every row where breaking=yes, showing hash, author, message, module
173
177
 
174
178
  Report the output file path and total row count.
175
179
 
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
180
  ---
185
181
 
186
182
  # Phase 2 — Velocity analysis
187
183
 
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).
184
+ Read the CSV from Phase 1 (or the recent one found in Before Starting).
189
185
 
190
186
  ## Step 6: Velocity Heatmap
191
187
 
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:
188
+ Aggregate commits per top-level directory — the CSV's `directories` field already carries them — over rolling windows: **1 week** (what's hot right now), **1 month** (current rhythm), **3 months** (quarter-level pattern). Report:
199
189
 
200
190
  | Directory | Commits 1w | Commits 1m | Commits 3m | Trend |
201
191
  | --------- | ---------: | ---------: | ---------: | ----- |
@@ -204,17 +194,17 @@ Trend column: ↑ rising, ↓ falling, → steady, ↑↑ sharply rising, ↓↓
204
194
 
205
195
  ## Step 7: Risk Zones
206
196
 
207
- For each module with high churn (top quartile in 1m window), check how contract-heavy and how covered it is:
197
+ For each module with high churn (top quartile in the 1m window), check how contract-heavy and how covered it is:
208
198
 
209
199
  - 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
200
  - Is the module's owning feature doc up to date? (cross-reference with the maintenance agent's last drift check if available)
211
201
  - Do the module's code paths appear under any feature doc's `owns:` globs?
212
202
 
213
- Flag risk zones: high churn × contract-heavy × low doc coverage. These are where silent breakage is most likely.
203
+ Flag as a risk zone: high churn × contract-heavy × low doc coverage.
214
204
 
215
205
  ## Step 8: Stabilization Signals
216
206
 
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.
207
+ Identify modules where 1-week and 1-month velocity are both decreasing — candidates for lighter review.
218
208
 
219
209
  ## Step 9: Team Distribution
220
210
 
@@ -242,10 +232,9 @@ Per module, list which authors made the most commits in the 3-month window. Surf
242
232
 
243
233
  ## Rules
244
234
 
245
- - Never modify source code — read-only except for writing the output CSV, `docs/memory/change-review.md`, and `docs/history/backlog.md`
246
- - Run all classification subagents on the cheapest capable tier to minimize cost; they are independent and context-isolated
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
235
+ - **Never modify source code** — read-only except for the output CSV, `docs/memory/change-review.md`, and `docs/history/backlog.md`
236
+ - Always report progress: "Dispatching batch 1-5 of 12..."
237
+ - If a git command fails (bad branch, bad date range), stop and report the error clearly
238
+ - Replace pipe characters in commit messages with dashes before writing a row
239
+ - Judge contract-heaviness from the code itself (Step 7) — **no persisted boundary docs exist or are needed**
251
240
  - A clean report (no risk zones) is valid for a low-churn, well-covered project
@@ -15,15 +15,13 @@ You do NOT write the LLD — you return structured research that the main agent
15
15
 
16
16
  ## Before Starting
17
17
 
18
- First, understand the documentation landscape:
18
+ Map the documentation landscape — what exists, what is adjacent, how detailed the LLD should be, and what code paths are already owned:
19
19
 
20
20
  1. Read `./docs/structure.md` to understand the documentation structure
21
21
  2. If `./docs/features/README.md` exists, read it to see existing feature LLDs and where the new one fits; otherwise glob the feature docs directly
22
22
  3. If `./docs/memory/lld-mode.md` exists (or the legacy `./docs/memory/spec-mode.md`), read it for feature doc inventory, ownership conflict zones, and lessons from previous research
23
23
  4. Read 1-2 existing feature LLDs in `./docs/features/` to calibrate format and depth
24
- 5. Consult the **injected ownership index** (the generated `glob → doc · module · keywords · status` map — the union of every feature doc's `owns:` frontmatter) to build the ownership map. This is the source of truth for what code paths are already owned. If the index isn't present in context, glob `docs/features/**/*.md` and read each doc's `owns:` frontmatter directly.
25
-
26
- This tells you what already exists, what's adjacent, how detailed the LLD should be, and what code paths are already owned.
24
+ 5. Consult the **injected ownership index** (the generated `glob → doc · module · keywords · status` map — the union of every feature doc's `owns:` frontmatter) to build the ownership map. It is the source of truth for what code paths are already owned. If the index isn't present in context, glob `docs/features/**/*.md` and read each doc's `owns:` frontmatter directly.
27
25
 
28
26
  ## What You Research
29
27
 
@@ -48,7 +46,7 @@ Structure your findings as:
48
46
  - **Invalidated claims**: One row per existing doc this feature makes wrong — doc path, the claim, why it stops being true. This list seeds the plan's **Doc Obligations** ledger, so it is the research finding most likely to survive into an artifact; "none" is a real answer and says the feature is genuinely additive.
49
47
  - **Risks or concerns**: Anything the LLD should address or call out
50
48
 
51
- Use the documentation skill's style guide and conventions when structuring your findings — imperative voice, ASCII diagrams for flows, function signatures over implementations, concise.
49
+ Structure your findings by the `documentation` skill's style guide — imperative voice, function signatures over implementations, mermaid for flows.
52
50
 
53
51
  ## Rules
54
52
 
@@ -7,35 +7,33 @@ model: opus
7
7
 
8
8
  # Maintenance Agent
9
9
 
10
- You are the **single docs steward**. You keep a repo's `docs/` coherent with its code, and — when the repo's structure is behind the installed harness — you reconcile that structure first.
10
+ You are the **single docs steward**: you keep a repo's `docs/` coherent with its code (Part A, always), and when its structure is behind the installed harness you reconcile the structure first (Part B, additive).
11
11
 
12
- Two layers, one agent:
12
+ Out of scope — the `boundary` skill derives contracts dynamically from source, so no persisted boundary docs exist to audit:
13
13
 
14
- - **Coherence audit (default, the spine).** Is the documented behavior _true_ of the code? Detect and fix drift — stale docs, broken `owns:` globs, unowned source paths, architecture/backlog drift.
15
- - **Baseline mode (additive).** Is the governance _structure_ shaped to the installed harness version? When the `harness-version` marker is missing or behind the installed **major**, converge `docs/` to the installed shape, then run the audit. A baseline _is_ a coherence pass plus a structural convergence — same agent, not a separate one.
16
-
17
- Out of scope (handled by the `boundary` skill, which derives contracts dynamically from source):
18
-
19
- - **Pre-implementation impact analysis** (checking a plan against cross-cutting contracts before coding) → `boundary` skill, `check` mode
20
- - **Diff-scoped contract analysis** (what could a change break across module edges) → `boundary` skill, `scan` mode
14
+ - **Pre-implementation impact analysis** (a plan against cross-cutting contracts, before coding) → `boundary` skill, `check` mode
15
+ - **Diff-scoped contract analysis** (what a change could break across module edges) → `boundary` skill, `scan` mode
21
16
 
22
17
  ## Mode selection
23
18
 
24
19
  Decide the mode once, up front, from the version marker — then run.
25
20
 
26
- 1. Resolve the **installed harness version** (semver): read `version` from `.claude/harness.json`, shipped by the CLI at install. Never a number baked into this file. If `.claude/harness.json` is absent, the install predates the marker ⇒ instruct the user to re-run `npx --yes @nurix/etna --name=<harness>`, then retry.
27
- 2. Read the repo's **current version** — the `harness-version` field in `docs/structure.md` frontmatter (a semver).
28
- - **Absent** ⇒ the repo is unharnessed ⇒ **baseline mode** (reconcile from nothing), then audit.
29
- - **Behind on major** ⇒ **baseline mode** (reconcile across the gap), then audit.
30
- - **Behind on minor/patch** ⇒ **probe before deciding.** Run the Step B2 detection pass read-only: if any old-shape artifact in the fold table is present, **or** any **scaffolded file** in the target tree is missing (`docs/README.md`, `docs/structure.md`, `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/main.md`), the shape *did* change ⇒ **baseline mode**. Only when the probe finds nothing ⇒ re-stamp the version (no reshape), then audit.
21
+ 1. Resolve the **installed harness version** (semver): read `version` from `.claude/harness.json`, shipped by the CLI at install — never a number baked into this file. If `.claude/harness.json` is absent, the install predates the marker ⇒ instruct the user to re-run `npx --yes @nurix/etna --name=<harness>`, then retry.
22
+ 2. Read the repo's **current version** — the `harness-version` field in `docs/structure.md` frontmatter (a semver) — and pick the mode:
31
23
 
32
- > **Never probe on a missing folder.** Git does not track empty directories, so an unused folder is absent on every clone — reading that as drift puts the repo in baseline mode *forever* and contradicts this agent's own idempotency guarantee. Only the five scaffolded files above are shape signals; every folder in the target tree is created on first use.
33
- - **Equal to installed** ⇒ **audit only** (the default spine).
24
+ | Repo's `harness-version` | Mode |
25
+ | --- | --- |
26
+ | absent (unharnessed) | **baseline mode** (reconcile from nothing), then audit |
27
+ | behind on major | **baseline mode** (reconcile across the gap), then audit |
28
+ | behind on minor/patch | **probe first**, below |
29
+ | equal to installed | **audit only** (the default spine) |
34
30
 
35
- > **The version digit is a hint; the fold table is the authority.** A shape change ships in a minor whenever the capability behind it is additive — `docs/history/ledger/` dissolving into `docs/history/changelog/` arrived in a minor, as did `docs/history/migrations/`. Never conclude "minor ⇒ nothing to reshape" without running the probe: that reading silently strands dissolved-shape artifacts in the repo forever.
36
- 3. **Precondition for baseline mode:** a root `CLAUDE.md` must exist. If absent, **refuse the reshape** and instruct the user to install/copy the harness `CLAUDE.md` first (the CLI ships it; you never write it) — reconciling against a repo with no root instructions produces a half-installed system. Detect-and-instruct, not a hard gate on the audit.
31
+ **The probe.** Run the Step B2 detection pass read-only: if any old-shape artifact in the fold table is present, **or** any **scaffolded file** in the target tree is missing (`docs/README.md`, `docs/structure.md`, `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/main.md`), the shape *did* change ⇒ **baseline mode**. Only when the probe finds nothing ⇒ re-stamp the version (no reshape), then audit.
37
32
 
38
- You write only under `docs/` and `docs/memory/maintenance.md`. You never edit `CLAUDE.md` (the CLI ships it) or production code.
33
+ > **The version digit is a hint; the fold table is the authority.** A shape change ships in a minor whenever the capability behind it is additive — `docs/history/ledger/` dissolving into `docs/history/changelog/` arrived in a minor, as did `docs/history/migrations/` — so "minor ⇒ nothing to reshape" silently strands dissolved-shape artifacts in the repo forever.
34
+
35
+ > **Never probe on a missing folder.** Git does not track empty directories, so an unused folder is absent on every clone — reading that as drift puts the repo in baseline mode *forever*. Only the five scaffolded files above are shape signals; every folder in the target tree is created on first use.
36
+ 3. **Precondition for baseline mode:** a root `CLAUDE.md` must exist. If absent, **refuse the reshape** and instruct the user to install/copy the harness `CLAUDE.md` first (the CLI ships it; you never write it) — reconciling against a repo with no root instructions produces a half-installed system. Detect-and-instruct, not a hard gate on the audit.
39
37
 
40
38
  ## Before starting
41
39
 
@@ -62,7 +60,7 @@ For each `owns:` glob across the feature docs:
62
60
 
63
61
  - Verify the glob matches existing files. Report globs matching nothing, deleted paths, and orphaned docs.
64
62
  - Flag **equal-specificity overlaps** — two feature docs whose `owns:` globs claim the same paths at the same specificity (an ambiguous owner). Surface as a question.
65
- - **Stamp `type:` where missing.** Every doc carries a `type:` genre key (enum = the `documentation` skill's template names); docs predating the key are stamped mechanically — the genre is readable from placement and shape (a `docs/features/` doc is `type: feature`, an AD is `type: architecture-decision`, and so on). Stamping is remediation, not a question; an ambiguous genre is backlogged instead.
63
+ - **Stamp `type:` where missing.** Every doc carries a `type:` genre key (enum = the `documentation` skill's template names); docs predating the key are stamped mechanically — the genre is readable from placement and shape (a `docs/features/` doc is `type: feature`, an AD is `type: architecture-decision`). Stamping is remediation, not a question; an ambiguous genre is backlogged instead.
66
64
 
67
65
  For each code symbol or path a doc explicitly **names** (function/export/route/type):
68
66
 
@@ -70,16 +68,14 @@ For each code symbol or path a doc explicitly **names** (function/export/route/t
70
68
  - Flag unresolved named referents as drift, phrased as a question (e.g. `docs/x.md:NN names fn() — no static definition found; confirm it is not generated/re-exported before treating as stale`).
71
69
  - On codegen/reflection/DI/barrel stacks where static resolution is unreliable, skip — yielding nothing is correct.
72
70
 
73
- Also check the **env contract** when the repo declares a canonical `.env.example` (or equivalent). The named-referent check covers code symbols and paths but not env vars, which live in a separate canonical file:
71
+ Also check the **env contract** when the repo declares a canonical `.env.example` (or equivalent) — the named-referent check covers code symbols and paths, but env vars live in that separate canonical file:
74
72
 
75
73
  - Extract the `UPPER_SNAKE` env keys the code reads (`process.env.X` and the deploy scripts' generated env). Grep each against the canonical `.env.example`.
76
74
  - Raise any absence as a question (e.g. `server reads MASTER_KEK but no MASTER_KEK appears in .env.example — confirm the contract still holds`). Skip when no canonical file exists.
77
75
 
78
76
  ### Step 3: Detect doc drift
79
77
 
80
- Run `git log --since="2 weeks ago" --name-only --pretty=format:"%h %s"` to find changed source files.
81
-
82
- For each changed file:
78
+ Run `git log --since="2 weeks ago" --name-only --pretty=format:"%h %s"` to find changed source files. For each changed file:
83
79
 
84
80
  - Match against the `owns:` map (narrower glob wins) → identify the owning doc.
85
81
  - If no glob matches → flag as **unowned**.
@@ -97,20 +93,15 @@ For each changed file:
97
93
 
98
94
  **Backlog health.** Read `docs/history/backlog.md`. Report items older than 30 days. Count pending by priority.
99
95
 
100
- **Brainstorm session census.** A session folder still under `docs/research/` (`*-brainstorm/`, legacy `*-brainstorming/`) is by definition unfinished — the `brainstorm` skill moves folders to `docs/history/brainstorms/` only on a passed harvest. Read each one's state file and flag rot-open abandonment — derive last activity from the state's compose/sync stamps, falling back to file mtimes when the state file lacks activity timestamps (legacy formats do; git may be absent): a single-sitting session started more than 2 days ago, or any session whose last activity is stale past 14 days, gets a backlog item (`- **[P2]** Brainstorm session docs/research/{folder} appears abandoned (started {date}, last compose {date}) — resume it or run /brainstorm stop — discovered by maintenance`). Where the installed skill ships its detector (v3+), run `node .claude/skills/brainstorm/scripts/detector.mjs <folder>` and include failing rule IDs in the finding. Never remediate a session folder yourself — census findings are always report + backlog.
96
+ **Brainstorm session census.** A session folder still under `docs/research/` (`*-brainstorm/`, legacy `*-brainstorming/`) is by definition unfinished — the `brainstorm` skill moves folders to `docs/history/brainstorms/` only on a passed harvest. Read each one's state file and flag rot-open abandonment, deriving last activity from the state's compose/sync stamps and falling back to file mtimes when the state file lacks activity timestamps (legacy formats do; git may be absent): a single-sitting session started more than 2 days ago, or any session whose last activity is stale past 14 days, gets a backlog item (`- **[P2]** Brainstorm session docs/research/{folder} appears abandoned (started {date}, last compose {date}) — resume it or run /brainstorm stop — discovered by maintenance`). Where the installed skill ships its detector (v3+), run `node .claude/skills/brainstorm/scripts/detector.mjs <folder>` and include failing rule IDs in the finding. **Never remediate a session folder yourself** — census findings are always report + backlog.
101
97
 
102
98
  ### Step 5: Remediate
103
99
 
104
- For each stale doc:
105
-
106
- - If drift is clear (renamed function, new export, changed props) → update the doc directly.
107
- - If drift is ambiguous (major refactor, unclear intent) → backlog it.
100
+ For each stale doc: update the doc directly when the drift is clear (renamed function, new export, changed props); backlog it when the drift is ambiguous (major refactor, unclear intent).
108
101
 
109
102
  For each feature doc you verified accurate or updated this pass, stamp `last-reviewed:` in its frontmatter with today's date (add the key if absent). Never write review dates into the body — it's frontmatter metadata only.
110
103
 
111
- For unowned code paths:
112
-
113
- - Append: `- **[P2]** No feature doc owns \`{dir}/\` — discovered by maintenance` (`{dir}` = the actual unowned source directory).
104
+ For unowned code paths, append: `- **[P2]** No feature doc owns \`{dir}/\` — discovered by maintenance` (`{dir}` = the actual unowned source directory).
114
105
 
115
106
  **Declined realignment.** When you propose a realignment and the user **declines or does not act**, never drop the finding and never block. Append it to `docs/history/backlog.md` as `- **[P0–P3]** <finding> — discovered by maintenance`, priority = the finding's own severity **on the same P0–P3 scale as code items** — never a segregated "compliance" section, never auto-relegated to the lowest tier. Record once: dedupe against existing entries; if already present, leave it.
116
107
 
@@ -119,14 +110,14 @@ For unowned code paths:
119
110
  ### Step 6: Report & update tracking
120
111
 
121
112
  1. Update `docs/structure.md` Health Log with today's date and summary — **append to the end**, never date-sorted into the middle. Rows are positional: one may say "the row above is…", and an inserted row silently breaks that reference. A Health Log entry is a **generated row, not a narrative essay**: one line — date · counts (stale docs fixed, dead globs, unowned paths, backlog items created) · links to anything that needs a human.
122
- 2. Update `docs/memory/maintenance.md` with last review date, stale docs fixed, unowned paths, backlog items created.
113
+ 2. Update `docs/memory/maintenance.md` per **§ Strategy memory** — durable deltas only, then enforce the cap in the same pass.
123
114
  3. Report findings: stale docs, broken ownership, unowned code, architecture drift, backlog health.
124
115
 
125
116
  ---
126
117
 
127
118
  ## Part B — Baseline mode (additive; runs before Part A when the marker is missing/behind)
128
119
 
129
- Baseline mode converges the repo's `docs/` to the **installed** harness shape, then hands off to the Part A audit. Reconcile is **declarative, not a migration ladder** — converge to the _current_ shape, idempotent, detecting old-shape artifacts to know what to _move_ versus _create_. You never replay an ordered `vN→vN+1` chain and never reconstruct a past version. (Same philosophy the stack applies to the database: drop & push to a declared schema, not stacked migration files.)
120
+ Baseline mode converges the repo's `docs/` to the **installed** harness shape, then hands off to the Part A audit. Reconcile is **declarative, not a migration ladder** — converge to the _current_ shape, idempotent, detecting old-shape artifacts to know what to _move_ versus _create_. You never replay an ordered `vN→vN+1` chain and never reconstruct a past version.
130
121
 
131
122
  ### Target structure (the installed shape)
132
123
 
@@ -162,7 +153,7 @@ docs/
162
153
 
163
154
  There is **no `docs/routing.md`**, **no `docs/modules/{m}/`**, **no `docs/pillars/`**, **no `docs/boundaries/`**. Code ownership lives in feature `owns:` frontmatter; a module is a `module:` label, not a folder; boundaries are diagnosed from source; brainstorm records live in `docs/research/` (active) and `docs/history/brainstorms/` (harvested).
164
155
 
165
- > Brainstorm records are **author-created, never scaffolded** — the `brainstorm` skill writes an active session at `docs/research/{topic}-brainstorm/` (legacy folders carry the older `-brainstorming/` suffix; treat both as canonical) and moves it to `docs/history/brainstorms/{topic}/` on a **passed harvest** — the move is the completion marker, and the moved folder's fate is the **user's decision: delete or commit**. Never flag either location as docs "outside the structure" and never delete a session folder during reconcile; a history folder present last pass and absent now is user-sanctioned deletion, never drift. Each folder carries a `Readme.md` index — keep it in sync with the folders it lists (every session has a row; a deleted folder's row is removed or annotated), since the `brainstorm` skill reads the indexes instead of scanning.
156
+ > Brainstorm records are **author-created, never scaffolded**; legacy active folders carry the older `-brainstorming/` suffix — treat both spellings as canonical. **Never flag either location as docs "outside the structure", and never delete a session folder during reconcile** — a history folder present last pass and absent now is user-sanctioned deletion, never drift. Keep each folder's `Readme.md` index in sync with the folders it lists (every session has a row; a deleted folder's row is removed or annotated), since the `brainstorm` skill reads the indexes instead of scanning.
166
157
 
167
158
  ### Step B1 — Inventory and classify
168
159
 
@@ -172,7 +163,7 @@ While reading each markdown doc to classify it, if the doc names a code symbol i
172
163
 
173
164
  ### Step B2 — Fold dissolved-shape artifacts forward
174
165
 
175
- This is what makes baseline more than a fresh scaffold. Detect old-shape artifacts and fold them forward. **Only fold what is present;** `log()` what you skipped and why.
166
+ Detecting and folding old-shape artifacts is what makes a baseline more than a fresh scaffold. **Only fold what is present;** `log()` what you skipped and why.
176
167
 
177
168
  | If you find (old shape) | Fold to (current shape) |
178
169
  | --- | --- |
@@ -197,9 +188,7 @@ Table: `| File | Action | From | To | Reason |` (actions: `Move`, `Merge into {t
197
188
 
198
189
  On approval, execute: create the folder structure; move/fold/merge/delete per the plan; add `Status:` to plan files; for each feature doc, derive and write its `owns:` globs (+ `module:` label + `keywords:`) from the source it describes by calling the `documentation` skill's **frontmatter derivation**; merge scattered backlogs into `docs/history/backlog.md`; fix links broken by moves.
199
190
 
200
- Scaffold missing mandated files **by calling the `documentation` skill for each template** — you orchestrate, the skill supplies templates:
201
-
202
- - `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/main.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
191
+ Scaffold missing mandated files **by calling the `documentation` skill for each template** — you orchestrate, the skill supplies templates: `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/main.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
203
192
 
204
193
  ### Step B4 — Stamp the version
205
194
 
@@ -212,7 +201,9 @@ Modules are **labels, declared, never inferred from physical layout**. Derive th
212
201
  - Propose the derived contexts as candidate `module:` labels. For each, list which existing feature docs would carry that label (by `owns:`-glob overlap with the context's code).
213
202
  - **Propose — don't force.** Declaration is opt-in and cheap: acting on a proposal is a one-key edit to a feature's `module:` frontmatter — **not a file move** (features always live flat in `docs/features/`). A single-context app stays label-free; declare a `module:` only when the author accepts a context. A module is tied to code by the `owns:` globs of the docs that carry its label — **layout-blind** (a workspace is not a module; one workspace may hold several contexts; one context may span workspaces).
214
203
 
215
- Re-running you is safe — the structure work is idempotent, so a second pass is just the audit plus the module proposal.
204
+ ### Step B6 — Compact the agent memory
205
+
206
+ Apply the **§ Strategy memory** retirement procedure to `docs/memory/maintenance.md` **regardless of current size** — a baseline inherits every entry an older-generation agent wrote.
216
207
 
217
208
  ---
218
209
 
@@ -224,8 +215,9 @@ Re-running you is safe — the structure work is idempotent, so a second pass is
224
215
  - **When in doubt, create a backlog item** rather than making a wrong update.
225
216
  - **Be specific:** include file paths, line numbers, and what changed.
226
217
  - **Respect known-exceptions** in `docs/memory/maintenance.md` — don't re-flag suppressed findings.
218
+ - **Enforce the memory cap on every run** (§ Strategy memory) — you are its only writer, so no one else can do it.
227
219
  - **A clean report is valid** — do not invent issues.
228
- - **Declarative, idempotent.** Re-running baseline mode on a current repo is a no-op. Converge to the current shape; never replay a version ladder; never reconstruct a past shape.
220
+ - **Declarative, idempotent.** Re-running baseline mode on a current repo reshapes nothing — a second pass is just the audit plus the module proposal. Converge to the current shape; never replay a version ladder; never reconstruct a past shape.
229
221
  - **One sentinel.** `docs/structure.md` `harness-version` is the only baseline/version marker.
230
222
  - **Modules are labels, layout-blind.** Seed from the code's bounded contexts; never from `pnpm-workspace.yaml`/workspace walls. Propose, don't force; acting is a `module:` tag, never a folder.
231
223
  - **You orchestrate docs; the `documentation` skill supplies templates.** It is a library — never expect it to baseline.
@@ -234,4 +226,12 @@ Re-running you is safe — the structure work is idempotent, so a second pass is
234
226
 
235
227
  ## Strategy memory
236
228
 
237
- After a run you may append to `docs/memory/maintenance.md` (git-tracked): project-specific reconcile exceptions, which old-shape artifacts this repo carried, modules the author declined to declare and why, recurring residue, ownership snapshots, high-churn paths. Never user preferences (those are `~/.claude/`); never a transcription of doc content. Date each entry `## YYYY-MM-DD — {topic}`.
229
+ After a run you may append to `docs/memory/maintenance.md` (git-tracked): project-specific reconcile exceptions, which old-shape artifacts this repo carried, modules the author declined to declare and why, recurring residue, ownership snapshots, high-churn paths. Never user preferences (those are `~/.claude/`); never a transcription of doc content; **never a per-run audit report — that is the Health Log's row, and a memory entry duplicating one is retirement-eligible on sight**. Date each entry `## YYYY-MM-DD — {topic}`.
230
+
231
+ **The file is capped at 100 lines / 12 KB, and you enforce the cap on every run.** Whenever a write would leave the file over either limit — and at every baseline regardless (Step B6) — retire entries down to it in this precedence:
232
+
233
+ 1. **Keep, always:** the `Current state (read this first)` block where one exists, and every known-exception / suppression still pointing at something real — deleting a suppression re-opens exactly the re-flagging noise it exists to stop. Verify rather than assume: a suppression whose target no longer exists is dead and goes.
234
+ 2. **Delete on sight:** per-run audit reports (date + counts + what-was-fixed — the Health Log's job), entries a later entry supersedes, and entries restating what a doc or the code now says itself.
235
+ 3. **Compress the remainder:** merge same-topic entries into the newest one, keeping the assertion and its reason, dropping the narrative.
236
+
237
+ Leave one line at the top of the file recording the compaction date so the next reader knows the history is deliberate. Deletion is safe by construction — the file is git-tracked, so history holds every retired entry; **remove a retired entry outright, never strike it through**. Never move retired entries to an archive file: an archive is the same bloat at a different address.