archgen-mcp 0.0.7 → 0.1.0

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 (42) hide show
  1. package/README.md +2 -6
  2. package/assets/briefs/investigate.md +16 -17
  3. package/assets/briefs/review.md +41 -29
  4. package/assets/briefs/survey.md +17 -20
  5. package/assets/briefs/verifier.md +52 -40
  6. package/assets/harness-mcp.json +6 -6
  7. package/assets/platform-capabilities.json +387 -71
  8. package/assets/references/artifact-templates.md +67 -232
  9. package/assets/references/interview.md +83 -199
  10. package/assets/references/mcp-and-skills.md +35 -125
  11. package/assets/references/orchestration.md +96 -209
  12. package/assets/references/platforms.md +41 -110
  13. package/assets/skill-registry.json +10 -1
  14. package/assets/templates/adr.md +3 -3
  15. package/assets/templates/architecture.yaml +31 -28
  16. package/assets/templates/edge-matrix.md +8 -8
  17. package/assets/templates/mermaid.md +3 -10
  18. package/assets/templates/prd.md +15 -15
  19. package/assets/templates/tasks.yaml +25 -18
  20. package/package.json +2 -2
  21. package/src/cli.mjs +1 -2
  22. package/src/context.mjs +12 -42
  23. package/src/core/brief-context.mjs +106 -0
  24. package/src/core/brief-scope.mjs +218 -0
  25. package/src/core/briefs.mjs +109 -1
  26. package/src/core/codegraph-manager.mjs +12 -0
  27. package/src/core/doc-navigator.mjs +101 -17
  28. package/src/core/errors.mjs +1 -1
  29. package/src/core/harness-wiring.mjs +65 -22
  30. package/src/core/jsonc-config.mjs +706 -0
  31. package/src/core/plan-grapher.mjs +11 -3
  32. package/src/core/skill-manager.mjs +181 -13
  33. package/src/core/skill-roots.mjs +92 -0
  34. package/src/core/tokens.mjs +78 -0
  35. package/src/core/worker-contract.mjs +145 -18
  36. package/src/server.mjs +0 -3
  37. package/src/tools/help.mjs +17 -34
  38. package/src/tools/plan.mjs +36 -22
  39. package/src/tools/skills.mjs +67 -5
  40. package/src/tools/tasks.mjs +44 -18
  41. package/src/core/ui-channel.mjs +0 -222
  42. package/src/tools/ui.mjs +0 -67
@@ -2,17 +2,7 @@
2
2
 
3
3
  ## Provenance header (SHOULD on every NEW tasks.yaml / architecture.yaml)
4
4
 
5
- Begin both files with three YAML comment lines. Comments are ignored by every
6
- consumer (the MCP server, the VS Code extension, any YAML toolchain), so this is
7
- purely additive metadata — it can never break a parser:
8
-
9
- **NEVER type the version yourself.** The `scaffold` action writes the generator
10
- line with the RUNNING server's version, and you paste its output verbatim. A
11
- version you write by hand is either stale or made up — and the provenance
12
- header exists precisely so it is never either.
13
-
14
- The shape of what `scaffold` returns (the version below is a sample of the
15
- running server's, not a value to copy):
5
+ Begin `tasks.yaml` and `architecture.yaml` with the three YAML comment lines returned by `archgen_plan{action:'scaffold'}`:
16
6
 
17
7
  ```yaml
18
8
  # schema_version: 1
@@ -20,266 +10,111 @@ running server's, not a value to copy):
20
10
  # generated_at: 2026-08-26T09:00:00.000Z
21
11
  ```
22
12
 
23
- The scaffold action returns these three lines ready to paste.
24
-
25
- Version token rules — code-defensive, NEVER guess:
26
-
27
- 1. The `scaffold` action already resolved the version for you. Copy its
28
- header as-is.
29
- 2. If you must write the header yourself (backfilling an artifact the tool
30
- did not create), resolve the version in this order and never invent one:
31
- a. The `.archgen-version` stamp next to the installed `SKILL.md`, when it
32
- reads as exact `MAJOR.MINOR.PATCH`.
33
- b. Otherwise the `"version"` field of an adjacent `archgen.config.json`,
34
- when it is semver-shaped.
35
- c. Otherwise omit the version token entirely: plain `# generator: archgen`.
36
- 3. `npx archgen-skill migrate --apply` applies rules 2(a)–(c) to existing
37
- artifacts for you, and backs each file up before it touches it.
13
+ **Version token rules (NEVER guess or hand-type a version):**
14
+ 1. Paste the header generated by `scaffold` verbatim.
15
+ 2. When backfilling manually, resolve version strictly in this order:
16
+ a. Exact `MAJOR.MINOR.PATCH` from `.archgen-version` adjacent to `SKILL.md`.
17
+ b. Semver `"version"` field from adjacent `archgen.config.json`.
18
+ c. Omit version token: `# generator: archgen`.
19
+ 3. `npx archgen-skill migrate --apply` (`--check` dry-run default) snapshots existing files to `.archgen/.backup/<ts>/migrate/` and backfills missing headers idempotently.
38
20
 
39
- `generated_at` is one ISO-8601 timestamp per generation run (all files written
40
- by the same run share it). Keep the header at the very top of the file; never
41
- place content above it and never encode meaning anywhere except these three
42
- lines.
43
-
44
- Older artifacts without the header are backfilled by
45
- `npx archgen-skill migrate --apply` (dry-run `--check` is the default), which
46
- snapshots each file into `.archgen/.backup/<ts>/migrate/` before touching it
47
- and skips already-stamped files, so re-running is always safe.
21
+ All files created in a single run share one ISO-8601 `generated_at` timestamp at line 1–3.
48
22
 
49
23
  ## Self-containment rules (anti-hallucination)
50
24
 
51
- Artifacts are executed by sessions and sub-agents that were NEVER part of the
52
- conversation that produced them. Hard rules, no exceptions:
25
+ Artifacts are executed by sub-agents with zero conversation history. Enforce strictly:
53
26
 
54
- 1. **Full paths, always.** Every task step, `file_ownership` glob, artifact,
55
- and verification command uses complete repo-root-relative paths
56
- (`src/features/catalog/api/routes.ts`), never bare filenames (`routes.ts`)
57
- and never invented directories. Paths come from `structure:` /
58
- `owns[]` in architecture.yaml or from surveyed code — nowhere else.
59
- 2. **Names derive from naming_conventions.** Every file, symbol, table, and
60
- env-var name you introduce cites WHICH convention key produced it, e.g.
61
- `camelCase symbols per naming_conventions.symbol_casing`. If no key covers
62
- it, add the key first, then use it.
63
- 3. **Plans survive context summarization alone.** Any session reading ONLY
64
- `.archgen/<slug>/` must execute correctly with zero chat history. If a fact
65
- matters, it is written in an artifact; if it is not written, it does not
66
- exist.
67
- 4. **Forbidden phrases** (in any artifact): "as discussed", "the usual
68
- pattern", "same as before", "see chat". Replace each with the concrete
69
- artifact reference it was standing in for.
70
- 5. **Cross-references are artifact-relative**, e.g.
71
- `see ../architecture.yaml data_contracts.orders` or
72
- `payload per ../architecture.yaml api_contracts.payments.request_payload`.
73
- Never restate a contract from memory — point at it.
74
- 6. **Markdown heading anchors are GitHub-exact slugs.** Lowercase, punctuation
75
- dropped, every whitespace character becomes a hyphen (runs are NOT
76
- collapsed): `## TASK-02 — Auth API` slugs to `#task-02--auth-api`. A link
77
- whose anchor does not resolve against the target document's real heading
78
- slugs is a broken `anchor` finding (verifier-blocking). Underscores and
79
- hyphens survive; letters/digits are never dropped.
80
- 7. **Verifier-compatible ids in plans.** `archgen_plan{action:'verify'}` rejects
81
- any UPPERCASE-numbered token in `plans/*.md` that is not a real tasks.yaml id
82
- (`TASK-999` fails; your actual ids pass). So: requirement ids
83
- (`FR-<MODULE>-nn`) are cited from `tasks.yaml` acceptance lines and
84
- `docs/prd.md` itself; inside plan prose link the anchor instead —
85
- `../docs/prd.md#fr-catalog-01`. Every tasks.yaml id MUST appear in some
86
- plan file (coverage check runs both directions).
27
+ 1. **Full repo-root-relative paths:** Every task step, `file_ownership` glob, artifact, and verification command MUST use complete paths (`src/features/catalog/api/routes.ts`), sourced exclusively from `architecture.yaml` (`structure:`/`owns[]`) or surveyed code. Never use bare filenames.
28
+ 2. **Traceable naming:** Every file, symbol, table, and env var must cite its governing `naming_conventions` key (e.g., `camelCase per naming_conventions.symbol_casing`). Add missing keys to `architecture.yaml` before citing them.
29
+ 3. **Zero chat dependency:** `.archgen/<slug>/` must be 100% self-contained. Unwritten facts do not exist.
30
+ 4. **Forbidden phrases:** Never write `"as discussed"`, `"the usual pattern"`, `"same as before"`, or `"see chat"`. Cite concrete artifact paths/keys instead.
31
+ 5. **Artifact-relative cross-references:** Point to contracts rather than restating them (e.g., `see ../architecture.yaml data_contracts.orders` or `../architecture.yaml api_contracts.payments.request_payload`).
32
+ 6. **GitHub-exact heading anchors:** Lowercase, strip punctuation (keep `-` and `_`), and convert every whitespace character to `-` without collapsing runs (`## TASK-02 — Auth API` $\rightarrow$ `#task-02--auth-api`). Broken anchors block verification.
33
+ 7. **Verifier-compatible IDs:** `archgen_plan{action:'verify'}` rejects unknown `UPPERCASE-NN` tokens in `plans/*.md`. Cite `FR-<MODULE>-nn` IDs in `tasks.yaml` acceptance criteria and `docs/prd.md`; inside `plans/*.md`, link via anchor (`../docs/prd.md#fr-catalog-01`). Every `tasks.yaml` ID must appear in `plans/*.md` (bidirectional coverage check).
87
34
 
88
35
  ## Plan depth by scope class
89
36
 
90
- Pick ONE class before writing any artifact; depth scales with risk, not
91
- enthusiasm. Misclassifying is a defect: inflating SMALL wastes tokens,
92
- shrinking LARGE hallucinates.
93
-
94
- **The required artifact set is a tool output — never hand-assemble it:**
37
+ Select ONE scope class before authoring. Always fetch the required file set and skeletons from the tool:
95
38
 
96
39
  ```
97
- archgen_plan { action: 'scaffold', scope: 'LARGE', slug: '<slug>' }
40
+ archgen_plan { action: 'scaffold', scope: 'SMALL' | 'MEDIUM' | 'LARGE', slug: '<slug>' }
98
41
  ```
99
42
 
100
- It returns the scope class's REQUIRED artifacts (with paths), the plan sections,
101
- the minimum edge cases per task, the prohibitions, and ready-to-fill skeletons for
102
- `answers.yaml`, `tasks.yaml`, the plan, `docs/prd.md`, `architecture.yaml`, the
103
- ADR and the edge-case matrix. Adding or dropping files is a right-sizing defect.
104
-
105
- What follows is the AUTHORING content for each class — what to WRITE, not WHICH
106
- files to create.
107
-
108
- - **SMALL** (add/touch few things): a lean plan note —
43
+ Adding or omitting files outside the scaffold output is a right-sizing defect. Authoring depth per class:
109
44
 
45
+ - **SMALL** (localized change): Lean plan note only (no Context, PRD, or diagrams; full repo-root paths still mandatory):
110
46
  ```markdown
111
47
  # <feature> — plan note (SMALL)
112
48
  Intent: <one paragraph>
113
49
  Tasks: see tasks.yaml entries <ids>
114
50
  Risks: <bullets or none>
115
51
  ```
116
-
117
- Every task entry STILL carries absolute-from-repo-root paths verbatim —
118
- in `file_ownership`, in each step, in verification commands. No Context
119
- section, no diagrams, no PRD.
120
-
121
- - **MEDIUM**: the plan gains, in order:
122
- - **Context** — 2–4 paragraphs max: why now, what exists, what changes.
123
- - **Per-task sections** (one `<id> — <title>` heading per task):
124
- Approach (short bullets) + **Edge cases** (min 3 bullets each, feeding
125
- the edge-case matrix below) + **Out-of-scope** (explicit non-goals).
126
- - **Verification steps** — ordered, runnable, repo-root-relative.
127
- No PRD, no diagrams unless structure changed.
128
-
129
- - **LARGE / greenfield-from-scratch**: the FULL professional stack — PRD
130
- (~1 page per major module) + expanded `architecture.yaml` (naming_conventions,
131
- data_contracts, api_contracts, environment_matrix) + per-task edge-case
132
- matrices + per-module diagrams + MEDIUM-grade plan sections. Every diagram
133
- ≤15 nodes.
52
+ - **MEDIUM**: Plan includes:
53
+ - **Context** (2–4 paragraphs max: why now, current state, delta).
54
+ - **Per-task sections** (`## <id> — <title>`): Approach (short bullets), **Edge cases** ($\ge 3$ bullets feeding the edge-case matrix), and **Out-of-scope**.
55
+ - **Verification steps**: Ordered, runnable, repo-root-relative commands. No PRD or diagrams unless structural changes require them.
56
+ - **LARGE / greenfield-from-scratch**: Full stack—PRD (~1 page/module) + expanded `architecture.yaml` (`naming_conventions`, `data_contracts`, `api_contracts`, `environment_matrix`) + per-task edge-case matrices + per-module & integration Mermaid diagrams ($\le 15$ nodes each) + MEDIUM plan sections.
134
57
 
135
58
  ## Structural correctness — verifier-enforced authoring rules
136
59
 
137
- - **Waves derive from `depends_on`.** Declared wave / `parallel_group` labels
138
- MUST match the dependency-derived topological order — never hand-label a
139
- task into a wave that contradicts its `depends_on`. A dependent task may not
140
- sit in an earlier (or parallel) wave than its prerequisite.
141
- `archgen_plan{action:'graph', format:'mermaid'}` is the ground truth for wave order.
142
- - **artifacts ⊆ file_ownership.** Every path a task lists in `artifacts` must
143
- fall inside that task's `file_ownership` globs — workers can write ONLY
144
- owned paths. Listing a doc the task doesn't own is a verifier-blocking
145
- defect.
146
- - **Verification commands**: repo-root-relative (no `../`, no `--plan .`),
147
- fully specific — exact commands, versions, sample sizes, thresholds — the
148
- same form a worker would actually run. Generic "run the tests" or
149
- wrong-root-resolved paths fail.
150
- - **YAML subset**: the parser supports block mappings, block sequences, and
151
- SINGLE-LINE flow collections (`["a/**", "b.ts"]`, `{id: A}`). It REJECTS
152
- block scalars (`|` / `>`), duplicate keys, and UNTERMINATED flow sequences
153
- (a flow collection must open and close on the same line). Emit only what
154
- parses — the forbidden forms caused format-repair loops in the field.
155
- - **tasks.yaml edits**: make small targeted edits or one clean full
156
- regeneration — never large multi-region patches (they corrupted tasks.yaml
157
- in the field).
60
+ - **Topological waves:** Wave / `parallel_group` labels MUST match the `depends_on` topological order (`archgen_plan{action:'graph', format:'mermaid'}`). Dependents never precede or share a wave with prerequisites.
61
+ - **`artifacts` $\subseteq$ `file_ownership`:** Every path in `artifacts` must match the task's `file_ownership` globs.
62
+ - **Runnable verification commands:** Repo-root-relative (no `../` or `--plan .`), specifying exact commands, flags, sample sizes, and thresholds.
63
+ - **Restricted YAML subset:** Block mappings, block sequences, and single-line flow collections (`["a/**", "b.ts"]`, `{id: A}`) ONLY. **BANNED:** block scalars (`|` / `>`), duplicate keys, and multi-line flow collections.
64
+ - **Targeted `tasks.yaml` edits:** Apply small, surgical edits or a clean full regeneration—never large multi-region patches.
158
65
 
159
66
  ## Agent workspace & artifact location — the two-tier rule
160
67
 
161
- Location follows LIFETIME + AUDIENCE: the plan (and its rationale) travels as
162
- ONE self-contained, reviewable, git-versioned unit; the product's deliverables
163
- travel with the product.
164
-
165
- INSIDE `.archgen/<slug>/` — the plan + everything needed to execute/review it:
166
- - tasks.yaml, plans/, architecture.yaml, answers.yaml, codebase-map.md.
167
- - `docs/prd.md` — a PLANNING artifact (defines the FR-ids tasks cite), not a
168
- shipped doc — stays inside so `archgen_docs` can validate FR references.
169
- - `decisions/NNNN-title.md` — the plan's formal ADRs (its rationale). Inside
170
- keeps the feature folder self-contained and ADR↔task↔plan references valid.
171
- - `.agent/` — ALL agent/sub-agent working state. The leading dot keeps it out
172
- of doc scans (process state, not a validated artifact):
173
- - `.agent/decisions/NNNN-<slug>.md` — EXECUTION-time decisions a sub-agent
174
- takes while working (distinct from the plan's formal ADRs in `decisions/`).
175
- - `.agent/learnings.md` — conventions/patterns discovered (append-only).
176
- - `.agent/notes/<task-id-or-topic>.md` — worker/survey/investigator notes.
177
- - `.agent/reports/<verifier|reviewer|investigate>-<round>.md` — persisted
178
- verifier/reviewer/investigation findings.
179
- - `.agent/resume.md` — the RE-ENTRY snapshot, rewritten after every wave:
180
- ≤10 lines carrying slug, wave index, done/failed/blocked ids, the one
181
- command to resume (`archgen_tasks{action:'next'}`), and the plan sections the remaining tasks
182
- own. This is the FIRST file to read after any context compaction.
183
-
184
- OUTSIDE `.archgen/` — project DELIVERABLES an approved task produces, written
185
- to the task's `file_ownership` paths at the repo root (never into `.archgen/`):
186
- - source code (`src/...`), and
187
- - shipped documentation: README, API reference, deployment/runbooks, user
188
- guides — the docs the running software ships to users/operators.
189
-
190
- Enterprise refinement — durable ADRs: a decision that outlives this feature
191
- (project-wide, e.g. "Postgres over MongoDB") SHOULD also be promoted to the
192
- project's canonical ADR register (`docs/adr/` or the team's equivalent) so
193
- future features discover it. `.archgen/<slug>/decisions/` is the working
194
- record; the register is the durable project-wide copy. Never delete or
195
- re-number an accepted ADR — supersede it.
68
+ - **INSIDE `.archgen/<slug>/`** (self-contained planning & execution state):
69
+ - `tasks.yaml`, `plans/`, `architecture.yaml`, `answers.yaml`, `codebase-map.md`.
70
+ - `docs/prd.md` (planning artifact defining `FR-*` IDs validated by `archgen_docs`).
71
+ - `decisions/NNNN-title.md` (formal feature ADRs).
72
+ - `.agent/` (process state excluded from doc validation):
73
+ - `.agent/decisions/NNNN-<slug>.md` — runtime sub-agent implementation decisions.
74
+ - `.agent/learnings.md` — append-only discovered repo conventions.
75
+ - `.agent/notes/<task-id-or-topic>.md` — worker/survey/investigator working notes.
76
+ - `.agent/reports/<verifier|reviewer|investigate>-<round>.md` — gate & investigation reports.
77
+ - `.agent/resume.md` — $\le 10$-line compaction re-entry snapshot (slug, wave index, done/failed/blocked IDs, `archgen_tasks{action:'next'}`, remaining task plan sections), updated after every wave.
78
+ - **OUTSIDE `.archgen/`** (product deliverables written to task `file_ownership` paths):
79
+ - Source code (`src/...`) and shipped user/operator documentation (`README.md`, API docs, runbooks).
80
+ - *Durable ADRs:* Promote repo-wide architectural decisions from `.archgen/<slug>/decisions/` to the project's canonical ADR directory (`docs/adr/`). Supersede rather than deleting/renumbering accepted ADRs.
196
81
 
197
82
  ## architecture.yaml (LARGE scope)
198
83
 
199
- **The template is a tool output** — `archgen_plan{action:'scaffold', scope:'LARGE'}`
200
- returns it with the provenance header and the slug filled in. Do not retype it.
201
-
202
- The four contract blocks (`naming_conventions`, `data_contracts`,
203
- `api_contracts`, `environment_matrix`) are THE anti-hallucination source of
204
- truth: tasks cite them by key instead of re-describing shapes from memory.
205
- Module entries extend `schemas/architecture-conventions.md` (its
206
- `name`/`responsibility`/`owns[]` trio is unchanged and still normative).
207
-
208
- **Authoring rules for the blocks:**
209
- - One contract block per module/domain (~10–20 lines each); split further
210
- rather than letting any single block exceed ~40 lines.
211
- - `modules[].depends_on_modules` MUST be acyclic — it drives the task
212
- `depends_on` edges.
213
- - `key_interfaces` lists what OTHER modules may import — nothing else.
214
- - `environment_matrix` variables are unparsed vars that fail fast in
215
- `src/config/`.
216
-
84
+ Generated via `archgen_plan{action:'scaffold', scope:'LARGE'}`. Authoring rules for the four anti-hallucination contract blocks:
85
+ - Keep each module/domain contract block concise (~10–20 lines; split before exceeding 40 lines).
86
+ - `modules[].depends_on_modules` MUST be a DAG (drives task `depends_on`).
87
+ - `key_interfaces` lists ONLY exports consumable by other modules.
88
+ - `environment_matrix` vars must fail fast if unparsed in `src/config/`.
217
89
 
218
90
  ## Product requirements document (PRD) — LARGE/greenfield
219
91
 
220
- **The template is a tool output** — the scaffold returns `docs/prd.md`.
221
-
222
- Written BEFORE tasks.yaml. Bullet-dense prose, zero filler paragraphs; target
223
- ~1 page per major module. Requirement ids here are the stable handles every task
224
- acceptance cites.
225
-
226
- **Authoring rules:**
227
- - `FR-<MODULE>-nn` ids are IMMUTABLE once tasks reference them.
228
- - Non-functional requirements need NUMBERS — "fast"/"scalable" without figures
229
- fail the interview's completion test.
230
- - Success metrics need a baseline → target within a window.
231
-
92
+ Generated via `scaffold` (`docs/prd.md`) and authored BEFORE `tasks.yaml` (~1 bullet-dense page per module):
93
+ - `FR-<MODULE>-nn` IDs are **immutable** once referenced by `tasks.yaml`.
94
+ - NFRs require concrete numbers (latency, RPS, compliance standard); adjectives fail verification.
95
+ - Success metrics require `<baseline> -> <target> within <window>`.
232
96
 
233
97
  ## tasks.yaml (canonical shape)
234
98
 
235
- **The template is a tool output** — the scaffold returns `tasks.yaml` with the
236
- provenance header, the YAML subset rules already applied, and a worked
237
- MINIMAL + LARGE example.
238
-
239
- **Rules encoded in the template:**
240
- - `depends_on` = prerequisites (never dependents).
241
- - Ownership globs are disjoint within a wave.
242
- - Acceptance = objectively checkable statements.
243
- - Acceptance bullets SHOULD reference edge-matrix rows (`E1`–`En`) and, on
244
- LARGE, the FR ids they implement.
245
- - Schema stays stable (`schemas/tasks.schema.json`, schema_version 1) — no new
246
- required fields; guidance lives in comments and plan files.
247
-
99
+ Generated via `scaffold` (`schemas/tasks.schema.json`, `schema_version: 1`):
100
+ - `depends_on` lists prerequisite task IDs (never dependents).
101
+ - Same-wave `file_ownership` globs must be strictly disjoint.
102
+ - `acceptance` criteria must be objectively checkable and cite edge-matrix rows (`E1`–`En`) and `FR-<MODULE>-nn` IDs (for LARGE).
248
103
 
249
104
  ## Edge-case matrix (per task, MEDIUM+)
250
105
 
251
- **The matrix template is a tool output** — the scaffold returns a pre-filled
252
- header with one row per coverage class.
253
-
254
- Each MEDIUM/LARGE task carries a matrix in its plan section. Every row MUST map
255
- to an acceptance bullet — no orphan rows; every acceptance bullet SHOULD trace to
256
- ≥1 row. Minimum coverage classes per task: empty/null, boundary values, authz
257
- denied, concurrent/conflicting write, failure/retry path, i18n/formatting edge.
258
- Tasks touching infra (migrations, deploys, queues) ADD: partial-failure
259
- recovery, rollback story.
106
+ Generated via `scaffold` and placed in each MEDIUM/LARGE task's plan section ($\le 10$ rows per table; split by concern if larger):
107
+ - **Mandatory coverage classes:** empty/null, boundary values, authz denied, concurrent/conflicting write, failure/retry path, i18n/formatting edge.
108
+ - **Infra tasks (migrations, deploys, queues) add:** partial-failure recovery, rollback path.
109
+ - **Traceability:** Every row maps to `Covered by` (`<task-id>#<1-based acceptance index>`); zero orphan rows.
260
110
 
261
- `Covered by` = `<task-id>#<acceptance index>` (1-based, matching the tasks.yaml
262
- `acceptance` array). Rows are additive across waves; keep each matrix ≤10 rows —
263
- split into per-concern tables beyond that.
264
-
265
-
266
- ## ADR template (decisions/NNNN-title.md)
267
-
268
- **The template is a tool output** — the scaffold returns it.
269
-
270
-
271
- ## Mermaid snippets
272
-
273
- **The snippets are a tool output** — the scaffold returns them
274
- (`docs/mermaid-snippets.md`): the C4 context and container diagrams.
111
+ ## ADR template & Mermaid snippets
275
112
 
113
+ Generated via `scaffold` (`decisions/NNNN-title.md` and `docs/mermaid-snippets.md`).
276
114
 
277
115
  ## Per-module diagram (LARGE)
278
116
 
279
- **The diagram rules stay here; the template is a tool output.**
280
-
281
- For EACH `modules:` entry in architecture.yaml, one small flowchart of its
282
- internal components plus its `depends_on_modules` edges (arrow points from
283
- consumer to provider). Plus ONE integration diagram wiring all modules — edges
284
- between modules only, no internals. HARD LIMIT: ≤15 nodes per diagram; split
285
- into two diagrams rather than cramming. Internals stay ≤6 nodes per module.
117
+ Generated via `scaffold`. Authoring rules:
118
+ - One flowchart per `modules:` entry showing internal components ($\le 6$ nodes) plus inbound `depends_on_modules` edges (consumer $\rightarrow$ provider).
119
+ - One system integration diagram wiring modules as atomic nodes (no module internals).
120
+ - **Hard limit:** $\le 15$ nodes per diagram (split if larger).