@evolvehq/docflow 0.9.1 → 0.9.3

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.
package/README.md CHANGED
@@ -39,23 +39,41 @@ and point you at `/bootstrap`.
39
39
 
40
40
  ## What `/bootstrap` installs
41
41
 
42
+ Only the **core** is always written; everything else is an **opt-in layer**
43
+ chosen during the assessment, so a minimal repo stays as light as a classic
44
+ ADR catalogue.
45
+
46
+ **Core (always):**
42
47
  - `AGENTS.md` — hard rules for coding agents (the entry point).
43
- - `CLAUDE.md` — one-liner re-exporting `AGENTS.md` so Claude Code picks
44
- it up automatically.
45
- - `CONVENTIONS.md` — authoring rules for ADRs, naming, status
46
- lifecycle, audit trail, and git contract.
48
+ - `CLAUDE.md` — one-liner re-exporting `AGENTS.md` so Claude Code picks it
49
+ up automatically.
50
+ - `CONVENTIONS.md` — authoring rules for ADRs, naming, status lifecycle,
51
+ audit trail, and git contract.
47
52
  - `INDEX.md` — generated table of all ADRs.
48
- - `adr/` — ADR catalogue with a capability-ADR template (and an
49
- optional technology-ADR template).
50
- - `plan/todo/` and `plan/done/` — implementation queue. `git mv` from
51
- `todo/` to `done/` is the completion event.
52
- - `_agent/` multi-agent coordination: `ROLES.md`, `LOCKS.md`,
53
- `WORKLOG.md`, `CURRENT_FOCUS.md`, `HANDOFF.md`, and an optional
54
- unsupervised-run prompt under `prompts/`.
55
-
56
- Optional, off by default: `GLOSSARY.md`, `domains/<slug>/README.md`
57
- groupings, project-specific hard rules (vendor-naming restriction,
58
- regulated-evidence posture, language mandate, audit-stream separation).
53
+ - `adr/0000-template.md`the ADR template; the catalogue starts here.
54
+
55
+ **Optional layers (opt-in):**
56
+ - `plan/todo/` + `plan/done/` the implementation queue (Q4a). `git mv`
57
+ from `todo/` to `done/` is the completion event.
58
+ - `_agent/` — coordination (`ROLES`, `LOCKS`, `WORKLOG`, `CURRENT_FOCUS`,
59
+ `HANDOFF`, optional `prompts/`). **Q5 — choose *None* to omit it.**
60
+ - `GLOSSARY.md`, `domains/<slug>/README.md` groupings, the technology-ADR
61
+ template, and project-specific hard rules (vendor-naming, regulated
62
+ evidence, language mandate, audit-stream separation) Q7/Q10.
63
+
64
+ Omitting any optional layer leaves a valid repo; a lifecycle skill that
65
+ needs an absent layer refuses cleanly and says what's missing.
66
+
67
+ **Placement:** `AGENTS.md` and `CLAUDE.md` always stay at the repository
68
+ root; everything else lives under a configurable **artefact root** —
69
+ `docs/` (the default), the repo root, or `.docflow/` — chosen at bootstrap
70
+ and recorded in `CONVENTIONS.md`.
71
+
72
+ **Seed ADR:** by default, bootstrap also writes **`adr/0001`** — a first
73
+ ADR recording the decision to adopt this method (self-documenting, like the
74
+ classic "use ADRs" convention). It references `CONVENTIONS.md` for the rules
75
+ and is created `Implemented`. Decline it at sign-off if you want only the
76
+ template.
59
77
 
60
78
  ## Why
61
79
 
@@ -80,11 +98,25 @@ set keeps numbering contiguous **per repo** while a federation-wide
80
98
  identity is the cross-repo key. The `rollup` skill aggregates every
81
99
  member's catalogue into one product-wide view, and `audit` gains
82
100
  cross-repo checks (membership, identity collisions, dangling references,
83
- roll-up drift). No tool writes across a repo boundary; consistency is
84
- declared at the edges and enforced by audit. See the
101
+ roll-up drift, convention drift). Work and status cross repos the same way:
102
+ a cross-repo decision is one plan item per affected repo, and its aggregate
103
+ status ("2 of 3 repos") surfaces in the roll-up. No tool writes across a
104
+ repo boundary; consistency is declared at the edges and enforced by audit. See the
85
105
  [methodology](https://evolvehq.github.io/docflow/methodology/#5-scaling-to-many-repositories)
86
106
  for the full model.
87
107
 
108
+ ## No drafts in the catalogue
109
+
110
+ docflow records **outcomes, not work-in-progress**. There is **no `Draft`
111
+ status** and **no `brainstorming/` folder** — an ADR's first persisted
112
+ status is `Proposed`, created only once a decision is approved. The
113
+ `brainstorm` skill explores candidates **in conversation and writes
114
+ nothing** until you approve them; only then does `new-adr` mint a numbered
115
+ ADR. This keeps the catalogue free of half-formed drafts and the numbering
116
+ clean — numbers go only to real decisions — following the lightweight-ADR
117
+ tradition that an ADR captures the agreed decision, not the discussion that
118
+ produced it.
119
+
88
120
  ## Install
89
121
 
90
122
  docflow ships from **one skill source** (`plugins/docflow/skills/`) to
@@ -171,6 +203,9 @@ OpenCode has no marketplace command for `SKILL.md` skills (its plugin
171
203
  system is for npm JS plugins), so a shared skills directory is the clean
172
204
  path. Skills auto-load by description.
173
205
 
206
+ **OpenCode-compatible forks** — e.g. Xiaomi's *mimocode* — inherit this
207
+ support via the same skill-discovery path; no separate packaging.
208
+
174
209
  ### Claude Code — local development (no install)
175
210
 
176
211
  ```
package/USAGE.md CHANGED
@@ -165,6 +165,7 @@ After sign-off, the skill writes:
165
165
  | `CLAUDE.md` | `templates/CLAUDE.md` | Single line `@AGENTS.md`. |
166
166
  | `adr/0000-template.md` | `templates/adr-capability.md` | Capability-ADR template. |
167
167
  | `adr/NNNN-template.md` | `templates/adr-technology.md` | Technology-ADR template. Only if Q2 said split. `NNNN` is the project-defined cutoff (default 0100). |
168
+ | `adr/0001-record-architecture-decisions.md` | `templates/adr-0001-seed.md` | **Seed ADR** recording the decision to adopt the method (`Implemented`, references `CONVENTIONS.md`). Default on; declined at sign-off if not wanted. |
168
169
  | `plan/README.md` | `templates/plan-README.md` | Plus empty `plan/todo/.gitkeep` and `plan/done/.gitkeep`. |
169
170
  | `_agent/ROLES.md` | `templates/_agent-ROLES.md` | Single `default-agent` by default. |
170
171
  | `_agent/LOCKS.md` | `templates/_agent-LOCKS.md` | Empty header. Created only if Q5 enabled LOCKS discipline. |
@@ -174,7 +175,7 @@ After sign-off, the skill writes:
174
175
  | `_agent/IN_FLIGHT.md` | `templates/_agent-IN_FLIGHT.md` | Only in Q5 mode 3 (worktree). Committed cross-worktree dashboard. |
175
176
  | `.gitattributes` (entry) | (none — inline) | Only in Q5 mode 3: appends `_agent/WORKLOG.md merge=union`. |
176
177
  | `.gitignore` (entry) | (none — inline) | Only in Q5 mode 3: adds `_agent/CURRENT_FOCUS.md` so it stays local-only. |
177
- | `INDEX.md` | (none — generated) | Stub header + empty table. |
178
+ | `INDEX.md` | (none — generated) | Header + the seed ADR's row (empty table only if the seed was declined). |
178
179
  | `_agent/prompts/autonomous.md` | `templates/_agent-prompts-autonomous.md` | Only if Q8 confirmed a verify gate. |
179
180
 
180
181
  ## 5. After scaffolding
@@ -273,9 +274,14 @@ it inherits the topology and identity scheme rather than re-choosing them.
273
274
  collide.
274
275
  - **References.** Cross-repo links use the logical identity, resolved via
275
276
  the home's `federation-index.md`; same-repo links stay relative.
277
+ - **Work & status.** A cross-repo decision is one plan item **per affected
278
+ repo**, each tracing to the owning ADR by its federation identity (no
279
+ umbrella record); the decision's aggregate status ("2 of 3 repos") is a
280
+ derived roll-up column, `Implemented` only when every per-repo item ships.
276
281
  - **`/rollup`** aggregates every member's catalogue into one product-wide
277
282
  view; **`/audit`** gains cross-repo checks (bidirectional membership,
278
- identity collisions, dangling references, roll-up drift).
283
+ identity collisions, dangling references, roll-up drift, convention
284
+ drift).
279
285
  - **Conventions** are copied at bootstrap and kept honest by audit
280
286
  drift-detection — referenceable from the home, never force-pushed.
281
287
 
@@ -340,6 +346,11 @@ scheme:
340
346
  and `INDEX.md`).
341
347
  - **G3 — gate backstop:** the single-threaded merge gate rejects a
342
348
  duplicate; the later author renumbers.
349
+ - **G4 — claim before do:** before implementing a queued item, claim it (a
350
+ draft PR referencing it, or an `IN_FLIGHT`/`owner` entry) so two writers
351
+ don't build the same unclaimed `plan/todo` item — G1–G3 protect the
352
+ *number*, G4 protects the *work assignment*; the audit's
353
+ duplicate-plan-ownership check is the backstop.
343
354
 
344
355
  `bootstrap` **pre-wires** these into `CONVENTIONS.md` + an `AGENTS.md`
345
356
  hard rule **only** for multi-agent (mode 2/3) or PR-based repos.
@@ -348,6 +359,26 @@ get none of this ceremony. Numbers are immutable once merged. (For
348
359
  orchestrated runs, `agent-wave` additionally *reserves* disjoint number
349
360
  blocks up front, so G2/G3 rarely fire.)
350
361
 
362
+ ### Numbering at scale, and grouping by domain
363
+
364
+ ADR numbers are **integers**; the four-digit zero-padding is cosmetic and
365
+ sorts **numerically**, so a catalogue is not capped at `9999` — widen the
366
+ padding to five digits if you ever approach it (no real catalogue does).
367
+
368
+ Two alternative identifier schemes are intentionally *not* used (the
369
+ [methodology](https://evolvehq.github.io/docflow/methodology/#46-numbering-at-scale-and-alternatives-considered)
370
+ has the full reasoning): **timestamp / opaque ids** — they trade away
371
+ ordering and readability, and the guardrails above handle collisions
372
+ instead; and **per-domain numbering** like `auth/0001` — the federation
373
+ serves genuinely independent sequences, and within one repo you group
374
+ rather than renumber.
375
+
376
+ **Grouping by domain.** Opt in to `domains/<slug>/README.md` files that
377
+ list the ADRs for each area (e.g. `domains/auth/`, `domains/billing/`). It
378
+ is purely organisational: each ADR keeps its flat number and its `INDEX.md`
379
+ row; the domain README is a curated view, not a namespace. Reach for it
380
+ when a flat catalogue grows large enough to be hard to navigate.
381
+
351
382
  ## 6. Customising or extending
352
383
 
353
384
  The templates are deliberately small and self-contained. To customise:
package/docs/preview.png CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolvehq/docflow",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "ADR-driven documentation workflow: scaffold an Architecture Decision Record (ADR) catalogue, a plan/ queue, and AGENTS.md conventions into any repo, then author, queue, ship, audit, and roll up ADRs with lifecycle skills — across one repo or a multi-repo product. Works on Claude Code, Claude Cowork, pi, Codex, and OpenCode.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: audit
3
- description: Audit a documentation-led repo against its own conventions — contiguous ADR numbering, INDEX sync, plan/ coverage, required sections, status validity, cross-reference resolution, language mandate, ADR-privacy leaks into user-visible code, cross-worktree collisions (duplicate numbers, duplicate plan ownership, same ADR edited on two branches), and — for a multi-repo product — cross-repo federation checks (bidirectional membership, identity collisions, dangling cross-repo references, roll-up drift). Reports a punch list and offers to fix the mechanical issues. Use when the user says "audit the ADRs", "lint the conventions", "check repo consistency", "are the ADRs in sync", or invokes /audit.
3
+ description: Audit a documentation-led repo against its own conventions — contiguous ADR numbering, INDEX sync, plan/ coverage, required sections, status validity, cross-reference resolution, language mandate, ADR-privacy leaks into user-visible code, cross-worktree collisions (duplicate numbers, duplicate plan ownership, same ADR edited on two branches), and — for a multi-repo product — cross-repo federation checks (bidirectional membership, identity collisions, dangling cross-repo references, roll-up drift, convention drift). Reports a punch list and offers to fix the mechanical issues. Use when the user says "audit the ADRs", "lint the conventions", "check repo consistency", "are the ADRs in sync", or invokes /audit.
4
4
  ---
5
5
 
6
6
  # audit
@@ -14,11 +14,14 @@ This is the enforcement `AGENTS.md` cannot guarantee on its own.
14
14
  2. Read `CONVENTIONS.md` to learn what to enforce: ADR shape and
15
15
  cutoff, status lifecycle, integration model, multi-agent mode,
16
16
  language mandate, optional artefacts present (GLOSSARY, domains/),
17
- and any Q10 domain hard rules.
17
+ and any Q10 domain hard rules, and the **artefact root** (default:
18
+ repository root) — resolve `adr/`, `plan/`, `INDEX.md` against it and
19
+ honour it in the cross-reference and INDEX-sync checks.
18
20
  3. If a `federation.md` exists, this repo is part of a multi-repo
19
- product. Note whether it is the **home** or a **member** and read the
20
- recorded identity scheme; the cross-repo checks (check 12) run from
21
- the home repo.
21
+ product. Note its `Role` (`central` / `home` / `coordinator`
22
+ index-holder, or a plain `member`) and read the recorded identity
23
+ scheme; the cross-repo checks (check 12) run from the index-holding
24
+ repo.
22
25
 
23
26
  ## Step 1 — Run the checks (read-only)
24
27
 
@@ -48,7 +51,8 @@ relevant):
48
51
  `adr-0042`, `see ADR`, ADR titles — in UI copy, API responses,
49
52
  error messages, customer-facing logs, public docs, release notes.
50
53
  Report each suspect; this rule is easy to violate by reflex.
51
- 10. **Coordination hygiene.** `_agent/LOCKS.md` has no stale claims
54
+ 10. **Coordination hygiene.** N/A if `_agent/` was omitted at bootstrap
55
+ (Q5 = None). Otherwise: `_agent/LOCKS.md` has no stale claims
52
56
  (mode 2); `_agent/IN_FLIGHT.md` rows match live worktrees (mode 3).
53
57
  11. **Cross-worktree collisions** (mode 3, or when auditing across
54
58
  unmerged branches). These catch semantic conflicts that a
@@ -67,22 +71,35 @@ relevant):
67
71
  Cross-check against `_agent/IN_FLIGHT.md`: every collision should
68
72
  correspond to a reservation/ownership violation recorded there.
69
73
  12. **Cross-repo (federation) checks** — only when a `federation.md`
70
- exists; run from the **home** repo. Reach each member through the
71
- local checkout named in `federation-index.md`. A member not checked
74
+ exists; run from the **index-holding** repo (`Role: central`, `home`,
75
+ or `coordinator` whichever holds `federation-index.md`). Reach each
76
+ member through the local checkout named in `federation-index.md`. A member not checked
72
77
  out locally is reported **"unverified this run"** — never silently
73
78
  passed, never a hard failure.
74
79
  - **Bidirectional membership.** Every repo listed in the member index
75
- carries a `federation.md` back-pointer to this home, and every repo
76
- whose back-pointer names this home is listed in the index. Flag
77
- either half-edge (in-index-without-back-pointer, or
78
- points-home-but-unlisted).
79
- - **Identity collisions.** No two ADRs across the federation resolve
80
- to the same identity under the recorded identity scheme.
81
- - **Dangling cross-repo references.** Every cross-repo link resolves
82
- to a real ADR in the named member; flag a target that does not
83
- exist. (Same-repo relative links are check 7.)
80
+ carries a `federation.md` back-pointer to this index-holder, and
81
+ every repo whose back-pointer names this repo is listed in the
82
+ index. Flag either half-edge (in-index-without-back-pointer, or
83
+ points-here-but-unlisted).
84
+ - **Identity collisions.** Under the repo-prefixed scheme an identity
85
+ is `repo-id` + local number, so the only reachable collision is a
86
+ **duplicate `repo-id`**. Flag any repo-id that appears on more than
87
+ one `federation-index.md` row or in two members' `federation.md`
88
+ back-pointers.
89
+ - **Dangling cross-repo references.** Resolve each cross-repo link
90
+ along `repo-id → Pointer → adr/NNNN-*.md` — look up the repo-id's
91
+ Pointer in `federation-index.md`, then the ADR file under that repo.
92
+ A repo-id with **no index row** is a dangling reference. If the row
93
+ exists but the **checkout is absent**, report it **"unverified this
94
+ run"** (not dangling); only an **absent ADR in a present checkout**
95
+ is a true dangling reference. (Same-repo relative links are
96
+ check 7.)
84
97
  - **Roll-up drift.** The roll-up agrees with each member's `INDEX.md`
85
98
  metadata; flag rows that are stale, missing, or extra.
99
+ - **Convention drift.** Compare each member's **shared** conventions
100
+ against the index-holder's authoritative copy; flag a member whose
101
+ shared conventions have drifted from the source. Members' **local-only**
102
+ conventions are exempt.
86
103
 
87
104
  ## Step 2 — Report
88
105
 
@@ -57,11 +57,27 @@ questions.
57
57
  federation-index.md # multi-repo only (Q11): member index — home repo only
58
58
  ```
59
59
 
60
+ **Placement.** The tree above shows the **root** option. `AGENTS.md` and
61
+ `CLAUDE.md` always sit at the repository root; `adr/`, `plan/`, `_agent/`,
62
+ `INDEX.md`, and `CONVENTIONS.md` go under the **artefact root** chosen in
63
+ Q12 (default `docs/`, e.g. `docs/adr/`, `docs/plan/`).
64
+
65
+ **Core vs optional layers.** Only the **core** is always written:
66
+ `AGENTS.md`, `CLAUDE.md`, `CONVENTIONS.md`, `adr/0000-template.md`, and
67
+ `INDEX.md`. A repo with just these is a valid, lightweight docflow repo — a
68
+ classic ADR catalogue with conventions. Everything else is an **opt-in
69
+ layer**: the `plan/` queue (Q4a), the `_agent/` coordination set (Q5 —
70
+ choose *None* to omit it), `GLOSSARY.md` and `domains/` (Q7). Omitting any
71
+ optional layer is a valid state, not an error; a lifecycle skill that needs
72
+ an absent layer refuses cleanly and names what is missing.
73
+
60
74
  For a **multi-repo product** (one product spread across several repos —
61
75
  see Q11), two extra files appear: `federation.md`, a small back-pointer
62
76
  every member repo carries, and `federation-index.md`, the authoritative
63
- member list that lives only in the home/establishing repo. A standalone
64
- repo has neither.
77
+ member list that lives only in the home/establishing repo. All federation
78
+ artefacts `federation.md`, `federation-index.md`, and the derived
79
+ roll-up `ROLLUP.md` — are placed under the **configured artefact root**.
80
+ A standalone repo has none of them.
65
81
 
66
82
  ## Step 3 — Conventions to install
67
83
 
@@ -120,7 +136,7 @@ repo has neither.
120
136
  doubt, ask whether a non-builder would ever see this string — if
121
137
  yes, the ADR reference comes out.
122
138
 
123
- ## Step 4 — Assessment (10 questions, plus an optional federation question)
139
+ ## Step 4 — Assessment (10 questions, plus federation (Q11) and placement (Q12))
124
140
 
125
141
  **Ask the questions one at a time, not in a batch.** For each question,
126
142
  state a **recommended** option (label it "Recommended") with one short
@@ -134,7 +150,9 @@ ask in plain text, listing options as A/B/C and naming the recommended
134
150
  one.
135
151
 
136
152
  After the answers are in, summarise the resulting plan in 5–10
137
- lines and ask for sign-off before writing any files.
153
+ lines and ask for sign-off before writing any files. Note in the summary
154
+ that a **seed ADR `0001`** recording the adopted method is created by
155
+ default (the operator may decline it — see Step 5 item 5b).
138
156
 
139
157
  1. **Project identity.** Name, one-line description, doc language
140
158
  (en-GB / en-US / other), and — if existing repo — what current files
@@ -171,8 +189,16 @@ lines and ask for sign-off before writing any files.
171
189
  marks ready, merges. Ask the user for merge strategy
172
190
  (squash / merge / rebase — default: squash for clean history,
173
191
  rebase if per-commit identity matters).
174
- 5. **Multi-agent setup.** Pick one the three options have different
175
- coordination-file shapes, and switching later is not free:
192
+ 5. **Coordination by number of writers.** Pick by how many people/agents
193
+ *write* to this repo and how they integrate **writers (integration
194
+ concurrency), not how many agents you run.** A team of several developers
195
+ is multi-writer even with one agent each, and wants the worktree/PR
196
+ shape. This sets the `_agent/` shape (or omits it); switching later is
197
+ not free:
198
+ - **None — omit `_agent/`.** A solo human/agent with no coordination
199
+ need; no `_agent/` directory is written, and lifecycle skills skip the
200
+ WORKLOG/snapshot steps. The lightest footprint (the optional `_agent/`
201
+ layer is left out — see the core-vs-optional note in Step 2).
176
202
  - **(Recommended) Single agent.** `default-agent` in ROLES.
177
203
  LOCKS skipped. WORKLOG / CURRENT_FOCUS as standard single-file
178
204
  snapshots. Right for small projects and the "one human + one
@@ -246,15 +272,31 @@ lines and ask for sign-off before writing any files.
246
272
  The scheme is recorded in the federation config and applied by the
247
273
  authoring skills.
248
274
 
249
- **Establish** designates this repo as the home/central repo, writes
250
- the member index here, and records the topology **and identity
251
- scheme** in the federation config. **Join** asks for the home pointer **you confirm it; the
252
- skill performs no cross-repo read and no host API call** then
253
- writes **only this repo's** back-pointer config and inherits the
254
- topology without re-asking it. Joining never writes into any other
275
+ **Establish** sets this repo's role from the chosen topology
276
+ **central** (A), **coordinator** (B), or **home** (C) writes the
277
+ member index here, and records the topology **and identity scheme**
278
+ in the federation config. **Join** asks for the home pointer **and the federation's topology +
279
+ identity scheme** **you supply them; the skill performs no
280
+ cross-repo read and no host API call** — then writes **only this
281
+ repo's** back-pointer config, recording those values (it does not
282
+ re-choose the topology). Joining never writes into any other
255
283
  repo; adding this repo to the member index is a deliberate edit in
256
284
  the home repo. A standalone repo (Q11 = No) writes none of these
257
285
  files and behaves exactly as a single-repo bootstrap.
286
+ 12. **Artefact placement.** Where the non-entry artefacts live — `adr/`,
287
+ `plan/`, `_agent/`, `INDEX.md`, `CONVENTIONS.md`:
288
+ - **(Recommended) `docs/`** — aligns with the common `doc/adr` / `docs/`
289
+ convention; keeps the repo root clean (`docs/adr/`, `docs/plan/`, …).
290
+ - **Repository root** — flat layout; decisions beside the code (good for
291
+ monorepos). This is docflow's own layout.
292
+ - **`.docflow/`** — hidden root; quietest footprint.
293
+
294
+ `AGENTS.md` and `CLAUDE.md` are **always** written to the repository
295
+ root (coding agents discover them there). The chosen root is recorded in
296
+ `CONVENTIONS.md`, and every lifecycle skill resolves `adr/`, `plan/`,
297
+ and `INDEX.md` against it. For an existing repo already laid out
298
+ differently, offer a documented migration (`git mv` into the chosen root
299
+ + update `CONVENTIONS.md`) — never force it.
258
300
 
259
301
  ## Step 4.5 — Cross-check before sign-off
260
302
 
@@ -283,6 +325,13 @@ Templates live in this skill's `templates/` directory. Read each
283
325
  template, fill its placeholders from the assessment answers, then
284
326
  write it into the repo.
285
327
 
328
+ **Placement (Q12):** write `AGENTS.md` and `CLAUDE.md` to the repository
329
+ root; write everything below under the chosen **artefact root** (default
330
+ `docs/`) — e.g. `docs/adr/0000-template.md`, `docs/plan/`, `docs/INDEX.md`.
331
+ Record the chosen root in `CONVENTIONS.md` so every lifecycle skill resolves
332
+ paths against it, and adjust the `adr/`/`plan/` cross-paths in the filled
333
+ `AGENTS.md` (and other templates) to the chosen root (e.g. `docs/adr/`).
334
+
286
335
  1. `CONVENTIONS.md` — from `templates/CONVENTIONS.md`. Spec other files
287
336
  reference. Include the **§Concurrency Guardrails** section only if Q5
288
337
  is mode 2/3 **or** Q4b is PR-based; omit it for single-agent
@@ -290,16 +339,29 @@ write it into the repo.
290
339
  (multi-repo)** section only if Q11 = yes; fill `<product>` and state
291
340
  the chosen identity scheme. Omit it for standalone repos.
292
341
  2. `AGENTS.md` — from `templates/AGENTS.md`. Include the concurrency
293
- guardrails hard-rule bullet (G2/G3) under the same condition as the
342
+ guardrails hard-rule bullet (G2–G4) under the same condition as the
294
343
  CONVENTIONS section above; omit otherwise.
295
344
  3. `CLAUDE.md` — from `templates/CLAUDE.md` (single line `@AGENTS.md`).
296
345
  4. `adr/0000-template.md` — from `templates/adr-capability.md`.
297
346
  5. `adr/NNNN-template.md` — from `templates/adr-technology.md`, only if
298
347
  Q2 said split. `NNNN` is the number where capability ADRs end
299
348
  (project-defined, e.g. 0091; default 0100 if unspecified).
349
+ 5b. **Seed ADR (default on; opt-out at sign-off).** Write the seed
350
+ `adr/0001-record-architecture-decisions.md` from
351
+ `templates/adr-0001-seed.md`, filled from the assessment answers — it
352
+ records the **decision to adopt** the documentation-led, ADR-driven
353
+ method, status **`Implemented`**, and **references `CONVENTIONS.md`** for
354
+ the rules (it does not duplicate them). Keep it generic — no other
355
+ project's ADR numbers. **Skip only if the operator opted out.** For a
356
+ **split** repo (Q2) use the technology-ADR shape for the seed. If `plan/`
357
+ exists, also write a matching `plan/done/<date>-adopt-adr-method.md` (the
358
+ seed's completion event is this bootstrap), so plan-coverage stays
359
+ satisfied. On a **retrofit/backfill** (Step 6), the seed is `0001`, ahead
360
+ of the reconstructed decisions.
300
361
  6. `plan/README.md` — from `templates/plan-README.md`. Create empty
301
362
  `plan/todo/.gitkeep` and `plan/done/.gitkeep`.
302
- 7. `_agent/ROLES.md` — from `templates/_agent-ROLES.md`. Mode 1
363
+ 7. `_agent/ROLES.md` — from `templates/_agent-ROLES.md`. **If Q5 = None,
364
+ skip items 7–11 entirely — no `_agent/` directory.** Otherwise: Mode 1
303
365
  keeps the `default-agent` block; modes 2 and 3 expand to named
304
366
  agents per Q5.
305
367
  8. `_agent/LOCKS.md` — from `templates/_agent-LOCKS.md`. **Skip in
@@ -315,7 +377,8 @@ write it into the repo.
315
377
  `_agent/IN_FLIGHT.md` from `templates/_agent-IN_FLIGHT.md` as
316
378
  the committed cross-worktree dashboard.
317
379
  11. `_agent/HANDOFF.md` — from `templates/_agent-HANDOFF.md`.
318
- 12. Stub `INDEX.md` — header + empty table.
380
+ 12. `INDEX.md` — header + the seed ADR's row (item 5b); an empty table only
381
+ if the seed was declined.
319
382
  13. `_agent/prompts/autonomous.md` — from
320
383
  `templates/_agent-prompts-autonomous.md`, **only** if Q8 confirmed a
321
384
  verify gate. Keep the integration block matching Q4b: the
@@ -326,18 +389,30 @@ write it into the repo.
326
389
  configured artefact root (repository root by default).
327
390
  - **Establish:** write `federation-index.md` (the member index, a
328
391
  Markdown table) from `templates/federation-index.md` into this
329
- repo, seeded with this repo as the home member; and write
330
- `federation.md` from `templates/federation-config.md` with
331
- `Role: home`, the chosen topology, and the chosen identity scheme
332
- (default repo-prefixed slug). Record the identity scheme in both
333
- files so it is the same on every read.
392
+ repo, seeded with this repo as the first member; and write
393
+ `federation.md` from `templates/federation-config.md` with the
394
+ chosen topology, the chosen identity scheme (default repo-prefixed
395
+ slug), and this repo's **`Role` set from the topology**:
396
+ `central` for **A** (this repo holds all product-wide ADRs),
397
+ `coordinator` for **B** (this repo holds only the member index —
398
+ product-wide decisions are distributed and the roll-up is the
399
+ product-wide view), or `home` for **C** (this repo holds
400
+ product-wide ADRs; members keep local ADRs alongside). Record the
401
+ identity scheme in both files so it is the same on every read.
334
402
  - **Join:** write **only** `federation.md` from
335
403
  `templates/federation-config.md` with `Role: member`, the
336
404
  confirmed home pointer, and the topology **and identity scheme**
337
- inherited from the federation (read them from the home, do not
338
- re-ask). Write nothing into any other repo, and do **not** create a
339
- member index. Tell the user to add this repo to the home repo's
340
- `federation-index.md` (a deliberate edit there).
405
+ for the federation, **supplied by the operator at join** (recorded
406
+ into this repo's `federation.md`; no cross-repo read). Then apply
407
+ the **topology's member rule**: for **A**, this
408
+ repo references the central repo and does **not** hold product-wide
409
+ ADRs locally (its `adr/` is for local-implementation decisions
410
+ only); for **B**, this repo owns its own catalogue in full; for
411
+ **C**, this repo keeps local ADRs and references the home for
412
+ product-wide ones. Write nothing into any other repo, and do **not**
413
+ create a member index. Tell the user to add this repo to the
414
+ **index-holding repo's** `federation-index.md` — the home (C),
415
+ central (A), or coordinator (B) repo — a deliberate edit there.
341
416
 
342
417
  Commit each file (or logical group) with a Conventional Commit message;
343
418
  no `Co-Authored-By` trailer unless Q6 asked for one.
@@ -4,6 +4,10 @@
4
4
 
5
5
  Project name: <name>.
6
6
 
7
+ Artefact root: `<docs/ | . | .docflow/>` — `adr/`, `plan/`, `INDEX.md`, and
8
+ this file live under this root; `AGENTS.md` and `CLAUDE.md` always stay at
9
+ the repository root. Every lifecycle skill resolves paths against this root.
10
+
7
11
  <!-- Q1 language: if a language mandate is set, state it here.
8
12
  Example: "Language: en-GB throughout. Use forms such as organisation,
9
13
  behaviour, prioritise, catalogue, authorisation consistently across all
@@ -14,6 +18,14 @@ files." -->
14
18
  ADR filenames use `NNNN-kebab-case-slug.md`, zero-padded to 4 digits,
15
19
  with contiguous numbering and no reserved gaps.
16
20
 
21
+ The number is an **integer**; the four-digit zero-padding is a display
22
+ convention only — tools sort ADRs **numerically**, not lexically, so the
23
+ catalogue is not capped at `9999` (widen the padding to five digits if you
24
+ ever approach it; none do). Related ADRs may be **grouped** under
25
+ `domains/<slug>/README.md` without changing their numbers — grouping is a
26
+ curated view, not a separate namespace; the contiguous number stays the
27
+ single identity.
28
+
17
29
  Each ADR describes one decision. If a decision splits, supersede the
18
30
  original ADR and create new ADRs rather than expanding scope inside a
19
31
  single document.
@@ -31,6 +43,11 @@ Status lifecycle: `<from Q3>`.
31
43
  Terminal states (Superseded / Deprecated) are reachable from any prior
32
44
  state.
33
45
 
46
+ The first **persisted** status is `Proposed` — there is no separate `Draft`
47
+ state and no `brainstorming/`/`drafts/` folder. Work-in-progress lives in
48
+ the brainstorm conversation; only an approved decision is written, as a
49
+ numbered `Proposed` ADR.
50
+
34
51
  Cross-references link by relative path to `adr/NNNN-*.md`.
35
52
 
36
53
  ## ADR Shapes
@@ -165,6 +182,13 @@ once merged:
165
182
  - **G3 — gate backstop.** Integration is single-threaded; it rejects a
166
183
  duplicate number as the last line of defence, and the later author
167
184
  renumbers.
185
+ - **G4 — claim before do.** Before implementing a queued item, **claim it**
186
+ so two writers don't build the same thing: open a draft PR referencing
187
+ the item (the authoritative claim in PR-based / worktree repos), or record
188
+ an `owner` / `_agent/IN_FLIGHT.md` entry. An unclaimed `plan/todo` item on
189
+ `main` (which G1 deliberately puts there) is otherwise an open invitation
190
+ to duplicate effort. G1–G3 protect the *number*; G4 protects the *work
191
+ assignment*. `/audit`'s duplicate-plan-ownership check is the backstop.
168
192
  -->
169
193
 
170
194
  <!-- Federation (multi-repo) — bootstrap INCLUDES this section
@@ -177,13 +201,27 @@ This repo belongs to the **<product>** federation. Topology and the
177
201
  identity scheme are recorded in `federation.md`; the home repo's
178
202
  `federation-index.md` is the authoritative member list.
179
203
 
204
+ - **Where product-wide decisions live depends on the topology** (recorded
205
+ in `federation.md`):
206
+ - **A — central:** a single central repo holds **all** product-wide
207
+ ADRs; every other repo references them and never duplicates a
208
+ product-wide decision locally.
209
+ - **B — distributed:** **no** repo holds product-wide ADRs; each repo
210
+ owns its own catalogue and the roll-up is the product-wide view.
211
+ - **C — home + local:** the home repo holds product-wide ADRs; members
212
+ keep purely-local ADRs alongside and reference the home for
213
+ product-wide ones.
180
214
  - **Numbering is per-repo contiguous.** Each member repo numbers its own
181
215
  ADRs contiguously from `0001`; numbers are **not** unique across the
182
216
  federation. The cross-federation key is the **identity scheme** recorded
183
217
  in `federation.md` — default repo-prefixed slug `<repo-id>/NNNN-slug`.
184
218
  - **Cross-repo references use the logical identity**, resolved through the
185
- member index (`repo-id → location`); they survive a target repo move
186
- (edit one index row, not the references). **Same-repo references stay
219
+ member index along `repo-id → Pointer (repo root) adr/NNNN-*.md`: look
220
+ up the repo-id's `Pointer` in `federation-index.md`, then find
221
+ `adr/NNNN-*.md` under that repo. They survive a target repo move (edit
222
+ one index row, not the references). A **member repo holds no index**, so
223
+ it first reaches `federation-index.md` via its own `federation.md`
224
+ `Home` pointer, then resolves as above. **Same-repo references stay
187
225
  relative paths** (`adr/NNNN-*.md`).
188
226
  - `supersedes:` / `superseded-by:` may point across repos using the
189
227
  logical identity.
@@ -191,6 +229,24 @@ identity scheme are recorded in `federation.md`; the home repo's
191
229
  `federation.md` back-pointer; adding it to the home's
192
230
  `federation-index.md` is a deliberate edit there. The two must agree —
193
231
  audit cross-checks both directions.
232
+ - **Cross-repo work is one plan item per repo.** A decision implemented in
233
+ several repos gets one `plan/todo` item **per affected repo**, each in
234
+ the repo whose code it changes and naming the owning ADR by its
235
+ federation identity. The owning ADR is the single grouping point — its
236
+ per-repo items are discoverable from it; there is **no umbrella record**.
237
+ Per-repo "lower numbers first" ordering is unchanged.
238
+ - **Aggregate status is derived in the roll-up.** A cross-repo decision is
239
+ `Implemented` only when **every** owning per-repo plan item has shipped
240
+ (each under its own repo's completion event); until then it is partially
241
+ implemented. The aggregate ("2 of 3 repos") is a **derived column in the
242
+ roll-up**, computed from per-repo plan-item state — never hand-written
243
+ into the ADR, so no cross-repo writes.
244
+ - **Shared conventions come from one source.** Shared conventions and
245
+ templates are authoritative in the index-holding repo; members **copy
246
+ them at bootstrap** and may keep **local-only** conventions alongside.
247
+ Updates are **not** force-pushed — drift between a member's copy and the
248
+ source is **detected by audit**. Referenceable, not enforced; no
249
+ cross-repo writes.
194
250
  -->
195
251
 
196
252
  ## Audit Trail Policy
@@ -0,0 +1,81 @@
1
+ ---
2
+ adr: 0001
3
+ title: Record architecture decisions as ADRs
4
+ status: Implemented
5
+ date: <YYYY-MM-DD>
6
+ owner: <agent-id or human>
7
+ supersedes:
8
+ superseded-by:
9
+ depends-on: []
10
+ tags: [process, conventions]
11
+ ---
12
+
13
+ # ADR 0001 — Record architecture decisions as ADRs
14
+
15
+ <!-- Bootstrap writes this as the seed ADR (adr/0001) by default. It records
16
+ the *decision* to adopt the method; the operative rules live in
17
+ CONVENTIONS.md. Keep it generic — do not reference another project's ADR
18
+ numbers. For a split-shape repo, adapt to the technology-ADR shape. -->
19
+
20
+ ## Context
21
+
22
+ <Project> needs its significant decisions to be **discoverable, traceable,
23
+ and durable** — not held in chat logs, pull-request threads, or one
24
+ person's memory. The lightweight Architecture Decision Record practice
25
+ (Michael Nygard, 2011; the markdown-ADR convention) records each decision
26
+ as one small, numbered, immutable file stored beside the code, so the
27
+ reasons behind the system are part of the repository.
28
+
29
+ ## Capability statement
30
+
31
+ This repository is **documentation-led and ADR-driven**: every significant
32
+ decision is recorded as a numbered ADR under `adr/`; the catalogue is the
33
+ **source of truth** the running system is expected to match; and a status
34
+ lifecycle drives a `plan/` work queue. The authoring rules — ADR shape,
35
+ status lifecycle, numbering, audit trail, and git contract — live in
36
+ `CONVENTIONS.md`. This ADR records the **decision to adopt the practice**,
37
+ not the rules themselves.
38
+
39
+ ## User stories / scenarios
40
+
41
+ - As a contributor, I find the reasons behind this system in the catalogue,
42
+ not by asking someone.
43
+ - As a maintainer, each decision, the work that implements it, and the
44
+ commit that ships it are linked through one stable identifier.
45
+ - As a new reader, the first ADR explains why this repository uses ADRs and
46
+ points me at where the rules live.
47
+
48
+ ## Acceptance criteria
49
+
50
+ 1. Significant decisions are recorded as numbered ADRs under `adr/`,
51
+ following `CONVENTIONS.md`.
52
+ 2. The catalogue is the source of truth; code is expected to match the
53
+ decisions it records.
54
+ 3. ADR authoring, the status lifecycle, and the `plan/` queue follow
55
+ `CONVENTIONS.md`.
56
+
57
+ ## Out of scope
58
+
59
+ - The detailed authoring rules (ADR shape, lifecycle, numbering, git
60
+ contract) — these live in `CONVENTIONS.md`, not here.
61
+
62
+ ## Open questions
63
+
64
+ - None.
65
+
66
+ ## References / cross-links
67
+
68
+ - CONVENTIONS.md (the operative authoring rules)
69
+ - Michael Nygard, "Documenting Architecture Decisions" — https://adr.github.io
70
+
71
+ ## Revision History
72
+
73
+ | Date | Revision | Author | Change |
74
+ |------|----------|--------|--------|
75
+ | <YYYY-MM-DD> | r1 | <owner> | Adopted the documentation-led, ADR-driven method (seeded at bootstrap). |
76
+
77
+ ## Approvals
78
+
79
+ | Role | Name | Date | Signature |
80
+ |------|------|------|-----------|
81
+ | <role> | <name> | <YYYY-MM-DD> | — |
@@ -9,7 +9,7 @@ is my home?"; the home repo's `federation-index.md` is the answer to
9
9
  - **Topology:** <A — central decisions repo | B — distributed + federation | C — home repo + local>
10
10
  - **Identity scheme:** <repo-prefixed slug `<repo-id>/NNNN-slug` (default) | other scheme chosen at establishment>
11
11
  - **Home:** <pointer to the home/central repo — URL or path; for the home repo itself, `this repo`>
12
- - **Role:** <home | member>
12
+ - **Role:** <central | home | coordinator | member — the establishing repo's role is set by the topology (central for A, coordinator for B, home for C); every joining repo is `member`>
13
13
  - **Repo id:** <short identifier for this repo, used to qualify its records across the federation>
14
14
 
15
15
  <!-- Hand-maintained. Membership is declared, not auto-discovered: a
@@ -11,7 +11,12 @@ skills read this to enumerate the product's repos.
11
11
 
12
12
  | Repo id | Repo | Role | Pointer |
13
13
  |---------|------|------|---------|
14
- | <id> | <this repo> | home | this repo |
14
+ | <id> | <this repo> | <central\|home\|coordinator> | this repo |
15
+
16
+ <!-- Role values: the establishing repo is `central` (topology A),
17
+ `coordinator` (B), or `home` (C); every other member is `member`.
18
+ Pointer `this repo` means the repo that holds this index (the
19
+ index-holder); resolve every other Pointer relative to it. -->
15
20
 
16
21
  <!-- Each row should have a matching federation.md back-pointer in the
17
22
  named repo, and vice versa. The audit step cross-checks both directions. -->
@@ -15,7 +15,9 @@ Author one new ADR, consistent with this repo's conventions.
15
15
  2. Read `CONVENTIONS.md` to learn this repo's choices: ADR shape
16
16
  (single vs. capability/technology split and the cutoff number),
17
17
  status lifecycle, language mandate (if any), whether `domains/`
18
- groupings exist, and the multi-agent mode.
18
+ groupings exist, the multi-agent mode, and the **artefact root**
19
+ (default: repository root) — resolve `adr/` and `INDEX.md` against it
20
+ (`AGENTS.md`/`CLAUDE.md` stay at the repo root).
19
21
  3. Read `INDEX.md` and `ls adr/` to learn existing numbers and titles.
20
22
  4. If a `federation.md` exists, this repo is part of a multi-repo
21
23
  product. Note the **identity scheme** and the **home** it records —
@@ -84,8 +86,8 @@ If this ADR replaces an existing one:
84
86
  History row noting the successor.
85
87
  - **Same-repo** links use relative paths (`adr/NNNN-*.md`). **In a
86
88
  federation**, a link to an ADR in another repo uses the logical
87
- identity (`<repo-id>/NNNN-slug`), resolved via the member index — not
88
- a relative path.
89
+ identity (`<repo-id>/NNNN-slug`), resolved via the member index along
90
+ `repo-id → Pointer → adr/NNNN-*.md` — not a relative path.
89
91
  - A pure deprecation (no successor) sets the target to `Deprecated`
90
92
  with a Revision History row — and is usually done directly, not via
91
93
  this skill.
@@ -13,7 +13,8 @@ Add one item to the implementation queue.
13
13
  repo was bootstrapped without a plan folder (Q4a = skip), stop and
14
14
  say so — there is no queue to add to.
15
15
  2. Read `CONVENTIONS.md` for the plan-folder convention and the
16
- completion event, and `plan/README.md` if present.
16
+ completion event, and `plan/README.md` if present. Resolve `plan/`
17
+ against the **artefact root** recorded there (default: repository root).
17
18
  3. `ls plan/todo/` to learn existing numbers and priority ordering.
18
19
 
19
20
  ## Step 0.5 — Assessment (run first)
@@ -52,6 +53,12 @@ Questions (skip any the request already answers):
52
53
  still `Proposed`, warn — you can queue ahead of acceptance, but the
53
54
  work is not yet authorised. If it has no ADR at all, suggest running
54
55
  the **new-adr** skill first; plan items should trace to a decision.
56
+ - **In a federation** (a `federation.md` exists): the owning ADR may live
57
+ in **another** repo (the home/central). Name it by its **federation
58
+ identity** (`<repo-id>/NNNN-slug`); the plan item itself lives in **this**
59
+ repo — the one whose code the work changes. A decision spanning several
60
+ repos gets **one item per affected repo**, each tracing to the same
61
+ owning ADR (the grouping point — no umbrella record).
55
62
 
56
63
  ## Step 2 — Pick number and position
57
64
 
@@ -12,11 +12,13 @@ from source, never hand-edited — treat it exactly like a repo's own
12
12
 
13
13
  ## Step 0 — Preconditions
14
14
 
15
- 1. This skill runs in the **home repo** of a federation. Confirm a
16
- `federation-index.md` (the authoritative member list) and a
17
- `federation.md` with `Role: home` exist. If they do not, stop: either
18
- this repo is standalone (nothing to roll up) or it is a member, not the
19
- home point the user at the home repo.
15
+ 1. This skill runs in the **index-holding repo** of a federation the one
16
+ that carries `federation-index.md` (its `Role` is `central` for
17
+ topology A, `coordinator` for B, or `home` for C). Confirm
18
+ `federation-index.md` and a `federation.md` whose `Role` is `central`,
19
+ `home`, or `coordinator` exist. If they do not, stop: either this repo
20
+ is standalone (nothing to roll up) or it is a plain member — point the
21
+ user at the index-holding repo.
20
22
  2. Read `federation.md` to learn the **identity scheme** (default
21
23
  repo-prefixed slug `<repo-id>/NNNN-slug`); roll-up rows use it.
22
24
 
@@ -38,6 +40,12 @@ For every member whose checkout is **locally available** at its pointer:
38
40
  A member's own `INDEX.md` stays authoritative for that member; this skill
39
41
  only reads it.
40
42
 
43
+ For the **aggregate status** of a product-wide decision (one with owning
44
+ per-repo plan items across several members), also scan each member's
45
+ `plan/todo/` (pending) and `plan/done/` (shipped) for items naming that
46
+ decision's federation identity — that per-repo state feeds the aggregate
47
+ column in Step 4.
48
+
41
49
  ## Step 3 — Handle unreachable members
42
50
 
43
51
  A member named in the index whose checkout is **not locally available** is
@@ -47,12 +55,17 @@ visible rather than silent.
47
55
 
48
56
  ## Step 4 — Write the roll-up
49
57
 
50
- Write the aggregate to a derived file in the home repo (e.g. `ROLLUP.md`):
58
+ Write the aggregate to **`ROLLUP.md`** at the configured artefact root (the
59
+ same root as `INDEX.md`), so every re-run overwrites the same file:
51
60
 
52
61
  - A header stating it is **generated — do not hand-edit**, with the run
53
62
  date and the set of members aggregated.
54
63
  - One table across the whole product: federation identity, title, status,
55
64
  owning repo, date. Group or sort by owning repo for readability.
65
+ - For product-wide decisions, an **aggregate status** column **derived**
66
+ from per-repo plan-item state: `Implemented` only when every owning
67
+ per-repo plan item is in a member's `plan/done/`, otherwise `N of M
68
+ repos` shipped. This column is derived — never written back into any ADR.
56
69
  - The "Not aggregated this run" list from Step 3.
57
70
 
58
71
  Do not alter any member's `INDEX.md` and do not write into any other repo.
@@ -14,7 +14,9 @@ order-sensitive operation in the system — follow the steps exactly.
14
14
  2. Read `CONVENTIONS.md` and `AGENTS.md` for: the **integration model**
15
15
  (direct-to-main fast-forward vs. PR-based with required CI), the
16
16
  **verify gate** command, the **multi-agent mode**, and the Git
17
- contract (signed commits, tags, trailers).
17
+ contract (signed commits, tags, trailers). Resolve `adr/`, `plan/`, and
18
+ `INDEX.md` against the **artefact root** recorded in `CONVENTIONS.md`
19
+ (default: repository root).
18
20
 
19
21
  ## Step 1 — Select the item
20
22
 
@@ -53,6 +55,9 @@ Once the change is on `main`:
53
55
 
54
56
  ## Step 6 — Record
55
57
 
58
+ **If `_agent/` was omitted at bootstrap (Q5 = None), skip this step** — git
59
+ history is the record.
60
+
56
61
  - Append a one-line `_agent/WORKLOG.md` row: branch, HEAD, verify
57
62
  result, any deferral.
58
63
  - Update the live snapshot: `_agent/CURRENT_FOCUS.md` in single-checkout