@nurix/etna 0.20.25 → 0.20.26

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 (72) hide show
  1. package/data/harness-index.json +1 -1
  2. package/data/harnesses/code/CLAUDE.md +4 -4
  3. package/data/harnesses/code/agents/bookkeeper.md +1 -1
  4. package/data/harnesses/code/agents/change-review.md +1 -1
  5. package/data/harnesses/code/agents/lld-mode.md +1 -1
  6. package/data/harnesses/code/agents/maintenance.md +7 -9
  7. package/data/harnesses/code/docs/structure.md +133 -71
  8. package/data/harnesses/code/harness.json +4 -4
  9. package/data/harnesses/code/hooks/awareness.mjs +0 -10
  10. package/data/harnesses/code/hooks/lib/ownership.mjs +4 -2
  11. package/data/harnesses/code/hooks/lib/sweep.mjs +4 -8
  12. package/data/harnesses/code/skills/documentation/SKILL.md +19 -8
  13. package/data/harnesses/code/skills/documentation/references/frontmatter.md +3 -3
  14. package/data/harnesses/code/skills/documentation/references/style-guide.md +70 -27
  15. package/data/harnesses/code/skills/documentation/references/untemplated.md +2 -1
  16. package/data/harnesses/code/skills/documentation/scripts/doc-lint.mjs +87 -1
  17. package/data/harnesses/code/skills/documentation/templates/Readme.md +4 -3
  18. package/data/harnesses/code/skills/documentation/templates/bookkeeping.md +1 -1
  19. package/data/harnesses/code/skills/documentation/templates/docs-readme.md +15 -36
  20. package/data/harnesses/code/skills/documentation/templates/doctrine.md +82 -0
  21. package/data/harnesses/code/skills/documentation/templates/feature.md +31 -123
  22. package/data/harnesses/code/skills/documentation/templates/handover.md +174 -0
  23. package/data/harnesses/code/skills/documentation/templates/operations-procedure.md +1 -1
  24. package/data/harnesses/code/skills/documentation/templates/package.md +28 -94
  25. package/data/harnesses/code/skills/documentation/templates/root-readme.md +103 -65
  26. package/data/harnesses/code/skills/documentation/templates/setup.md +138 -0
  27. package/data/harnesses/code/skills/documentation/templates/system.md +25 -109
  28. package/data/harnesses/delivery/agents/lld-mode.md +1 -1
  29. package/data/harnesses/delivery/agents/maintenance.md +7 -9
  30. package/data/harnesses/delivery/harness.json +2 -2
  31. package/data/harnesses/delivery/skills/documentation/SKILL.md +19 -8
  32. package/data/harnesses/delivery/skills/documentation/references/frontmatter.md +3 -3
  33. package/data/harnesses/delivery/skills/documentation/references/style-guide.md +70 -27
  34. package/data/harnesses/delivery/skills/documentation/references/untemplated.md +2 -1
  35. package/data/harnesses/delivery/skills/documentation/scripts/doc-lint.mjs +87 -1
  36. package/data/harnesses/delivery/skills/documentation/templates/Readme.md +4 -3
  37. package/data/harnesses/delivery/skills/documentation/templates/bookkeeping.md +1 -1
  38. package/data/harnesses/delivery/skills/documentation/templates/docs-readme.md +15 -36
  39. package/data/harnesses/delivery/skills/documentation/templates/doctrine.md +82 -0
  40. package/data/harnesses/delivery/skills/documentation/templates/feature.md +31 -123
  41. package/data/harnesses/delivery/skills/documentation/templates/handover.md +174 -0
  42. package/data/harnesses/delivery/skills/documentation/templates/operations-procedure.md +1 -1
  43. package/data/harnesses/delivery/skills/documentation/templates/package.md +28 -94
  44. package/data/harnesses/delivery/skills/documentation/templates/root-readme.md +103 -65
  45. package/data/harnesses/delivery/skills/documentation/templates/setup.md +138 -0
  46. package/data/harnesses/delivery/skills/documentation/templates/system.md +25 -109
  47. package/data/harnesses/etna/agents/change-review.md +1 -1
  48. package/data/harnesses/etna/agents/lld-mode.md +1 -1
  49. package/data/harnesses/etna/agents/maintenance.md +7 -9
  50. package/data/harnesses/etna/harness.json +2 -2
  51. package/data/harnesses/etna/skills/documentation/SKILL.md +19 -8
  52. package/data/harnesses/etna/skills/documentation/references/frontmatter.md +3 -3
  53. package/data/harnesses/etna/skills/documentation/references/style-guide.md +70 -27
  54. package/data/harnesses/etna/skills/documentation/references/untemplated.md +2 -1
  55. package/data/harnesses/etna/skills/documentation/scripts/doc-lint.mjs +87 -1
  56. package/data/harnesses/etna/skills/documentation/templates/Readme.md +4 -3
  57. package/data/harnesses/etna/skills/documentation/templates/bookkeeping.md +1 -1
  58. package/data/harnesses/etna/skills/documentation/templates/docs-readme.md +15 -36
  59. package/data/harnesses/etna/skills/documentation/templates/doctrine.md +82 -0
  60. package/data/harnesses/etna/skills/documentation/templates/feature.md +31 -123
  61. package/data/harnesses/etna/skills/documentation/templates/handover.md +174 -0
  62. package/data/harnesses/etna/skills/documentation/templates/operations-procedure.md +1 -1
  63. package/data/harnesses/etna/skills/documentation/templates/package.md +28 -94
  64. package/data/harnesses/etna/skills/documentation/templates/root-readme.md +103 -65
  65. package/data/harnesses/etna/skills/documentation/templates/setup.md +138 -0
  66. package/data/harnesses/etna/skills/documentation/templates/system.md +25 -109
  67. package/lib/install/materialize.mjs +4 -12
  68. package/lib/install/plan.mjs +4 -11
  69. package/package.json +3 -2
  70. package/data/harnesses/code/skills/documentation/templates/structure.md +0 -71
  71. package/data/harnesses/delivery/skills/documentation/templates/structure.md +0 -71
  72. package/data/harnesses/etna/skills/documentation/templates/structure.md +0 -71
@@ -0,0 +1,174 @@
1
+ # Hand-over (`docs/history/handovers/YYYY-MM-DD-{slug}.md`)
2
+
3
+ Record. Use for: the account an **unattended or multi-session build** leaves the person who owns it — written by the orchestrating session as its last act, before the owner's first decision, read in one sitting. It is a **decision queue, an undo manual and a resume file**, in that order: is it done · what must I decide today · what escaped the repository and how do I undo it · can I see it working · what was decided for me and how do I overturn it · what is red and whose it is. Everything below the divider is for the next session, not the owner. It is not a pull-request description (which argues for a diff), not a changelog entry (which carries refinement context) and not a plan (which is frozen). It is mutable while `status: open` — a successor that re-proves a state line corrects it in place and appends one Timeline row — and **freezes when the owner has acted on § 1 (`status: accepted`)**; a correction after that is a new dated hand-over linking back. Raw artefacts (plans, hand-offs, notes) live in a same-named folder beside it.
4
+
5
+ Required: **Verdict**, **Decide today**, **Live-world ledger** (even when empty), **See it work**, **Decided for you**, **Red board**, **What was built**, **Proof**, **State**, **Open loops**, **Artefacts & mandate**. Optional: Left alone, Discoveries, Debt, Cost, Timeline.
6
+
7
+ **Reading order is act → verify → understand.** Owner half, ~20 minutes: Verdict (1) · § 1 (2) · § 2 (2) · § 3 (10, at the product) · § 4 (3) · § 5–6 (2). Successor half, read when the job arrives: § 8–14 (~10).
8
+
9
+ ````markdown
10
+ ---
11
+ type: handover
12
+ status: {open | accepted}
13
+ date: {YYYY-MM-DD}
14
+ as_of: {YYYY-MM-DDTHH:MM±TZ}
15
+ as_of_commit: {sha} # every § 9 claim is true of THIS commit and no other
16
+ verdict: {done | done-needs-calls | partial | stopped-at-budget | failed}
17
+ decide_today: {N} irreversible_acts: {N} decisions: {N} red_mine: {N} open_loops: {N}
18
+ deployed:
19
+ - { plane: {dev|staging|production}, artifact: {name}, version: "{id}", by: {automatic|manual}, verify: "{command}" }
20
+ prs:
21
+ - { n: {N}, base: {branch}, state: {open|draft|merged}, action: "{what the owner does}" }
22
+ ---
23
+
24
+ # Hand-over — {what was built}, {YYYY-MM-DD}
25
+
26
+ **{VERDICT TOKEN}.** {One sentence in the product's words: what exists and what a person can now do.}
27
+
28
+ | | |
29
+ | --- | --- |
30
+ | Built | {N} units · {N} plans · ledger rows {N}, discharged {N}, blocked {N} |
31
+ | Proof | {N} tests pass / {N} fail — on `{sha}`, verified {HH:MM} |
32
+ | Decide today | **{N}** — § 1 |
33
+ | Touched the live world | **{N}** acts, **{N}** you cannot undo — § 2 |
34
+ | Red | {N} mine · {N} pre-existing · {N} environment — § 5 |
35
+ | See it work | {N} min — § 3 |
36
+ | Taken alone | {N} decisions, {N} stops filed of {N} — § 4 |
37
+
38
+ **Start here:** `{the one command that brings the reader's machine to the state everything below describes}`
39
+ **If you only act on one thing:** {act} — by {YYYY-MM-DD}, or {consequence}.
40
+
41
+ ## 1. Decide today
42
+
43
+ | # | Decision or act | Why today | If you say nothing | Decide by | Do it (exact) | Evidence |
44
+ | --- | --- | --- | --- | --- | --- | --- |
45
+ | 1 | {one line, no mechanism} | {what a week costs} | {the outcome silence produces} | {date} | `{command}` / {PR link} / {UI path} | `{path:line · sha · PR}` |
46
+
47
+ ## 2. Live-world ledger
48
+
49
+ Everything that left the repository, hardest to undo first. Verified {HH:MM}.
50
+
51
+ | # | Act (past tense, dated) | Target (system + id) | Command | Reversible | Undo — exact | Evidence / backup + expiry |
52
+ | --- | --- | --- | --- | --- | --- | --- |
53
+ | 1 | {what was done, {YYYY-MM-DD HH:MM}} | {named system} | `{exact}` | {no / with loss / yes} | `{command}` or {runbook path} — {or "forward only: …"} | {artefact · where · when it expires} |
54
+
55
+ **Did not happen, and the proof:** {claim} — `{command}`.
56
+
57
+ ## 3. See it work in ten minutes
58
+
59
+ **Before you start:** `{command}` · **Sign in as:** {who} · **Total:** {N} min
60
+
61
+ | # | Do (URL → click) | You should see | It proves | If not |
62
+ | --- | --- | --- | --- | --- |
63
+ | 1 | {url} → {action} | {an observable a person can be wrong about} | {unit from § 6} | {§ 5 row, or "file it — new"} |
64
+
65
+ ## 4. Decided for you
66
+
67
+ Each was taken because waiting would have stopped the run. Sorted by cost to reverse.
68
+
69
+ | # | I decided | Instead of | Why | Authority | Landed at | Overturn — exact | If you say nothing | Hardens when |
70
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- |
71
+ | D-1 | {the ruling} | {the alternative, fairly} | {the constraint} | {owner said so HH:MM "…" / auto-ruled as recommended / taken alone — by {agent · model}} | `{file:line}` | `{edit or command}` | {default} | {event} |
72
+
73
+ *Bulk: {N} per-plan questions ruled `as recommended, overturnable` — index at `{path}`. Only rows costing more than one commit to reverse are listed.*
74
+
75
+ ## 5. Red board
76
+
77
+ | What's red | Where | Mine? | Proof | Blocks | Next step + owner |
78
+ | --- | --- | --- | --- | --- | --- |
79
+ | {test or command} | `{file:line}` | {mine / pre-existing / environment} | `{the command or stash that settled it}` | {what it stops, or nothing} | {act} — {who} |
80
+
81
+ ## 6. What was built
82
+
83
+ | Unit | What it does for a person | Landed | Proof |
84
+ | --- | --- | --- | --- |
85
+ | {name} | {one clause, behaviour before mechanism} | {branch · PR · release} | {suite + counts, or "driven only", or empty} |
86
+
87
+ ## 7. Left alone
88
+
89
+ | Thing | State | Why untouched |
90
+ | --- | --- | --- |
91
+
92
+ ---
93
+
94
+ *Everything above is for the owner. Everything below is for the next session.*
95
+
96
+ ## 8. Proof
97
+
98
+ | Unit | Promise (clause) | Code @ | Pinned @ | Independent? | Rows p/o/b | Gap |
99
+ | --- | --- | --- | --- | --- | --- | --- |
100
+ | {plan} | {ruling n — five words} | `{sha7}` | `{sha7}` | {yes / **no — {who did both}**} | {n}/{n}/{n} | {G-n / —} |
101
+
102
+ | # | Claim that is not proven | Why | What would prove it | Sev |
103
+ | --- | --- | --- | --- | --- |
104
+ | G-1 | {stated as the build would state it} | {blocked row / never driven / self-authored pin / no suite on this head / not recorded} | `{exact command}` | P{0-3} |
105
+
106
+ ## 9. State
107
+
108
+ Present tense; every row true of `as_of_commit`, and every row re-provable by its own command.
109
+
110
+ | Repo · branch | HEAD | vs upstream | Working tree | Worktrees | Re-prove |
111
+ | --- | --- | --- | --- | --- | --- |
112
+
113
+ | Plane | Artifact | Version | Deployed by | Re-prove |
114
+ | --- | --- | --- | --- | --- |
115
+
116
+ | Store | Env | Last destructive act | Backup + expiry | Re-prove |
117
+ | --- | --- | --- | --- | --- |
118
+
119
+ | Process / connection / token | Where | State | Check or stop |
120
+ | --- | --- | --- | --- |
121
+
122
+ ## 10. Open loops
123
+
124
+ | # | Loop | Whose | Next command or ask | Blocked by | Evidence |
125
+ | --- | --- | --- | --- | --- | --- |
126
+ | L-1 | {present tense} | {session / owner / external} | `{command}` or {the question, with the default in force} | {id / —} | `{path:line}` |
127
+
128
+ ## 11. Discoveries — do not pay for these twice
129
+
130
+ | # | Trap | The truth | Cost paid | Guard |
131
+ | --- | --- | --- | --- | --- |
132
+ | X-1 | {what it looks like from outside} | {present-tense fact} | {hours / runs} | `{command}` or `none — {what would hold it}` |
133
+
134
+ ## 12. Debt and can wait
135
+
136
+ | # | What | Why not now | Re-open when | Parked at |
137
+ | --- | --- | --- | --- | --- |
138
+ | T-1 | {one line} | {the ruling} | {a trigger, not a date} | `{backlog row · issue · path:line}` |
139
+
140
+ ## 13. Cost
141
+
142
+ **Wall-clock:** {Nh Nm} ({start} → {end}) · **unattended:** {Nh} · **Agents:** {N} · **Tokens:** {N | unmeasured — {what would measure it}} · **Rework:** {what was thrown away} · **Stops filed:** {N} of {N}
143
+
144
+ ## 14. Artefacts & mandate
145
+
146
+ | Path | Holds | Volatile | Safe to delete after |
147
+ | --- | --- | --- | --- |
148
+
149
+ **Corpus:** {tracked at `{path}` @ {sha} | **UNTRACKED at `{path}` — {what would durably hold it}**}
150
+ **May, alone:** {one line each} · **Must file or ask:** {one line each} · **Never:** {one line each}
151
+
152
+ ## 15. Timeline
153
+
154
+ <!-- Append only. Never rewritten. -->
155
+
156
+ - {YYYY-MM-DD HH:MM} — {event} (`{sha7}` / PR #{n})
157
+ ````
158
+
159
+ ## Field rules
160
+
161
+ - **Verdict (≤14 lines).** One token from the closed set — `DONE` · `DONE, NEEDS YOUR CALLS` · `PARTIAL` · `STOPPED AT BUDGET` · `FAILED` — first in the body; a paragraph before it is a format violation. The scoreboard is always the same seven rows in that order, and a zero is written `0` — `Touched the live world: 0` is one of the most valuable lines the file can carry. `Start here` is exactly one command.
162
+ - **§ 1 Decide today (≤7 rows).** Owner-only acts, sorted by cost of deferral descending. `Do it (exact)` is a command, a link or a literal UI path — `git revert -m 1 {sha}`, never "revert the merge". `If you say nothing` is mandatory and honest. **A decision has an alternative and belongs in § 4; an act outside the repository with no alternative is a chore and belongs here.**
163
+ - **§ 2 Live-world ledger.** Required even when empty — `none — nothing left the repository`, with the command that proves it. Sorted hardest-to-undo first, never chronologically. `Reversible` takes three values: `no` states what now exists in the world, `with loss` names what is lost, `yes` carries the command. An act reversible only forward (redeploy, reseed, a superseding publish) is `no`, and the forward path goes in `Undo`. A backup states its expiry; copying a volatile backup somewhere durable is row 1 of § 1.
164
+ - **§ 3 See it work (≤6 steps, ≤10 min).** Every `You should see` is an observable a person can be wrong about — a number, a named control, a status code — never "the page loads". It is the only check the owner performs with his own eyes rather than on the build's word.
165
+ - **§ 4 Decided for you (≤10 rows).** Sorted by cost to reverse. `Authority` takes exactly three values — the owner said so (with the words and the time) · auto-ruled as recommended · taken alone — recorded per decision, never per run: it is the distinction an unattended run exists to preserve. `Overturn` is an edit or a command. `Hardens when` names the event after which reversal stops being cheap. A ruling with no reversal path is a constraint, not a decision — it moves to § 12.
166
+ - **§ 5–7.** One home per fact: a red appears in § 5 even when a decision caused it, and the decision cites the row. `Mine?` is proved by the command or stash in `Proof`; `mine` is the default when no proof is offered. § 6 leads with behaviour, not plan slugs. § 7 exists so an owner scanning the repository does not mistake somebody else's branch for the run's debris.
167
+ - **§ 8 Proof.** **An unproven claim is an empty cell, never a sentence** — prose has no empty cell to scan for. `Independent?` reads `no` whenever one agent authored both the code and its pin, or found, fixed and pinned the same defect, and names who. Ledger counts are parsed from the plan, never quoted from an agent's summary, so `blocked` cannot hide inside "discharged". Every `G-n` names the command that would close it.
168
+ - **§ 9 State.** Present tense; a claim that cannot be re-proved by its `Re-prove` command does not belong here — it moves to § 15 as a dated event. Volatile things (`/tmp`, pid files, ports, tokens, browser connections) declare a lifetime and the command that makes them durable.
169
+ - **§ 10–12.** A loop is a runnable command or a named question, never a noun phrase and never "investigate"; one needing a person's judgment states the question and the default in force. A discovery is a present-tense fact with a guard — "Workers Builds does not fire on a `dev` merge", not "we found that it didn't"; `none — {what would hold it}` is an honest guard that feeds the backlog. Debt names where it now lives, so this file can be deleted without losing it.
170
+ - **§ 13–14.** Every uninstrumented number reads `unmeasured — {what would have measured it}`; a blank reports a cheaper run than the one that happened. **State whether the run's own corpus is version-controlled** — an untracked corpus is one `rm -rf` from being three PR descriptions, and archiving it is a § 1 row.
171
+ - **Ids are stable and run-global** — `D-`, `G-`, `L-`, `X-`, `T-` — so a PR comment or a successor cites a row instead of re-describing it. A withdrawn row keeps its id and states what disproved it.
172
+ - **Evidence is an address that outlives the run** — `path:line`, a 7-char sha, a PR number, a URL, or a command. A branch name is not a pointer; a `/tmp` log is not evidence — copy it into the record folder first.
173
+ - **Blanket claims are banned.** "All suites green", "every ledger discharged", "nothing was deployed" carry a count and the sha they are true of, or they become a `G-n` row.
174
+ - **The last act before showing the file is a contradiction pass**: the scoreboard against § 2, § 6 against § 1, every count against its source, every `{…}` resolved. An unresolved placeholder in an action cell is a defect of the same class as a broken command.
@@ -1,6 +1,6 @@
1
1
  # Operations Procedure (docs/operations/{procedure}.md)
2
2
 
3
- Truth document. Use for: any **recurring** procedure — setup, development, deployment, maintenance. A procedure is consulted mid-task, not read: exact commands, copy-paste runnable, no narrative. Updated in place whenever the workflow changes.
3
+ Truth document. Use for: any **recurring** procedure — development, deployment, maintenance. The one-time first run (prerequisites, install, env files, first commands, the stack) is not one of these: it has its own template and a fixed name, `templates/setup.md` → `docs/operations/setup.md`, one per repo. A procedure is consulted mid-task, not read: exact commands, copy-paste runnable, no narrative. Updated in place whenever the workflow changes.
4
4
 
5
5
  A **one-shot** procedure (a migration, an upgrade, an incident response executed once) is not an operations doc — it is a **Migration Runbook** (record, below). The test: will someone run this again next month? Yes → operations. No → runbook.
6
6
 
@@ -1,131 +1,65 @@
1
1
  # Package Documentation (docs/architecture/packages/{package}.md)
2
2
 
3
- Truth document. Use for: **one workspace package — what it is and how it behaves**. One file per package, named for the package's folder (`packages/cli/` → `docs/architecture/packages/cli.md`). It states the package's own machinery: its manifest and published identity, its build and entry point, its source layout, and every behavior of its tree that no system or feature document claims.
3
+ Truth document. Use for: **one workspace package** — one unit of distribution: a manifest, a build, a binary, a bundle, a Worker. One file per package, named for its folder.
4
4
 
5
- **A package document is the residual owner of its own tree.** Its `owns:` is the whole package glob — `["packages/{name}/**"]` — and that glob is the *broadest* claim anything makes on those paths, so it loses to every narrower one. A system document naming `packages/{name}/src/server/runs/**` wins those files by specificity; a feature document naming `packages/{name}/src/surfaces/apps/**` wins those. What is left after every narrower claim is what this document describes, and it describes that exhaustively. **The residual claim is a promise of completeness, not of scope**: a package document with nothing left after the systems and features have claimed their subtrees is still owed — the manifest, the build, the entry, the layout, the test wiring and the deploy shape are always residual.
5
+ **A document is read by people, and its footer is for the agent** (`references/style-guide.md` § Documents are read by people). A package document tells a person what the package is for, why it is its own unit, how it ships and to whom, how it is meant to be used, and what its consumers can rely on. Its manifest, build, entry, internal layout and test wiring are the code graph's (`docs/architecture/systems/knowledge-layer.md`), not a roster here.
6
6
 
7
- **Two rules bind the glob.** Neither genre may claim a path another document claims at **equal specificity** — equal-specificity overlap is an ownership conflict to resolve before either document ships, not a duplication to live with. And every glob **matches at least one file on disk** at `status: active`; a projected glob is permitted only at `draft`, and is confirmed when the document flips.
7
+ **A package document's deepest layer is its public contract** (`references/style-guide.md` § Shape — the model first, the detail after): the commands and flags a person types, the exports another package imports, what is installed and where. For a CLI the flags *are* the promise, so they belong in How it is used. It stops before internal layout, build steps and which file holds what.
8
8
 
9
- **How this differs from its neighbours.** A **feature** document covers one capability or one page a person names, and owns that surface's globs. A **system** document covers one machine that spans packages, and owns the subtrees that machine is made of. A **package** document covers one unit of distribution — a manifest, a build, a binary or a bundle — and owns what is left of it. The unit is the package boundary, so if the subject you are writing about does not stop at a `package.json`, it is not this genre. Route it: one screen → feature; one machine crossing two packages → [system](system.md).
9
+ **A package document is the residual owner of its own tree.** Its `owns:` is the whole package glob — the broadest claim on those paths, so it loses to every narrower system or feature claim. The one enumerable fact it declares is the ownership table: which subtrees other documents claim.
10
10
 
11
- **Required vs optional.** Required in every package document: the **frontmatter**, the **opening** (title, identity line, what the package is), the **ownership boundary** (what this document does not describe and which document does), at least one **behavior section**, **Files**, and **Related**. Everything else is optional — include a section only when the package has something real to put in it. A package with no test wiring of its own gets no verification section; a package that nothing else in the repo consumes says so in one line rather than growing a Consumers section. A short accurate document beats a full skeleton with empty headings.
12
-
13
- Package documents run long because they are exhaustive over their residue — roughly 150 to 600 lines is the working range, and the top of that range is a package holding an application, not a document that has lost discipline.
11
+ **Required:** the frontmatter, the identity line, the goal line, **Why it exists**, **Ownership** (one paragraph or a table), **How it is used**, **What it promises**, **For the agent**. **What was decided** once any choice was made the code cannot explain. **Known gaps** only when there is one. Nothing else — the feature template's lint rules apply. Forty to a hundred and twenty lines.
14
12
 
15
13
  ```yaml
16
14
  ---
17
- owns: ["packages/{name}/**"] # required — the whole package tree, one glob; the residual claim
18
- keywords: [package-name, binary, build, entry] # required — discovery terms: the npm name, the binary, the surfaces
19
- status: active # required — active | draft | deprecated
20
- applies: [docs/architecture/common/api.md] # optional — cross-cutting doctrine this package is BOUND by (obligation, not a bibliography); omit when none
21
- type: package # required tooling key — genre stamp; preserve on edits, never narrate
15
+ type: package
16
+ status: active
17
+ objects: [nustack cli, device credential] # required — the objects this package designs or ships
18
+ owns: ["packages/{name}/**"] # required until the graph computes ownership — the residual claim
19
+ applies: [docs/architecture/common/api.md] # optional
22
20
  ---
23
21
  ```
24
22
 
25
- > A package document carries no `module:` — a package is already a bounded unit, and a second label
26
- > for the same boundary is a thing to keep in sync for nothing. `last-reviewed:` is optional and,
27
- > like `type:`, is tooling metadata: preserve it, never narrate it.
28
-
29
23
  ```
30
24
  # {package-path} — {the one-line role}
31
25
 
32
- **Package:** `@scope/name` · **Ships as:** {a public npm package with one binary `x` / a private
33
- source-first workspace package / a Worker on {domain}} · **Source:** `packages/{name}`
34
-
35
- {One paragraph: what this package is and the job it does in the product. Name what it holds that
36
- nothing else does, and what it deliberately does not hold. Written for someone who has not opened
37
- the folder.}
38
-
39
- {One paragraph: the ownership boundary. This document is the residual owner of `packages/{name}/**`;
40
- these subtrees are claimed at higher specificity by these documents and are pointed at, not
41
- restated. Where the routing is more than a sentence, make it the table below instead.}
26
+ **Package:** `@scope/name` · **Ships as:** {…} · **Source:** `packages/{name}`
42
27
 
43
- {Optional, and worth its line whenever the body names paths: "Paths below are relative to
44
- `packages/{name}/` unless they name another package."}
28
+ {One sentence: the job this package does in the product, for whom.}
45
29
 
46
- ## What is built and what is not
30
+ ## Why it exists
47
31
 
48
- {Optional — required in substance whenever some of the tree does not run. State plainly which
49
- halves exist and which do not, with the source evidence for each claim, and say what a reader who
50
- runs the unbuilt half will actually observe. A package whose subject as a whole does not run is
51
- `status: draft` and says so here; a scoped gap in a working package stays `active` and takes an
52
- UNBUILT marker at the section that describes the gap.}
32
+ {Why it is its own unit, what it holds that nothing else does, what it deliberately does not hold, who consumes it, how and when it ships. Prose.}
53
33
 
54
- ## Ownership — packages/{name}
34
+ ## Ownership
55
35
 
56
- {Optional — use the table form when more than two documents claim subtrees of this package.}
57
-
58
- **The package glob is the residual claim.** A system or feature document's `owns:` is more specific
59
- and wins by specificity, so this document describes only what none of them claims, and points to
60
- each for the rest.
61
-
62
- | Path | What it is |
63
- | --- | --- |
64
- | `src/index.ts` | {the residue: the entry, the dispatch, the layout} |
36
+ This document is the residual owner of `packages/{name}/**`. Claimed at higher specificity:
65
37
 
66
38
  | Subtree | Stated and owned by |
67
39
  | --- | --- |
68
40
  | `src/{machine}/**` | [{system}](../systems/{system}.md) |
69
- | `src/surfaces/{x}/**` | [{feature}](../../features/{feature}.md) |
70
41
 
71
- ## {Behavior sections — named for this package's own machinery}
42
+ ## How it is used
72
43
 
73
- {The body. There is no fixed section list, and inventing one would be a lie: what a CLI owes
74
- (commands, the store, the on-ramp) and what a UI package owes (the host port, the frame, the route
75
- zones, the component pool) share no headings. Name each section for the thing it describes and
76
- order them the way a reader meets them — identity and build first, then the surface, then what it
77
- writes, then how it is verified. Prefer a table wherever the content is a roster (commands, routes,
78
- exports, bindings, environment variables); prefer prose wherever the content is a rule and its
79
- reason. State mechanisms and contracts, never pasted implementations.}
44
+ {What a person or another package does with it, in plain words — install, run, import, call — and what they see. Terms introduced on first use. Code named only at a seam.}
80
45
 
81
- ## Tests
46
+ ## What was decided
82
47
 
83
- {Optional. What proves this package, and what each suite pins — a `Suite | Pins` table, or the
84
- commands a reader runs. A package whose verification is a build check names the check instead
85
- (`## Checks`, `## Build and test`); a package with no suite of its own says so in one line in the
86
- build section and carries no heading here.}
48
+ {Themed paragraphs.}
87
49
 
88
- ## Files
50
+ ## What it promises
89
51
 
90
- | Path | Role |
91
- | --- | --- |
92
- | `packages/{name}/package.json` | {the manifest: the bin, the exports, the scripts} |
93
- | `packages/{name}/src/index.ts` | {the entry} |
52
+ {What a consumer can rely on and what the package refuses; checkable sentences, grouped.}
94
53
 
95
- {One row or bullet per file this document owns, with what it holds — the roster a reader uses to go
96
- from the document to the code. Close with the inverse where it helps: "Read here, owned elsewhere:"
97
- naming the paths the body describes but another document claims.}
54
+ ## Known gaps
98
55
 
99
- ## Related
56
+ {One paragraph, only when needed.}
100
57
 
101
- - [`{system}.md`](../systems/{system}.md) — {why a reader of this document would open that one}
102
- - [`{other-package}.md`]({other-package}.md) — {the seam between the two}
103
- - [`{doctrine}.md`](../common/{doctrine}.md) — {the cross-cutting contract this package answers to}
104
- ```
105
-
106
- ### The identity line
58
+ ## For the agent
107
59
 
108
- The bolded `·`-separated run under the title is what a reader checks first, and it answers three
109
- questions no body section should have to: **what is this called** on the registry or in the
110
- workspace, **how does it ship** (a public tarball, a private source-first package, a deployed
111
- Worker, a signed installer), and **where is its source**. A package that ships two artifacts names
112
- both. Add a `**Crate:**` or `**Deploys as:**` term where the package has one; drop any term that
113
- would restate the title.
60
+ Objects: {…}. Commands {…} and exports {…} — the public contract. Code root `packages/{name}/`. Seams {…} by name. Checklist `tests/{package}.md`. See also {neighbour} ({why}). No file lists or symbol rosters — those are the graph's.
61
+ ```
114
62
 
115
63
  ### Marking what is decided and unbuilt
116
64
 
117
- Where the package holds code for a design that is decided and not built — or a surface whose other
118
- half does not exist — wrap the prose in a marker so the gap is machine-findable and its evidence
119
- travels with it:
120
-
121
- ```
122
- <!-- UNBUILT:START — {what is decided, where it is decided (an AD or an owner ruling), and the
123
- source evidence that it is not built: the file that does not exist, the route that is not mounted,
124
- the binding that is not declared} -->
125
- {the prose describing the unbuilt half}
126
- <!-- UNBUILT:END -->
127
- ```
128
-
129
- **A design that was decided *against* carries no marker.** A marker means the work is owed and
130
- absent; using one for a rejected design turns the register of debt into a register of opinions.
131
- Say in prose that it is not built and not owed, and name the decision that settled it.
65
+ `<!-- UNBUILT:START — {…} -->` … `<!-- UNBUILT:END -->` around the prose for a decided, unbuilt half; a design decided *against* carries no marker.
@@ -1,104 +1,142 @@
1
- # Project Root README
1
+ # Project Root README (/README.md)
2
2
 
3
- Truth document. Use for: the human-facing entry point at the repository root (`/README.md`) — what visitors and new contributors land on. Distinct from `docs/README.md` (the agent/doc index — see **docs/README.md (Documentation Root)** above). The two coexist; don't merge them.
3
+ Truth document. Use for: the repository root `/README.md`. It opens outward — what the product does, for whom, and where it runs, in a user's terms — then turns inward for the team and coding agents: what state the repo is in, how it works, what its parts are and what must not break, then routes every other question into `docs/`. The outward part comes first because it is what a stranger reads; the inward part is longer because it is what the team uses. **It hosts nothing it can link to.** It is distinct from `docs/README.md`, which describes the folders of the docs tree, and from `CLAUDE.md` / `AGENTS.md`, the standing rules an agent loads. It points at both and restates neither.
4
4
 
5
- ### Strategy
5
+ ### What it carries
6
6
 
7
- The root README answers, in order:
7
+ Sections come in this order; 1 to 3 are the outward-facing first screen, 4 onward the inward page. Skip any section the repo cannot fill truthfully. Never pad it, and never leave a stub.
8
8
 
9
- 1. **What is this?** — one to two sentences, no marketing claims
10
- 2. **What do I get if I install it?** — capability families
11
- 3. **What's it built on?** — terse stack list with versions
12
- 4. **How do I run it?** — the three or four scripts that matter
13
- 5. **How is it laid out?** — directory tree, one-liner per significant folder
14
- 6. **How do I extend it?** — numbered contribution checklist
15
- 7. **What state is it in?** — pre-publish, beta, stable, internal
9
+ 1. **Identity.** The H1 plus two or three sentences in a user's terms: what the product is, where it runs, and what using it is like.
10
+ 2. **What it does.** Two to four paragraphs, outward-facing: the core loop as a person meets it, what surrounds that loop, how the product follows the person across its surfaces, and who it is for, closing with what it deliberately is not. Plain words, no feature roster, no superlatives.
11
+ 3. **Where it runs.** One paragraph: the addresses, the distributed artifacts and where they are published, where identity comes from, and whether a self-hosted edition exists.
12
+ 4. **The turn.** A rule and one paragraph saying the rest is for the team and agents, with the scope line: what lives in this repo and what lives elsewhere.
13
+ 5. **State.** Optional: a one-line blockquote, present only while something repo-wide is true that a newcomer must know (frozen, mid-migration, mid-breaking-change on `dev`). It links the plan or runbook that owns the change. Say here which units publish and where, if any do.
14
+ 6. **How it works.** Three to six short paragraphs, or numbered stages, along the main request or data path: who arrives, what is built, where state lives, how the result leaves. Name a technology only where it explains a stage. End with a link to the system overview.
15
+ 7. **What is in the repository.** A sentence on how the tree is organised, then one table row per top-level unit (package, app, service), giving its path, what it is in one line, and its owning doc; the top folders that are not packages get a sentence each. This replaces the tree.
16
+ 8. **Rules that bite.** Optional. At most five one-line invariants, public/internal boundaries, never-edit paths (generated, protected) or non-goals, each linked to the doc that argues it.
17
+ 9. **Where to go.** An intent-to-destination table. Its last row is the one for agents.
18
+ 10. **Everyday commands.** Optional. At most four commands run on every change, ending at the gate a push must pass. First-run commands are never here.
16
19
 
17
- Skip any section that doesn't apply. Don't pad to fill the template.
20
+ ### What it leaves out
21
+
22
+ | Left out | Lives in |
23
+ | --- | --- |
24
+ | Getting started, install, prerequisites, env files, first run, troubleshooting | `docs/operations/setup.md` |
25
+ | Stack: technologies, what each is for, where its version is pinned | `docs/operations/setup.md` § Stack. Why it was chosen goes in `docs/architecture/` |
26
+ | Directory or file tree | `docs/structure.md`, the only tree |
27
+ | Daily loop, watch modes, per-package traps | `docs/operations/local-development.md` |
28
+ | Contributing procedure, branch model, commit rules | `CLAUDE.md` and `docs/operations/` |
29
+ | Feature list, news, "what's new", roadmap, changelog | `docs/features/`, `docs/history/` |
30
+ | Badges, logos, images, screenshots, social links, sponsors, hand-written TOC, license text, superlatives | Nowhere. The outward sections are plain prose too. Agents cannot read them and the team does not need them. License is one line or absent |
18
31
 
19
32
  ### Writing rules
20
33
 
21
- - **Sentence-case headings.** "Getting started", not "Getting Started".
22
- - **Concrete over abstract.** Real versions, real paths, real commands. No "leverages cutting-edge…".
23
- - **The tagline answers "what is this?"** — not "why is it great?". Two sentences max.
24
- - **Tables for enumeration** (routes, commands, endpoints). **Bullets for families and categories.**
25
- - **Directory tree as a code block**, not a nested markdown list.
26
- - **Numbered checklist** for "how to add a thing" — readers should be able to follow it top-to-bottom without re-reading.
27
- - **Point to `docs/` for depth.** The root README links into deep docs; it doesn't host them.
28
- - **Detect the package manager from the lockfile** (`pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, otherwise npm) and write commands accordingly. Don't hardcode `npm` if the repo uses pnpm.
34
+ - **Budget: between 60 and 140 non-blank lines, the outward part under a third of it.** Prose is welcome — How it works and Rules that bite read better as paragraphs than as rows — but past the ceiling a section is hosting content that belongs in a doc. Move it and leave the link.
35
+ - **Every section is either a fact the reader acts on or a link.** If a section needs a paragraph, it needs a doc.
36
+ - **One H1, then H2 sections, in plain Markdown.** Sentence-case headings, no emoji, no HTML layout, and no `#` comment lines inside code blocks (they parse as H1s).
37
+ - **Relative links into the repo only.** Never an absolute repo URL. Never an external site as the home of a canonical doc.
38
+ - **Link folders and mandated scaffolds, never rosters.** The allowed targets are folders, `docs/README.md`, `docs/structure.md`, `docs/operations/setup.md`, `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `CLAUDE.md` and the owning docs in the Map. A procedure is named only where a Where-to-go row needs it. Never list individual feature docs: the ownership index finds them.
39
+ - **No tree.** The Map stops at top-level units and never lists files. Mark paths that look primary but are not, for example "`legacy/`: reference only, never edited".
40
+ - **The Map is a coarse view of the ownership index, not a rival to it.** The Owning doc column names the doc that the index's `owns:` globs resolve to. When the two disagree the index wins, and the Map row is fixed in the same change.
41
+ - **No version numbers and no dates.** Name the file that pins a version (`.nvmrc`, `packageManager`, `rust-toolchain.toml`). Write in the present tense, with no "coming soon" and no "as of".
42
+ - **State rules, don't argue them.** One line each. The reasoning lives in the linked doc, and agent process rules stay in `CLAUDE.md`.
43
+ - **Commands come from the repo.** Detect the package manager from the lockfile (`pnpm-lock.yaml` gives pnpm, `yarn.lock` gives yarn, otherwise npm). Use only scripts that exist, each with a trailing comment saying what it does.
29
44
 
30
45
  ### Template
31
46
 
32
47
  ```markdown
33
- # {package-name}
48
+ # {Project name}
34
49
 
35
- {One- to two-sentence positioning. What it is and what scope it covers. No superlatives, no value claims.}
50
+ {Two or three sentences in a user's terms: what the product is, where it runs, what using it is like.}
36
51
 
37
- ## What's in the box
52
+ ## What it does
38
53
 
39
- - **{Family 1}** — {what's in it; a few specific items, comma-listed.}
40
- - **{Family 2}** — {what's in it.}
41
- - **{Family 3}** — {what's in it.}
54
+ {The core loop as a person meets it: what they bring, what the product does, what they get back and what record it leaves.}
42
55
 
43
- The full surface lives in [`{path/to/public-index}`]({path/to/public-index}). ← optional pointer for libraries
56
+ {What surrounds the loop: the capabilities a team needs to run it, named plainly.}
44
57
 
45
- ## Stack
58
+ {How it follows the person across surfaces: CLI, desktop, integrations, agents' doors.}
46
59
 
47
- - {Framework} {version} · {Language} {version}
48
- - {Build tool} {version}
49
- - {Other load-bearing deps}
60
+ {Who it is for, and what it deliberately is not.}
50
61
 
51
- ## Getting started
62
+ ## Where it runs
52
63
 
53
- \`\`\`bash
54
- {pm} install
55
- {pm} run dev # what it does (port, URL)
56
- {pm} run build # what it does
57
- {pm} run preview # what it does (omit if not applicable)
58
- \`\`\`
64
+ {Addresses; distributed artifacts and where they publish; where identity comes from; whether a self-hosted edition exists.}
59
65
 
60
- {Optional one-liner about first-run behavior — e.g., "Dev server lands on /playground."}
66
+ ---
61
67
 
62
- ## {Runtime entry point} ← optional; e.g., "The playground", "CLI", "API endpoints"
68
+ The rest of this page is for the team and for coding agents working in this repository. {What lives in this repo and what lives elsewhere.} {One sentence: the sections below route every other question into docs/.}
63
69
 
64
- {Brief description of the dev/runtime surface.}
70
+ > **State:** {one line: what is in flux right now; which units publish where} → [{plan or runbook}](docs/history/{plans|migrations}/{file}.md) ← optional; delete when the flux ends
65
71
 
66
- | {Thing} | {What it shows / does} |
67
- | -------------------- | ---------------------- |
68
- | `{route or command}` | {description} |
72
+ ## How it works
69
73
 
70
- ## Layout
74
+ 1. **{Stage}**: {what happens, naming the mechanism only where it explains the step}.
75
+ 2. **{Stage}**: {…}.
76
+ 3. **{Stage}**: {where state lives}.
77
+ 4. **{Stage}**: {the outbound effect: what is written, deployed or returned}.
71
78
 
72
- \`\`\`
73
- src/
74
- ├── {entry-file} # {purpose}
75
- ├── {folder}/ # {purpose}
76
- │ └── ...
77
- └── {folder}/ # {purpose}
78
- \`\`\`
79
+ {Optional, one sentence naming the seam everything passes through, e.g. "Every client reaches data through `{path}`; nothing else talks to the database."} The full account: [{system overview}](docs/architecture/{overview}.md).
80
+
81
+ ## What is in the repository
82
+
83
+ {One or two sentences: the workspace shape and where each unit's design document lives.}
79
84
 
80
- ## Adding a {primary unit}
85
+ | Path | Role | Owning doc |
86
+ | --- | --- | --- |
87
+ | [`{packages/unit}/`]({packages/unit}/) | {one line: what it is and who consumes it} | [{doc}](docs/architecture/packages/{unit}.md) |
88
+ | [`{packages/unit}/`]({packages/unit}/) | {one line} | [{doc}]({path}) |
89
+ | [`{top-folder}/`]({top-folder}/) | {one line; "generated" or "reference only" where true} | — |
81
90
 
82
- 1. {Drop the source under the right family/folder.}
83
- 2. {Re-export from the public surface.}
84
- 3. {Wire into the playground / example app / test harness so reviewers can see it render.}
85
- 4. {Document any divergence from upstream in `docs/{...}`.}
91
+ {One sentence each for the top folders that are not packages — `registry/`, `scripts/`, `docs/` — with their owning doc.} Where every doc lives: [docs/structure.md](docs/structure.md).
86
92
 
87
- ## Styling ← optional; replace with whichever cross-cutting concern matters most
93
+ ## Rules that bite
88
94
 
89
- {Configuration notes that affect every consumer — design tokens, conventions, opt-outs.}
95
+ {One sentence saying these are stated here and argued in the documents they point at.}
90
96
 
91
- ## Status
97
+ - **{Invariant}**: {the rule, one line}. → [{source}]({path})
98
+ - **{Boundary}**: `{path}` is the only {public | published} surface; everything else is internal.
99
+ - **{Never-edit paths}**: `{path}` is {generated by `{command}` | protected}; edit {the source} instead.
100
+ - **Not here:** {a non-goal stated as a refusal}.
92
101
 
93
- {Pre-publish, beta, stable, internal-only. State the stability tier per surface — which APIs are contracts and which are experimental — so readers know what can be relied on.}
102
+ ## Where to go
94
103
 
95
- ## License
104
+ | I want to… | Go to |
105
+ | --- | --- |
106
+ | Set up a machine and run it the first time | [docs/operations/setup.md](docs/operations/setup.md) |
107
+ | Work on it day to day | [docs/operations/{local-development}.md](docs/operations/{local-development}.md) |
108
+ | Understand the design | [docs/architecture/](docs/architecture/) |
109
+ | Change a feature | [docs/features/](docs/features/), found through the ownership index |
110
+ | Change a contract ({db schema · wire envelope · auth · events · env}) | [{contract doc}]({path}), boundary-checked before the change |
111
+ | Ship or release | [docs/operations/{deployment}.md](docs/operations/{deployment}.md) |
112
+ | Place a new doc | [docs/structure.md](docs/structure.md) · [docs/README.md](docs/README.md) |
113
+ | See what changed and what is open | [CHANGELOG](docs/history/CHANGELOG.md) · [backlog](docs/history/backlog.md) |
114
+ | Work here as a coding agent | [CLAUDE.md](CLAUDE.md) ([AGENTS.md](AGENTS.md) for other runtimes): load before any edit |
96
115
 
97
- {License name — scope. e.g., "UNLICENSED — internal use only", "MIT".}
116
+ ## Everyday commands
117
+
118
+ \`\`\`bash
119
+ {pm} {typecheck} # {what it checks}
120
+ {pm} {test} # {the unit suite, from a cold shell}
121
+ {pm} {gate} # {what a change must pass before it is pushed}
122
+ \`\`\`
123
+
124
+ `{pm} --filter <unit> run` lists a unit's own scripts.
125
+
126
+ {License, one line, e.g. "UNLICENSED, internal use only."} ← optional
98
127
  ```
99
128
 
100
129
  ### Baseline scaffolding behavior
101
130
 
102
- The baseline audit **does** scaffold the project root README when missing. The risk this template guards against — template-shaped placeholders that look abandoned — is mitigated by the writing rules above: fill every section with concrete details from the repo (real package manager from the lockfile, real scripts, real layout, real status). Skip sections that genuinely don't apply rather than leaving stubs.
131
+ The baseline **does** scaffold `/README.md` when it is missing, and it fills each section from the repo:
132
+
133
+ - **Identity, What it does, Where it runs:** from the product charter and vision documents under `docs/architecture/common/` (what the product is, the core loop, who it is for), the package manifests (what publishes where), and the deploy config (addresses). Written in a user's terms; where the charter is missing, the baseline writes Identity only and raises a `note:` row for the rest.
134
+ - **How it works:** from the system overview.
135
+ - **Map:** from the workspace globs and the ownership index.
136
+ - **Rules:** from `docs/operations/protected-files.md` and the architecture doctrine.
137
+ - **Commands:** from the lockfile and the root scripts.
138
+ - **Where to go:** only the rows whose targets exist.
139
+
140
+ It drops every section it cannot fill concretely.
103
141
 
104
- **Never overwrite an existing root README** during a baseline. If one is present — even sparse or outdated — leave it untouched. Treat updates to a pre-existing root README as a separate, explicit request.
142
+ **It never overwrites an existing root README.** If one is present, even sparse or outdated, the baseline leaves it untouched and raises a `note:` row proposing the reshape. Reshaping is a separate, explicit request. When it runs, each removed section moves in the same change: getting-started, install and env content and the Stack go to `docs/operations/setup.md`, a drawn tree becomes the Map (the tree itself stays in `structure.md`), and a contributing checklist goes to `docs/operations/`. Nothing is deleted without a home.