@nurix/etna 0.17.1 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +19 -9
  2. package/bin/etna.js +56 -28
  3. package/data/harness-index.json +21 -6
  4. package/data/harnesses/code/CLAUDE.md +7 -18
  5. package/data/harnesses/code/agents/brainstorm.md +3 -3
  6. package/data/harnesses/code/agents/change-review.md +13 -10
  7. package/data/harnesses/code/agents/harness-manager.md +16 -16
  8. package/data/harnesses/code/agents/maintenance.md +10 -3
  9. package/data/harnesses/code/agents/performance-review.md +5 -0
  10. package/data/harnesses/code/harness.json +1 -1
  11. package/data/harnesses/code/rules/general.md +40 -36
  12. package/data/harnesses/code/skills/boundary/SKILL.md +15 -42
  13. package/data/harnesses/code/skills/boundary/references/boundary-taxonomy.md +366 -304
  14. package/data/harnesses/code/skills/brainstorm/README.md +9 -9
  15. package/data/harnesses/code/skills/brainstorm/SKILL.md +15 -15
  16. package/data/harnesses/code/skills/brainstorm/harvest.md +2 -2
  17. package/data/harnesses/code/skills/brainstorm/templates/backlog.md +2 -2
  18. package/data/harnesses/code/skills/brainstorm/templates/build.md +6 -6
  19. package/data/harnesses/code/skills/brainstorm/templates/decisions.md +3 -3
  20. package/data/harnesses/code/skills/brainstorm/templates/doctrine.md +2 -2
  21. package/data/harnesses/code/skills/brainstorm/templates/domain-model.md +2 -2
  22. package/data/harnesses/code/skills/brainstorm/templates/glossary.md +2 -1
  23. package/data/harnesses/code/skills/brainstorm/templates/non-goals.md +3 -7
  24. package/data/harnesses/code/skills/brainstorm/templates/questions.md +6 -5
  25. package/data/harnesses/code/skills/brainstorm/templates/state.md +1 -8
  26. package/data/harnesses/code/skills/brainstorm/templates/tech.md +6 -6
  27. package/data/harnesses/code/skills/brainstorm/templates/thesis.md +2 -2
  28. package/data/harnesses/code/skills/distiller/SKILL.md +48 -177
  29. package/data/harnesses/code/skills/distiller/references/docs-mode.md +116 -343
  30. package/data/harnesses/code/skills/distiller/references/method.md +37 -109
  31. package/data/harnesses/code/skills/documentation/SKILL.md +9 -6
  32. package/data/harnesses/code/skills/documentation/references/examples.md +30 -61
  33. package/data/harnesses/code/skills/documentation/references/style-guide.md +59 -62
  34. package/data/harnesses/code/skills/documentation/references/templates.md +25 -33
  35. package/data/harnesses/code/skills/workflow-mapper/SKILL.md +32 -11
  36. package/data/harnesses/code/skills/workflow-mapper/references/patterns.md +1 -1
  37. package/data/harnesses/code-fable/CLAUDE.md +12 -23
  38. package/data/harnesses/code-fable/agents/brainstorm.md +3 -3
  39. package/data/harnesses/code-fable/agents/change-review.md +13 -10
  40. package/data/harnesses/code-fable/agents/harness-manager.md +16 -16
  41. package/data/harnesses/code-fable/agents/maintenance.md +10 -3
  42. package/data/harnesses/code-fable/agents/performance-review.md +5 -0
  43. package/data/harnesses/code-fable/harness.json +1 -1
  44. package/data/harnesses/code-fable/rules/general.md +40 -36
  45. package/data/harnesses/code-fable/skills/boundary/SKILL.md +15 -42
  46. package/data/harnesses/code-fable/skills/boundary/references/boundary-taxonomy.md +366 -304
  47. package/data/harnesses/code-fable/skills/brainstorm/README.md +9 -9
  48. package/data/harnesses/code-fable/skills/brainstorm/SKILL.md +15 -15
  49. package/data/harnesses/code-fable/skills/brainstorm/harvest.md +2 -2
  50. package/data/harnesses/code-fable/skills/brainstorm/templates/backlog.md +2 -2
  51. package/data/harnesses/code-fable/skills/brainstorm/templates/build.md +6 -6
  52. package/data/harnesses/code-fable/skills/brainstorm/templates/decisions.md +3 -3
  53. package/data/harnesses/code-fable/skills/brainstorm/templates/doctrine.md +2 -2
  54. package/data/harnesses/code-fable/skills/brainstorm/templates/domain-model.md +2 -2
  55. package/data/harnesses/code-fable/skills/brainstorm/templates/glossary.md +2 -1
  56. package/data/harnesses/code-fable/skills/brainstorm/templates/non-goals.md +3 -7
  57. package/data/harnesses/code-fable/skills/brainstorm/templates/questions.md +6 -5
  58. package/data/harnesses/code-fable/skills/brainstorm/templates/state.md +1 -8
  59. package/data/harnesses/code-fable/skills/brainstorm/templates/tech.md +6 -6
  60. package/data/harnesses/code-fable/skills/brainstorm/templates/thesis.md +2 -2
  61. package/data/harnesses/code-fable/skills/distiller/SKILL.md +48 -177
  62. package/data/harnesses/code-fable/skills/distiller/references/docs-mode.md +116 -343
  63. package/data/harnesses/code-fable/skills/distiller/references/method.md +37 -109
  64. package/data/harnesses/code-fable/skills/documentation/SKILL.md +9 -6
  65. package/data/harnesses/code-fable/skills/documentation/references/examples.md +30 -61
  66. package/data/harnesses/code-fable/skills/documentation/references/style-guide.md +59 -62
  67. package/data/harnesses/code-fable/skills/documentation/references/templates.md +25 -33
  68. package/data/harnesses/code-fable/skills/workflow-mapper/SKILL.md +32 -11
  69. package/data/harnesses/code-fable/skills/workflow-mapper/references/patterns.md +1 -1
  70. package/data/harnesses/discover/CLAUDE.md +41 -109
  71. package/data/harnesses/discover/agents/api.md +11 -28
  72. package/data/harnesses/discover/agents/codebase.md +12 -30
  73. package/data/harnesses/discover/agents/community.md +9 -21
  74. package/data/harnesses/discover/agents/deployed-client-bundle.md +16 -67
  75. package/data/harnesses/discover/agents/distribution-artifacts.md +21 -59
  76. package/data/harnesses/discover/agents/docs.md +11 -20
  77. package/data/harnesses/discover/agents/infra-backend-fingerprint.md +28 -68
  78. package/data/harnesses/discover/agents/packages.md +12 -28
  79. package/data/harnesses/discover/agents/session.md +18 -50
  80. package/data/harnesses/discover/agents/website.md +9 -19
  81. package/data/harnesses/discover/agents/wire-capture.md +22 -72
  82. package/data/harnesses/discover/harness.json +1 -1
  83. package/data/harnesses/discover/rules/discovery.md +73 -182
  84. package/data/harnesses/discover/rules/evaluation.md +90 -98
  85. package/data/harnesses/discover/rules/ingestion.md +123 -322
  86. package/data/harnesses/discover/rules/self-correction.md +67 -92
  87. package/data/harnesses/discover/rules/tradecraft.md +201 -172
  88. package/data/harnesses/hr/CLAUDE.md +21 -51
  89. package/data/harnesses/hr/harness.json +1 -1
  90. package/data/harnesses/hr/skills/interview-eval/SKILL.md +23 -11
  91. package/data/harnesses/hr/skills/interview-eval/TEMPLATE.md +49 -29
  92. package/data/harnesses/hr/skills/interview-eval/rubric.md +30 -30
  93. package/data/harnesses/kb-agi/CLAUDE.md +8 -8
  94. package/data/harnesses/kb-agi/agents/kb-agi-init.md +31 -22
  95. package/data/harnesses/kb-agi/agents/kb-catch-stale.md +1 -1
  96. package/data/harnesses/kb-agi/agents/kb-find-gaps.md +1 -1
  97. package/data/harnesses/kb-agi/agents/kb-fix-links.md +1 -1
  98. package/data/harnesses/kb-agi/agents/kb-refresh-summaries.md +2 -2
  99. package/data/harnesses/kb-agi/agents/kb-sync-metadata.md +2 -2
  100. package/data/harnesses/kb-agi/harness.json +1 -1
  101. package/package.json +1 -1
package/README.md CHANGED
@@ -6,17 +6,26 @@ A second install path also exists and is fully supported: `/plugin install <plug
6
6
 
7
7
  ## Usage
8
8
 
9
- From the root of the project you want to bootstrap:
9
+ From the root of the project you want to bootstrap, pick a harness from the interactive menu:
10
10
 
11
11
  ```sh
12
- npx @nurix/etna code
12
+ npx @nurix/etna
13
+ ```
14
+
15
+ …or install one directly by name:
16
+
17
+ ```sh
18
+ npx @nurix/etna --name=code
13
19
  ```
14
20
 
15
21
  After this completes:
16
22
 
17
23
  ```
18
24
  your-project/
19
- ├── CLAUDE.md ← harness policy (your existing file → CLAUDE.md.bak.<ISO>)
25
+ ├── CLAUDE.md ← harness policy (non-git repo: existing file → CLAUDE.md.bak.<ISO>)
26
+ ├── .prettierrc.json ← markdown formatting (proseWrap: never)
27
+ ├── .prettierignore
28
+ ├── .vscode/settings.json ← editor settings (markdown formatter on save)
20
29
  └── .claude/
21
30
  ├── skills/ ← documentation, boundary, distiller, brainstorm, workflow-mapper
22
31
  ├── agents/ ← harness-manager, spec-mode, brainstorm, maintenance, change-review, performance-review
@@ -28,22 +37,22 @@ your-project/
28
37
 
29
38
  That's the entire footprint. Nothing is written outside the project. No marketplace registration, no `enabledPlugins` entry, no global cache dependency — Claude Code picks up the project-scoped agents/skills/rules on its next session start, and the hooks wire in through `.claude/settings.json`.
30
39
 
31
- Re-run `npx @nurix/etna code` anytime to refresh the harness content with what the latest published package ships. Existing same-named files are overwritten; files you've added that aren't part of the harness are left alone. The previous `CLAUDE.md` is backed up to `CLAUDE.md.bak.<ISO-timestamp>`. Because the new `harness.json` carries the installed `{version, epoch, digest}`, a re-run that's ahead of your repo's stamped `harness-version` is what the reconcile (below) detects as an upgrade.
40
+ Re-run `npx @nurix/etna --name=code` anytime to refresh the harness content with what the latest published package ships. Existing same-named files are overwritten; files you've added that aren't part of the harness are left alone. In a git repo the previous `CLAUDE.md` is overwritten in place (recover it with `git checkout CLAUDE.md`); outside a git repo it's backed up to `CLAUDE.md.bak.<ISO-timestamp>`. Because the new `harness.json` carries the installed `{version, epoch, digest}`, a re-run that's ahead of your repo's stamped `harness-version` is what the reconcile (below) detects as an upgrade.
32
41
 
33
42
  ## After install: bootstrap the harness
34
43
 
35
- Installing only *drops the files* — the harness isn't active for your repo until you **baseline** it. Open Claude Code in the project and drive the reconcile chain once (the installed `CLAUDE.md` carries the same steps under its `## Bootstrap` heading, for the agent):
44
+ Installing only _drops the files_ — the harness isn't active for your repo until you **baseline** it. Open Claude Code in the project and drive the reconcile chain once (the installed `CLAUDE.md` carries the same steps under its `## Bootstrap` heading, for the agent):
36
45
 
37
46
  1. **"baseline this repo"** (or "reconcile the harness") — runs the **`harness-manager`** agent. It builds the `docs/` tree to the harness shape, stamps `docs/structure.md` with the installed `harness-version`, then hands back.
38
47
  2. If it asks for boundaries (a real codebase whose `docs/boundaries/` is still empty) — run **`/boundary generate`**. It detects your stack + information architecture and writes the typed boundary files.
39
48
  3. **"reconcile the harness"** again — `harness-manager` now proposes **modules** from those boundaries.
40
49
 
41
- Then work normally. This brownfield path reads your *actual* code, not a blank slate, so it's safe to run on an existing project with real history.
50
+ Then work normally. This brownfield path reads your _actual_ code, not a blank slate, so it's safe to run on an existing project with real history.
42
51
 
43
52
  Two things worth knowing on an existing repo:
44
53
 
45
54
  - **Your root `CLAUDE.md` is replaced** with the harness policy file (the old one is saved to `CLAUDE.md.bak.<ISO>`). If it held project-specific instructions, fold them back in after install — the harness file is the policy skeleton; your domain specifics sit alongside it.
46
- - **The ledger starts on your next commit.** The `post-commit` hook appends to `docs/memory/ledger/`; once enough entries accrue, the `maintenance` agent *proposes* a `distiller` run that distills them into provenance-linked fact-cards and, eventually, proposed `docs/` updates. Nothing runs on its own — it proposes, you approve.
55
+ - **The ledger starts on your next commit.** The `post-commit` hook appends to `docs/memory/ledger/`; once enough entries accrue, the `maintenance` agent _proposes_ a `distiller` run that distills them into provenance-linked fact-cards and, eventually, proposed `docs/` updates. Nothing runs on its own — it proposes, you approve.
47
56
 
48
57
  ### Optional: semantic retrieval (qmd)
49
58
 
@@ -60,13 +69,14 @@ The `nurixlabs` marketplace entry in `~/.claude/settings.json` is harmless to le
60
69
  Listed by `npx @nurix/etna` (no args) using the bundled `data/harness-index.json`.
61
70
 
62
71
  | Plugin name | Source in etna | What it ships |
63
- |---|---|---|
72
+ | --- | --- | --- |
64
73
  | `code` | [`plugins/code/`](../../plugins/code/) | Governance + session agents, baseline workflow skills, knowledge-ledger hooks |
65
74
  | `kb-agi` | [`plugins/kb-agi/`](../../plugins/kb-agi/) | Knowledge-vault scaffolding |
66
75
 
67
76
  ## How it works
68
77
 
69
78
  Each harness has two halves in the etna repo:
79
+
70
80
  - `plugins/<name>/` — the **plugin** (what a Claude Code plugin natively bundles): `definition.md` (manifest — identity + `skills:`/`rules:` lists), `agents/`, `hooks/`.
71
81
  - `harness/<name>/` — the **policy**: `CLAUDE.md` (pure policy, no frontmatter — installed as a verbatim copy) plus `index.md`, whose `plugin:` key names the plugin this harness pairs with. All harness-folder frontmatter lives in `index.md` alone.
72
82
 
@@ -79,7 +89,7 @@ Two kinds of membership:
79
89
  ---
80
90
  name: code
81
91
  skills: [boundary, brainstorm, distiller, documentation, workflow-mapper]
82
- rules: [general, nomenclature]
92
+ rules: [general, nomenclature]
83
93
  ---
84
94
  ```
85
95
 
package/bin/etna.js CHANGED
@@ -43,15 +43,16 @@ function isInteractive() {
43
43
  return Boolean(process.stdin.isTTY && process.stdout.isTTY);
44
44
  }
45
45
 
46
- // Boxed list of installable harnesses, for --help and the non-interactive no-arg path.
46
+ // Boxed list of installable harnesses (name + description), for --help and error paths.
47
47
  function printHarnessList(harnesses) {
48
48
  const entries = Object.entries(harnesses);
49
49
  if (!entries.length) {
50
50
  p.log.warn('No harnesses are bundled. Run `npm run build:data` from the package root.');
51
51
  return;
52
52
  }
53
+ const width = Math.max(...entries.map(([folder]) => folder.length));
53
54
  const lines = entries.map(
54
- ([folder, plugin]) => `${folder}${plugin && plugin !== folder ? ` (plugin: ${plugin})` : ''}`,
55
+ ([folder, meta]) => `${folder.padEnd(width)}${meta?.description ? ` ${meta.description}` : ''}`,
55
56
  );
56
57
  p.note(lines.join('\n'), 'Available harnesses');
57
58
  }
@@ -216,35 +217,32 @@ function mergeHooks(targetDir, bundledHooksJson) {
216
217
  return added;
217
218
  }
218
219
 
219
- // Resolve the harness to install: the positional arg, or — in a TTY — an interactive
220
- // pick. Returns the chosen folder name, or null if the user cancels / can't be prompted.
221
- async function resolveHarnessName(positional, harnesses) {
220
+ // Resolve the harness to install: the --name value, or — in a TTY — an interactive pick
221
+ // showing each harness's description. Returns the chosen folder, or null on cancel.
222
+ async function resolveHarnessName(name, harnesses) {
222
223
  const names = Object.keys(harnesses);
223
- if (positional) {
224
- if (!harnesses[positional]) {
225
- p.log.error(`Unknown harness '${positional}'.`);
224
+ if (name !== null) {
225
+ if (!name || !harnesses[name]) {
226
+ p.log.error(name ? `Unknown harness '${name}'.` : 'Empty --name value.');
226
227
  printHarnessList(harnesses);
227
- p.outro('Pick one of the harnesses above.');
228
+ p.outro('Pass --name=<harness> with one of the names above.');
228
229
  process.exit(1);
229
230
  }
230
- return positional;
231
+ return name;
231
232
  }
232
233
  if (!isInteractive()) {
233
- p.log.error('No harness specified, and not running in an interactive terminal.');
234
+ p.log.error('No --name given, and not running in an interactive terminal.');
234
235
  printHarnessList(harnesses);
235
- p.outro('Re-run as `npx @nurix/etna <harness-name>`.');
236
+ p.outro('Re-run as `npx @nurix/etna --name=<harness>`.');
236
237
  process.exit(1);
237
238
  }
238
239
  const choice = await p.select({
239
240
  message: 'Which harness do you want to install here?',
240
- options: names.map((folder) => {
241
- const plugin = harnesses[folder];
242
- return {
243
- value: folder,
244
- label: folder,
245
- hint: plugin && plugin !== folder ? `plugin: ${plugin}` : undefined,
246
- };
247
- }),
241
+ options: names.map((folder) => ({
242
+ value: folder,
243
+ label: folder,
244
+ hint: harnesses[folder]?.description || undefined,
245
+ })),
248
246
  });
249
247
  if (p.isCancel(choice)) {
250
248
  p.cancel('Cancelled — nothing installed.');
@@ -273,7 +271,7 @@ async function installHarness(harnessName, harnesses) {
273
271
  const versionTag = harnessMeta.version ? ` v${harnessMeta.version}` : '';
274
272
  // The underlying plugin's name — may differ from the harness name, and several
275
273
  // harnesses may share it. Used only for legacy marketplace-entry cleanup.
276
- const pluginName = harnessMeta.name || harnesses[harnessName] || harnessName;
274
+ const pluginName = harnessMeta.name || harnesses[harnessName]?.plugin || harnessName;
277
275
 
278
276
  const spin = p.spinner();
279
277
  spin.start(`Installing ${harnessName}${versionTag} into ${targetDir}`);
@@ -346,32 +344,62 @@ async function installHarness(harnessName, harnesses) {
346
344
 
347
345
  p.outro(
348
346
  `${harnessName}${versionTag} ready in ${targetDir}. ` +
349
- `Re-run \`npx @nurix/etna ${harnessName}\` anytime to refresh harness content.`,
347
+ `Re-run \`npx @nurix/etna --name=${harnessName}\` anytime to refresh harness content.`,
350
348
  );
351
349
  }
352
350
 
351
+ // Parse argv. `--name=<harness>` / `--name <harness>` selects a harness; -h/--help shows
352
+ // help; any other bare token is the dropped positional form (a breaking change in 0.18.0).
353
+ function parseArgs(args) {
354
+ let name = null;
355
+ let help = false;
356
+ let positional = null;
357
+ for (let i = 0; i < args.length; i++) {
358
+ const a = args[i];
359
+ if (a === '-h' || a === '--help') help = true;
360
+ else if (a.startsWith('--name=')) name = a.slice('--name='.length);
361
+ else if (a === '--name') name = args[++i] ?? '';
362
+ else if (!a.startsWith('-') && positional === null) positional = a;
363
+ }
364
+ return { name, help, positional };
365
+ }
366
+
353
367
  async function main(args) {
354
368
  const idx = loadHarnessIndex();
355
369
  const harnesses = idx.harnesses || {};
370
+ const { name, help, positional } = parseArgs(args);
356
371
 
357
- if (args.includes('-h') || args.includes('--help')) {
372
+ if (help) {
358
373
  p.intro('@nurix/etna — Nurix harness installer');
359
- p.log.message('Usage: npx @nurix/etna [harness-name]');
374
+ p.log.message(
375
+ 'Usage:\n' +
376
+ ' npx @nurix/etna pick a harness from the menu\n' +
377
+ ' npx @nurix/etna --name=<harness> install that harness directly',
378
+ );
360
379
  printHarnessList(harnesses);
361
- p.outro('Run with a name to install, or with no name to pick interactively.');
380
+ p.outro('No args → interactive menu. --name=<harness> → direct install.');
362
381
  return;
363
382
  }
364
383
 
365
- const positional = args.find((a) => !a.startsWith('-'));
366
-
367
384
  p.intro('@nurix/etna — Nurix harness installer');
368
385
 
386
+ // Breaking change (0.18.0): the positional form `etna <harness>` was replaced by
387
+ // `--name=<harness>`. Fail loudly with the new syntax rather than silently misfiring.
388
+ if (positional && name === null) {
389
+ p.log.error(
390
+ `Positional arguments are no longer supported. Install with \`npx @nurix/etna --name=${positional}\`.`,
391
+ );
392
+ printHarnessList(harnesses);
393
+ p.outro('Use --name=<harness> to install, or no args to pick from the menu.');
394
+ process.exit(1);
395
+ }
396
+
369
397
  const boot = p.spinner();
370
398
  boot.start('Starting up');
371
399
  await sleep(2000);
372
400
  boot.stop('Ready');
373
401
 
374
- const harnessName = await resolveHarnessName(positional, harnesses);
402
+ const harnessName = await resolveHarnessName(name, harnesses);
375
403
  if (!harnessName) return; // user cancelled the interactive pick
376
404
 
377
405
  await installHarness(harnessName, harnesses);
@@ -1,10 +1,25 @@
1
1
  {
2
- "fingerprint": "50dc8734b7ee",
2
+ "fingerprint": "5749d4f02de6",
3
3
  "harnesses": {
4
- "code": "code-fable",
5
- "code-fable": "code-fable",
6
- "discover": "discover",
7
- "hr": "hr",
8
- "kb-agi": "kb-agi"
4
+ "code": {
5
+ "plugin": "code-fable",
6
+ "description": "Nurix code-project harness"
7
+ },
8
+ "code-fable": {
9
+ "plugin": "code-fable",
10
+ "description": "Nurix code-project harness"
11
+ },
12
+ "discover": {
13
+ "plugin": "discover",
14
+ "description": "Product Discovery harness"
15
+ },
16
+ "hr": {
17
+ "plugin": "hr",
18
+ "description": "Hiring / AI-Steering Evaluation harness"
19
+ },
20
+ "kb-agi": {
21
+ "plugin": "kb-agi",
22
+ "description": "self-improving knowledge-base harness"
23
+ }
9
24
  }
10
25
  }
@@ -31,7 +31,7 @@ This is the only step that runs **before** the harness exists; everything below
31
31
  Three peer modes plus a Completion step — enter wherever the user's thinking already is. Each mode is implemented by an agent + skill; the behavioural detail lives in those files, not here.
32
32
 
33
33
  | Mode | Enter when | Implemented by | Exits to |
34
- |------|-----------|----------------|----------|
34
+ | --- | --- | --- | --- |
35
35
  | **Brainstorming** | explicit ask; or a user utterance challenges a loaded pillar headline → name the brushed principle and offer `/brainstorm start` (no auto-entry) | `brainstorm` agent + skill | Spec, Plan, or close + harvest |
36
36
  | **Spec** | new feature work | `spec-mode` agent + `documentation` skill | Plan |
37
37
  | **Plan** | a spec is approved | `documentation` skill → `docs/history/plans/YYYY-MM-DD-{slug}.md` | Completion |
@@ -51,7 +51,7 @@ Before modifying code in an unfamiliar area:
51
51
  5. If a `docs/memory/` file exists for the domain you're working in, read it for domain knowledge and failure modes
52
52
  6. When you author a declared module's docs, its `docs/modules/{m}/CLAUDE.md` auto-loads (the pillar bootstrap) — follow it. For code work it's surfaced via step 2.
53
53
 
54
- For the protocol on *writing* to memory (which file, what belongs there, what doesn't), see **Project Memory** below.
54
+ For the protocol on _writing_ to memory (which file, what belongs there, what doesn't), see **Project Memory** below.
55
55
 
56
56
  ---
57
57
 
@@ -60,12 +60,12 @@ For the protocol on *writing* to memory (which file, what belongs there, what do
60
60
  Project-specific learnings live in `docs/memory/` (git-tracked). Cross-project user preferences live in `~/.claude/` (untracked).
61
61
 
62
62
  | File | Owner | Contents |
63
- |------|-------|----------|
63
+ | --- | --- | --- |
64
64
  | `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 |
65
65
  | `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. |
66
66
  | `~/.claude/projects/...` | Auto-memory system | User preferences, role, communication style, cross-project habits |
67
67
 
68
- **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/`.
68
+ **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/`.
69
69
 
70
70
  `docs/memory/main.md` is created on first write. Append entries dated `## YYYY-MM-DD — {topic}`; oldest at bottom is fine.
71
71
 
@@ -103,25 +103,14 @@ A boundary is a horizontal cross-cutting contract — entity model, db schema, w
103
103
 
104
104
  Unless explicitly requested:
105
105
 
106
- ❌ **Tests** – Never generate, update, or modify test files.
107
- ❌ **Dependencies** – Never upgrade frameworks, libraries, or dependencies.
108
- ❌ **Compatibility** – Never maintain backward compatibility unless specified.
109
- ❌ **Branches & Worktrees** – Never self-create git branches or worktrees. Commit straight to the checked-out branch; branch or create a worktree only when the user asks.
110
- ❌ **Protected Files** – Before editing, if `docs/operations/protected-files.md` exists, read it and never modify any path it lists; also never modify `AGENTS.md` or the `protected-files.md` file itself.
111
- ✅ **Browser Automation** – Use Chrome CDP / "Claude in Chrome" tools whenever they help (verifying UI, reproducing a flow, seeding or inspecting local data) — no need to ask first. **Main session only:** never drive the browser from a sub-agent or workflow executor — the session-bound Chrome connection destabilizes the sub-agent. A sub-agent that needs browser verification instead returns an explicit CDP checklist (exact URLs, actions, expected outcomes) for the orchestrator to execute in the main session.
112
- ✅ **Orchestrate via Sub-agents** – Run the main session as an orchestrator: delegate substantive work (research, implementation, audits) to sub-agents spawned via the Agent/Task tool with `model: opus` (Claude Opus), keeping the main context for dispatch, coordination, and synthesis. Give each sub-agent a self-contained prompt; parallelize independent dispatches.
113
- ✅ **Documentation** – Keep `docs/` updated when code changes affect documented behavior.
114
- ⚠️ **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.
115
- ⚠️ **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.
106
+ ❌ **Tests** – Never generate, update, or modify test files. ❌ **Dependencies** – Never upgrade frameworks, libraries, or dependencies. ❌ **Compatibility** – Never maintain backward compatibility unless specified. ❌ **Branches & Worktrees** – Never self-create git branches or worktrees. Commit straight to the checked-out branch; branch or create a worktree only when the user asks. ❌ **Protected Files** – Before editing, if `docs/operations/protected-files.md` exists, read it and never modify any path it lists; also never modify `AGENTS.md` or the `protected-files.md` file itself. ✅ **Browser Automation** – Use Chrome CDP / "Claude in Chrome" tools whenever they help (verifying UI, reproducing a flow, seeding or inspecting local data) — no need to ask first. **Main session only:** never drive the browser from a sub-agent or workflow executor — the session-bound Chrome connection destabilizes the sub-agent. A sub-agent that needs browser verification instead returns an explicit CDP checklist (exact URLs, actions, expected outcomes) for the orchestrator to execute in the main session. ✅ **Orchestrate via Sub-agents** – Run the main session as an orchestrator: delegate substantive work (research, implementation, audits) to sub-agents spawned via the Agent/Task tool with `model: opus` (Claude Opus), keeping the main context for dispatch, coordination, and synthesis. Give each sub-agent a self-contained prompt; parallelize independent dispatches. ✅ **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.
116
107
 
117
108
  ---
118
109
 
119
110
  ## File Structure
120
111
 
121
- - Add file path at top of each file:
122
- `// src/modules/example.js - Module for handling user authentication`
123
- - Add a 1-line function description as a comment above each function:
124
- `// Extract JWT token from request based on endpoint type`
112
+ - Add file path at top of each file: `// src/modules/example.js - Module for handling user authentication`
113
+ - Add a 1-line function description as a comment above each function: `// Extract JWT token from request based on endpoint type`
125
114
 
126
115
  ---
127
116
 
@@ -20,15 +20,15 @@ If none of those steering files exist yet (a freshly-baselined repo), a session
20
20
 
21
21
  ## Modes and the close gate
22
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.
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
24
 
25
25
  ## How you facilitate
26
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.
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
28
  - **Suggest, never seize.** Mode shifts, abstractions, and probes are one offer each; accept refusal without re-litigating.
29
29
  - **Never write production code** while a session is open — load-bearing snippets are illustration only, inside the session folder.
30
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.
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
32
 
33
33
  ## What you may write
34
34
 
@@ -18,14 +18,14 @@ You work in two phases:
18
18
 
19
19
  Parse these from the user's prompt. Use defaults if not specified.
20
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" |
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
29
 
30
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
31
 
@@ -66,6 +66,7 @@ git diff-tree --no-commit-id --numstat -r {hash}
66
66
  ```
67
67
 
68
68
  Run these in a single bash call using a loop for efficiency. From the numstat output, compute per-commit totals:
69
+
69
70
  - `files_changed`: number of files in the commit
70
71
  - `insertions`: sum of added lines across all files
71
72
  - `deletions`: sum of removed lines across all files
@@ -86,11 +87,13 @@ Spawn **haiku** sub-agents via the Task tool with `subagent_type: "general-purpo
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
88
 
88
89
  **Generic Module Taxonomy fallback:**
90
+
89
91
  ```
90
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`.
91
93
  ```
92
94
 
93
95
  **Generic Feature Taxonomy fallback:**
96
+
94
97
  ```
95
98
  Infer the product area from the commit message and file paths. Use descriptive labels like `auth`, `editor`, `deploy`, `ui`, `infra`, `docs`, `dx`, `other`.
96
99
  ```
@@ -182,7 +185,7 @@ When a commit cannot be classified by a sub-agent, use these defaults:
182
185
 
183
186
  # Phase 2 — Velocity analysis
184
187
 
185
- 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).
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).
186
189
 
187
190
  ## Step 6: Velocity Heatmap
188
191
 
@@ -195,7 +198,7 @@ Compute commits-per-directory over rolling windows:
195
198
  Aggregate by the top-level directories the CSV's `directories` field already carries (computed generically in Phase 1, Step 2). Report:
196
199
 
197
200
  | Directory | Commits 1w | Commits 1m | Commits 3m | Trend |
198
- |-----------|-----------:|-----------:|-----------:|-------|
201
+ | --------- | ---------: | ---------: | ---------: | ----- |
199
202
 
200
203
  Trend column: ↑ rising, ↓ falling, → steady, ↑↑ sharply rising, ↓↓ sharply falling.
201
204
 
@@ -9,14 +9,14 @@ model: inherit
9
9
 
10
10
  You bring a repo's `docs/` governance tree into conformance with the **installed** harness version, and you audit that conformance on demand. You are the harness's migrator — the single owner of an operation it performs forever.
11
11
 
12
- The keystone: **baseline and upgrade are the same operation.** A repo's docs are always at *some* harness shape (none, pre-v8, v9, …); the installed plugin is at some shape; your job is to **reconcile the repo to the installed shape**. Baseline is the degenerate case (reconcile from nothing). Upgrade is reconcile across a version gap. Same agent, same convergence.
12
+ The keystone: **baseline and upgrade are the same operation.** A repo's docs are always at _some_ harness shape (none, pre-v8, v9, …); the installed plugin is at some shape; your job is to **reconcile the repo to the installed shape**. Baseline is the degenerate case (reconcile from nothing). Upgrade is reconcile across a version gap. Same agent, same convergence.
13
13
 
14
- Reconcile is **declarative, not a migration ladder.** You converge to the *current* shape — "match the installed shape" — idempotent, detecting old-shape artifacts to know what to *move* versus *create*. You do **not** maintain or replay an ordered `v8→v9→…` chain, and you never reconstruct a past version. (Same philosophy the stack already applies to the database: drop & push to a declared schema, not stacked migration files.)
14
+ Reconcile is **declarative, not a migration ladder.** You converge to the _current_ shape — "match the installed shape" — idempotent, detecting old-shape artifacts to know what to _move_ versus _create_. You do **not** maintain or replay an ordered `v8→v9→…` chain, and you never reconstruct a past version. (Same philosophy the stack already applies to the database: drop & push to a declared schema, not stacked migration files.)
15
15
 
16
16
  ## The two version layers (don't confuse them)
17
17
 
18
- - The **CLI** (`npx @nurix/etna code`) refreshes the *engine* — `CLAUDE.md` + `.claude/{agents,skills,rules,scripts}/`. That is not your job; the install does it.
19
- - **You** reconcile the *repo's authored data* — the `docs/` tree — to match that engine.
18
+ - The **CLI** (`npx @nurix/etna --name=code`) refreshes the _engine_ — `CLAUDE.md` + `.claude/{agents,skills,rules,scripts}/`. That is not your job; the install does it.
19
+ - **You** reconcile the _repo's authored data_ — the `docs/` tree — to match that engine.
20
20
 
21
21
  The upgrade story is the two run back-to-back: install refreshes the engine → you reconcile the docs to it.
22
22
 
@@ -29,15 +29,15 @@ The upgrade story is the two run back-to-back: install refreshes the engine →
29
29
 
30
30
  These are different axes — keep them clean:
31
31
 
32
- - **`maintenance` audits docs-vs-code *fidelity*** — is the documented behavior *true* of the code? (stale docs, broken `owns` globs, routing drift). It edits docs for content accuracy.
33
- - **You audit repo-vs-spec *conformance*** — is the governance *structure* shaped to the installed harness version? (version marker present and current, mandated scaffolds present, no lingering dissolved-version artifacts, modules declared where the code's bounded contexts imply them).
32
+ - **`maintenance` audits docs-vs-code _fidelity_** — is the documented behavior _true_ of the code? (stale docs, broken `owns` globs, routing drift). It edits docs for content accuracy.
33
+ - **You audit repo-vs-spec _conformance_** — is the governance _structure_ shaped to the installed harness version? (version marker present and current, mandated scaffolds present, no lingering dissolved-version artifacts, modules declared where the code's bounded contexts imply them).
34
34
 
35
- You never edit a doc for content fidelity (that is `maintenance`); `maintenance` never reshapes the structure to a new version (that is you). Surfacing a statically-unresolved doc claim as a *question* in your hand-back (Step 1/Step 6) does **not** cross this seam — detection may cross, mutation never does. You observe and ask; you never assert falsity or fix the doc.
35
+ You never edit a doc for content fidelity (that is `maintenance`); `maintenance` never reshapes the structure to a new version (that is you). Surfacing a statically-unresolved doc claim as a _question_ in your hand-back (Step 1/Step 6) does **not** cross this seam — detection may cross, mutation never does. You observe and ask; you never assert falsity or fix the doc.
36
36
 
37
37
  ## Before starting
38
38
 
39
39
  1. Verify a **root `CLAUDE.md` exists** before any reconcile. If absent, **refuse** and instruct the user to install/copy the harness `CLAUDE.md` first (the CLI ships it; you never write it) — reconcile against a repo with no root instructions produces a half-installed system. Detect-and-instruct, not a gate.
40
- 2. Resolve the **installed harness epoch** — read it 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 @nurix/etna code`, then retry. The resolved epoch is the target.
40
+ 2. Resolve the **installed harness epoch** — read it 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 @nurix/etna --name=code`, then retry. The resolved epoch is the target.
41
41
  3. Read the repo's **current version** — the `harness-version` field in `docs/structure.md` frontmatter. Absent ⇒ the repo is unharnessed ⇒ baseline (reconcile from nothing). Equal to installed ⇒ report and stop, **except** when re-invoked for the Step 6 module proposal: the version is already current from your first pass, so skip the stop and go straight to Step 6. (Health asked ⇒ run Health.) Behind ⇒ reconcile forward.
42
42
  4. If `docs/memory/harness-manager.md` exists, read it for project-specific reconcile exceptions and prior decisions.
43
43
 
@@ -82,7 +82,7 @@ While reading each markdown doc to classify it, if the doc names a code symbol i
82
82
  This is what makes reconcile more than a fresh scaffold. Detect old-shape artifacts and fold them forward:
83
83
 
84
84
  | If you find (old shape) | Fold to (current shape) |
85
- |---|---|
85
+ | --- | --- |
86
86
  | `docs/operations/guardrails.md` | fold durable contract notes into `docs/architecture/` |
87
87
  | `docs/boundaries/` (legacy persisted boundaries) | delete — boundary analysis is a plan-time diagnostic (the `boundary` skill reads contracts fresh from source); fold any human-authored knowledge (external consumers, intent, accepted exceptions) into `docs/architecture/` |
88
88
  | repo-wide `docs/pillars/` | module-local `docs/modules/{m}/pillars/`; cross-module doctrine → `docs/architecture/` |
@@ -110,7 +110,7 @@ Write `harness-version: <installed epoch>` into `docs/structure.md` frontmatter.
110
110
 
111
111
  ### Step 5b — Register the qmd retrieval lens (optional, skip-if-absent)
112
112
 
113
- Strictly optional and guarded on the binary — if `command -v qmd` finds nothing, **skip this entire step silently** (no error, no behavior change) and carry one advisory line into the Step 6 hand-back: *"qmd not installed — semantic retrieval unavailable; glob routing active."* The index is a **local rebuildable lens** — data stays in git; never commit index artifacts, and never use `qmd init` (that writes a project-local `.qmd`; the default global index keeps the repo clean).
113
+ Strictly optional and guarded on the binary — if `command -v qmd` finds nothing, **skip this entire step silently** (no error, no behavior change) and carry one advisory line into the Step 6 hand-back: _"qmd not installed — semantic retrieval unavailable; glob routing active."_ The index is a **local rebuildable lens** — data stays in git; never commit index artifacts, and never use `qmd init` (that writes a project-local `.qmd`; the default global index keeps the repo clean).
114
114
 
115
115
  If the binary exists, register the docs subtrees once the tree is scaffolded. **Do not register one collection rooted at `docs/`** — qmd 2.5.3 hard-codes the `**/*.md` pattern (a custom positional glob is silently discarded) and has no `--ignore`/`--exclude` flag, so a `docs/`-root collection provably sweeps the consumable inbox queue at `docs/memory/inbox/` into the index. The inbox is **not** in scope (it is distilled into `memory/facts`, which is — and its entries are deleted on digestion, which would leave dangling index entries). Register one collection **per indexable subtree** instead — never `docs/memory` as a whole, only `docs/memory/facts` — so the inbox is excluded by construction:
116
116
 
@@ -130,12 +130,12 @@ This augments routing; it never supersedes the Step 6 ownership resolution.
130
130
 
131
131
  ### Step 6 — Module proposal
132
132
 
133
- Modules are *declared*, never inferred from physical layout. Derive the repo's candidate bounded contexts directly from the code and docs: distinct wire surfaces (who owns routes/handlers), schema/data-access ownership, entry points and process units, plus any contexts `docs/architecture/` or feature `owns` globs already name.
133
+ Modules are _declared_, never inferred from physical layout. Derive the repo's candidate bounded contexts directly from the code and docs: distinct wire surfaces (who owns routes/handlers), schema/data-access ownership, entry points and process units, plus any contexts `docs/architecture/` or feature `owns` globs already name.
134
134
 
135
135
  - Propose the derived contexts as candidate modules. For each, partition existing flat feature docs by `owns`-glob overlap.
136
136
  - **Propose — don't force.** Declaration is opt-in: a single-context app stays flat (so does a monolith whose contexts all share one kernel); declare `docs/modules/{m}/` only when the author accepts a context as a module. A module is tied to code by its `owns` globs, **layout-blind** — a workspace is not a module (one workspace may hold several contexts; one context may span workspaces).
137
137
 
138
- If Step 5b skipped because `qmd` was absent, carry its one advisory line into the hand-back — *"qmd not installed — semantic retrieval unavailable; glob routing active."* — advisory, never an error, never a gate.
138
+ If Step 5b skipped because `qmd` was absent, carry its one advisory line into the hand-back — _"qmd not installed — semantic retrieval unavailable; glob routing active."_ — advisory, never an error, never a gate.
139
139
 
140
140
  Re-running you is safe — the structure work is already done (idempotent), so a second pass is just the module proposal.
141
141
 
@@ -143,7 +143,7 @@ Re-running you is safe — the structure work is already done (idempotent), so a
143
143
 
144
144
  > - `docs/x.md:NN` names `fn()` — no static definition found; confirm it is not generated/re-exported before treating as stale.
145
145
 
146
- End the block with: *"NEXT (optional): run the maintenance agent to confirm or dismiss these — advisory, not a gate; baseline is complete regardless."* Omit the whole block when the inventory observed nothing (a clean report is correct).
146
+ End the block with: _"NEXT (optional): run the maintenance agent to confirm or dismiss these — advisory, not a gate; baseline is complete regardless."_ Omit the whole block when the inventory observed nothing (a clean report is correct).
147
147
 
148
148
  If the user **declines** the advisory rather than running the follow-up, record each declined item in `docs/history/backlog.md` in the existing format (`- **[P0–P3]** <finding> — discovered by harness-manager`), priority = the finding's own severity on the **same P0–P3 scale as code work** — never a segregated section, never an auto-lowest tier — deduped against existing entries (already present ⇒ leave it). A backlog line is a record, never a gate.
149
149
 
@@ -157,9 +157,9 @@ Confirm all mandated files exist; `structure.md` carries the current `harness-ve
157
157
 
158
158
  Conformance, not fidelity. Report a table; fix nothing destructively without asking.
159
159
 
160
- - **Version currency** — `harness-version` present in `structure.md` and equal to installed? If behind/absent → recommend Reconcile. (This is the *repo-vs-installed* gap — it self-heals once the consumer reinstalls and re-runs you. The next two checks catch what reinstall *hasn't* happened yet, or was bypassed by a hand-edit.)
161
- - **Published-version currency** *(advisory, network)* — the installed `.claude/harness.json` records the kit's `version`; the published kit may have moved past it. Attempt `npm view @nurix/etna version` (the kit is a restricted package — needs npm auth + network). **Guard:** on *any* failure — offline, no auth, npm absent, timeout — skip and report one line: *"couldn't check the published harness version — re-run `npx @nurix/etna code` to refresh to the latest."* On success, compare the published version against `.claude/harness.json`'s `version`; if published is ahead, recommend re-running the CLI to pull the newer kit. Never a gate, never blocks.
162
- - **Kit build fingerprint (digest)** *(informational)* — `.claude/harness.json` carries a `digest`: a deterministic fingerprint of the exact kit **build** the consumer installed (`build-data` computes it over the shipped bundle). Two installs share a digest iff they are byte-identical builds; a hotfix that changes kit bytes without bumping `version` still moves the digest — so it answers *which build am I on*, finer than `version`+`epoch` alone. **Don't recompute it over `.claude/` to self-check:** the installed layout is a superset of the build (the project `CLAUDE.md` sits at the repo root, `.claude/` adds `settings.json`/`harness.json`/local rule files), so paths and file sets differ **by design** — a recompute would never match. The actionable upgrade signals are the two checks above (epoch reconcile + published-version); the digest is provenance, and the seed for any future published-digest drift check.
160
+ - **Version currency** — `harness-version` present in `structure.md` and equal to installed? If behind/absent → recommend Reconcile. (This is the _repo-vs-installed_ gap — it self-heals once the consumer reinstalls and re-runs you. The next two checks catch what reinstall _hasn't_ happened yet, or was bypassed by a hand-edit.)
161
+ - **Published-version currency** _(advisory, network)_ — the installed `.claude/harness.json` records the kit's `version`; the published kit may have moved past it. Attempt `npm view @nurix/etna version` (the kit is a restricted package — needs npm auth + network). **Guard:** on _any_ failure — offline, no auth, npm absent, timeout — skip and report one line: _"couldn't check the published harness version — re-run `npx @nurix/etna --name=code` to refresh to the latest."_ On success, compare the published version against `.claude/harness.json`'s `version`; if published is ahead, recommend re-running the CLI to pull the newer kit. Never a gate, never blocks.
162
+ - **Kit build fingerprint (digest)** _(informational)_ — `.claude/harness.json` carries a `digest`: a deterministic fingerprint of the exact kit **build** the consumer installed (`build-data` computes it over the shipped bundle). Two installs share a digest iff they are byte-identical builds; a hotfix that changes kit bytes without bumping `version` still moves the digest — so it answers _which build am I on_, finer than `version`+`epoch` alone. **Don't recompute it over `.claude/` to self-check:** the installed layout is a superset of the build (the project `CLAUDE.md` sits at the repo root, `.claude/` adds `settings.json`/`harness.json`/local rule files), so paths and file sets differ **by design** — a recompute would never match. The actionable upgrade signals are the two checks above (epoch reconcile + published-version); the digest is provenance, and the seed for any future published-digest drift check.
163
163
  - **Scaffold completeness** — every mandated file present.
164
164
  - **Dissolved-version residue** — any `operations/guardrails.md`, repo-wide `docs/pillars/`, `architecture/overview.md`, a persisted `docs/boundaries/` tree, or other old-shape artifact lingering.
165
165
  - **Module declaration coverage** — do the repo's bounded contexts have declared module homes where the author intended them? (Surface gaps; never auto-declare.)
@@ -10,6 +10,7 @@ model: inherit
10
10
  You maintain codebase coherence by detecting drift between docs and code, and fixing it. Scope: stale feature docs, broken ownership, routing table drift, architecture drift, unowned source paths, backlog health.
11
11
 
12
12
  Out of scope (handled by the `boundary` skill, which derives contracts dynamically from source):
13
+
13
14
  - **Pre-implementation impact analysis** (checking a plan against cross-cutting contracts before coding) → `boundary` skill, `check` mode
14
15
  - **Diff-scoped contract analysis** (what could a change break across module edges) → `boundary` skill, `scan` mode
15
16
 
@@ -30,15 +31,18 @@ Out of scope (handled by the `boundary` skill, which derives contracts dynamical
30
31
  ## Step 2: Validate Ownership
31
32
 
32
33
  For each doc with `owns` frontmatter:
34
+
33
35
  - Verify the glob patterns match existing files
34
36
  - Report deleted paths, empty globs, orphaned ownership
35
37
 
36
38
  For each code symbol or path a doc explicitly **names** (function/export/route/type):
39
+
37
40
  - Verify it resolves in the code, independent of git-churn — Step 3's churn gate is blind to churn-free false claims
38
41
  - 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`)
39
42
  - On codegen/reflection/DI/barrel stacks where static resolution is unreliable, skip — yielding nothing is correct
40
43
 
41
44
  Also check the **env contract** when the repo declares a canonical `.env.example` (or equivalent). The named-referent check above covers code symbols and paths but not env vars, which live in a separate canonical file:
45
+
42
46
  - 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`.
43
47
  - 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.
44
48
 
@@ -47,6 +51,7 @@ Also check the **env contract** when the repo declares a canonical `.env.example
47
51
  Run `git log --since="2 weeks ago" --name-only --pretty=format:"%h %s"` to find changed source files.
48
52
 
49
53
  For each changed file:
54
+
50
55
  - Match against `owns` patterns from every feature doc — flat and module-local alike (`docs/{features,modules/*/features}/**/*.md`) → identify the owning doc
51
56
  - If no owner exists → flag as unowned
52
57
  - If owner exists → compare last modified dates (`git log -1 --format="%ci" -- <path>`), flag docs where code changed more recently (14-day threshold)
@@ -61,7 +66,7 @@ If `./docs/routing.md` exists:
61
66
 
62
67
  Also flag **unowned paths** — top-level source directories with no owning feature doc (no `owns` glob covers them).
63
68
 
64
- Also catch a **stale greenfield self-label.** If `routing.md` (or `structure.md`) asserts the repo is greenfield — *"Greenfield. No source code or feature docs exist yet"* or similar — **but a real source tree exists** (the derived source roots from this step's item 2 above, or Step 5's Unowned-code derivation, are non-empty, e.g. a populated `packages/` of real workspaces), the self-label has gone stale: the scaffold filled in but the doc still announces an empty repo. Raise it as a question (e.g. `routing.md says "No source code exists yet" but packages/ holds 5 workspaces — confirm the greenfield label should be retired`).
69
+ Also catch a **stale greenfield self-label.** If `routing.md` (or `structure.md`) asserts the repo is greenfield — _"Greenfield. No source code or feature docs exist yet"_ or similar — **but a real source tree exists** (the derived source roots from this step's item 2 above, or Step 5's Unowned-code derivation, are non-empty, e.g. a populated `packages/` of real workspaces), the self-label has gone stale: the scaffold filled in but the doc still announces an empty repo. Raise it as a question (e.g. `routing.md says "No source code exists yet" but packages/ holds 5 workspaces — confirm the greenfield label should be retired`).
65
70
 
66
71
  ## Step 5: Check Architecture & Backlog
67
72
 
@@ -74,10 +79,12 @@ Also catch a **stale greenfield self-label.** If `routing.md` (or `structure.md`
74
79
  ## Step 6: Remediate
75
80
 
76
81
  For each stale doc:
82
+
77
83
  - If drift is clear (renamed function, new export, changed props) → update the doc directly
78
84
  - If drift is ambiguous (major refactor, unclear intent) → backlog it
79
85
 
80
86
  For unowned code paths:
87
+
81
88
  - Append: `- **[P2]** No feature doc owns \`{dir}/\` — discovered by maintenance` (`{dir}` = the actual unowned source directory)
82
89
 
83
90
  **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`, with 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. (This is the decline branch — it pairs with dispatching a remediation sub-agent on a yes.)
@@ -87,8 +94,8 @@ For unowned code paths:
87
94
  1. Update `docs/structure.md` Health Log with today's date and summary
88
95
  2. Update `docs/memory/maintenance.md` with last review date, stale docs fixed, unowned paths, backlog items created
89
96
  3. Report findings: stale docs, broken ownership, unowned code, architecture drift, backlog health
90
- 4. **Inbox-distillation threshold.** Count undigested inbox entries — `## ` entry blocks across `docs/memory/inbox/*.md` (the inbox is consume-on-digest, so every block present is undigested). If the count is **≥5**, add one line to the report **proposing** a `distiller` `facts` run — propose only, never auto-run, no cron. If the user declines or ignores it, do nothing: the count keeps growing and the proposal reappears next pass — that recurrence *is* the dedupe, so never backlog it.
91
- 5. **Docs-distillation threshold.** Per target doc, count undigested fact-cards (`invalid_from: null`, the doc's path not in their `digested_into:`) that **touch** it by the structural intersection in `skills/distiller/references/docs-mode.md` Resolution 1 (provenance∩`owns` strong, entities∩declared-ownership supporting — qmd-independent). If **≥10** map to **one** doc, add one line to the report **proposing** a `distiller docs --doc <path>` run on that doc — propose only, never auto-run, no cron. Declined or ignored ⇒ the count keeps growing and the proposal reappears next pass; that recurrence *is* the dedupe, so never backlog the proposal.
97
+ 4. **Inbox-distillation threshold.** Count undigested inbox entries — `## ` entry blocks across `docs/memory/inbox/*.md` (the inbox is consume-on-digest, so every block present is undigested). If the count is **≥5**, add one line to the report **proposing** a `distiller` `facts` run — propose only, never auto-run, no cron. If the user declines or ignores it, do nothing: the count keeps growing and the proposal reappears next pass — that recurrence _is_ the dedupe, so never backlog it.
98
+ 5. **Docs-distillation threshold.** Per target doc, count undigested fact-cards (`invalid_from: null`, the doc's path not in their `digested_into:`) that **touch** it by the structural intersection in `skills/distiller/references/docs-mode.md` Resolution 1 (provenance∩`owns` strong, entities∩declared-ownership supporting — qmd-independent). If **≥10** map to **one** doc, add one line to the report **proposing** a `distiller docs --doc <path>` run on that doc — propose only, never auto-run, no cron. Declined or ignored ⇒ the count keeps growing and the proposal reappears next pass; that recurrence _is_ the dedupe, so never backlog the proposal.
92
99
 
93
100
  ## Step 8: Refresh Index (Optional)
94
101