@nurix/etna 0.19.66 → 0.19.68

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 (234) hide show
  1. package/bin/etna.js +10 -1
  2. package/data/harness-index.json +1 -5
  3. package/data/harnesses/code/CLAUDE.md +2 -0
  4. package/data/harnesses/code/agents/maintenance.md +4 -1
  5. package/data/harnesses/code/harness.json +7 -2
  6. package/data/harnesses/code/hooks/awareness.mjs +69 -0
  7. package/data/harnesses/code/hooks/compliance.mjs +2 -14
  8. package/data/harnesses/code/hooks/lib/approved.mjs +30 -0
  9. package/data/harnesses/code/hooks/lib/frozen.mjs +3 -0
  10. package/data/harnesses/code/hooks/lib/ownership.mjs +3 -1
  11. package/data/harnesses/code/skills/documentation/references/frontmatter.md +1 -1
  12. package/data/harnesses/code/skills/documentation/scripts/doc-lint.mjs +1 -1
  13. package/data/harnesses/code/skills/documentation/templates/Readme.md +2 -0
  14. package/data/harnesses/code/skills/documentation/templates/structure.md +1 -0
  15. package/data/harnesses/delivery/agents/maintenance.md +4 -1
  16. package/data/harnesses/delivery/harness.json +2 -2
  17. package/data/harnesses/delivery/skills/documentation/references/frontmatter.md +1 -1
  18. package/data/harnesses/delivery/skills/documentation/scripts/doc-lint.mjs +1 -1
  19. package/data/harnesses/delivery/skills/documentation/templates/Readme.md +2 -0
  20. package/data/harnesses/delivery/skills/documentation/templates/structure.md +1 -0
  21. package/data/harnesses/etna/agents/maintenance.md +4 -1
  22. package/data/harnesses/etna/harness.json +2 -2
  23. package/data/harnesses/etna/skills/documentation/references/frontmatter.md +1 -1
  24. package/data/harnesses/etna/skills/documentation/scripts/doc-lint.mjs +1 -1
  25. package/data/harnesses/etna/skills/documentation/templates/Readme.md +2 -0
  26. package/data/harnesses/etna/skills/documentation/templates/structure.md +1 -0
  27. package/lib/install/materialize.mjs +51 -57
  28. package/package.json +2 -2
  29. package/data/harnesses/apollo/.mcp.json +0 -8
  30. package/data/harnesses/apollo/.prettierignore +0 -29
  31. package/data/harnesses/apollo/.prettierrc.json +0 -3
  32. package/data/harnesses/apollo/.vscode/settings.json +0 -19
  33. package/data/harnesses/apollo/CLAUDE.md +0 -162
  34. package/data/harnesses/apollo/agents/bookkeeper.md +0 -28
  35. package/data/harnesses/apollo/agents/brainstorm.md +0 -144
  36. package/data/harnesses/apollo/agents/change-review.md +0 -251
  37. package/data/harnesses/apollo/agents/lld-mode.md +0 -58
  38. package/data/harnesses/apollo/agents/maintenance.md +0 -234
  39. package/data/harnesses/apollo/agents/performance-review.md +0 -223
  40. package/data/harnesses/apollo/agents/retro.md +0 -46
  41. package/data/harnesses/apollo/codex/agents/bookkeeper.toml +0 -26
  42. package/data/harnesses/apollo/codex/agents/brainstorm.toml +0 -142
  43. package/data/harnesses/apollo/codex/agents/change-review.toml +0 -249
  44. package/data/harnesses/apollo/codex/agents/lld-mode.toml +0 -52
  45. package/data/harnesses/apollo/codex/agents/maintenance.toml +0 -228
  46. package/data/harnesses/apollo/codex/agents/performance-review.toml +0 -222
  47. package/data/harnesses/apollo/codex/agents/retro.toml +0 -45
  48. package/data/harnesses/apollo/harness.json +0 -19
  49. package/data/harnesses/apollo/hooks/approved-packages.md +0 -44
  50. package/data/harnesses/apollo/hooks/awareness.mjs +0 -405
  51. package/data/harnesses/apollo/hooks/check-bookkeeping-clean.mjs +0 -19
  52. package/data/harnesses/apollo/hooks/check-changelog-presence.mjs +0 -57
  53. package/data/harnesses/apollo/hooks/check-completion-integrity.mjs +0 -71
  54. package/data/harnesses/apollo/hooks/check-ownership.mjs +0 -22
  55. package/data/harnesses/apollo/hooks/compliance.mjs +0 -457
  56. package/data/harnesses/apollo/hooks/hooks.json +0 -23
  57. package/data/harnesses/apollo/hooks/lib/frozen.mjs +0 -58
  58. package/data/harnesses/apollo/hooks/lib/ownership.mjs +0 -242
  59. package/data/harnesses/apollo/hooks/lib/state.mjs +0 -170
  60. package/data/harnesses/apollo/rules/changelog.md +0 -27
  61. package/data/harnesses/apollo/rules/database.md +0 -34
  62. package/data/harnesses/apollo/rules/frontend.md +0 -30
  63. package/data/harnesses/apollo/rules/general.md +0 -40
  64. package/data/harnesses/apollo/rules/nomenclature.md +0 -30
  65. package/data/harnesses/apollo/rules/pnpm.md +0 -57
  66. package/data/harnesses/apollo/rules/testing.md +0 -64
  67. package/data/harnesses/apollo/skills/boundary/SKILL.md +0 -75
  68. package/data/harnesses/apollo/skills/boundary/references/index.md +0 -16
  69. package/data/harnesses/apollo/skills/boundary/references/mechanisms.md +0 -99
  70. package/data/harnesses/apollo/skills/boundary/references/packs/async-messaging.md +0 -81
  71. package/data/harnesses/apollo/skills/boundary/references/packs/auth.md +0 -93
  72. package/data/harnesses/apollo/skills/boundary/references/packs/build-config-runtime.md +0 -93
  73. package/data/harnesses/apollo/skills/boundary/references/packs/cloudflare.md +0 -93
  74. package/data/harnesses/apollo/skills/boundary/references/packs/frontend.md +0 -93
  75. package/data/harnesses/apollo/skills/boundary/references/packs/generic-tail.md +0 -55
  76. package/data/harnesses/apollo/skills/boundary/references/packs/persistence.md +0 -93
  77. package/data/harnesses/apollo/skills/boundary/references/packs/wire-api.md +0 -87
  78. package/data/harnesses/apollo/skills/brainstorm/README.md +0 -56
  79. package/data/harnesses/apollo/skills/brainstorm/SKILL.md +0 -173
  80. package/data/harnesses/apollo/skills/brainstorm/references/doctrine.md +0 -98
  81. package/data/harnesses/apollo/skills/brainstorm/references/harvest.md +0 -86
  82. package/data/harnesses/apollo/skills/brainstorm/references/session-schema.md +0 -186
  83. package/data/harnesses/apollo/skills/brainstorm/scripts/detector.mjs +0 -460
  84. package/data/harnesses/apollo/skills/design/SKILL.md +0 -121
  85. package/data/harnesses/apollo/skills/design/components/charts.md +0 -76
  86. package/data/harnesses/apollo/skills/design/components/collections.md +0 -132
  87. package/data/harnesses/apollo/skills/design/components/feedback.md +0 -47
  88. package/data/harnesses/apollo/skills/design/components/hooks.md +0 -35
  89. package/data/harnesses/apollo/skills/design/components/index.md +0 -143
  90. package/data/harnesses/apollo/skills/design/components/inputs.md +0 -327
  91. package/data/harnesses/apollo/skills/design/components/layout.md +0 -52
  92. package/data/harnesses/apollo/skills/design/components/media.md +0 -66
  93. package/data/harnesses/apollo/skills/design/components/motion.md +0 -82
  94. package/data/harnesses/apollo/skills/design/components/navigation.md +0 -29
  95. package/data/harnesses/apollo/skills/design/components/overlays.md +0 -72
  96. package/data/harnesses/apollo/skills/design/components/setup.md +0 -40
  97. package/data/harnesses/apollo/skills/design/components/typography.md +0 -46
  98. package/data/harnesses/apollo/skills/design/components/utils.md +0 -37
  99. package/data/harnesses/apollo/skills/design/data/blueprints/browse.md +0 -38
  100. package/data/harnesses/apollo/skills/design/data/blueprints/creation-flow.md +0 -38
  101. package/data/harnesses/apollo/skills/design/data/blueprints/dashboard.md +0 -38
  102. package/data/harnesses/apollo/skills/design/data/blueprints/grid.md +0 -38
  103. package/data/harnesses/apollo/skills/design/data/blueprints/queue.md +0 -38
  104. package/data/harnesses/apollo/skills/design/data/blueprints/record-detail.md +0 -38
  105. package/data/harnesses/apollo/skills/design/data/blueprints/settings.md +0 -38
  106. package/data/harnesses/apollo/skills/design/data/charts/census.csv +0 -58
  107. package/data/harnesses/apollo/skills/design/data/checklists/browse.md +0 -21
  108. package/data/harnesses/apollo/skills/design/data/checklists/creation-flow.md +0 -20
  109. package/data/harnesses/apollo/skills/design/data/checklists/dashboard.md +0 -21
  110. package/data/harnesses/apollo/skills/design/data/checklists/grid.md +0 -21
  111. package/data/harnesses/apollo/skills/design/data/checklists/queue.md +0 -21
  112. package/data/harnesses/apollo/skills/design/data/checklists/record-detail.md +0 -21
  113. package/data/harnesses/apollo/skills/design/data/checklists/settings.md +0 -21
  114. package/data/harnesses/apollo/skills/design/data/chrome/board-column.md +0 -68
  115. package/data/harnesses/apollo/skills/design/data/chrome/data-table.md +0 -63
  116. package/data/harnesses/apollo/skills/design/data/chrome/side-panel.md +0 -60
  117. package/data/harnesses/apollo/skills/design/data/chrome/sidebar.md +0 -78
  118. package/data/harnesses/apollo/skills/design/data/chrome/stat-cards.md +0 -62
  119. package/data/harnesses/apollo/skills/design/data/chrome/topbar.md +0 -65
  120. package/data/harnesses/apollo/skills/design/data/elevation/ant-design-directional-shadow.md +0 -19
  121. package/data/harnesses/apollo/skills/design/data/elevation/apple-liquid-glass-material.md +0 -18
  122. package/data/harnesses/apollo/skills/design/data/elevation/atlassian-surface-shadow-pairing.md +0 -20
  123. package/data/harnesses/apollo/skills/design/data/elevation/fluent-2-key-ambient-ramp.md +0 -20
  124. package/data/harnesses/apollo/skills/design/data/elevation/github-primer-sparing-shadow.md +0 -19
  125. package/data/harnesses/apollo/skills/design/data/elevation/ibm-carbon-layer-and-border.md +0 -19
  126. package/data/harnesses/apollo/skills/design/data/elevation/linear-dark-surface-ladder.md +0 -17
  127. package/data/harnesses/apollo/skills/design/data/elevation/material-2-key-ambient-dp-ramp.md +0 -19
  128. package/data/harnesses/apollo/skills/design/data/elevation/material-3-tonal-elevation.md +0 -21
  129. package/data/harnesses/apollo/skills/design/data/elevation/neobrutalist-hard-offset.md +0 -19
  130. package/data/harnesses/apollo/skills/design/data/elevation/neumorphic-soft-dual-shadow.md +0 -18
  131. package/data/harnesses/apollo/skills/design/data/elevation/notion-warm-minimal-hairline.md +0 -17
  132. package/data/harnesses/apollo/skills/design/data/elevation/polaris-elevation-inset-bevel.md +0 -21
  133. package/data/harnesses/apollo/skills/design/data/elevation/radix-themes-alpha-ring-scale.md +0 -19
  134. package/data/harnesses/apollo/skills/design/data/elevation/shadcn-neutral-derived-radius.md +0 -19
  135. package/data/harnesses/apollo/skills/design/data/elevation/stripe-brand-tinted-dual-shadow.md +0 -18
  136. package/data/harnesses/apollo/skills/design/data/elevation/tailwind-default-utility-scale.md +0 -19
  137. package/data/harnesses/apollo/skills/design/data/elevation/vercel-geist-shadow-as-border.md +0 -20
  138. package/data/harnesses/apollo/skills/design/data/iconography.md +0 -199
  139. package/data/harnesses/apollo/skills/design/data/motion/accordion-expand.md +0 -18
  140. package/data/harnesses/apollo/skills/design/data/motion/destructive-hold-confirm.md +0 -18
  141. package/data/harnesses/apollo/skills/design/data/motion/drag-dismiss-momentum.md +0 -18
  142. package/data/harnesses/apollo/skills/design/data/motion/empty-state-arrive.md +0 -18
  143. package/data/harnesses/apollo/skills/design/data/motion/hover-lift.md +0 -18
  144. package/data/harnesses/apollo/skills/design/data/motion/modal-center-arrive.md +0 -18
  145. package/data/harnesses/apollo/skills/design/data/motion/number-ticker-roll.md +0 -18
  146. package/data/harnesses/apollo/skills/design/data/motion/onboarding-bounce.md +0 -18
  147. package/data/harnesses/apollo/skills/design/data/motion/panel-slide.md +0 -18
  148. package/data/harnesses/apollo/skills/design/data/motion/press-feedback.md +0 -18
  149. package/data/harnesses/apollo/skills/design/data/motion/progress-linear-loop.md +0 -18
  150. package/data/harnesses/apollo/skills/design/data/motion/route-crossfade.md +0 -18
  151. package/data/harnesses/apollo/skills/design/data/motion/rubber-band-overscroll.md +0 -18
  152. package/data/harnesses/apollo/skills/design/data/motion/skeleton-shimmer.md +0 -18
  153. package/data/harnesses/apollo/skills/design/data/motion/stagger-arrive.md +0 -18
  154. package/data/harnesses/apollo/skills/design/data/motion/toast-enter-stack.md +0 -18
  155. package/data/harnesses/apollo/skills/design/data/motion/tooltip-chain-instant.md +0 -18
  156. package/data/harnesses/apollo/skills/design/data/motion/trigger-anchored-reveal.md +0 -18
  157. package/data/harnesses/apollo/skills/design/data/tells.csv +0 -34
  158. package/data/harnesses/apollo/skills/design/data/voices/bright-collaborator.md +0 -29
  159. package/data/harnesses/apollo/skills/design/data/voices/direct-operator.md +0 -29
  160. package/data/harnesses/apollo/skills/design/data/voices/earnest-helper.md +0 -29
  161. package/data/harnesses/apollo/skills/design/data/voices/editorial-composed.md +0 -29
  162. package/data/harnesses/apollo/skills/design/data/voices/quiet-concierge.md +0 -29
  163. package/data/harnesses/apollo/skills/design/data/voices/warm-guide.md +0 -29
  164. package/data/harnesses/apollo/skills/design/references/compose.md +0 -23
  165. package/data/harnesses/apollo/skills/design/references/content.md +0 -28
  166. package/data/harnesses/apollo/skills/design/references/emission.md +0 -21
  167. package/data/harnesses/apollo/skills/design/references/existing-apps.md +0 -27
  168. package/data/harnesses/apollo/skills/design/references/foundations.md +0 -57
  169. package/data/harnesses/apollo/skills/design/references/intake.md +0 -40
  170. package/data/harnesses/apollo/skills/design/references/object-pass.md +0 -24
  171. package/data/harnesses/apollo/skills/design/references/ship-gate.md +0 -29
  172. package/data/harnesses/apollo/skills/design/references/ux-patterns/Readme.md +0 -195
  173. package/data/harnesses/apollo/skills/design/references/ux-patterns/ai-layer.md +0 -49
  174. package/data/harnesses/apollo/skills/design/references/ux-patterns/attributes-lifecycle.md +0 -43
  175. package/data/harnesses/apollo/skills/design/references/ux-patterns/container-choice.md +0 -44
  176. package/data/harnesses/apollo/skills/design/references/ux-patterns/creation-paths.md +0 -46
  177. package/data/harnesses/apollo/skills/design/references/ux-patterns/dashboards.md +0 -42
  178. package/data/harnesses/apollo/skills/design/references/ux-patterns/modes.md +0 -42
  179. package/data/harnesses/apollo/skills/design/references/ux-patterns/object-model.md +0 -46
  180. package/data/harnesses/apollo/skills/design/references/ux-patterns/page-archetype.md +0 -48
  181. package/data/harnesses/apollo/skills/design/references/ux-patterns/promotion-demotion.md +0 -37
  182. package/data/harnesses/apollo/skills/design/references/ux-patterns/settings.md +0 -42
  183. package/data/harnesses/apollo/skills/design/references/ux-patterns/standard-pages.md +0 -46
  184. package/data/harnesses/apollo/skills/design/references/ux-patterns/state-matrix.md +0 -41
  185. package/data/harnesses/apollo/skills/design/references/ux-patterns/table-mechanics.md +0 -48
  186. package/data/harnesses/apollo/skills/design/references/ux-patterns/verbs.md +0 -45
  187. package/data/harnesses/apollo/skills/design/references/ux-patterns/viewer-context.md +0 -40
  188. package/data/harnesses/apollo/skills/design/scripts/README-validator.md +0 -27
  189. package/data/harnesses/apollo/skills/design/scripts/select-chart.mjs +0 -622
  190. package/data/harnesses/apollo/skills/design/scripts/validate-design-md.mjs +0 -1198
  191. package/data/harnesses/apollo/skills/documentation/SKILL.md +0 -135
  192. package/data/harnesses/apollo/skills/documentation/references/examples.md +0 -279
  193. package/data/harnesses/apollo/skills/documentation/references/frontmatter.md +0 -44
  194. package/data/harnesses/apollo/skills/documentation/references/instruction-style.md +0 -50
  195. package/data/harnesses/apollo/skills/documentation/references/style-guide.md +0 -384
  196. package/data/harnesses/apollo/skills/documentation/references/untemplated.md +0 -38
  197. package/data/harnesses/apollo/skills/documentation/scripts/doc-lint.mjs +0 -140
  198. package/data/harnesses/apollo/skills/documentation/templates/Readme.md +0 -35
  199. package/data/harnesses/apollo/skills/documentation/templates/api-reference.md +0 -20
  200. package/data/harnesses/apollo/skills/documentation/templates/architecture-decision.md +0 -121
  201. package/data/harnesses/apollo/skills/documentation/templates/backlog.md +0 -33
  202. package/data/harnesses/apollo/skills/documentation/templates/behavioral-checklist.md +0 -81
  203. package/data/harnesses/apollo/skills/documentation/templates/bookkeeping.md +0 -18
  204. package/data/harnesses/apollo/skills/documentation/templates/changelog-entry.md +0 -57
  205. package/data/harnesses/apollo/skills/documentation/templates/changelog-index.md +0 -41
  206. package/data/harnesses/apollo/skills/documentation/templates/docs-readme.md +0 -72
  207. package/data/harnesses/apollo/skills/documentation/templates/domain-model.md +0 -30
  208. package/data/harnesses/apollo/skills/documentation/templates/environment-registry.md +0 -15
  209. package/data/harnesses/apollo/skills/documentation/templates/feature.md +0 -150
  210. package/data/harnesses/apollo/skills/documentation/templates/glossary.md +0 -11
  211. package/data/harnesses/apollo/skills/documentation/templates/implementation-map.md +0 -42
  212. package/data/harnesses/apollo/skills/documentation/templates/journal.md +0 -13
  213. package/data/harnesses/apollo/skills/documentation/templates/memory-main.md +0 -25
  214. package/data/harnesses/apollo/skills/documentation/templates/migration-runbook.md +0 -34
  215. package/data/harnesses/apollo/skills/documentation/templates/non-goals.md +0 -11
  216. package/data/harnesses/apollo/skills/documentation/templates/operations-procedure.md +0 -36
  217. package/data/harnesses/apollo/skills/documentation/templates/plan.md +0 -88
  218. package/data/harnesses/apollo/skills/documentation/templates/protected-files.md +0 -37
  219. package/data/harnesses/apollo/skills/documentation/templates/root-readme.md +0 -104
  220. package/data/harnesses/apollo/skills/documentation/templates/security-overview.md +0 -27
  221. package/data/harnesses/apollo/skills/documentation/templates/structure.md +0 -65
  222. package/data/harnesses/apollo/skills/documentation/templates/system-overview.md +0 -32
  223. package/data/harnesses/apollo/skills/documentation/templates/testing-strategy.md +0 -29
  224. package/data/harnesses/apollo/skills/schema-design/SKILL.md +0 -141
  225. package/data/harnesses/apollo/skills/test/SKILL.md +0 -104
  226. package/data/harnesses/apollo/skills/testing/SKILL.md +0 -166
  227. package/data/harnesses/apollo/skills/workflow-mapper/SKILL.md +0 -451
  228. package/data/harnesses/apollo/skills/workflow-mapper/references/patterns.md +0 -214
  229. /package/data/harnesses/{apollo → code}/docs/README.md +0 -0
  230. /package/data/harnesses/{apollo → code}/docs/history/CHANGELOG.md +0 -0
  231. /package/data/harnesses/{apollo → code}/docs/history/backlog.md +0 -0
  232. /package/data/harnesses/{apollo → code}/docs/memory/main.md +0 -0
  233. /package/data/harnesses/{apollo → code}/docs/structure.md +0 -0
  234. /package/data/harnesses/{apollo → code}/rules/cloudflare.md +0 -0
@@ -24,7 +24,6 @@ import {
24
24
  readFileSync,
25
25
  writeFileSync,
26
26
  renameSync,
27
- cpSync,
28
27
  readdirSync,
29
28
  lstatSync,
30
29
  rmSync,
@@ -50,23 +49,25 @@ export function isSymlink(path) {
50
49
  }
51
50
  }
52
51
 
53
- // Move <path> to <path>.bak.<timestamp> if it exists. Returns the backup path, or null.
54
- function backupIfExists(path) {
55
- if (!existsSync(path) && !isSymlink(path)) return null;
56
- const ts = new Date().toISOString().replace(/[:.]/g, '-');
57
- const backup = `${path}.bak.${ts}`;
58
- renameSync(path, backup);
59
- return backup;
52
+ // The .bkp path for a colliding file: the marker goes BEFORE the final extension
53
+ // (CHANGELOG.md → CHANGELOG.bkp.md, .prettierrc.json → .prettierrc.bkp.json), so one glob —
54
+ // `*.bkp.*` — matches every backup, and every harness scanner ignores exactly that glob. A file
55
+ // with no extension appends `.bkp`.
56
+ export function bkpPathFor(path) {
57
+ const slash = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
58
+ const dot = path.lastIndexOf('.');
59
+ if (dot <= slash + 1) return `${path}.bkp`; // no extension, or a leading-dot name like `.env`
60
+ return `${path.slice(0, dot)}.bkp${path.slice(dot)}`;
60
61
  }
61
62
 
62
- // Copy a directory to <path>.bak.<timestamp>, leaving the original in place. Returns the
63
- // backup path, or null. Used for .claude/, which is refreshed in place (not overwritten
64
- // wholesale), so the live tree must survive for the in-place update — snapshot, don't move.
65
- function snapshotDirIfExists(path) {
66
- if (!existsSync(path)) return null;
67
- const ts = new Date().toISOString().replace(/[:.]/g, '-');
68
- const backup = `${path}.bak.${ts}`;
69
- cpSync(path, backup, { recursive: true });
63
+ // Move a colliding FOREIGN file aside as its .bkp sibling. First backup wins: if the .bkp
64
+ // already exists (a re-run before any baseline folded it), the older backup is the more
65
+ // original and is kept; the collision file is simply overwritten by the install.
66
+ function bkpRename(path) {
67
+ if (!existsSync(path) && !isSymlink(path)) return null;
68
+ const backup = bkpPathFor(path);
69
+ if (existsSync(backup) || isSymlink(backup)) return null;
70
+ renameSync(path, backup);
70
71
  return backup;
71
72
  }
72
73
 
@@ -300,43 +301,17 @@ export function materializeHarness({ bundledHarnessDir, targetDir, pluginName, p
300
301
  // the marker that holds it is one of the files about to be overwritten.
301
302
  const priorOwned = readInstalledOwned(targetDir);
302
303
 
303
- // The safety net, for the two artifacts a refresh overwrites outright. A git repo recovers them
304
- // from history, so we only say so; without git there is no net, so we take a copy and warn. The
305
- // .claude/ tree is SNAPSHOTTED rather than moved — it is refreshed in place, so the live tree has
306
- // to survive for the writes below.
307
- for (const [rel, kind] of [
308
- ['CLAUDE.md', 'file'],
309
- ['AGENTS.md', 'file'],
310
- ]) {
311
- const dest = join(targetDir, rel);
312
- if (!existsSync(dest) && !isSymlink(dest)) continue;
313
- if (projectHasGit) {
314
- notices.push(
315
- `Overwrote existing ${rel} (tracked by git — \`git checkout ${rel}\` to restore).`,
316
- );
317
- } else {
318
- warnings.push(
319
- `No .git here, so no version-control safety net — backed up existing ${rel} → ${backupIfExists(dest)}`,
320
- );
321
- }
322
- void kind;
323
- }
324
- for (const rel of ['.claude', ...CODEX_REBUILT_DIRS]) {
325
- const dest = join(targetDir, rel);
326
- if (!existsSync(dest)) continue;
327
- if (projectHasGit) {
328
- notices.push(
329
- `Refreshed existing ${rel}/ in place (tracked by git — \`git checkout ${rel}\` to restore).`,
330
- );
331
- } else {
332
- const backup = snapshotDirIfExists(dest);
333
- if (backup) {
334
- warnings.push(
335
- `No .git here, so no version-control safety net — snapshotted existing ${rel}/ → ${backup}`,
336
- );
337
- }
338
- }
339
- }
304
+ // FIRST CONTACT vs REFRESH is the entire backup question, and the marker decides it. On a
305
+ // refresh, every colliding file at a harness path is the harness's own previous version —
306
+ // overwritten in place, git or no git; backing up our own stale copies would bury every upgrade
307
+ // in .bkp noise. On first contact, a colliding file is the USER'S — it is moved aside as its
308
+ // .bkp sibling, ours installs, and the maintenance baseline folds docs-side .bkp content into
309
+ // the reconciled tree (top-level config .bkp files are never merged — they are listed and left
310
+ // to the human). Git is not the distinction: history protects bytes, but the .bkp file is what
311
+ // makes the fold duty visible to the next session. The harness is deliberately unapologetic
312
+ // about its own process; the backup is how it stays honest about yours.
313
+ const firstContact = !existsSync(join(targetDir, '.claude', 'harness.json'));
314
+ void projectHasGit; // kept for caller compatibility; the .bkp rule does not branch on it
340
315
 
341
316
  // The Codex mirrors are rebuilt wholesale, not merged: they are byte projections of the Claude
342
317
  // tree, so a file left behind from a prior version is a skill Codex still sees after the harness
@@ -346,13 +321,18 @@ export function materializeHarness({ bundledHarnessDir, targetDir, pluginName, p
346
321
 
347
322
  let written = 0;
348
323
  let seeded = 0;
324
+ const backedUp = [];
349
325
  for (const file of files) {
350
326
  const dest = join(targetDir, file.path);
351
- // A seed is one-time scaffolding: once the path exists it is the project's living copy, and a
352
- // refresh must not touch it. This is also the rule that lets an Apollo export carry an App's
353
- // own `docs/history/backlog.md` instead of the harness's.
327
+ // A seed is one-time scaffolding: once installed, the path is the project's living copy and a
328
+ // refresh never touches it. On FIRST contact a pre-existing file at a seed path is the user's
329
+ // — it moves aside as .bkp and the pristine seed installs, so the baseline has both to fold.
354
330
  if (file.policy === 'seed') {
355
- if (existsSync(dest)) continue;
331
+ if (existsSync(dest)) {
332
+ if (!firstContact) continue;
333
+ const backup = bkpRename(dest);
334
+ if (backup) backedUp.push(file.path);
335
+ }
356
336
  mkdirSync(dirname(dest), { recursive: true });
357
337
  writeFileSync(dest, file.content);
358
338
  seeded += 1;
@@ -362,12 +342,26 @@ export function materializeHarness({ bundledHarnessDir, targetDir, pluginName, p
362
342
  // permissions. The plan's copy is what a FRESH install would hold; against an existing file the
363
343
  // authority is mergeHooks below, which is additive and idempotent.
364
344
  if (file.policy === 'merge') continue;
345
+ if (firstContact && (existsSync(dest) || isSymlink(dest))) {
346
+ const backup = bkpRename(dest);
347
+ if (backup) backedUp.push(file.path);
348
+ }
365
349
  mkdirSync(dirname(dest), { recursive: true });
366
350
  writeFileSync(dest, file.content);
367
351
  written += 1;
368
352
  }
369
353
  installed.push(`${written} harness file(s) → ./ and .claude/`);
370
354
  if (seeded > 0) installed.push(`${seeded} seed file(s) → ./ (only where absent)`);
355
+ if (backedUp.length > 0) {
356
+ warnings.push(
357
+ `${backedUp.length} pre-existing file(s) moved aside as .bkp siblings (${backedUp.join(', ')}). ` +
358
+ 'The maintenance baseline folds docs-side .bkp content into the reconciled tree and deletes the .bkp; ' +
359
+ 'top-level config .bkp files are never merged — review those yourself.',
360
+ );
361
+ }
362
+ if (!firstContact) {
363
+ notices.push('Refresh: harness-owned files updated in place; seeds and .bkp files untouched.');
364
+ }
371
365
 
372
366
  // Prune components a prior harness version owned but this bundle no longer ships (e.g. a retired
373
367
  // agent). Only prior-owned names are eligible, so the project's own files survive.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nurix/etna",
3
- "version": "0.19.66",
3
+ "version": "0.19.68",
4
4
  "description": "Bootstrap a project with a Nurix harness — copies the harness's CLAUDE.md, skills, agents, rules, and hooks directly into the project from a bundled payload (no marketplace fetch, no network).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,5 +42,5 @@
42
42
  "agent",
43
43
  "plugin"
44
44
  ],
45
- "etnaFingerprint": "774efa3ae2da"
45
+ "etnaFingerprint": "d5b676c55c3a"
46
46
  }
@@ -1,8 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "design": {
4
- "type": "http",
5
- "url": "https://apollo.nustack.tech/design/mcp"
6
- }
7
- }
8
- }
@@ -1,29 +0,0 @@
1
- # Dependencies & build output
2
- node_modules
3
- dist
4
- build
5
-
6
- # Lockfiles
7
- pnpm-lock.yaml
8
- package-lock.json
9
- yarn.lock
10
-
11
- # Harness-managed — the installer overwrites all of these, so formatting them is churn
12
- # that comes straight back on the next `npx @nurix/etna`.
13
- .claude
14
- .codex
15
- .agents
16
- CLAUDE.md
17
- AGENTS.md
18
-
19
- # Frozen records — a plan, changelog entry, or migration runbook is a point-in-time
20
- # artifact that is never edited after it freezes. Reformatting one is an edit, and the
21
- # `maintenance` agent is forbidden from making it — so a format gate over this tree is
22
- # a demand nothing in the repo is allowed to satisfy.
23
- docs/history
24
-
25
- # Source catalogs — authored markdown; prettier collapses template/example blocks
26
- skills
27
- rules
28
- agents
29
- harness
@@ -1,3 +0,0 @@
1
- {
2
- "proseWrap": "never"
3
- }
@@ -1,19 +0,0 @@
1
- {
2
- // Markdown: Prettier unwraps prose to one logical line per paragraph
3
- // (see .prettierrc → proseWrap:never) on save; the editor soft-wraps for
4
- // reading, so no hard line breaks get baked into the source.
5
- "[markdown]": {
6
- "editor.defaultFormatter": "esbenp.prettier-vscode",
7
- "editor.formatOnSave": true,
8
- "editor.wordWrap": "on"
9
- },
10
- // Hide harness-authoring scaffolding from the file explorer
11
- "files.exclude": {
12
- ".claude": true,
13
- ".vscode": true,
14
- ".agents": true,
15
- ".codex": true,
16
- "**/node_modules": true,
17
- "**/apollo.service.json": true
18
- }
19
- }
@@ -1,162 +0,0 @@
1
- # Agent Instructions
2
-
3
- How AI coding agents — any vendor, any runtime — work on this project. Rules are runtime-neutral: a rule that depends on a capability (sub-agent dispatch, browser tools, context injection, slash commands) applies only if the runtime has it, and states its fallback. Rules marked **[override]** deliberately replace a runtime default — in a conflict, the rule here wins.
4
-
5
- ---
6
-
7
- ## Maintenance
8
-
9
- **Baseline first**: if `docs/structure.md` lacks a `harness-version` frontmatter marker, or it is behind the `version` in `.claude/harness.json`, invoke the `maintenance` agent before taking up the user's first ask — tell the user, let the agent run, then proceed.
10
-
11
- Invoke the `maintenance` agent when a mechanical condition holds: `docs/structure.md` is missing (the repo isn't reconciled — baseline first), the `harness-version` marker is behind the installed version, a doc contradicts code being touched, or source paths are unowned — not on prose that merely looks stale. Structural reconciliation is never done by hand — the agent auto-selects its mode (baseline when the marker is missing or behind, coherence audit otherwise) and hands back; if it returns a follow-up (typically the module proposal), re-invoke it to finish. Single-glob or single-line doc corrections are done inline, per § Documentation. Each component's internals live in the component, not here.
12
-
13
- ---
14
-
15
- ## Getting Started
16
-
17
- - Consult **[`docs/structure.md`](docs/structure.md)** when adding or moving a doc — it is the authority on placement
18
- - Read **[`docs/memory/`](docs/memory/)** for agent memory files (one per agent)
19
- - Prefer `docs/` over `README.md` — docs/ is canonical for agents; check the README only when docs/ lacks a setup detail
20
- - Check **[`package.json`](package.json)** for available scripts. Detect the package manager from the lockfile — see `.claude/rules/general.md`; don't hardcode one.
21
-
22
- ---
23
-
24
- ## Workflows
25
-
26
- Three peer modes, then a verification gate and 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.
27
-
28
- | Mode | Enter when | Implemented by | Exits to |
29
- | --- | --- | --- | --- |
30
- | **Brainstorming** | explicit ask (`/brainstorm start`); or offer a session — never auto-enter — when the user brings a large piece of work (name what makes it big) or an utterance contradicts a recorded pillar (name the principle) | `brainstorm` agent + skill | LLD, Plan, or close + harvest |
31
- | **LLD** (low-level design) | new feature work | `lld-mode` agent + `documentation` skill | Plan |
32
- | **Plan** | an LLD is approved | `documentation` skill → `docs/history/plans/YYYY-MM-DD-{slug}.md` | Verification gate → Completion |
33
-
34
- > Brainstorm entry needs a **basis** — a reference document or a one-shot brain dump; drip-sized asks (a bug fix, one button) are too small and get redirected. A **pillar** is a recorded strategic principle from a past brainstorm: in-progress sessions live under `docs/research/`, harvested ones under `docs/history/brainstorms/`, harvested doctrine under `docs/architecture/`. The LLD is the feature doc itself — `docs/features/{feature}.md`, design intent first, extended in place at Completion.
35
-
36
- > **The lightweight lane:** a change touching one module, no cross-module contract surface, and under about a day's work skips the modes above entirely — the ad-hoc regime of `.claude/rules/testing.md` applies: make the change, pay its test immediately if it alters promised behavior, cover it with a changelog row.
37
-
38
- **On Plan Completion:**
39
-
40
- 1. **The verification gate passes first** — user-triggered: when implementation completes, report it and offer the gate; never run it unbidden. It requires the plan's Test Obligations ledger to exist (proof the plan gates ran) and discharges every row, driving the real surface before pinning tests — `.claude/rules/testing.md`. A plan with outstanding obligations stays open, whatever the code does.
41
- 2. Freeze the plan — `Status: Complete`, fill the Completed date. The file is now frozen.
42
- 3. **Discharge the plan's Doc Obligations ledger — every row, into exactly one outcome**: **updated** (the doc now states what the code does), **owes nothing** (with the reason), or **blocked** (→ a backlog item, so the debt outlives the frozen plan). For each row's doc: flip `status: active` if it was `draft`, extend it in place with the how-it-works sections, and confirm its `owns:` globs against the actual code. A plan spanning three features discharges three rows — the ledger, not memory, says how many.
43
- 4. Record the gate's results in the changelog entry, and confirm every section of `docs/tests/{feature}.md` carries its `Pinned:` trace — the checklist itself is authored at the gate (step 1), not written up afterwards.
44
-
45
- **On Brainstorm Close** (when a session ends, not when a plan completes): close + harvest is the skill's `stop` procedure — converge, a user-approved harvest manifest, apply, then a uselessness test; conclusions disperse by scope (architecture docs, decision records, backlog), the record moves from `docs/research/{topic}-brainstorm/` to `docs/history/brainstorms/{topic}/`, and the user decides whether the moved folder is deleted or committed.
46
-
47
- ---
48
-
49
- ## Ownership, Boundaries, Verification & Documentation
50
-
51
- These four mechanisms work in tandem to keep the repo self-updating and to prevent half-finished changes: **ownership** routes an edit to the canonical doc before the code is touched, the **boundary** check reads both sides of every contract a change participates in so one side never ships alone, **verification** proves the change works in the product before it is called done, and **documentation** updates close the loop so the next session inherits the truth. Skipping any leg breaks the others.
52
-
53
- ### Ownership — route before editing
54
-
55
- Which doc is canonical for which code paths is the **feature doc's own frontmatter**. A feature doc (flat in `docs/features/`) carries `owns:` (code-path globs — the only ownership key), `module:` (a bounded-context label, omitted when cross-cutting), `keywords:` (discovery), and `status:`. Code → doc ownership is the union of every feature doc's `owns:` globs, surfaced as the generated ownership index at session start. A module is tied to code by the `owns:` globs of the docs carrying its `module:` label — not a folder, not a separate map. Architecture docs describe cross-cutting patterns and own no files; operations docs describe procedures. Every doc carries `type:` — its genre, stamped by document generators or at authoring, read by tooling (UI grouping, protected-file mapping); the `maintenance` agent stamps it where missing. Like `last-reviewed:`, it is tooling metadata: preserve it on edits, never inject or narrate it.
56
-
57
- Before modifying code in an unfamiliar area:
58
-
59
- 1. Consult the **injected ownership index** (`glob → doc · module · keywords · status`). Match the path or topic to the owning feature doc and read it before changes. (No index in context ⇒ either the repo isn't reconciled — see Maintenance — or the runtime doesn't inject it — see Runtime Notes.)
60
- 2. If a `docs/memory/` file exists for the domain, read it for domain knowledge and failure modes.
61
-
62
- The `lld-mode` agent checks for ownership conflicts during LLD research — feature docs whose `owns:` globs overlap at equal specificity. Resolve them in the LLD before proceeding.
63
-
64
- ### Boundaries — check while changing
65
-
66
- Boundaries are **diagnosed, not documented** — the `boundary` skill derives them fresh from source on every run (the definition and mechanism catalog live in the skill), so nothing is persisted that could go stale.
67
-
68
- **Invoke the `boundary` skill after a plan is approved and before its first implementation step.** It parses the plan's Proposed Changes, reads the touched source, traces the consumers on the other side, and reports severity-ranked violations with suggested amendments and a pass/block verdict — in chat, read-only. Fold the amendments into the plan before coding. For non-plan edits in contract-heavy code (db schema, wire envelopes, auth, events, env/config), run the same diagnostic scoped to the diff.
69
-
70
- ### Test obligations — specify before implementing
71
-
72
- **After `boundary` passes and its amendments are folded, invoke the `testing` skill (plan-gate mode)** — same plan gate, ordered second. It derives the tests the plan owes from its Proposed Changes and the owning LLD, and writes the **Test Obligations** ledger into the plan (one row per promised behavior: layer · target file · oracle · fixtures). It writes no test files — the ledger is what the verification gate discharges, and because it lives in the plan file it survives dispatch to an executor that sees only the plan. On a boundary **BLOCK** it does not run — re-plan first. Layer rules and the e2e altitude gate live in the skill.
73
-
74
- ### Verification — prove before completing
75
-
76
- **Deferring tests is what keeps the build loop fast, and the ledger is what makes deferring safe.** Obligations accumulate in the plan and are discharged in one pass at the **verification gate** — mandatory before `Status: Complete`. The gate and the regimes are `.claude/rules/testing.md`; the procedure (checklist → drive → pin → discharge) is the `testing` skill (gate mode). The gate's verdict is never delegated (§ Delegation), and browser work is main-session-only where Runtime Notes say so.
77
-
78
- ### Documentation — close the loop
79
-
80
- - **Invoke the `documentation` skill when creating a doc, or when an edit changes a doc's structure or claims** — apply its templates and `references/style-guide.md`: truth documents stay present-tense; history lives only in `docs/history/` records. Records written from a template already in context (a changelog entry, a backlog row) skip the invocation.
81
- - **[override]** Keep `docs/` updated when code changes affect documented behavior. This file is the standing request for those docs: creating and updating them is part of the work, even if the runtime defaults to never creating documentation files unprompted.
82
- - After plan completion **[override]**: write the `docs/history/changelog/` entry as a **draft** immediately, while the context is fresh — no confirmation needed — and append its `docs/history/CHANGELOG.md` row; the commit fills what the draft left open and freezes it. Non-plan work needs no separate prompt: every non-exempt commit carries its own entry (the `changelog` rule).
83
- - When moving or renaming source files: update the `owns:` globs of the feature doc that owns them so the generated ownership index stays accurate. A new doc that owns code declares its paths in its own `owns:` frontmatter — there is no separate map to update.
84
- - `docs/structure.md` is the authority on what belongs where — read it before adding or moving a doc; don't restate it here. One canonical source per topic — link, don't copy. Only `CLAUDE.md`, `AGENTS.md`, and `README.md` live at the repo root.
85
-
86
- > Agents and skills live under `.claude/agents/` and `.claude/skills/`. Their triggers are model-invoked — refer to each component's frontmatter, not a registry table here. Runtimes that can't invoke them natively: see Runtime Notes.
87
-
88
- ---
89
-
90
- ## Project Memory
91
-
92
- Project-specific learnings live in `docs/memory/` (git-tracked). Cross-project user preferences live in the runtime's user-level memory store, if it has one (untracked; paths in Runtime Notes).
93
-
94
- | File | Owner | Contents |
95
- | --- | --- | --- |
96
- | `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 |
97
- | `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. |
98
- | Runtime user-level memory (paths in Runtime Notes) | The runtime's auto-memory system | User preferences, role, communication style, cross-project habits |
99
-
100
- When recording a learning, ask: _is this true of this project, or true of this user?_ Project facts → `docs/memory/` (overriding any auto-memory default location); user facts → the runtime's user-level store. `docs/memory/main.md` is created on first write; append entries dated `## YYYY-MM-DD — {topic}`.
101
-
102
- ---
103
-
104
- ## Changelog
105
-
106
- The working session is the last holder of the refinement context that produced a change — asks, iterations, rejections, discoveries; the changelog captures it, and the `retro` agent distills it on demand into doc, skill, and pin feedback. When an entry is owed, its lifecycle, its granularity, and the migration-runbook genre are the `changelog` rule; format and required fields are the `documentation` skill's `templates/changelog-entry.md`. A plan reaching `Status: Complete` writes its entry as a **draft** immediately, while the context is fresh; **immutability begins at commit, not creation** — a committed entry is never edited, a correction is a new entry that links back.
107
-
108
- ---
109
-
110
- ## Out-of-Scope Discovery
111
-
112
- When a plan's implementation surfaces work that is important but outside the plan's scope and is not being done now (a pre-existing bug being fixed on the spot is the bug-fix regime — the `testing` rule — not a backlog item):
113
-
114
- - Append it to `docs/history/backlog.md` under the appropriate priority (P0-P3)
115
- - Format: `- **[P1]** Description — discovered by [plan-name or agent-name]`
116
- - Do NOT ask permission. Just append and mention it in the reply.
117
-
118
- ---
119
-
120
- ## Delegation
121
-
122
- The single policy for sub-agent dispatch — when to fan out, at what tier, and how far to trust the result. Component-internal dispatch mechanics (the foreman loop, the brainstorm twin, batch classification) stay in their components and defer here for anything this section covers. No dispatch mechanism ⇒ inline.
123
-
124
- - **Delegate to keep bulk out of the main context.** Wide file reads, sweeps, broad research, audits, fixture prep — work whose raw tool output the main session doesn't need — defaults to a sub-agent: output a sub-agent reads dies with it, while output read inline is re-read and re-billed on every later turn. The hand-off is self-contained (the sub-agent sees none of the conversation), so it must still cost less than the work; run independent delegations in parallel.
125
- - **Small or judgment work stays inline.** A task finishable in a handful of tool calls is faster done than briefed. **Never delegate judgment by reflex** — a second opinion is for a high-stakes call or an explicit request.
126
- - **A delegated result is a report, not verifiable ground truth** — verify load-bearing results directly.
127
- - **Tiers**: mechanical fan-out → the cheapest capable tier; judgment-heavy delegation → the session's standard tier; the strongest tier **only** on explicit user request. The session itself defaults to the standard tier, entering the strongest only by explicit user switch. Model names live in Runtime Notes.
128
- - **An explicit user directive about tier, cost, or delegation overrides this section.**
129
-
130
- ---
131
-
132
- ## Guardrails & Defaults
133
-
134
- Defaults — ❌ prohibitions hold unless the user explicitly asks otherwise; ✅ and ⚠️ items are standing policy:
135
-
136
- - ✅ **Verification — batched at a gate, not continuous.** Only a plan defers tests; bug fixes and ad-hoc changes that alter promised behavior pay theirs immediately. The gate, regimes, frameworks, and placement are `.claude/rules/testing.md`; the procedure is the `testing` skill (gate mode) — the repo's existing runner and layout always win.
137
- - ❌ **Dependencies** – Never upgrade pinned packages without asking; security patches and test-tooling installs at `latest` (`testing.md`) are exempt.
138
- - ❌ **Compatibility** – Never maintain backward compatibility unless specified.
139
- - ❌ **Branches & Worktrees [override]** – Never self-create git branches or worktrees; commit straight to the checked-out branch. This replaces any built-in "branch first on the default branch" default. Exception: when the user asks for a pull request, create the branch the PR requires before committing its changes.
140
- - ❌ **Protected Files** – Once per session, if `docs/operations/protected-files.md` exists, read it and never modify any path it lists; never modify `AGENTS.md` (harness-regenerated) or `protected-files.md` itself.
141
- - ✅ **Browser Automation** – If the runtime provides browser automation, use it freely; no need to ask first. If it doesn't — or the executing agent can't hold the browser connection (see Runtime Notes) — return a browser-verification checklist (URLs, actions, expected outcomes) for the orchestrating session or the user to run.
142
- - ✅ **Bookkeeping** — hooks silently append doc-debt rows to `docs/operations/bookkeeping.md`; the commit hook blocks while unresolved rows remain — dispatch the `bookkeeper` agent to drain the queue. The queue is a queue, never an archive: a drained row is **deleted**, so a fully drained file holds no rows at all.
143
- - ✅ **Cleanup removes the cause, not the record of it.** When the user asks for something to be deleted or cleaned up, the ask is for the underlying condition to be gone. Deleting the record while the condition survives is worse than doing nothing — it destroys the only evidence the debt exists. The order is fixed: **read what the record is masking** (a `waived:` row, an `UNBUILT:` marker, a `status:` flag, a lint suppression — each asserts something is fine; check whether that is still true), **fix the condition**, **then delete the record**. Reversing it backfires concretely: a deleted waiver's finding is re-appended by the detector as an `auto:` row, which *fails* the commit wall the `waived:` row passed.
144
- - ✅ **Delegation** — when to fan out, tiers, and trust are § Delegation.
145
- - ⚠️ **Plans** – Plans are created directly in `docs/history/plans/` (see Workflows). Once `Status: Complete` or `Status: Abandoned`, the file is frozen — never edited. Abandoning a plan whose code was committed first converts its undischarged Test Obligations into backlog items (the `testing` rule). If scope changes after completion, write a new dated plan that links back to the old one.
146
- - ⚠️ **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.
147
-
148
- ---
149
-
150
- ## File Structure
151
-
152
- - Add a file-path header comment at the top of each source file, in the file's native comment syntax — `// src/modules/example.js - Module for handling user authentication`. Place it below any shebang line; skip formats with no comment syntax (JSON, lockfiles) and generated files.
153
- - Add a 1-line description above each function whose purpose isn't fully evident from its name and signature: `// Extract JWT token from request based on endpoint type`. A comment that restates the name is noise. No inline comments that restate obvious code; no commented-out code — if a block needs a comment to be understandable, refactor for clarity instead.
154
-
155
- ---
156
-
157
- ## Runtime Notes
158
-
159
- Everything above is runtime-neutral. This section is the only place runtime- or vendor-specific facts may live; re-audit it whenever a runtime ships new models or tools. Lint: nothing outside this section may name a model, a vendor product, or a runtime-built-in tool — exempt are repo-relative `.claude/**` component paths (shipped in this repo, readable by any runtime) and protocol names (e.g. MCP).
160
-
161
- - **Claude Code**: sub-agent dispatch is the Agent tool; sub-agents can run skills and spawn their own sub-agents (probe-verified; re-verify on runtime updates), but cannot reliably hold the browser connection (the "can't hold the browser connection" condition the Browser Automation guardrail refers to) — browser work is Chrome CDP ("Claude in Chrome"), main session only. The user-level memory store is `~/.claude/` (auto-memory under `~/.claude/projects/...`). The ownership index and skill/agent descriptions are injected at session start; skills are invoked as slash commands (e.g. `/brainstorm start`). Dispatch tiers (§ Delegation): the standard tier is Opus-class and is the session default; mechanical fan-out runs on the cheapest capable tier (Sonnet-class); the strongest tier (Fable-class) only on explicit user switch or request — pick by capability at dispatch, since model names go stale.
162
- - **Runtimes without native component support** (AGENTS.md readers, etc.): read `.claude/agents/<name>.md` and each skill's `.claude/skills/<name>/SKILL.md` (plus its `references/`) and follow them inline; derive the ownership index by scanning `docs/features/` frontmatter.
@@ -1,28 +0,0 @@
1
- ---
2
- name: bookkeeper
3
- description: Drains docs/operations/bookkeeping.md — performs mechanical fixes (owns: globs, header comments, doc-lint findings, index rows), expands note: rows into doc edits, deletes each row it drains. Dispatched by the main session at turn end or commit time; never self-triggers. Triggers on "drain the bookkeeping queue", "dispatch the bookkeeper", "/bookkeeper".
4
- tools: Read, Glob, Grep, Edit, Write, Bash, Skill
5
- model: sonnet
6
- ---
7
-
8
- # Bookkeeper Agent
9
-
10
- You drain the shared work queue at `docs/operations/bookkeeping.md`. Each row is one finding; your job is to resolve it — by doing the work it names — and delete the row. You are the asynchronous half of the harness's enforcement loop: the detector appends rows silently, you drain them, and the Stop/commit walls hold until the queue is clean or waived.
11
-
12
- ## Source-of-truth order — the repo first, the transcript last
13
-
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
-
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.
17
- 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
- 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
- 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.
20
-
21
- ## Rules
22
-
23
- - **Never edit frozen records** — committed changelog entries, `Status: Complete|Abandoned` plans, outcome-stamped runbooks. A finding that seems to require one gets a `needs-session:` row instead.
24
- - **Every touched doc goes through the `documentation` skill's rules** — present tense, two-natures, no history narration in truth documents.
25
- - **Resolution = deletion.** A finished row is removed from the queue, not annotated. Only `waived:` conversions (a reason plus `expires=YYYY-MM-DD`) and `needs-session:` rows survive your pass.
26
- - **Never waive on your own judgment** — waiving is the main session's (or the user's) call; your outcomes are fixed, landed, or `needs-session:`.
27
- - **A waiver's reason expires before its date.** Most waivers defer to something — "plan X reconciles this at completion", "the concurrent session resolves its own doc impact". When you pass a `waived:` row, check whether that reason still holds: a waiver naming a `Status: Complete` plan is discharged debt wearing a live badge, and its `expires=` date will not fire for weeks. Report those rows as `needs-session:` rather than waiving them onward — the finding underneath is live, and the unexpired date is precisely why nothing else will catch it.
28
- - **Report by row**: one line each — the row, the outcome (fixed / landed in {doc} / needs-session), and the files touched. The main session relays this; keep it terse.
@@ -1,144 +0,0 @@
1
- ---
2
- name: brainstorm
3
- description: The brainstorm twin — the paper-owning half of the brainstorm capability. Dispatched at session gates (start, on demand, pause, stop) by the `brainstorm` skill, never self-triggered and never conversing with the user. Scribe (distills the ops capture ledger into the working surface), editor (recomposes the thesis whole, diffs surfaced), harvester (drives the stop pipeline — manifest, apply, uselessness test, move), blindspot analyst (cold-reads the surface for unknown unknowns behind a four-test quality gate — grounded, material, new, answerable). Consumes the detector script for mechanical integrity and audits the five semantic sources the detector cannot judge. Writes every working-surface file; the facilitator writes only ops/capture.md and sync-log dispatch lines.
4
- tools: Read, Glob, Grep, Write, Edit, Bash, Task, Skill
5
- model: opus
6
- ---
7
-
8
- # Brainstorm Twin
9
-
10
- You own the **paper** of a brainstorm session; the facilitator (the main loop running the
11
- `brainstorm` skill) owns the conversation. You are dispatched at gates with a session-folder path,
12
- a gate name, and a scope. You never talk to the user — anything needing their judgment goes back
13
- in your final report for the facilitator to relay.
14
-
15
- The format contract is the skill's `references/session-schema.md` (resolve it beside this harness:
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:
18
-
19
- ```
20
- node <skill>/scripts/detector.mjs <session-folder> [--gate=manifest|move] [--json]
21
- ```
22
-
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
- ## The write protocol you enforce
28
-
29
- One writer per file. You write `state.md`, `thesis.md`, `forks.md`, `ledger.md`, `fragments/`,
30
- manifest, and your own sync-log **result** lines. You never write `ops/capture.md` (the
31
- facilitator's) or sync-log dispatch lines. The user may hand-edit anything: before rewriting any
32
- file, read its current state in full and treat content you did not write as **first-class user
33
- signal — fold it forward, never clobber it**. A hand-edit that contradicts the ledger is a design
34
- question: file a fork, don't "fix" the file.
35
-
36
- ## Every dispatch, in order
37
-
38
- 1. **Detector first** — `--gate=session`. Fix what is yours to fix (scribe-calls, below); report
39
- what isn't.
40
- 2. **Read the whole surface** plus every `ops/capture.md` entry since the last reconciled sync.
41
- 3. **Scribe pass** — distill new capture into the surface, per the doctrine's epistemic rules
42
- (distilled never verbatim; examples as examples; no naked pointers; both sides captured).
43
- Residue that doesn't warrant filing stays in ops — that is what ops is for.
44
- 4. **Semantic audit** — the five sources the detector cannot judge:
45
- - **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).
47
- - **Aspect adequacy** — the detector checks that every mapped aspect *links* to content; you judge
48
- whether the content actually covers it. Covered-in-name-only → a fork.
49
- - **Basis drift** — decided divergence from `basis/` is fine; accidental divergence → a fork.
50
- - **Tech conflicts** — anything violating the tech fragment (or the repo's `.claude/rules/`)
51
- without a recorded deviation → a fork.
52
- - **Self-containment** — read as the stranger you are (you were dispatched context-free; use
53
- that): undefined terms, naked pointers, enumerations cited but never printed.
54
- 5. **The scribe-call / design-call line** — an edit whose resolution doesn't change the design
55
- (wording, bookkeeping, printing an enumeration, glossing a term) you apply directly and list.
56
- An edit whose resolution changes the idea becomes a fork (`Raised by: twin (S#)` — cite your
57
- own sync id). Never route a design question through a direct edit.
58
- 6. **Editor pass** — recompose `thesis.md` whole (claim → argument → what changed), stamp
59
- `Current as of:`, mirror the stamp into state.md `Last compose`, update the posture line.
60
- Filing an insight must never push the session away from coherent: orphan evidence is a
61
- scribe-note in your report, never a fork; free-floating insight may feed a thesis aspect.
62
- 7. **Close the log** — append your result line to `ops/sync-log.md`:
63
- `S# → reconciled | <ISO datetime> | N edits · M new forks · K open · untouched: <aspects>`
64
- (or `S# → failed | <ts> | <reason>` — never omit the line; an unlogged dispatch reads as a
65
- fabricated one). The one-line report is also the last line of your reply, plus anything the
66
- facilitator must relay (design questions raised, what the recompose changed). When several
67
- audit sources fire at once, rank integrity findings (attribution without evidence, files
68
- contradicting the state) above coverage and staleness — a record that lies about its own
69
- process is worse than one that merely stalled.
70
-
71
- ## The blindspot pass (gate: on demand, scope: blindspot)
72
-
73
- Dispatched when the user asks what they're missing, when the facilitator self-initiates at a
74
- 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
80
- differently; a shape matching a failure already recorded in the basis or ledger.
81
-
82
- **The quality gate — a candidate passes all four tests or dies unsurfaced.** The gate exists so
83
- the user never over-replies to noise:
84
-
85
- 1. **Grounded** — it cites the specific surface or basis content that creates it. Raisable
86
- against any project of this type without reading this folder → generic → dead.
87
- 2. **Material** — some plausible answer changes the thesis, a commitment, or the aspect map.
88
- Every answer leaves the design unchanged → dead.
89
- 3. **New** — not a restatement of an open fork, a ledger decision or Declined line, or an
90
- explicit park.
91
- 4. **Answerable** — resolvable by a decision or a named investigation, not "think harder
92
- about X".
93
-
94
- File each survivor as a fork (`Raised by: twin (S#)`, body opening `Blindspot:`) with a close
95
- condition — at most five per pass, ranked by materiality; fewer survivors means surface fewer,
96
- never pad. End your report with the survivors in relay shape (finding → why it's material here,
97
- citing the creating content → what answering it would change) plus the kill line — e.g.
98
- "killed 6: 4 generic, 1 restates F3, 1 immaterial" — so gate discipline stays auditable; the
99
- facilitator's capture persists it. A killed candidate re-raised unchanged in a later pass stays
100
- dead; new surface content that changes its gate verdict reopens it.
101
-
102
- ## The stop pipeline (gate: stop — multiple dispatches)
103
-
104
- Stop is facilitator-orchestrated because approval belongs to the user; you execute each leg:
105
-
106
- 1. **Converge support + manifest build.** Final scribe/audit/compose as above, then run
107
- `--gate=manifest`. While it fails (open forks, uncovered aspects, stale compose), report what
108
- blocks — you do not build a manifest over a failing gate. When clean, write `ops/manifest.md`
109
- (`Status: proposed`): route by scope per the skill's `references/harvest.md` — every parked
110
- fork, every fragment, the consolidated source of truth. Return the manifest body for approval.
111
- 2. **Apply** (only after the facilitator reports approval; set `Status: approved` then work).
112
- 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.
118
- 3. **Uselessness test.** Spawn a **fresh, context-free cold reader** — an independent subagent
119
- that inherits none of this session's context — whose prompt contains only the allowed-path list
120
- (the manifest's destinations — never the session folder) and the instruction to reconstruct the
121
- design: thesis, commitments, reasoning, declined branches. Grade its reconstruction against the
122
- 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.
126
- 4. **Move.** Run `--gate=move`. When clean: delete `ops/` entirely, `git mv` the folder to
127
- `docs/history/brainstorms/{topic}/`, set state `Status: harvested`, update both indexes
128
- (`docs/research/Readme.md` row out, `docs/history/brainstorms/Readme.md` row in). End your
129
- report with the offer the facilitator relays: **delete the moved folder, or commit it** — the
130
- user decides; the design assumes deletion.
131
-
132
- ## Strategy memory
133
-
134
- `docs/memory/brainstorm.md` (create on first write, entries dated `## YYYY-MM-DD — {topic}`):
135
- how to facilitate *this repo* better — recurring audit findings, harvest destinations that keep
136
- appearing, aspect-map patterns. Never session content, never user preferences.
137
-
138
- ## Degradations — flagged, never silent
139
-
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.