@nurix/etna 0.19.64 → 0.19.66

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 (63) hide show
  1. package/bin/etna.js +155 -557
  2. package/data/harness-index.json +1 -1
  3. package/data/harnesses/apollo/CLAUDE.md +1 -1
  4. package/data/harnesses/apollo/agents/maintenance.md +1 -0
  5. package/data/harnesses/apollo/harness.json +2 -2
  6. package/data/harnesses/apollo/hooks/approved-packages.md +2 -0
  7. package/data/harnesses/apollo/rules/changelog.md +2 -0
  8. package/data/harnesses/apollo/skills/documentation/SKILL.md +1 -0
  9. package/data/harnesses/apollo/skills/documentation/references/frontmatter.md +1 -1
  10. package/data/harnesses/apollo/skills/documentation/references/style-guide.md +34 -1
  11. package/data/harnesses/apollo/skills/documentation/scripts/doc-lint.mjs +1 -1
  12. package/data/harnesses/apollo/skills/documentation/templates/Readme.md +1 -0
  13. package/data/harnesses/apollo/skills/documentation/templates/behavioral-checklist.md +2 -0
  14. package/data/harnesses/apollo/skills/documentation/templates/changelog-entry.md +2 -2
  15. package/data/harnesses/apollo/skills/documentation/templates/feature.md +1 -0
  16. package/data/harnesses/apollo/skills/documentation/templates/implementation-map.md +42 -0
  17. package/data/harnesses/apollo/skills/testing/SKILL.md +5 -5
  18. package/data/harnesses/code/CLAUDE.md +1 -1
  19. package/data/harnesses/code/agents/maintenance.md +1 -0
  20. package/data/harnesses/code/harness.json +2 -2
  21. package/data/harnesses/code/hooks/approved-packages.md +2 -0
  22. package/data/harnesses/code/hooks/check-completion-integrity.mjs +8 -0
  23. package/data/harnesses/code/hooks/compliance.mjs +138 -27
  24. package/data/harnesses/code/hooks/lib/ledger.mjs +31 -0
  25. package/data/harnesses/code/hooks/lib/session-log.mjs +75 -0
  26. package/data/harnesses/code/rules/changelog.md +2 -0
  27. package/data/harnesses/code/skills/documentation/SKILL.md +1 -0
  28. package/data/harnesses/code/skills/documentation/references/frontmatter.md +1 -1
  29. package/data/harnesses/code/skills/documentation/references/style-guide.md +34 -1
  30. package/data/harnesses/code/skills/documentation/scripts/doc-lint.mjs +1 -1
  31. package/data/harnesses/code/skills/documentation/templates/Readme.md +1 -0
  32. package/data/harnesses/code/skills/documentation/templates/behavioral-checklist.md +2 -0
  33. package/data/harnesses/code/skills/documentation/templates/changelog-entry.md +2 -2
  34. package/data/harnesses/code/skills/documentation/templates/feature.md +1 -0
  35. package/data/harnesses/code/skills/documentation/templates/implementation-map.md +42 -0
  36. package/data/harnesses/code/skills/testing/SKILL.md +5 -5
  37. package/data/harnesses/delivery/agents/maintenance.md +1 -0
  38. package/data/harnesses/delivery/harness.json +2 -2
  39. package/data/harnesses/delivery/rules/changelog.md +2 -0
  40. package/data/harnesses/delivery/skills/documentation/SKILL.md +1 -0
  41. package/data/harnesses/delivery/skills/documentation/references/frontmatter.md +1 -1
  42. package/data/harnesses/delivery/skills/documentation/references/style-guide.md +34 -1
  43. package/data/harnesses/delivery/skills/documentation/scripts/doc-lint.mjs +1 -1
  44. package/data/harnesses/delivery/skills/documentation/templates/Readme.md +1 -0
  45. package/data/harnesses/delivery/skills/documentation/templates/behavioral-checklist.md +2 -0
  46. package/data/harnesses/delivery/skills/documentation/templates/changelog-entry.md +2 -2
  47. package/data/harnesses/delivery/skills/documentation/templates/feature.md +1 -0
  48. package/data/harnesses/delivery/skills/documentation/templates/implementation-map.md +42 -0
  49. package/data/harnesses/etna/agents/maintenance.md +1 -0
  50. package/data/harnesses/etna/harness.json +2 -2
  51. package/data/harnesses/etna/rules/changelog.md +2 -0
  52. package/data/harnesses/etna/skills/documentation/SKILL.md +1 -0
  53. package/data/harnesses/etna/skills/documentation/references/frontmatter.md +1 -1
  54. package/data/harnesses/etna/skills/documentation/references/style-guide.md +34 -1
  55. package/data/harnesses/etna/skills/documentation/scripts/doc-lint.mjs +1 -1
  56. package/data/harnesses/etna/skills/documentation/templates/Readme.md +1 -0
  57. package/data/harnesses/etna/skills/documentation/templates/behavioral-checklist.md +2 -0
  58. package/data/harnesses/etna/skills/documentation/templates/changelog-entry.md +2 -2
  59. package/data/harnesses/etna/skills/documentation/templates/feature.md +1 -0
  60. package/data/harnesses/etna/skills/documentation/templates/implementation-map.md +42 -0
  61. package/lib/install/materialize.mjs +402 -0
  62. package/lib/install/plan.mjs +271 -0
  63. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  {
2
- "fingerprint": "6b7cd94d8ed9",
2
+ "fingerprint": "774efa3ae2da",
3
3
  "harnesses": {
4
4
  "apollo": {
5
5
  "plugin": "apollo",
@@ -52,7 +52,7 @@ These four mechanisms work in tandem to keep the repo self-updating and to preve
52
52
 
53
53
  ### Ownership — route before editing
54
54
 
55
- Which doc is canonical for which code paths is the **feature doc's own frontmatter**. A feature doc (flat in `docs/features/`) carries `owns:` (code-path globs — the only ownership key), `module:` (a bounded-context label, omitted when cross-cutting), `keywords:` (discovery), and `status:`. Code → doc ownership is the union of every feature doc's `owns:` globs, surfaced as the generated ownership index at session start. A module is tied to code by the `owns:` globs of the docs carrying its `module:` label — not a folder, not a separate map. Architecture docs describe cross-cutting patterns and own no files; operations docs describe procedures.
55
+ Which doc is canonical for which code paths is the **feature doc's own frontmatter**. A feature doc (flat in `docs/features/`) carries `owns:` (code-path globs — the only ownership key), `module:` (a bounded-context label, omitted when cross-cutting), `keywords:` (discovery), and `status:`. Code → doc ownership is the union of every feature doc's `owns:` globs, surfaced as the generated ownership index at session start. A module is tied to code by the `owns:` globs of the docs carrying its `module:` label — not a folder, not a separate map. Architecture docs describe cross-cutting patterns and own no files; operations docs describe procedures. Every doc carries `type:` — its genre, stamped by document generators or at authoring, read by tooling (UI grouping, protected-file mapping); the `maintenance` agent stamps it where missing. Like `last-reviewed:`, it is tooling metadata: preserve it on edits, never inject or narrate it.
56
56
 
57
57
  Before modifying code in an unfamiliar area:
58
58
 
@@ -62,6 +62,7 @@ For each `owns:` glob across the feature docs:
62
62
 
63
63
  - Verify the glob matches existing files. Report globs matching nothing, deleted paths, and orphaned docs.
64
64
  - Flag **equal-specificity overlaps** — two feature docs whose `owns:` globs claim the same paths at the same specificity (an ambiguous owner). Surface as a question.
65
+ - **Stamp `type:` where missing.** Every doc carries a `type:` genre key (enum = the `documentation` skill's template names); docs predating the key are stamped mechanically — the genre is readable from placement and shape (a `docs/features/` doc is `type: feature`, an AD is `type: architecture-decision`, and so on). Stamping is remediation, not a question; an ambiguous genre is backlogged instead.
65
66
 
66
67
  For each code symbol or path a doc explicitly **names** (function/export/route/type):
67
68
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "harness": "apollo",
3
3
  "name": "apollo",
4
- "version": "1.2.1",
4
+ "version": "1.2.3",
5
5
  "files": [
6
6
  ".prettierignore",
7
7
  ".prettierrc.json",
@@ -15,5 +15,5 @@
15
15
  "docs/memory/main.md",
16
16
  ".mcp.json"
17
17
  ],
18
- "digest": "d01be54a3e94"
18
+ "digest": "4e61a01693cb"
19
19
  }
@@ -39,4 +39,6 @@ Read by the PreToolUse install gate (`compliance.mjs`) — an off-table install
39
39
  | `fast-deep-equal` | ^3.1.3 | Deep equality checks | `lodash.isEqual` |
40
40
  | `@ngneat/falso` | latest | Fake data generation | `@faker-js/faker`, `chance` |
41
41
  | `pino` | ^10.1.0 | Logging | `winston` |
42
+ | `wrangler` | ^4.118.0 | Cloudflare Workers CLI — dev server, deploy | `@cloudflare/wrangler` (deprecated), `miniflare` standalone |
43
+ | `mermaid` | ^11.16.0 | Diagram rendering in the browser | `mermaid` via CDN, `viz.js`, `flowchart.js` |
42
44
 
@@ -12,6 +12,8 @@ Every unit of work leaves one record — `docs/history/changelog/YYYY-MM-DD-{thr
12
12
 
13
13
  An entry is owed only by work that changes promised behavior or takes a design decision; mechanical and cosmetic commits — a typo, a copy tweak, a config value, a log line — take only their `docs/history/CHANGELOG.md` row, no entry file. The failure fields (`Ask:`, `Skills:`, `Pin:`) are required only when non-none.
14
14
 
15
+ Route the lesson by who pays for losing it: product context — what changed and why — belongs in the entry; anything the **next session would re-pay** — a library's API drifted from what the model expects, a validator's quirk, a tooling workaround — goes to `docs/memory/main.md` as well, because a changelog is read by people tracing history and memory is read by every session before it repeats the mistake.
16
+
15
17
  ## Lifecycle
16
18
 
17
19
  Draft (created before its commit exists) → complete (missing fields filled from the diff and the session) → frozen the moment it rides in a commit. **Immutability begins at commit, not at creation** — a draft is meant to be edited, which is what lets a completed plan record its context before anything is committed; a committed entry is history, and a correction is a new entry linking back, **never** an edit.
@@ -73,6 +73,7 @@ The two guarantees are complementary and both break on mixing: a reader holding
73
73
  | Testing strategy | [`templates/testing-strategy.md`](templates/testing-strategy.md) |
74
74
  | Behavioral checklist for one feature (`docs/tests/{feature}.md`) | [`templates/behavioral-checklist.md`](templates/behavioral-checklist.md) — the verification gate's driving script, and the source its suite tests are drawn from |
75
75
  | Recurring procedure/setup | [`templates/operations-procedure.md`](templates/operations-procedure.md) |
76
+ | Cold-start build order (implementation map) | [`templates/implementation-map.md`](templates/implementation-map.md) — authored by the executing session at build start, updated in place as waves complete |
76
77
  | Capture mid-execution knowledge (`docs/history/journal.md`) | [`templates/journal.md`](templates/journal.md) (record — append-only; a row resolves by landing in its owning doc) |
77
78
  | Bookkeeping work queue (`docs/operations/bookkeeping.md`) | [`templates/bookkeeping.md`](templates/bookkeeping.md) — machine-read row grammar; appended by hooks and sessions, drained by the `bookkeeper` agent, walled at Stop and commit |
78
79
  | One-shot migration/upgrade | [`templates/migration-runbook.md`](templates/migration-runbook.md) (record) |
@@ -12,7 +12,7 @@ When creating or updating a feature doc, derive its **`owns:` frontmatter** —
12
12
 
13
13
  ## How to derive the frontmatter
14
14
 
15
- A feature doc's ownership frontmatter is `owns:` (required), `module:` (optional), `keywords:` (required), and `status:` (required). An optional `last-reviewed:` date (stamped whenever the doc is substantively reviewed or updated) gives the `maintenance` agent a staleness signal to rank its audits by — it is tooling metadata, never narrated in the body.
15
+ A feature doc's ownership frontmatter is `owns:` (required), `module:` (optional), `keywords:` (required), and `status:` (required). An optional `last-reviewed:` date (stamped whenever the doc is substantively reviewed or updated) gives the `maintenance` agent a staleness signal to rank its audits by — it is tooling metadata, never narrated in the body. `type:` (required — the genre, enum = the template names) and `rev:` (generator-written generation stamp) are the same class: external tooling reads them, sessions **preserve them on edits** and never narrate or inject them. The `maintenance` agent stamps `type:` on docs that predate the key.
16
16
 
17
17
  **1. `owns:`** (the path scope)
18
18
 
@@ -154,6 +154,39 @@ For screen layouts (not data flows), use these conventions:
154
154
 
155
155
  ---
156
156
 
157
+ ## Mermaid Diagrams
158
+
159
+ **Structure at rest is ASCII; behaviour over time is mermaid.** A file tree, an on-disk layout, a load-class split, a wireframe — draw with box characters, because the diagram *is* the thing's shape. A sequence of turns, a state machine, a branching flow — write mermaid, because a renderer tracks the arrows better than a reader tracks them across box art, and the source stays diffable when a step is inserted.
160
+
161
+ **Docs only**, on the same reasoning as ASCII: a diagram never enters an instruction file.
162
+
163
+ ### When to Use
164
+
165
+ | Diagram | Use for |
166
+ | --- | --- |
167
+ | `sequenceDiagram` | Who calls whom in what order — a session turn, a hand-off between components |
168
+ | `stateDiagram-v2` | Modes with transitions — a workflow, a record's lifecycle |
169
+ | `flowchart` | A process with branches, gates, or fan-out |
170
+ | `timeline` | A dated lineage, in records only — never in a truth document |
171
+
172
+ ### Rules
173
+
174
+ - **At most 7 participants and 15 interactions** per diagram. Past that, split it — an unreadable diagram is worse than the prose it replaced.
175
+ - **Labels under 8 words**, no trailing punctuation.
176
+ - **Declare a direction** on every flowchart (`flowchart TD` / `LR`) so the render is stable.
177
+ - **The diagram never carries a fact the prose omits.** It restates structure for a reader who scans; a reader who greps must still find everything in the text.
178
+ - **No styling directives** — no `style`, no `classDef`, no theme overrides. Rendering is the reader's; the source stays portable across GitHub, Obsidian, and a plain editor.
179
+
180
+ ```
181
+ flowchart LR
182
+ A[Plan approved] --> B{boundary}
183
+ B -->|BLOCK| C[Re-plan]
184
+ B -->|PASS| D[testing plan-gate]
185
+ D --> E[Implement]
186
+ ```
187
+
188
+ ---
189
+
157
190
  ## Code Examples
158
191
 
159
192
  ### Rules
@@ -344,7 +377,7 @@ Always end with:
344
377
  | Parameters | Type + purpose |
345
378
  | Returns | Type + shape |
346
379
  | State | Persistence points only |
347
- | Diagrams | ASCII for all flows — docs only, never instruction files |
380
+ | Diagrams | ASCII for structure at rest, mermaid for behaviour over time — docs only, never instruction files |
348
381
  | Code | Under 15 lines, contracts only |
349
382
  | Voice | Imperative/active |
350
383
  | Mechanics | Inline-code identifiers; bold-assertion bullets |
@@ -89,7 +89,7 @@ function lintFile(path, findings) {
89
89
  const isFolderIndex = /(^|\/)(readme)\.md$/i.test(path);
90
90
  if (scope === 'truth' && !isFolderIndex && /(^|\/)docs\/features\/[^/]+\.md$/.test(path)) {
91
91
  const fm = text.startsWith('---') ? text.slice(0, text.indexOf('\n---', 3)) : '';
92
- for (const key of ['owns:', 'keywords:', 'status:'])
92
+ for (const key of ['owns:', 'keywords:', 'status:', 'type:'])
93
93
  if (!fm.includes(key)) findings.push({ path, n: 1, severity: 'block', id: 'feature-frontmatter', message: `feature doc missing \`${key}\` frontmatter` });
94
94
  }
95
95
  }
@@ -16,6 +16,7 @@ One file per template. Every template is either a **truth document** (states cur
16
16
  | Testing strategy | [testing-strategy.md](testing-strategy.md) | Truth |
17
17
  | Behavioral checklist | [behavioral-checklist.md](behavioral-checklist.md) | Truth |
18
18
  | Operations procedure | [operations-procedure.md](operations-procedure.md) | Truth |
19
+ | Implementation map | [implementation-map.md](implementation-map.md) | Truth |
19
20
  | Bookkeeping ledger | [bookkeeping.md](bookkeeping.md) | Truth (work queue) |
20
21
  | Protected files | [protected-files.md](protected-files.md) | Truth |
21
22
  | Project root README | [root-readme.md](root-readme.md) | Truth |
@@ -16,6 +16,7 @@ Required: **Conventions**, at least one numbered behavior section, **Failure Rep
16
16
  - **Prefer exact literals** — the real prompt text, the real button label, the real count. A vague assertion passes a broken product.
17
17
  - **Assert persistence separately from display.** "It appeared on screen" and "it was written" are two claims; a surface that streams unsaved content satisfies the first while failing the second.
18
18
  - **State each section's trace.** `Pinned:` names the suite test that now guards it, or says `driven only` **with the reason** — an unmarked section is indistinguishable from an unexamined one.
19
+ - **State each section's `AC:` keys.** Where the repo carries a keyed acceptance-criteria source, each section names the keys it proves, so the chain from criterion to checklist to suite test survives the last hop; the gate reports coverage and backlogs uncovered keys. `none — not AC-mapped` is the honest line where no keyed source exists.
19
20
  - **A known-failing assertion stays written as the contract.** A checklist states what the feature promises; the *run* records the failure and the backlog carries the defect. Never soften an assertion to make a run go green.
20
21
 
21
22
  ```
@@ -44,6 +45,7 @@ Each step is an action; each **Assert** is the observable it must produce.
44
45
  - [ ] **Assert**: {the persistence claim, where the behavior writes something}
45
46
 
46
47
  > Pinned: `{tests/path/to/file.test.ts}` — or `driven only — {why no durable test is bought}`
48
+ > AC: {the acceptance-criteria keys this section proves} — or `none — not AC-mapped`
47
49
 
48
50
  ### 2. {The next behavior}
49
51
 
@@ -16,7 +16,7 @@ An entry is not a summary line. Its value concentrates in the fields a diff cann
16
16
  - **Iterations:** {N} · rejected: {what was rejected and why} | none
17
17
  - **Skills:** {skill}@{version} — survived | partially survived | overridden ({why, briefly}) | none used
18
18
  - **Change:** {added/changed X, which does Y, because Z — behavior first, mechanism second. Plan-linked entries also carry the verification gate's results here: rows discharged, suite outcome, anything blocked}
19
- - **Discovered:** {non-obvious fact learned by running the product — environment quirk, platform ceiling, seam behavior, dependency constraint} | none
19
+ - **Discovered:** {non-obvious fact learned by running the product — environment quirk, platform ceiling, seam behavior, dependency constraint} [source: {tag}] | none
20
20
  - **Class:** {one or more keywords — suggestive vocabulary, not a closed enum; see Field rules}
21
21
  - **Pin:** {enforced artifact written in this entry's commit: test / token / guardrail / schema} | none — candidate: {what should hold it}
22
22
  ```
@@ -39,7 +39,7 @@ An entry is not a summary line. Its value concentrates in the fields a diff cann
39
39
  - **`surface`** uses the repo's ownership vocabulary — the owning feature doc's topic or an `owns:` path stem — so entries are queryable per surface.
40
40
  - **`Ask` quotes taste verbatim.** The user's preference wording is the one thing no skill can infer and no rebuild recovers; the entry is its durable home.
41
41
  - **`Skills` records efficacy honestly** — survived / partially survived / overridden with a reason. These verdicts are the raw data the `retro` agent aggregates into skill-evolution findings; sanitizing them into success stories destroys the mechanism's value.
42
- - **`Discovered` holds what only running the product teaches.** If it was learned in use, it is recorded the same day — this field feeds the pin candidates.
42
+ - **`Discovered` holds what only running the product teaches.** If it was learned in use, it is recorded the same day — this field feeds the pin candidates. **Each finding carries a `source:` tag from a closed list** — `generator` (a generated doc was wrong) · `generator-conflict` (two generated docs disagreed) · `rules-conflict` (a generated doc contradicted standing rules) · `runtime-discovery` (only running revealed it) · `environment` (tooling or harness). Closed deliberately, unlike `Class:` — the consumer is the doc generator's readback grep, not a human. A finding in a repo with no generated docs is almost always `runtime-discovery` or `environment`.
43
43
  - **`Class` is a suggestive vocabulary, not a closed enum.** Tag with one or more keywords, preferring an existing term over a synonym so the `retro` agent can cluster; coin a new one when nothing fits — a recurring coinage is itself retro signal that the vocabulary (or the doc set) is missing a category. Suggested keywords: `ux` · `ui` · `visual` · `taste` · `layout` · `motion` · `interaction` · `copy` · `a11y` · `responsiveness` · `navigation` · `state` · `structure` · `architecture` · `seam` · `contract` · `schema` · `data` · `content` · `seed` · `performance` · `caching` · `resilience` · `error-handling` · `security` · `auth` · `observability` · `logging` · `testing` · `tooling` · `dependency` · `ops` · `deploy` · `env` · `ci` · `i18n` · `docs`.
44
44
  - **`Pin` closes the loop:** the enforced artifact written in this commit, or the named candidate for the `retro` agent to flag. A taste-verified behavior with `Pin: none` and no candidate is a template smell.
45
45
  - **Out-of-session entries** (the writing session did not do the work): fill what the diff and conversation evidence support; mark the rest `unknown — committed out-of-session`.
@@ -13,6 +13,7 @@ module: billing # optional — single bounded-c
13
13
  keywords: [invoice, pdf] # required — discovery terms
14
14
  status: active # required — active | draft | deprecated
15
15
  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)
16
+ 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
16
17
  ---
17
18
  ```
18
19
 
@@ -0,0 +1,42 @@
1
+ # Implementation Map (docs/operations/implementation-map.md)
2
+
3
+ Truth document. Use for: **the cold-start execution contract of a project being built from its documented design** — one per repo, at `docs/operations/implementation-map.md`. It is authored by the **executing session at build start**, never generated at design time: build order is derived from the repo's actual feature docs and their stated dependencies, and a design-time prediction of it goes stale the day reality disagrees. It lives in operations because it says *how to proceed*, not *what is true of the design*.
4
+
5
+ ## Writing the map
6
+
7
+ - **Derive waves from the feature docs** — their stated dependencies plus shared foundations (schema before routes, auth before anything it guards). A wave groups features that can build together; the order reflects foundations, not product importance.
8
+ - **A wave's done criterion is observable** — its plans' verification gates passed, the suite green, a named surface driveable. Never "feels complete".
9
+ - **Authority order names this repo's own docs, most specific wins.** A contradiction between documents is repaired in the owning truth doc *before* code — never reinterpreted while planning.
10
+ - **Plans are records, not an execution queue.** The map points at the active wave's dated plan; historical plans are read only when a truth doc cites them as provenance.
11
+ - **Update in place as waves complete** — the map states the current build position in present tense; the journey lives in the plans and changelog entries.
12
+
13
+ ```
14
+ # {Project} implementation map
15
+
16
+ ## Cold-start contract
17
+
18
+ {One paragraph: what a fresh session asked to "build this" is expected to do with this
19
+ repository — plan, gate, implement, verify, in what granularity — and the statement that it
20
+ needs nothing outside the repo.}
21
+
22
+ ## Authority order
23
+
24
+ When documents disagree:
25
+
26
+ 1. {The constitutional docs — guardrails, non-goals, PRD-class documents}
27
+ 2. The most specific feature doc under `docs/features/`
28
+ 3. {The structural truth docs — domain model, storage schema, API contracts}
29
+ 4. The dated plan for the active wave
30
+ 5. Owned source files as implementation evidence
31
+
32
+ ## Waves
33
+
34
+ | Wave | Features | Depends on | Done when |
35
+ | - | - | - | - |
36
+ | 1 | {docs/features/x.md, docs/features/y.md} | — | {observable criterion} |
37
+ | 2 | {…} | 1 | {…} |
38
+
39
+ ## Current position
40
+
41
+ {One line per wave: complete · in progress ([plan](../history/plans/YYYY-MM-DD-slug.md)) · pending.}
42
+ ```
@@ -47,14 +47,14 @@ Assign each behavior the **cheapest layer that can prove it**, then name the ora
47
47
  ```
48
48
  ## Test Obligations
49
49
 
50
- | # | Behavior (LLD promise) | Layer | Target file | Oracle | Fixtures / faults |
51
- | - | ---------------------- | ----- | ----------- | ------ | ----------------- |
50
+ | # | Behavior (LLD promise) | Layer | Target file | Oracle | Fixtures / faults | Outcome |
51
+ | - | ---------------------- | ----- | ----------- | ------ | ----------------- | ------- |
52
52
 
53
53
  Coverage: {N} behaviors · {N} integration · {N} component · {N} unit · {N} e2e ({N} extend, {N} new)
54
54
  Completion checklist: docs/tests/{feature}.md (derived at the gate, not now)
55
55
  ```
56
56
 
57
- A behavior with no obligation is stated too, with the reason — "none — compiler-guarded" reads as *checked*; an empty cell reads as *not analyzed*. A short manifest is valid — do not pad.
57
+ A behavior with no obligation is stated too, with the reason — "none — compiler-guarded" reads as *checked*; an empty cell reads as *not analyzed*. A short manifest is valid — do not pad. **`Outcome` is written empty here — it is gate mode's cell**, and the completion walls read it: a plan cannot reach `Status: Complete` while any row's Outcome is empty.
58
58
  6. **Record the write in the plan's `Gates:` line**, rewriting only your segment to exactly `Test-plan: written YYYY-MM-DD (N rows)` — the compliance hook greps this exact form. Add the line if the plan predates the format.
59
59
 
60
60
  ---
@@ -162,5 +162,5 @@ Runs only when the user triggers the verification gate (constraints — precondi
162
162
 
163
163
  A driven check is evidence, not an artifact — it proves the change works today and leaves nothing behind; that is why this rung exists.
164
164
  4. **Run the affected suite**, plus the project's e2e smoke gate where one is wired.
165
- 5. **Discharge every ledger row into exactly one outcome**: **satisfied** (test green, or driven check passed), **owes nothing** (with the reason — compiler-guarded, covered elsewhere), or **blocked** (missing infrastructure named, row converted to a backlog item). A row left unexamined blocks the gate.
166
- 6. **Report results honestly, including failures**; record which test now guards each checklist section (`Pinned:` traces). Completion steps — freezing the plan, the changelog entry — are the root policy file's, not yours.
165
+ 5. **Discharge every ledger row into exactly one outcome**: **satisfied** (test green, or driven check passed), **owes nothing** (with the reason — compiler-guarded, covered elsewhere), or **blocked** (missing infrastructure named, row converted to a backlog item). **Open by re-reading the ledger from the plan file on disk, never from conversation memory** — a context-held copy is how rows get missed. **Write each row's outcome into its `Outcome` cell in the plan file** — exactly `satisfied`, `owes nothing — {reason}`, or `blocked → backlog` — because the Stop wall and CI read that cell, and a row left unexamined blocks completion.
166
+ 6. **Report results honestly, including failures**; record which test now guards each checklist section (`Pinned:` traces) and each section's `AC:` line where the repo carries a keyed acceptance-criteria source, closing with the coverage count — `AC coverage: {n}/{m}; uncovered: {keys} → backlog`. Completion steps — freezing the plan, the changelog entry — are the root policy file's, not yours.
@@ -50,7 +50,7 @@ These four mechanisms work in tandem to keep the repo self-updating and to preve
50
50
 
51
51
  ### Ownership — route before editing
52
52
 
53
- Which doc is canonical for which code paths is the **feature doc's own frontmatter**. A feature doc (flat in `docs/features/`) carries `owns:` (code-path globs — the only ownership key), `module:` (a bounded-context label, omitted when cross-cutting), `keywords:` (discovery), and `status:`. Code → doc ownership is the union of every feature doc's `owns:` globs, surfaced as the generated ownership index at session start. A module is tied to code by the `owns:` globs of the docs carrying its `module:` label — not a folder, not a separate map. Architecture docs describe cross-cutting patterns and own no files; operations docs describe procedures.
53
+ Which doc is canonical for which code paths is the **feature doc's own frontmatter**. A feature doc (flat in `docs/features/`) carries `owns:` (code-path globs — the only ownership key), `module:` (a bounded-context label, omitted when cross-cutting), `keywords:` (discovery), and `status:`. Code → doc ownership is the union of every feature doc's `owns:` globs, surfaced as the generated ownership index at session start. A module is tied to code by the `owns:` globs of the docs carrying its `module:` label — not a folder, not a separate map. Architecture docs describe cross-cutting patterns and own no files; operations docs describe procedures. Every doc carries `type:` — its genre, stamped by document generators or at authoring, read by tooling (UI grouping, protected-file mapping); the `maintenance` agent stamps it where missing. Like `last-reviewed:`, it is tooling metadata: preserve it on edits, never inject or narrate it.
54
54
 
55
55
  Before modifying code in an unfamiliar area:
56
56
 
@@ -62,6 +62,7 @@ For each `owns:` glob across the feature docs:
62
62
 
63
63
  - Verify the glob matches existing files. Report globs matching nothing, deleted paths, and orphaned docs.
64
64
  - Flag **equal-specificity overlaps** — two feature docs whose `owns:` globs claim the same paths at the same specificity (an ambiguous owner). Surface as a question.
65
+ - **Stamp `type:` where missing.** Every doc carries a `type:` genre key (enum = the `documentation` skill's template names); docs predating the key are stamped mechanically — the genre is readable from placement and shape (a `docs/features/` doc is `type: feature`, an AD is `type: architecture-decision`, and so on). Stamping is remediation, not a question; an ambiguous genre is backlogged instead.
65
66
 
66
67
  For each code symbol or path a doc explicitly **names** (function/export/route/type):
67
68
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "harness": "code",
3
3
  "name": "code",
4
- "version": "3.7.1",
4
+ "version": "3.7.3",
5
5
  "files": [
6
6
  ".prettierignore",
7
7
  ".prettierrc.json",
@@ -10,5 +10,5 @@
10
10
  "seeds": [
11
11
  ".mcp.json"
12
12
  ],
13
- "digest": "b7f0d55f9ba4"
13
+ "digest": "5e3c8dcf55ff"
14
14
  }
@@ -39,4 +39,6 @@ Read by the PreToolUse install gate (`compliance.mjs`) — an off-table install
39
39
  | `fast-deep-equal` | ^3.1.3 | Deep equality checks | `lodash.isEqual` |
40
40
  | `@ngneat/falso` | latest | Fake data generation | `@faker-js/faker`, `chance` |
41
41
  | `pino` | ^10.1.0 | Logging | `winston` |
42
+ | `wrangler` | ^4.118.0 | Cloudflare Workers CLI — dev server, deploy | `@cloudflare/wrangler` (deprecated), `miniflare` standalone |
43
+ | `mermaid` | ^11.16.0 | Diagram rendering in the browser | `mermaid` via CDN, `viz.js`, `flowchart.js` |
42
44
 
@@ -7,6 +7,7 @@
7
7
  import fs from "node:fs";
8
8
  import path from "node:path";
9
9
  import { frontmatter, field } from "./lib/ownership.mjs";
10
+ import { undischargedRows } from "./lib/ledger.mjs";
10
11
 
11
12
  const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
12
13
  const plansDir = path.join(projectDir, "docs", "history", "plans");
@@ -41,6 +42,13 @@ for (const file of plans) {
41
42
  const unchecked = (text.match(/^- \[ \]/gm) || []).length;
42
43
  if (unchecked > 0) fail(`${file} is Complete with ${unchecked} unchecked Done Criteria box(es)`);
43
44
 
45
+ // The ledger is discharged per row, in the file — a Done Criteria checkbox asserting "every
46
+ // row discharged" is exactly the checkbox-nothing-reads failure the doc ledger existed to fix.
47
+ const rows = undischargedRows(text);
48
+ if (rows.length > 0) {
49
+ fail(`${file} is Complete with ${rows.length} Test Obligations row(s) missing a discharge outcome (#${rows.join(", #")})`);
50
+ }
51
+
44
52
  // EVERY Spec line, not the first. A plan may implement against several feature docs, and a
45
53
  // single-match parse silently exempts all but one — the same singular assumption the Doc
46
54
  // Obligations ledger exists to break, reintroduced here where nothing would surface it.