@nurix/etna 0.19.20 → 0.19.21

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 (82) hide show
  1. package/data/harness-index.json +1 -1
  2. package/data/harnesses/code/.prettierignore +6 -0
  3. package/data/harnesses/code/CLAUDE.md +15 -14
  4. package/data/harnesses/code/agents/maintenance.md +1 -1
  5. package/data/harnesses/code/codex/agents/maintenance.toml +1 -1
  6. package/data/harnesses/code/harness.json +2 -2
  7. package/data/harnesses/code/skills/documentation/SKILL.md +64 -107
  8. package/data/harnesses/code/skills/documentation/references/examples.md +83 -7
  9. package/data/harnesses/code/skills/documentation/references/frontmatter.md +44 -0
  10. package/data/harnesses/code/skills/documentation/references/style-guide.md +44 -19
  11. package/data/harnesses/code/skills/documentation/references/untemplated.md +38 -0
  12. package/data/harnesses/code/skills/documentation/scripts/doc-lint.mjs +117 -0
  13. package/data/harnesses/code/skills/documentation/templates/Readme.md +31 -0
  14. package/data/harnesses/code/skills/documentation/templates/api-reference.md +20 -0
  15. package/data/harnesses/code/skills/documentation/templates/architecture-decision.md +121 -0
  16. package/data/harnesses/code/skills/documentation/templates/backlog.md +33 -0
  17. package/data/harnesses/code/skills/documentation/templates/changelog-entry.md +62 -0
  18. package/data/harnesses/code/skills/documentation/templates/changelog-index.md +41 -0
  19. package/data/harnesses/code/skills/documentation/templates/docs-readme.md +70 -0
  20. package/data/harnesses/code/skills/documentation/templates/domain-model.md +30 -0
  21. package/data/harnesses/code/skills/documentation/templates/environment-registry.md +15 -0
  22. package/data/harnesses/code/skills/documentation/templates/feature.md +149 -0
  23. package/data/harnesses/code/skills/documentation/templates/glossary.md +11 -0
  24. package/data/harnesses/code/skills/documentation/templates/memory-main.md +25 -0
  25. package/data/harnesses/code/skills/documentation/templates/migration-runbook.md +34 -0
  26. package/data/harnesses/code/skills/documentation/templates/non-goals.md +11 -0
  27. package/data/harnesses/code/skills/documentation/templates/operations-procedure.md +36 -0
  28. package/data/harnesses/code/skills/documentation/templates/plan.md +64 -0
  29. package/data/harnesses/code/skills/documentation/templates/protected-files.md +37 -0
  30. package/data/harnesses/code/skills/documentation/templates/root-readme.md +104 -0
  31. package/data/harnesses/code/skills/documentation/templates/security-overview.md +27 -0
  32. package/data/harnesses/code/skills/documentation/templates/structure.md +65 -0
  33. package/data/harnesses/code/skills/documentation/templates/system-overview.md +32 -0
  34. package/data/harnesses/code/skills/documentation/templates/testing-strategy.md +29 -0
  35. package/data/harnesses/discover/.prettierignore +6 -0
  36. package/data/harnesses/discover/CLAUDE.md +11 -12
  37. package/data/harnesses/discover/harness.json +2 -2
  38. package/data/harnesses/discover/tooling-recommendations.md +10 -10
  39. package/data/harnesses/discussion/.prettierignore +6 -0
  40. package/data/harnesses/discussion/harness.json +1 -1
  41. package/data/harnesses/etna/.prettierignore +6 -0
  42. package/data/harnesses/etna/CLAUDE.md +12 -11
  43. package/data/harnesses/etna/agents/maintenance.md +1 -1
  44. package/data/harnesses/etna/codex/agents/maintenance.toml +1 -1
  45. package/data/harnesses/etna/harness.json +2 -2
  46. package/data/harnesses/etna/skills/documentation/SKILL.md +64 -107
  47. package/data/harnesses/etna/skills/documentation/references/examples.md +83 -7
  48. package/data/harnesses/etna/skills/documentation/references/frontmatter.md +44 -0
  49. package/data/harnesses/etna/skills/documentation/references/style-guide.md +44 -19
  50. package/data/harnesses/etna/skills/documentation/references/untemplated.md +38 -0
  51. package/data/harnesses/etna/skills/documentation/scripts/doc-lint.mjs +117 -0
  52. package/data/harnesses/etna/skills/documentation/templates/Readme.md +31 -0
  53. package/data/harnesses/etna/skills/documentation/templates/api-reference.md +20 -0
  54. package/data/harnesses/etna/skills/documentation/templates/architecture-decision.md +121 -0
  55. package/data/harnesses/etna/skills/documentation/templates/backlog.md +33 -0
  56. package/data/harnesses/etna/skills/documentation/templates/changelog-entry.md +62 -0
  57. package/data/harnesses/etna/skills/documentation/templates/changelog-index.md +41 -0
  58. package/data/harnesses/etna/skills/documentation/templates/docs-readme.md +70 -0
  59. package/data/harnesses/etna/skills/documentation/templates/domain-model.md +30 -0
  60. package/data/harnesses/etna/skills/documentation/templates/environment-registry.md +15 -0
  61. package/data/harnesses/etna/skills/documentation/templates/feature.md +149 -0
  62. package/data/harnesses/etna/skills/documentation/templates/glossary.md +11 -0
  63. package/data/harnesses/etna/skills/documentation/templates/memory-main.md +25 -0
  64. package/data/harnesses/etna/skills/documentation/templates/migration-runbook.md +34 -0
  65. package/data/harnesses/etna/skills/documentation/templates/non-goals.md +11 -0
  66. package/data/harnesses/etna/skills/documentation/templates/operations-procedure.md +36 -0
  67. package/data/harnesses/etna/skills/documentation/templates/plan.md +64 -0
  68. package/data/harnesses/etna/skills/documentation/templates/protected-files.md +37 -0
  69. package/data/harnesses/etna/skills/documentation/templates/root-readme.md +104 -0
  70. package/data/harnesses/etna/skills/documentation/templates/security-overview.md +27 -0
  71. package/data/harnesses/etna/skills/documentation/templates/structure.md +65 -0
  72. package/data/harnesses/etna/skills/documentation/templates/system-overview.md +32 -0
  73. package/data/harnesses/etna/skills/documentation/templates/testing-strategy.md +29 -0
  74. package/data/harnesses/hr/.prettierignore +6 -0
  75. package/data/harnesses/hr/CLAUDE.md +19 -23
  76. package/data/harnesses/hr/harness.json +2 -2
  77. package/data/harnesses/kb-agi/.prettierignore +6 -0
  78. package/data/harnesses/kb-agi/CLAUDE.md +12 -12
  79. package/data/harnesses/kb-agi/harness.json +1 -1
  80. package/package.json +1 -1
  81. package/data/harnesses/code/skills/documentation/references/templates.md +0 -1091
  82. package/data/harnesses/etna/skills/documentation/references/templates.md +0 -1091
@@ -1,5 +1,5 @@
1
1
  {
2
- "fingerprint": "2e71b9321651",
2
+ "fingerprint": "2329fc4f3594",
3
3
  "harnesses": {
4
4
  "code": {
5
5
  "plugin": "code",
@@ -10,3 +10,9 @@ yarn.lock
10
10
 
11
11
  # Harness-managed agent/skill definitions (installed under .claude/)
12
12
  .claude
13
+
14
+ # Source catalogs — authored markdown; prettier collapses template/example blocks
15
+ skills
16
+ rules
17
+ agents
18
+ harness
@@ -1,12 +1,12 @@
1
1
  # Agent Instructions
2
2
 
3
- This file defines how AI coding agents — any vendor, any runtime — should 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 your runtime has it, and states its fallback. Rules marked **[override]** deliberately replace a default your runtime may have built in — in a conflict, the rule here wins.
3
+ This file defines how AI coding agents — any vendor, any runtime — should 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 default the runtime may have built in — in a conflict, the rule here wins.
4
4
 
5
5
  ---
6
6
 
7
7
  ## Maintenance
8
8
 
9
- Invoke the `maintenance` agent whenever you judge the docs need it — not just at first setup: a missing `docs/structure.md` (the repo isn't reconciled — baseline before applying anything below), a `harness-version` marker behind the installed version, docs contradicting code, unowned source paths, or drift you notice while working. Never reconcile these 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. Each component's internals live in the component, not here.
9
+ Invoke the `maintenance` agent whenever the docs look like they need it — not just at first setup: a missing `docs/structure.md` (the repo isn't reconciled — baseline before applying anything below), a `harness-version` marker behind the installed version, docs contradicting code, unowned source paths, or drift noticed while working. Never reconcile these 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. Each component's internals live in the component, not here.
10
10
 
11
11
  ---
12
12
 
@@ -43,30 +43,31 @@ Three peer modes plus a Completion step — enter wherever the user's thinking a
43
43
 
44
44
  ## Ownership, Boundaries & Documentation
45
45
 
46
- These three mechanisms work in tandem to keep the repo self-updating and to prevent half-finished changes: **ownership** routes you to the canonical doc before you touch code, the **boundary** check reads both sides of every contract your change participates in so you can't ship one side of it, and **documentation** updates close the loop so the next session inherits the truth. Skipping any leg breaks the other two.
46
+ These three 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, and **documentation** updates close the loop so the next session inherits the truth. Skipping any leg breaks the other two.
47
47
 
48
- ### Ownership — route before you edit
48
+ ### Ownership — route before editing
49
49
 
50
50
  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 don't own specific files; operations docs describe procedures.
51
51
 
52
52
  Before modifying code in an unfamiliar area:
53
53
 
54
- 1. Consult the **injected ownership index** (`glob → doc · module · keywords · status`). Match your 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 your runtime doesn't inject it — see Runtime Notes.)
55
- 2. If a `docs/memory/` file exists for the domain you're working in, read it for domain knowledge and failure modes.
54
+ 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.)
55
+ 2. If a `docs/memory/` file exists for the domain, read it for domain knowledge and failure modes.
56
56
 
57
57
  The `lld-mode` agent checks for ownership conflicts during LLD research — feature docs whose `owns:` globs overlap at equal specificity. If conflicts are found, address them in the LLD before proceeding.
58
58
 
59
- ### Boundaries — check while you change
59
+ ### Boundaries — check while changing
60
60
 
61
- A boundary is a contract between two pieces of code (or code and infra) that share an assumption with **no static link** between them — the column a raw SQL string names, the env var a deploy script reads. Changing one side ships green — compiles, lints, tests pass — and breaks the other at runtime. Boundaries are **diagnosed, not documented**: the `boundary` skill reads them fresh from source on every run, so nothing is persisted that could go stale.
61
+ 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.
62
62
 
63
63
  **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.
64
64
 
65
65
  ### Documentation — close the loop
66
66
 
67
- - **[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 your runtime defaults to never creating documentation files unprompted.
67
+ - **Every markdown document goes through the `documentation` skill.** Before creating or substantively editing any `.md` document — a doc, a README, an index, a record — invoke the `documentation` skill and apply its templates and `references/style-guide.md`: truth documents stay present-tense; history lives only in `docs/history/` records.
68
+ - **[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.
68
69
  - After plan completion **[override]**: add a `docs/history/changelog/` entry + update `docs/history/CHANGELOG.md` — no confirmation needed. Include `Commits:` if multi-commit. Non-plan changes (refactors, fixes, API changes): prompt first.
69
- - When you move or rename 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.
70
+ - 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.
70
71
  - `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.
71
72
 
72
73
  > 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.
@@ -89,11 +90,11 @@ When recording a learning, ask: _is this true of this project, or true of this u
89
90
 
90
91
  ## Out-of-Scope Discovery
91
92
 
92
- When implementing a plan, if you discover work that is important but outside the current plan's scope:
93
+ When a plan's implementation surfaces work that is important but outside the plan's scope:
93
94
 
94
95
  - Append it to `docs/history/backlog.md` under the appropriate priority (P0-P3)
95
96
  - Format: `- **[P1]** Description — discovered by [plan-name or agent-name]`
96
- - Do NOT ask permission. Just append and mention it in your response.
97
+ - Do NOT ask permission. Just append and mention it in the reply.
97
98
 
98
99
  ---
99
100
 
@@ -103,13 +104,13 @@ Defaults — ❌ prohibitions hold unless the user explicitly asks otherwise;
103
104
 
104
105
  - ✅ **Tests — suite-first.** Tests ship with every change to product code or behavior, built as one maintained suite, never as one-off scripts. Framework choice, test-tree placement, and shared fixtures/helpers are `.claude/rules/testing.md` — the repo's existing runner and layout always win.
105
106
  - **What gets tests**: a new feature ships with tests for the behavior its LLD promises; a bug fix ships with a regression test that fails before the fix and passes after.
106
- - **Discipline**: run the affected part of the suite before declaring work complete and report results honestly. When an LLD or plan intentionally changes behavior, updating the affected tests to the new contract is part of the change — the ban is on weakening, skipping, or deleting a test to mask a failure you can't explain.
107
+ - **Discipline**: run the affected part of the suite before declaring work complete and report results honestly. When an LLD or plan intentionally changes behavior, updating the affected tests to the new contract is part of the change — the ban is on weakening, skipping, or deleting a test to mask an unexplained failure.
107
108
  - **Throwaway checks are not tests**: temporary verification scripts go to scratch space and are deleted, never committed into the test tree.
108
109
  - ❌ **Dependencies** – Never upgrade frameworks, libraries, or dependencies.
109
110
  - ❌ **Compatibility** – Never maintain backward compatibility unless specified.
110
111
  - ❌ **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.
111
112
  - ❌ **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.
112
- - ✅ **Browser Automation** – If your runtime provides browser automation, use it freely; no need to ask first. If it doesn't — or you are an agent that 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.
113
+ - ✅ **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.
113
114
  - ✅ **Fan-out is a tool, not a default** — the main session does the work and its own reasoning; a delegated result comes back as a summary, not verifiable ground truth. Delegate **only when** the work is large, independent, or repetitive enough that a self-contained hand-off (the sub-agent sees none of the conversation) costs less than the work — broad research, wide sweeps, audits — and run independent delegations in parallel. **Never delegate judgment by reflex**: a second opinion is for a high-stakes call or an explicit request. No dispatch mechanism ⇒ inline.
114
115
  - ⚠️ **Plans** – Plans are created directly in `docs/history/plans/` (see Workflows). 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
116
  - ⚠️ **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.
@@ -180,7 +180,7 @@ On approval, execute: create the folder structure; move/fold/merge/delete per th
180
180
 
181
181
  Scaffold missing mandated files **by calling the `documentation` skill for each template** — you orchestrate, the skill supplies templates:
182
182
 
183
- - `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/index.md`, `docs/memory/main.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
183
+ - `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/main.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
184
184
 
185
185
  ### Step B4 — Stamp the version
186
186
 
@@ -177,7 +177,7 @@ On approval, execute: create the folder structure; move/fold/merge/delete per th
177
177
 
178
178
  Scaffold missing mandated files **by calling the `documentation` skill for each template** — you orchestrate, the skill supplies templates:
179
179
 
180
- - `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/index.md`, `docs/memory/main.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
180
+ - `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/main.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
181
181
 
182
182
  ### Step B4 — Stamp the version
183
183
 
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "harness": "code",
3
3
  "name": "code",
4
- "version": "3.1.13",
4
+ "version": "3.1.14",
5
5
  "files": [
6
6
  ".prettierignore",
7
7
  ".prettierrc.json",
8
8
  ".vscode/settings.json"
9
9
  ],
10
- "digest": "c1f024029b4d"
10
+ "digest": "6b9984997d77"
11
11
  }
@@ -1,13 +1,30 @@
1
1
  ---
2
2
  name: documentation
3
- description: Template & generator library for technical docs — the skill agents call to produce a doc from a template. Use to (1) document a feature or module (the feature doc is the feature's LLD — low-level design — written in LLD Mode), (2) create or update a changelog entry, (3) document data flows or Redux state, (4) add to protected files, (5) record or revise an architecture decision (an AD), (6) create or update the project root README, (7) create or update a plan, (8) derive a feature doc's `owns:` frontmatter (the code-path globs it owns) from code, (9) scaffold a standard doc (README, structure.md, CHANGELOG, backlog, memory) from its template, (10) document an operations procedure (setup, deployment, maintenance) or a one-shot migration runbook, (11) write a steering doc (system overview, domain model, glossary, non-goals, security overview, testing strategy), (12) catalog the API surface or the environment/config registry, or (13) co-author any technical doc. Baselining / reconciling a repo's docs to the installed harness version is the **`maintenance` agent (baseline mode)** (which calls this skill for each template) — this skill does not orchestrate baseline. Triggers on "document this", "create docs", "update changelog", "add to protected files", "AD", "ADR", "architecture decision", "root README", "plan", "feature doc", "LLD", "glossary", "domain model", "runbook", "API reference".
3
+ description: Invoke BEFORE creating or substantively editing ANY markdown doc. Templates + style authority for technical docs — LLDs, ADs, plans, changelogs, READMEs, runbooks. Owns the tense rule: truth docs state the present; history only in dated records. Baselining is the maintenance agent.
4
4
  ---
5
5
 
6
6
  # Technical Documentation Skill
7
7
 
8
8
  **This skill is a template & generator library, not an orchestrator.** It supplies the templates, the frontmatter-derivation generator, and the co-authoring workflow that _agents_ call to produce individual docs. It does **not** baseline, audit, or reconcile a repo's doc tree — that is the **`maintenance` agent (baseline mode)**, which calls this skill for each template it scaffolds. Reach here to generate _one_ doc from a template; reach for the `maintenance` agent (baseline mode) to bring a whole repo into shape.
9
9
 
10
- Document contracts and architecture, not implementation details. Show function signatures and API shapes — never paste full implementations (they rot fast). Use ASCII diagrams over prose for flows. Only document state at persistence boundaries (Redux persistence, DB schemas, API shapes), not component-level or transient state. Mark deprecated fields with `// UNUSED:` comments. Breaking changes belong in changelogs only, not module docs.
10
+ Document contracts and architecture, not implementation details. Show function signatures and API shapes — never paste full implementations (they rot fast). Use ASCII diagrams over prose for flows. Only document state at persistence boundaries (Redux persistence, DB schemas, API shapes), not component-level or transient state. Mark deprecated fields with `// UNUSED:` comments stating why the field is dead now — never where it went or when it dies. Breaking changes belong in changelogs only, not module docs.
11
+
12
+ ---
13
+
14
+ ## Present tense, always
15
+
16
+ **A document states what is — never how it got there, and never how far along it is.** Write as if the current design had always been the plan. This is the most-violated rule in the skill, so it sits at the top; it applies to every document written or edited through this skill, whatever the template.
17
+
18
+ | ❌ Strip this | ✅ Write this |
19
+ | --- | --- |
20
+ | "Build Sequence phases 0–4 are complete." | Nothing — progress lives in the plan/backlog record |
21
+ | "There is no standalone `skills/components/` — treat any reference to it as stale." | Nothing — fix the references; state only the present design |
22
+ | "Folded in from the `NuStack-X` repo (2026-06-12)." | "Vendor-connector catalogue; one subpath per vendor." |
23
+ | "was X, now Y", "the old worker", "Phase 2 softened this", "v1 → v2" | The current fact, with no predecessor named |
24
+
25
+ The journey — dates, migrations, progress, supersessions — lives only in records (`docs/history/`); when reality changes, a truth document simply becomes correct. The full strip-list and the record-side rules: [`references/style-guide.md`](references/style-guide.md) § The Two Natures — Tense & History.
26
+
27
+ The mechanical subset of these rules is checked by [`scripts/doc-lint.mjs`](scripts/doc-lint.mjs) — run it over changed docs before finishing. Block-severity findings must be fixed; `<!-- doc-lint-disable: <id> -->` with a reason beside it is the escape hatch.
11
28
 
12
29
  ---
13
30
 
@@ -25,10 +42,10 @@ Every document is exactly one of two things. Decide which before writing a word
25
42
 
26
43
  The two guarantees are complementary and both break on mixing: a reader holding a **truth document** must never need history to interpret it; a reader holding a **record** must be able to trust it was never rewritten. So the natures never share a document body.
27
44
 
28
- - **Truth documents never narrate history.** No migration/fold stories, no dated "shipped/verified on YYYY-MM-DD" markers, no "was X → now Y" journeys, no provenance asides ("ex-`@nurix/X`, folded 2026-06-12"). When the system changes, the change-story goes to `docs/history/` (a changelog entry) and the truth document simply becomes correct in present tense. When you find historical narration in a truth document, rewrite it to the present-tense fact and let the record carry the story.
45
+ - **Truth documents never narrate history** — the § Present tense, always rule above, applied to this nature. When the system changes, the change-story goes to `docs/history/` (a changelog entry) and the truth document simply becomes correct in present tense. When you find historical narration in a truth document, rewrite it to the present-tense fact and let the record carry the story.
29
46
  - **Records are never edited to match the present.** A completed plan stays wrong-in-hindsight; a changelog entry describes close-time state; a scope change gets a *new* dated record that links back, never an edit to a frozen one.
30
- - **The one bridge — head is truth, tail is provenance.** An **Architecture Decision (AD)** ends with a **Decision Changelog**: the single sanctioned dated-history section inside a truth document, because for a decision the journey (what each revision reversed, and what triggered it) is part of the reasoning. The AD body stays current-truth-only; the tail carries the dates and links to the plans that implemented each revision. No other truth document carries dated history.
31
- - **Truth documents cite records for the _why_, never the _when_.** `Provenance: AD-002` is good; "decided in AD-002 and shipped 2026-06-13" is not. Routing/index docs point only to truth documents — never to a plan or changelog entry as the "read first" source.
47
+ - **Two sanctioned bridges — head is truth, tail is provenance.** An **Architecture Decision (AD)** ends with a **Decision Changelog** (for a decision, the journey — what each revision reversed and what triggered it — is part of the reasoning), and `docs/structure.md` ends with the maintenance agent's **Health Log** (tooling-stamped audit rows, the structural cousin of `last-reviewed:`). In both, the body stays current-truth-only; the tail carries the dates. No other truth document carries dated history.
48
+ - **Truth documents cite records for the _why_, never the _when_.** `Provenance: AD-002` is good; "decided in AD-002 and shipped 2026-06-13" is not. Routing/index docs point only to truth documents as a topic's authority — never a plan or changelog entry as the "read first" source. (An index _of the records themselves_ — a History section listing `plans/`, `changelog/` — is sanctioned.)
32
49
 
33
50
  **No empty stubs.** Never leave a template section as an empty placeholder — omit any section with nothing real to say (each template declares its required core; everything else is optional). Write an explicit "None" only where the absence itself is information (e.g., a plan's Cross-Module Contracts Affected, an LLD's Ownership Conflicts). An empty table stub reads as "not yet researched"; an omitted section reads as "doesn't apply" — keep those meanings distinct.
34
51
 
@@ -36,51 +53,43 @@ The two guarantees are complementary and both break on mixing: a reader holding
36
53
 
37
54
  ---
38
55
 
39
- ## Decision Tree
40
-
41
- ```
42
- User request
43
- │
44
- ├─ "Baseline/reconcile docs" ──────▶ maintenance agent (baseline mode) (it calls this skill per template)
45
- │
46
- ├─ "Document feature/module (LLD)" ▶ Feature (LLD) Template
47
- │
48
- ├─ "Create/update changelog" ──────▶ Changelog Template (record)
49
- │
50
- ├─ "Document data flow" ───────────▶ Feature Template (Architecture section)
51
- │
52
- ├─ "Document Redux/state" ─────────▶ Feature Template (State section)
53
- │
54
- ├─ "Add to protected files" ───────▶ Protected Files Template
55
- │
56
- ├─ "Record/revise architecture
57
- │ decision" ────────────────────▶ AD Template (one per subject; revisions update it in place)
58
- │
59
- ├─ "System at a glance" ───────────▶ System Overview Template
60
- │
61
- ├─ "Domain model / glossary /
62
- │ non-goals" ───────────────────▶ Steering Templates
63
- │
64
- ├─ "Catalog the API surface" ──────▶ API Reference Template
65
- │
66
- ├─ "Document env vars / config" ───▶ Environment Registry Template
67
- │
68
- ├─ "Security / threat model" ──────▶ Security Overview Template
69
- │
70
- ├─ "Testing strategy" ─────────────▶ Testing Strategy Template
71
- │
72
- ├─ "Recurring procedure/setup" ────▶ Operations Procedure Template
73
- │
74
- ├─ "One-shot migration/upgrade" ───▶ Migration Runbook Template (record)
75
- │
76
- ├─ "Create/update root README" ────▶ Project Root README Template
77
- │
78
- ├─ "Create/update plan" ───────────▶ Plan Template (record)
79
- │
80
- ├─ "Update existing doc" ──────────▶ Preserve existing structure
81
- │
82
- └─ No template matches ────────────▶ Co-Authoring Workflow (below)
83
- ```
56
+ ## Routing
57
+
58
+ | Request | Route |
59
+ | --- | --- |
60
+ | Baseline / reconcile docs | `maintenance` agent (baseline mode) — it calls this skill per template |
61
+ | Document feature/module (LLD) | [`templates/feature.md`](templates/feature.md) |
62
+ | Document data flow / state / Redux | [`templates/feature.md`](templates/feature.md) — they are sections of the feature doc |
63
+ | Create/update changelog | [`templates/changelog-entry.md`](templates/changelog-entry.md) (record) |
64
+ | Create/update plan | [`templates/plan.md`](templates/plan.md) (record) |
65
+ | Record/revise architecture decision | [`templates/architecture-decision.md`](templates/architecture-decision.md) — one AD per subject; revisions update it in place |
66
+ | System at a glance | [`templates/system-overview.md`](templates/system-overview.md) |
67
+ | Domain model | [`templates/domain-model.md`](templates/domain-model.md) |
68
+ | Glossary | [`templates/glossary.md`](templates/glossary.md) |
69
+ | Non-goals | [`templates/non-goals.md`](templates/non-goals.md) |
70
+ | Catalog the API surface | [`templates/api-reference.md`](templates/api-reference.md) |
71
+ | Document env vars / config | [`templates/environment-registry.md`](templates/environment-registry.md) |
72
+ | Security / threat model | [`templates/security-overview.md`](templates/security-overview.md) |
73
+ | Testing strategy | [`templates/testing-strategy.md`](templates/testing-strategy.md) |
74
+ | Recurring procedure/setup | [`templates/operations-procedure.md`](templates/operations-procedure.md) |
75
+ | One-shot migration/upgrade | [`templates/migration-runbook.md`](templates/migration-runbook.md) (record) |
76
+ | Add to protected files | [`templates/protected-files.md`](templates/protected-files.md) |
77
+ | Create/update root README | [`templates/root-readme.md`](templates/root-readme.md) |
78
+ | Scaffold a standard doc (docs index, `structure.md`, CHANGELOG, backlog, memory) | [`templates/Readme.md`](templates/Readme.md) — the index names each scaffold file |
79
+ | Derive/update a feature doc's `owns:` | [`references/frontmatter.md`](references/frontmatter.md) |
80
+ | Update existing doc | § Editing an existing doc (below) |
81
+ | Instruction file (`CLAUDE.md`, a rule, an agent, skill prose) | Not these templates — every-load prose stays lean: assertion—reason bullets, tables over diagrams, no ASCII; the present-tense rule still applies |
82
+ | **No template matches** | [`references/untemplated.md`](references/untemplated.md) — shape decisions + the co-authoring workflow |
83
+
84
+ ---
85
+
86
+ ## Editing an existing doc
87
+
88
+ "Substantive" = anything beyond typo, link, or formatting fixes. On a substantive edit:
89
+
90
+ 1. **Determine the nature first.** A frozen record (a `Status: Complete`/`Abandoned` plan, a changelog entry, an executed runbook) is never edited — write a new dated record that links back.
91
+ 2. **Preserve structure, not violations.** Keep the doc's existing section shape, but every section touched sheds history narration, progress markers, and stale tripwires on the way through (§ Present tense, always).
92
+ 3. **Stamp and re-derive.** A substantive feature-doc update bumps `last-reviewed:`; if the documented scope moved, update `owns:` ([`references/frontmatter.md`](references/frontmatter.md)).
84
93
 
85
94
  ---
86
95
 
@@ -104,62 +113,7 @@ User request
104
113
 
105
114
  ## Frontmatter Derivation
106
115
 
107
- When creating or updating a feature doc, derive its **`owns:` frontmatter** — the code-path globs it is canonical for — from the source the doc describes. Code ownership lives in each feature doc's `owns:` frontmatter (the SessionStart hook unions them into the injected ownership index); there is no hand-maintained ownership map.
108
-
109
- ### When to run
110
-
111
- - **Baseline / reconcile** — for every feature doc whose code paths aren't yet declared in its `owns:` frontmatter (the `maintenance` agent (baseline mode) calls this)
112
- - **New feature doc** — when creating a doc via the Feature template, project its `owns:` globs
113
- - **Doc update** — when the documented scope changes, update the doc's `owns:` globs
114
-
115
- ### How to derive the frontmatter
116
-
117
- A feature doc's launch-map frontmatter is `owns:` (required), `module:` (optional), `keywords:` (required), and `status:` (required). An optional `last-reviewed:` date (stamped whenever the doc is substantively reviewed or updated) gives the `maintenance` agent a staleness signal to rank its audits by — it is tooling metadata, never narrated in the body.
118
-
119
- **1. `owns:`** (the path scope)
120
-
121
- Read the doc's content. Extract every source file path it references (file listings, function locations, component paths). Group them into the narrowest glob patterns that cover all referenced files without overlapping another doc's `owns:` globs at equal specificity. A doc may own several globs.
122
-
123
- | Doc references | Glob |
124
- | ------------------------------------ | ------------------------- |
125
- | Multiple files under one directory | `src/feature/**` |
126
- | Specific files in a shared directory | List each file explicitly |
127
- | A single entry-point file | The exact file path |
128
-
129
- Glob each pattern against the codebase; drop any that match nothing.
130
-
131
- **2. `module:`**
132
-
133
- The single bounded-context label this feature belongs to, or omit it for a cross-cutting feature that belongs to no single context. A module is a label, not a folder — features sharing a `module:` value are what ties that module to code (a filter over the generated ownership index).
134
-
135
- **3. `keywords:` & `status:`**
136
-
137
- `keywords:` are the discovery terms topic→doc lookup rides. `status:` is `active`, `draft`, or `deprecated` — it steers the model toward live docs and away from draft/deprecated ones.
138
-
139
- A doc's dependencies on other docs are expressed inline in its prose (links); cross-cutting contracts are diagnosed by the `boundary` skill from source, not persisted.
140
-
141
- ### Rules
142
-
143
- - One canonical doc per path. A doc's `owns:` globs must not overlap another doc's at equal specificity — the narrower glob wins; equal-specificity overlap is an ownership conflict to resolve.
144
- - Use glob patterns for directories, explicit paths for individual files. Don't list paths that don't exist in the codebase.
145
- - When a doc covers a deep feature with sub-specs (e.g., `editor/`), each sub-spec owns its own globs — don't duplicate a path across siblings.
146
- - For baseline/reconcile with many docs, use parallel sub-agents to read source and propose `owns:` globs.
147
-
148
- ---
149
-
150
- ## Co-Authoring Workflow
151
-
152
- For docs that don't match templates:
153
-
154
- **Stage 1: Context Gathering**
155
-
156
- - Ask: Audience? Purpose? Existing format?
157
- - Have user dump all context, then ask 5-10 clarifying questions
158
-
159
- **Stage 2: Structure & Draft**
160
-
161
- - Propose section structure, draft section by section
162
- - User indicates changes (don't edit directly — learn their style)
116
+ A feature doc carries ownership frontmatter — `owns:` (required), `module:` (optional), `keywords:` (required), `status:` (required), optional `last-reviewed:`. Deriving it from code and keeping it accurate is [`references/frontmatter.md`](references/frontmatter.md) — every feature-doc create or update, and the `maintenance` agent's baseline pass, route there.
163
117
 
164
118
  ---
165
119
 
@@ -167,6 +121,9 @@ For docs that don't match templates:
167
121
 
168
122
  | File | Use For |
169
123
  | --- | --- |
170
- | `references/templates.md` | docs/README.md, structure.md, the feature-frontmatter contract, scaffolds (CHANGELOG, backlog, memory), feature, changelog, plan, operations procedure, migration runbook, protected files, AD, steering docs (system overview, domain model, glossary, non-goals, security, testing strategy), API reference, environment registry, project root README templates |
124
+ | `templates/` | One file per template, indexed by [`Readme.md`](templates/Readme.md) — feature (LLD), changelog, plan, AD, steering docs, API reference, environment registry, operations procedure, migration runbook, protected files, READMEs, and the baseline scaffolds |
171
125
  | `references/style-guide.md` | Writing rules, formatting conventions, the two-natures tense rules |
126
+ | `references/frontmatter.md` | Deriving a feature doc's `owns:` / `module:` / `keywords:` / `status:` from code |
127
+ | `references/untemplated.md` | How to write a document no template covers (nature, placement, shape) + the co-authoring workflow |
172
128
  | `references/examples.md` | Good vs bad documentation examples |
129
+ | `scripts/doc-lint.mjs` | Mechanical checks over written docs (tense narration, dates, stubs, redirects) — run over changed docs before finishing |
@@ -21,11 +21,15 @@ function mergeData(server, local, changes) { const result = {}; const serverMap
21
21
  ```markdown
22
22
  ### `mergeData(serverData, localData, changes)`
23
23
 
24
- **Goal:** Merge server data with local changes **Input:**
24
+ **Goal:** Merge server data with local changes
25
+
26
+ **Input:**
25
27
 
26
28
  - `serverData` (array) - Fresh from API
27
29
  - `localData` (array) - Current state
28
- - `changes` (object) - `{ added, updated, removed }` **Output:** `{ merged: array, conflicts: array }`
30
+ - `changes` (object) - `{ added, updated, removed }`
31
+
32
+ **Output:** `{ merged: array, conflicts: array }`
29
33
 
30
34
  **Merge Rules:**
31
35
 
@@ -61,11 +65,22 @@ const [items, setItems] = useState([]);
61
65
  ```markdown
62
66
  ## State
63
67
 
64
- **Frontend (at persistence):** { "data": [], "changes": { "added": [], "updated": [], "removed": [] } // "cache": {} // UNUSED: Deprecated }
68
+ **Frontend (at persistence):**
69
+
70
+ {
71
+ "data": [],
72
+ "changes": { "added": [], "updated": [], "removed": [] }
73
+ // "cache": {} // UNUSED: dead key; kept so old persisted state rehydrates
74
+ }
65
75
 
66
76
  **Storage:** localStorage `app_state`
67
77
 
68
- **Backend:** model Item { id String @id data Json }
78
+ **Backend:**
79
+
80
+ export const items = pgTable('items', {
81
+ id: text('id').primaryKey(),
82
+ data: jsonb('data'),
83
+ });
69
84
  ```
70
85
 
71
86
  ---
@@ -144,9 +159,23 @@ When the page loads, the useAppInit hook calls the syncData function. This funct
144
159
  ```markdown
145
160
  ## Data Flow
146
161
 
147
- ┌─────────────────────────────────────────┐ │ DATA SYNC │ ├─────────────────────────────────────────┤ │ │ │ ┌──────┐ ┌──────┐ ┌──────┐ │ │ │Server│────▶│Merge │────▶│Redux │ │ │ │ API │ │ │ │Store │ │ │ └──────┘ └──────┘ └──────┘ │ │ │ │ │ ▼ │ │ Version Check │ │ │ └─────────────────────────────────────────┘
148
-
149
- **Trigger:** `useAppInit()` on page load **Version Rule:** Match → local wins, Mismatch → server wins
162
+ ┌─────────────────────────────────────────┐
163
+ │ DATA SYNC │
164
+ ├─────────────────────────────────────────┤
165
+ │ │
166
+ │ ┌──────┐ ┌──────┐ ┌──────┐ │
167
+ │ │Server│────▶│Merge │────▶│Redux │ │
168
+ │ │ API │ │ │ │Store │ │
169
+ │ └──────┘ └──────┘ └──────┘ │
170
+ │ │ │
171
+ │ ▼ │
172
+ │ Version Check │
173
+ │ │
174
+ └─────────────────────────────────────────┘
175
+
176
+ **Trigger:** `useAppInit()` on page load
177
+
178
+ **Version Rule:** Match → local wins, Mismatch → server wins
150
179
  ```
151
180
 
152
181
  ---
@@ -191,6 +220,52 @@ We use Better Auth with one-shot credential issuance… ← current truth, no
191
220
 
192
221
  ---
193
222
 
223
+ ## Example 6: Stripping history from a truth doc
224
+
225
+ The move agents fumble: deleting narration is only half the job — the story must land in a record.
226
+
227
+ ### ❌ Bad: The journey narrated in place
228
+
229
+ ```markdown
230
+ ## Export Pipeline
231
+
232
+ The exporter was extracted from the legacy `reports` worker (2026-06-02) and
233
+ now lives in `src/export/`. Phases 0–2 of the rewrite are complete; streaming
234
+ output is not yet implemented. Treat any reference to `reports/export.js` as
235
+ stale — it was superseded by `src/export/run.js`.
236
+ ```
237
+
238
+ ### ✅ Good: Present-tense truth doc + a dated record carrying the story
239
+
240
+ The feature doc states only what is:
241
+
242
+ ```markdown
243
+ ## Export Pipeline
244
+
245
+ `src/export/run.js` renders every export format from one job queue. Output is
246
+ buffered per job (streaming is out of scope — see `docs/history/backlog.md`).
247
+ ```
248
+
249
+ And the change-story goes to `docs/history/changelog/2026-06-02-export-extraction.md`:
250
+
251
+ ```markdown
252
+ # 2026-06-02 — Export pipeline extracted
253
+
254
+ ## Summary
255
+
256
+ Extracted export logic from the `reports` worker into `src/export/`.
257
+
258
+ ## Changes
259
+
260
+ ### Removed
261
+
262
+ - `reports/export.js` — replaced by `src/export/run.js`; all callers repointed.
263
+ ```
264
+
265
+ **Why it works:** the truth doc needs no archaeology to act on; the dates, the predecessor, and the supersession live in a frozen record; the unbuilt part is a backlog pointer, not a "not yet" hedge; and no stale-reference tripwire survives because the references themselves were fixed.
266
+
267
+ ---
268
+
194
269
  ## Quick Comparison
195
270
 
196
271
  | Aspect | Bad | Good |
@@ -200,4 +275,5 @@ We use Better Auth with one-shot credential issuance… ← current truth, no
200
275
  | Flows | Prose paragraphs | ASCII diagrams |
201
276
  | Changelogs | "Updated X" | Function names + migrations |
202
277
  | Decisions | New doc per revision | One AD per subject, updated in place |
278
+ | History | Narrated in the doc | Present-tense doc + dated record |
203
279
  | Length | 100+ lines | 20-40 lines |
@@ -0,0 +1,44 @@
1
+ # Frontmatter Derivation — feature-doc ownership
2
+
3
+ Load when: creating a feature doc, updating one whose documented scope moved, or running a baseline/reconcile pass over many docs.
4
+
5
+ When creating or updating a feature doc, derive its **`owns:` frontmatter** — the code-path globs it is canonical for — from the source the doc describes. Code ownership lives in each feature doc's `owns:` frontmatter (the SessionStart hook unions them into the injected ownership index); there is no hand-maintained ownership map.
6
+
7
+ ## When to run
8
+
9
+ - **Baseline / reconcile** — for every feature doc whose code paths aren't yet declared in its `owns:` frontmatter (the `maintenance` agent (baseline mode) calls this)
10
+ - **New feature doc** — when creating a doc via the [Feature template](../templates/feature.md), project its `owns:` globs
11
+ - **Doc update** — when the documented scope changes, update the doc's `owns:` globs
12
+
13
+ ## How to derive the frontmatter
14
+
15
+ A feature doc's ownership frontmatter is `owns:` (required), `module:` (optional), `keywords:` (required), and `status:` (required). An optional `last-reviewed:` date (stamped whenever the doc is substantively reviewed or updated) gives the `maintenance` agent a staleness signal to rank its audits by — it is tooling metadata, never narrated in the body.
16
+
17
+ **1. `owns:`** (the path scope)
18
+
19
+ Read the doc's content. Extract every source file path it references (file listings, function locations, component paths). Group them into the narrowest glob patterns that cover all referenced files without overlapping another doc's `owns:` globs at equal specificity. A doc may own several globs.
20
+
21
+ | Doc references | Glob |
22
+ | ------------------------------------ | ------------------------- |
23
+ | Multiple files under one directory | `src/feature/**` |
24
+ | Specific files in a shared directory | List each file explicitly |
25
+ | A single entry-point file | The exact file path |
26
+
27
+ Glob each pattern against the codebase. At `status: active`, drop any that match nothing; at `status: draft`, projected globs may match nothing yet — confirm them against real code when the doc flips to `active`.
28
+
29
+ **2. `module:`**
30
+
31
+ The single bounded-context label this feature belongs to, or omit it for a cross-cutting feature that belongs to no single context. A module is a label, not a folder — features sharing a `module:` value are what ties that module to code (a filter over the generated ownership index).
32
+
33
+ **3. `keywords:` & `status:`**
34
+
35
+ `keywords:` are the discovery terms topic→doc lookup rides. `status:` is `active`, `draft`, or `deprecated` — it steers the model toward live docs and away from draft/deprecated ones.
36
+
37
+ A doc's dependencies on other docs are expressed inline in its prose (links); cross-cutting contracts are diagnosed by the `boundary` skill from source, not persisted.
38
+
39
+ ## Rules
40
+
41
+ - One canonical doc per path. A doc's `owns:` globs must not overlap another doc's at equal specificity — the narrower glob wins; equal-specificity overlap is an ownership conflict to resolve.
42
+ - Use glob patterns for directories, explicit paths for individual files. At `active`, never list paths that don't exist in the codebase; a `draft`'s projected paths are confirmed at `active`.
43
+ - When a doc covers a deep feature with sub-specs (e.g., `editor/`), each sub-spec owns its own globs — don't duplicate a path across siblings.
44
+ - For baseline/reconcile with many docs, use parallel sub-agents to read source and propose `owns:` globs.