@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
@@ -1,151 +1,59 @@
1
- # Feature Documentation — the LLD (docs/features/{feature}.md)
1
+ # Feature Documentation (docs/features/{feature}.md)
2
2
 
3
- Truth document. Use for: every feature in `docs/features/`. The feature doc is the feature's **LLD (low-level design)**: the same file persists from design (Status: Draft, written in LLD Mode) through implementation to live reference (Status: Active). Sections fill in as the feature matures — no template swap. The body always describes the feature as it currently is; the journey lives in the linked plan and changelog entries.
3
+ Truth document. Use for: every feature in `docs/features/` — something a person points at: an address, a command family, a named control. One file per feature, cut by the objects it designs, never by the code's routers, tables, plans or packages. The file persists from design (`status: draft`) to live reference (`status: active`).
4
4
 
5
- **Required vs optional.** Required in every feature doc: the frontmatter, **Goal**, and **Background** — plus **Files** once implementation exists (a Draft for unbuilt code has no real paths to list) and **Current Behavior** once research or implementation exists (at Draft it's the pre-feature baseline; at Active it's how the feature works today). Every other section is optional: include it only when the feature has something real to put in it (no Redux → no Redux section; no risks worth naming → no Risks section). A **minimal form** is sanctioned for small features: frontmatter + Goal + a short how-it-works section + Files. A two-screen doc that is accurate beats a full-template doc with empty sections.
5
+ **A document is read by people, and its footer is for the agent** (`references/style-guide.md` § Documents are read by people). The body is plain English a newcomer reads top to bottom: what the thing is, why it is shaped that way, how a person meets it, what it promises. Every computable fact — columns, vocabularies, foreign keys, writers, routes, guards, codes, files — is the code graph's (`docs/architecture/systems/knowledge-layer.md`); a hand-typed copy is the defect this genre removes. The only code the body names is a cross-cutting seam the graph would not lead a reader to from the feature's own files: a middleware, a gate, a hook, a scheduler, a shared store. Everything else by plain name. Identifiers the graph cannot find from the roots live in the footer.
6
6
 
7
- The four research-derived sections (**Affected Modules**, **Conventions to Follow**, **Current Behavior**, **Ownership Conflicts**) map 1:1 to the `lld-mode` agent's return shape. The orchestrator drops its findings into those slots without restructuring.
7
+ **A feature document runs deepest toward its end** (`references/style-guide.md` § Shape — the model first, the detail after). The opening and Why it exists are the model; How it works is the journey; **What it promises** goes as deep as the behaviour does: every state the surface can be in, every edge case, what a refusal tells the person, the exact wording wherever the wording itself is promised. That depth is earned because a person or a test checks it and the code cannot state it as intent. It still stops before mechanism: a promise reads "a removed membership shows a panel, not a redirect, because nothing can restore it", never which route answers it.
8
+
9
+ **Required:** the frontmatter, the goal line, **Why it exists**, **How it works**, **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 — `doc-lint` blocks the retired mechanism sections (`mechanism-section`) and warns on identifiers in the body (`body-identifier`), on a section that is a list rather than prose (`list-not-prose`), and on three bold-led bullets in a row (`formula-run`). Forty to a hundred and twenty lines.
8
10
 
9
11
  ```yaml
10
12
  ---
11
- owns: ["src/feature/**", "src/other/file.ts"] # required — code-path globs this doc owns (the only ownership key)
12
- module: billing # optional — single bounded-context label; omit if cross-cutting
13
- keywords: [invoice, pdf] # required — discovery terms
13
+ type: feature # required tooling key — preserve, never narrate
14
14
  status: active # required — active | draft | deprecated
15
- applies: [docs/architecture/common/security.md] # optional — architecture docs this surface is BOUND by (obligation, not a bibliography); omit when none
16
- last-reviewed: YYYY-MM-DD # optional tooling key — stamped on substantive review/update; the maintenance agent ranks audit priority by it (metadata, never narrated in the body)
17
- type: feature # required tooling key — genre stamp (generator-written or authored; enum = the template names), read by tooling (UI grouping, protected-file mapping); preserve on edits, never narrate
15
+ objects: [device, credential grant] # required — the product objects this document designs, by their graph names
16
+ owns: ["packages/studio/src/server/routes/devices.ts"] # required until the graph computes ownership — the code this document speaks for; narrower glob wins
17
+ module: identity # optional — one bounded-context label
18
+ applies: [docs/architecture/common/security.md] # optional — doctrine this surface is BOUND by
18
19
  ---
19
20
  ```
20
21
 
21
- > Declare the code paths it owns in its `owns:` frontmatter — projected at Draft, confirmed against real code at Active.
22
-
23
22
  ```
24
- # {Feature Name}
25
-
26
- <!-- Lifecycle lives in the frontmatter `status:` key (active | draft | deprecated) — the single source of truth. Don't restate it in the body. -->
27
- **Plan:** [history/plans/YYYY-MM-DD-feature-name.md](../history/plans/YYYY-MM-DD-feature-name.md) <!-- added once a plan exists -->
28
-
29
- ## Goal
30
-
31
- One sentence. What this feature accomplishes, in user-facing terms.
32
-
33
- ## Goals & Non-Goals
34
-
35
- **In scope**
36
- - Bullet 1
37
- - Bullet 2
38
-
39
- **Out of scope**
40
- - Bullet 1
41
-
42
- ## Background
43
-
44
- Why this feature exists. The user need, the business trigger, the constraint that pushed it above the line. One paragraph.
45
-
46
- (For Product-level work, also include: problem statement, key hypotheses, open questions.)
47
-
48
- ## Approach
49
-
50
- High-level shape of the solution. ASCII diagram if it helps. Implementation specifics belong in the plan.
51
-
52
- ## Affected Modules
53
-
54
- (From lld-mode research) Files, routes, components, slices this feature involves. Group by module.
55
-
56
- | Module | Path | Role in this feature |
57
- |--------|------|----------------------|
23
+ # {Feature name}
58
24
 
59
- ## Conventions to Follow
25
+ {One sentence: what this lets a person do.}
60
26
 
61
- (From lld-mode research) Naming patterns, structural patterns, doc-fit heuristics confirmed for the area being touched. Cite the source file(s) where the convention is established.
27
+ ## Why it exists
62
28
 
63
- ## Current Behavior
29
+ {The need, the trigger, the constraint; what it is deliberately not for and why. Prose, one or two paragraphs. An AD is cited by number for the reasoning it holds, never restated.}
64
30
 
65
- (From lld-mode research) How the relevant part of the system works *today*, before this feature lands. Without this baseline the design intent is hard to evaluate.
31
+ ## How it works
66
32
 
67
- ## Ownership Conflicts
33
+ {The feature as a person meets it, start to finish, present tense, plain words: what they see, what happens, what refuses them and what they are told. Introduce each term of art the first time. Name code only at a cross-cutting seam — "every request passes the organization gate before this page is reached (`requireAuth`)" — and nothing else. No columns, routes, guards, functions, files or diagrams: that is the graph's.}
68
34
 
69
- (From lld-mode research) Existing feature docs whose `owns:` globs overlap with the projected scope. Resolve before the plan starts — leave nothing unresolved.
35
+ ## What was decided
70
36
 
71
- | Conflicting doc | Overlapping path(s) | Resolution |
72
- |-----------------|---------------------|------------|
37
+ {The choices the code cannot explain, as two to four themed paragraphs. A rejected alternative is named only where a reader would reach for it. No formula; no bullet per decision.}
73
38
 
74
- ## Architecture
39
+ ## What it promises
75
40
 
76
- [ASCII diagram. Fill once implementation lands. See style-guide.md for box-drawing patterns.]
41
+ {The guarantees and refusals a person or a test can check, grouped by theme, as short paragraphs — or a short list only where the items are genuinely parallel one-liners. Positive where possible. This is the deepest section: each state, edge case and refusal the person can meet, and the wording where it is promised. A table of states is right when the states are genuinely parallel.}
77
42
 
78
- ## Key Functions
43
+ ## Known gaps
79
44
 
80
- ### `functionName(param1, param2)`
81
- **Goal:** What it accomplishes
82
- **Input:**
83
- - `param1` (type) - Description
84
- - `param2` (type) - Description
85
- **Output:** Return type and shape
86
- **Side Effects:** DB writes, API calls, state updates
45
+ {One paragraph, only when the code does not keep something the document would otherwise promise. What is missing and what it would take; the backlog row carries the rest.}
87
46
 
88
- ### `hookName(config)`
89
- **Goal:** What it provides
90
- **Returns:** `{ data, loading, error }`
91
- **Triggers:** On mount, on change, manual
47
+ ## For the agent
92
48
 
93
- ## State
94
-
95
- **Frontend (at persistence):**
96
- {
97
- "data": [],
98
- "changes": { "added": [], "updated": [], "removed": [] }
99
- // "cache": {} // UNUSED: dead key; kept so old persisted state rehydrates
100
- }
101
-
102
- **Storage:** localStorage `app_state`
103
-
104
- **Backend:**
105
- export const resources = pgTable('resources', {
106
- id: text('id').primaryKey(),
107
- data: jsonb('data'),
108
- // oldField: text('old_field'), // UNUSED: dead column; nothing reads it
109
- });
110
-
111
- **API Shape:**
112
- { "status": 1, "data": {...} }
113
-
114
- ## Redux (if applicable)
115
-
116
- **Slice:** `sliceName`
117
-
118
- **Actions:**
119
- - `setData(payload)` - Replace all data
120
- - `upsertItem(item)` - Add or update single item
121
-
122
- **Selectors:**
123
- - `selectAll(state)` → `Array<Item>`
124
- - `selectById(state, id)` → `Item | undefined`
125
-
126
- ## Files
127
-
128
- - `src/path/to/main.js` - Core logic
129
- - `src/path/to/hooks.js` - React hooks
130
-
131
- ## Open Questions
132
-
133
- - Question — who decides, by when
134
- - (Resolved questions: fold the resolution into Background.)
135
-
136
- ## Risks
137
-
138
- - Risk — likelihood / impact / mitigation
49
+ Objects: {object} — {one plain-words line}; {object} — {…}. Pages {`/…`}. Code roots {`packages/…/src/…/`} — directories, where the graph should start. Seams {`name`} only where the roots would not lead to them. Checklist `tests/{feature}.md`. See also {neighbour} ({why}), {neighbour} ({why}). No tables, routes or symbol rosters — those are the graph's.
139
50
  ```
140
51
 
141
- ### Section evolution
142
-
143
- Sections fill in across the feature's lifecycle. No template swap — they accumulate in place.
52
+ ### Lifecycle
144
53
 
145
- | When | Sections written | Source |
146
- | --- | --- | --- |
147
- | Status: Draft (design) | Goal, Goals & Non-Goals, Background, Approach, Open Questions, Risks | User interview |
148
- | Status: Draft (research) | Affected Modules, Conventions to Follow, Current Behavior, Ownership Conflicts | lld-mode agent |
149
- | Status: Draft → Active (implementation lands) | Architecture, Key Functions, State, Redux, Files; `owns:` globs confirmed against real code | Main agent (from actual code) |
54
+ | When | What is written |
55
+ | --- | --- |
56
+ | `status: draft` (design) | goal, Why it exists, What was decided, What it promises (with gaps named), For the agent; the LLD research goes to the plan |
57
+ | `status: active` | How it works written from the shipped surface; `owns:` confirmed against real code |
150
58
 
151
- Resolved Open Questions can be summarized into Background; unresolved ones stay visible.
59
+ A feature whose code is gone is deleted, or `status: deprecated` with its footer pointing at what replaced it.
@@ -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.