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