@evolvehq/docflow 0.4.3 → 0.6.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.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # docflow
2
2
 
3
+ ![docflow — ADR-driven documentation workflow](docs/preview.png)
4
+
3
5
  A plugin for **ADR-driven, documentation-led projects**, working on both
4
6
  the **pi** and **Claude Code** coding agents from the same skill files.
5
7
  It installs a `bootstrap` skill that scaffolds (or retrofits) an
@@ -21,7 +23,7 @@ agent the same skills are invoked as `/skill:<name>` (e.g.
21
23
  | new-adr | `/new-adr` | Author one ADR — next contiguous number, right shape, INDEX + domain wiring, supersede linkage. |
22
24
  | new-plan | `/new-plan` | Add a `plan/todo` item tracing to its owning ADR(s). |
23
25
  | ship-item | `/ship-item` | Run the completion event: verify → integrate → `todo`→`done` → ADR `Accepted`→`Implemented` → INDEX/WORKLOG. |
24
- | add-convention | `/add-convention` | Assess whether a convention is worth codifying, route it to the right home (or to an ADR), then add it. |
26
+ | add-convention | `/add-convention` | Assess whether a convention is worth codifying, route it to the right home (or to an ADR), then add it. Use it to enable optional practices (e.g. TDD) on demand — see [USAGE §5a](USAGE.md). |
25
27
  | audit | `/audit` | Lint the repo against its own conventions — numbering, INDEX sync, plan coverage, **ADR-privacy leaks**, more. |
26
28
  | brainstorm | `/brainstorm` | Decompose a problem into candidate ADRs + plan items (proposes drafts; writes nothing until approved). |
27
29
  | agent-wave | `/agent-wave` | Orchestrate a wave of parallel worktree subagents over the queue, with checkpoint or continuous supervision. |
package/USAGE.md CHANGED
@@ -195,6 +195,70 @@ It requires a multi-agent mode (Q5 mode 2 or 3) and works best in mode
195
195
  Continuous-unsupervised runs are recommended only with PR-based
196
196
  integration, so CI gates each merge.
197
197
 
198
+ ### Enabling an optional convention later (worked example: TDD)
199
+
200
+ docflow's bootstrap is deliberately lean — practices such as
201
+ test-driven development are **not** baked in. You enable them whenever
202
+ you want with `/add-convention`; there is no dedicated command per
203
+ practice, and you don't have to re-bootstrap.
204
+
205
+ Say *"add a convention: implement plan items test-first"* (or just run
206
+ `/add-convention` and describe the rule). The skill will:
207
+
208
+ 1. **Assess** whether it is worth codifying. TDD passes — it is a
209
+ durable, repo-wide rule, not a one-off, a duplicate, or churn-prone.
210
+ 2. **Route** it to the right home: a short **hard rule** in `AGENTS.md`
211
+ plus the detail in `CONVENTIONS.md`. (It would not make this a
212
+ GLOSSARY term, and it is not a single decision, so not an ADR.)
213
+ 3. **Write** it, agent-neutral, so it holds on Claude Code and pi alike.
214
+
215
+ A typical result — a new `CONVENTIONS.md` section:
216
+
217
+ > ## Test-Driven Development
218
+ > Implement each `plan/todo` item test-first. For every numbered
219
+ > acceptance criterion in the owning ADR, write a failing test before
220
+ > the code that satisfies it, then make it pass, then refactor. An item
221
+ > is not shippable until its criteria have passing tests mapped back to
222
+ > them.
223
+
224
+ and a matching `AGENTS.md` hard-rule bullet:
225
+
226
+ > - **TDD:** write the failing test for an acceptance criterion before
227
+ > implementing it; map tests back to the owning ADR's criteria.
228
+
229
+ This rides docflow's existing rule that *acceptance criteria are
230
+ testable and numbered* — TDD simply fixes the order (test → code). To
231
+ turn it off, delete those sections (or re-run `/add-convention` and say
232
+ it no longer applies); to make it enforceable, add the test command to
233
+ the verify gate. Any other "we should always X" practice is enabled the
234
+ same way — `/add-convention` is the single path.
235
+
236
+ ### Concurrent ADR/plan creation (the numbering race)
237
+
238
+ ADR and `plan/todo` numbers are contiguous and chosen at authoring time,
239
+ so two branches/worktrees can both grab the same "next" number and
240
+ collide at merge. docflow keeps the numbers (they stay short, ordered,
241
+ and the stable cross-reference key — no UUIDs, no rename-breaks-refs) and
242
+ closes the race with **process guardrails** instead of a new identity
243
+ scheme:
244
+
245
+ - **G1 — decide before do** *(recommended):* prefer to land an ADR + its
246
+ plan items on `main` before implementation work begins.
247
+ - **G2 — check before merge** *(primary defence):* before integrating,
248
+ sync onto the current `main` and run the audit; if your number now
249
+ clashes with what landed, renumber locally **before** merging — a
250
+ trivial change (a new ADR/plan names its own number only in its file
251
+ and `INDEX.md`).
252
+ - **G3 — gate backstop:** the single-threaded merge gate rejects a
253
+ duplicate; the later author renumbers.
254
+
255
+ `bootstrap` **pre-wires** these into `CONVENTIONS.md` + an `AGENTS.md`
256
+ hard rule **only** for multi-agent (mode 2/3) or PR-based repos.
257
+ **Single-agent / direct-to-main repos have no race by construction** and
258
+ get none of this ceremony. Numbers are immutable once merged. (For
259
+ orchestrated runs, `agent-wave` additionally *reserves* disjoint number
260
+ blocks up front, so G2/G3 rarely fire.)
261
+
198
262
  ## 6. Customising or extending
199
263
 
200
264
  The templates are deliberately small and self-contained. To customise:
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolvehq/docflow",
3
- "version": "0.4.3",
3
+ "version": "0.6.0",
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, and audit ADRs with lifecycle skills. Works with the pi coding agent and Claude Code.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -16,8 +16,13 @@
16
16
  "url": "git+https://github.com/EvolveHQ/docflow.git"
17
17
  },
18
18
  "homepage": "https://github.com/EvolveHQ/docflow",
19
+ "scripts": {
20
+ "verify": "node scripts/verify.mjs",
21
+ "evals": "node evals/run.mjs"
22
+ },
19
23
  "files": [
20
24
  "skills/",
25
+ "docs/preview.png",
21
26
  "README.md",
22
27
  "USAGE.md",
23
28
  "LICENSE"
@@ -26,6 +31,7 @@
26
31
  "access": "public"
27
32
  },
28
33
  "pi": {
29
- "skills": ["./skills"]
34
+ "skills": ["./skills"],
35
+ "image": "https://raw.githubusercontent.com/EvolveHQ/docflow/main/docs/preview.png"
30
36
  }
31
37
  }
@@ -15,6 +15,36 @@ stenographer.
15
15
  2. Read `CONVENTIONS.md` and `AGENTS.md` in full so you can detect
16
16
  overlap with existing rules and judge fit.
17
17
 
18
+ ## Step 0.5 — Assessment (run first)
19
+
20
+ Run the shared assessment protocol; the triage (Step 1) and routing
21
+ (Step 2) questions are asked under it:
22
+
23
+ - **Opt-out gate first.** Ask whether to run the assessment or skip to
24
+ drafting. Recommend **running** it when the request arrived with little
25
+ or no context; recommend **skipping** when the convention and its home
26
+ are already clear.
27
+ - Ask questions **one at a time**, each with a **recommended option** and
28
+ a one-line reason; wait for each answer.
29
+ - Use **structured selection** (single- or multiple-choice). If the host
30
+ exposes a structured single-/multi-select question tool, use it and
31
+ mark the recommended option; otherwise list options A/B/C in plain text
32
+ and name the recommended one. Use **free text only** where an
33
+ enumerable set is impossible (e.g. the exact wording).
34
+ - **The operator decides.** Never proceed past a question without an
35
+ answer, and never guess scope when invoked with no context.
36
+
37
+ Questions (skip any the request already answers):
38
+ 1. **Worth codifying?** — yes (recurring, stable, testable) or no
39
+ (one-off, duplicate, churn-prone, vague). *Recommended: per the Step 1
40
+ triage; this question gates the rest.*
41
+ 2. **Home** — `AGENTS.md` hard rule / `CONVENTIONS.md` guidance /
42
+ `GLOSSARY.md` term / actually a decision (hand off to the **new-adr**
43
+ skill). *Recommended: per the rule's nature (see Step 2).*
44
+ 3. **Enforce in the verify gate?** — yes / no. *Recommended: no, unless
45
+ the rule is mechanically checkable.*
46
+ 4. **Wording** — free text (the rule statement itself).
47
+
18
48
  ## Step 1 — Assess: is this worth codifying?
19
49
 
20
50
  Apply triage. Recommend **against** adding when:
@@ -32,6 +32,25 @@ you there rather than pretending to be it.
32
32
  - **Mode 3 (worktrees):** the intended mode. Each subagent works in
33
33
  its own isolated worktree.
34
34
 
35
+ ## Step 0.5 — Assessment (run first)
36
+
37
+ Run the shared assessment protocol before spawning anything:
38
+
39
+ - **Opt-out gate first.** Ask whether to run the assessment or proceed on
40
+ recommended defaults. Recommend **running** it when the request arrived
41
+ with little or no context (e.g. a bare "fan out the queue"); recommend
42
+ **skipping** when width, budget, supervision, and merge strategy were
43
+ all specified.
44
+ - The Step 1 parameters **are** the assessment questions: ask them **one
45
+ at a time**, each with a **recommended option** and a one-line reason;
46
+ wait for each answer.
47
+ - Use **structured selection** (single- or multiple-choice). If the host
48
+ exposes a structured single-/multi-select question tool, use it and
49
+ mark the recommended option; otherwise list options A/B/C in plain text
50
+ and name the recommended one. Use free text only where unavoidable.
51
+ - **The operator decides.** Never spawn a wave without confirmed
52
+ parameters, and never guess when invoked with no context.
53
+
35
54
  ## Step 1 — Ask the wave parameters (one at a time, recommend)
36
55
 
37
56
  1. **Wave width N** — how many agents per wave.
@@ -42,6 +61,11 @@ you there rather than pretending to be it.
42
61
  continue) or **continuous** (run wave after wave until budget/queue
43
62
  exhausted).
44
63
  *Recommended: checkpoint* for the first run on a repo.
64
+ 4. **Merge / integration strategy** — how each shipped item lands.
65
+ *Recommended: follow the repo's integration model* (read it from
66
+ `CONVENTIONS.md`). Override options: **local fast-forward**,
67
+ **PR-based**, or **other**. This sets how each subagent integrates in
68
+ Step 3 and what "shipped" means for the wave.
45
69
 
46
70
  Cross-check: **continuous + direct-to-main** is risky — nothing gates
47
71
  each merge. If the repo is direct-to-main, recommend either switching
@@ -53,17 +77,39 @@ every merge.
53
77
  - Read `plan/todo/`; take the lowest-numbered N items with no unmet
54
78
  dependencies. Two agents must never get the same item or items that
55
79
  edit the same files — partition by item and, in mode 2, by LOCKS.
80
+ - **Reserve identifiers before spawning.** Parallel worktrees that each
81
+ author an ADR or a `plan/` item will otherwise collide on the same
82
+ next number — each worktree computes "next" against its own checkout,
83
+ so two will pick the same one and break the contiguous-numbering
84
+ invariant at merge. Before the wave:
85
+ - Compute the current highest ADR number and `plan/todo` slot.
86
+ - Hand each agent a **disjoint reserved block** — e.g. agent A may
87
+ create ADRs `0042+` and plan slots `0007+`, agent B `0043+` /
88
+ `0008+`, interleaved so no two blocks overlap. Most queue items
89
+ implement an existing ADR and need none — reserve only for items
90
+ that will author new ADRs/plans.
91
+ - An agent uses only its reserved identifiers; if it needs more than
92
+ reserved, it stops and reports rather than guessing.
93
+ - **Single writer per artefact.** An ADR body (or a given `plan/` item)
94
+ is edited by at most one worktree per wave. Never put two items that
95
+ both edit the same ADR in one wave — a `merge=union` would silently
96
+ concatenate contradictory edits into an incoherent document.
56
97
  - Record the assignment in `_agent/IN_FLIGHT.md` (mode 3) so the wave is
57
- visible.
98
+ visible — including each agent's reserved identifier block.
58
99
 
59
100
  ## Step 3 — Spawn the wave
60
101
 
61
102
  Spawn N subagents in parallel, each in an isolated worktree
62
103
  (`isolation: worktree`). Brief each with: its assigned queue item, the
63
104
  instruction to follow `_agent/prompts/autonomous.md` end-to-end for that
64
- one item (orient → implement → verify → integrate per the repo's model
65
- ship), and to report back a structured result (item, pass/fail, HEAD or
66
- PR link, any blocker).
105
+ one item (orient → implement → verify → **check before merge (G2)**
106
+ integrate per the repo's model → ship), and to report back a structured
107
+ result (item, pass/fail, HEAD or PR link, any blocker). The G2 step:
108
+ before integrating, sync onto the current `main` and run the **audit**
109
+ skill; if the item's new ADR/plan number now clashes with what landed,
110
+ renumber locally
111
+ before merging. (Reservation in Step 2 makes this rare; G2 catches what
112
+ slips through, e.g. an out-of-band ADR landing mid-wave.)
67
113
 
68
114
  ## Step 4 — Collect and checkpoint
69
115
 
@@ -1,65 +1,81 @@
1
- ---
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, and ADR-privacy leaks into user-visible code. 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
- ---
5
-
6
- # audit
7
-
8
- Check a documentation-led repo against the conventions it declares.
9
- This is the enforcement `AGENTS.md` cannot guarantee on its own.
10
-
11
- ## Step 0 — Preconditions and context
12
-
13
- 1. Confirm the repo is bootstrapped.
14
- 2. Read `CONVENTIONS.md` to learn what to enforce: ADR shape and
15
- cutoff, status lifecycle, integration model, multi-agent mode,
16
- language mandate, optional artefacts present (GLOSSARY, domains/),
17
- and any Q10 domain hard rules.
18
-
19
- ## Step 1 — Run the checks (read-only)
20
-
21
- Report each as PASS / FAIL / N/A with specifics (file + line where
22
- relevant):
23
-
24
- 1. **Numbering.** ADR filenames contiguous, zero-padded, no gaps, no
25
- duplicates. Split repos: capability below cutoff, technology at/above.
26
- 2. **INDEX sync.** Every ADR appears in `INDEX.md`; every INDEX row has
27
- a matching file; metadata fields (status, title, date) agree.
28
- 3. **Plan coverage.** Every `Accepted` ADR has a `plan/todo/` item;
29
- every `Implemented` ADR has a `plan/done/` entry. Flag orphans both
30
- ways.
31
- 4. **Section completeness.** Each ADR has the required sections in the
32
- order its shape mandates. Acceptance criteria are numbered.
33
- 5. **Status validity.** Every `status:` is in the declared lifecycle.
34
- `Superseded` ADRs name a successor in `superseded-by:`; the successor
35
- names them in `supersedes:` (symmetry).
36
- 6. **Revision/Approvals.** Revision History present; Approvals populated
37
- for ADRs at `Accepted` or beyond.
38
- 7. **Cross-references.** Relative `adr/NNNN-*.md` links resolve to real
39
- files. Glossary anchors (if used) resolve.
40
- 8. **Language mandate.** If set, spot-check user-facing docs for the
41
- required spellings.
42
- 9. **ADR-privacy leaks.** Grep source / product directories for ADR
43
- identifiers in user-visible strings — patterns like `ADR 0042`,
44
- `adr-0042`, `see ADR`, ADR titles — in UI copy, API responses,
45
- error messages, customer-facing logs, public docs, release notes.
46
- Report each suspect; this rule is easy to violate by reflex.
47
- 10. **Coordination hygiene.** `_agent/LOCKS.md` has no stale claims
48
- (mode 2); `_agent/IN_FLIGHT.md` rows match live worktrees (mode 3).
49
-
50
- ## Step 2 Report
51
-
52
- Lead with a one-line verdict (clean / N issues). Then the punch list,
53
- grouped by severity: **blocking** (privacy leaks, status/lifecycle
54
- violations, broken cross-refs), **drift** (INDEX out of sync, missing
55
- plan files), **hygiene** (stale locks, formatting).
56
-
57
- ## Step 3Offer fixes
58
-
59
- Offer to fix the **mechanical** issues automatically: regenerate
60
- `INDEX.md`, create missing `plan/todo` stubs, clear stale locks, fix
61
- broken relative links. **Do not** auto-edit ADR content, rewrite
62
- acceptance criteria, or remove suspected privacy leaks without the
63
- user confirming each — those need judgement. Commit fixes as
64
- `fix(adr): ...` / `docs: ...` with a `Rationale:` footer where an ADR
65
- is touched.
1
+ ---
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, and cross-worktree collisions (duplicate numbers, duplicate plan ownership, same ADR edited on two branches). 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
+ ---
5
+
6
+ # audit
7
+
8
+ Check a documentation-led repo against the conventions it declares.
9
+ This is the enforcement `AGENTS.md` cannot guarantee on its own.
10
+
11
+ ## Step 0 — Preconditions and context
12
+
13
+ 1. Confirm the repo is bootstrapped.
14
+ 2. Read `CONVENTIONS.md` to learn what to enforce: ADR shape and
15
+ cutoff, status lifecycle, integration model, multi-agent mode,
16
+ language mandate, optional artefacts present (GLOSSARY, domains/),
17
+ and any Q10 domain hard rules.
18
+
19
+ ## Step 1 — Run the checks (read-only)
20
+
21
+ Report each as PASS / FAIL / N/A with specifics (file + line where
22
+ relevant):
23
+
24
+ 1. **Numbering.** ADR filenames contiguous, zero-padded, no gaps, no
25
+ duplicates. Split repos: capability below cutoff, technology at/above.
26
+ 2. **INDEX sync.** Every ADR appears in `INDEX.md`; every INDEX row has
27
+ a matching file; metadata fields (status, title, date) agree.
28
+ 3. **Plan coverage.** Every `Accepted` ADR has a `plan/todo/` item;
29
+ every `Implemented` ADR has a `plan/done/` entry. Flag orphans both
30
+ ways.
31
+ 4. **Section completeness.** Each ADR has the required sections in the
32
+ order its shape mandates. Acceptance criteria are numbered.
33
+ 5. **Status validity.** Every `status:` is in the declared lifecycle.
34
+ `Superseded` ADRs name a successor in `superseded-by:`; the successor
35
+ names them in `supersedes:` (symmetry).
36
+ 6. **Revision/Approvals.** Revision History present; Approvals populated
37
+ for ADRs at `Accepted` or beyond.
38
+ 7. **Cross-references.** Relative `adr/NNNN-*.md` links resolve to real
39
+ files. Glossary anchors (if used) resolve.
40
+ 8. **Language mandate.** If set, spot-check user-facing docs for the
41
+ required spellings.
42
+ 9. **ADR-privacy leaks.** Grep source / product directories for ADR
43
+ identifiers in user-visible strings — patterns like `ADR 0042`,
44
+ `adr-0042`, `see ADR`, ADR titles — in UI copy, API responses,
45
+ error messages, customer-facing logs, public docs, release notes.
46
+ Report each suspect; this rule is easy to violate by reflex.
47
+ 10. **Coordination hygiene.** `_agent/LOCKS.md` has no stale claims
48
+ (mode 2); `_agent/IN_FLIGHT.md` rows match live worktrees (mode 3).
49
+ 11. **Cross-worktree collisions** (mode 3, or when auditing across
50
+ unmerged branches). These catch semantic conflicts that a
51
+ line-level git merge cannot:
52
+ - **Duplicate ADR or plan/todo numbers** two ADR files, or two
53
+ `plan/todo/` items, (across branches/worktrees) claiming the same
54
+ `NNNN`. Distinct from check 1, which only sees one tree. This is the
55
+ collision the concurrency guardrails (G2 pre-merge / G3 gate) guard
56
+ against; flag it so the later author renumbers.
57
+ - **Duplicate plan ownership** two `plan/todo/` items naming the
58
+ same owning ADR for the same scope, i.e. two worktrees building
59
+ the same thing.
60
+ - **Same ADR edited on two unmerged branches** — compare ADR files
61
+ across the live worktrees / open PRs; flag any ADR modified in
62
+ more than one. A `merge=union` would concatenate them silently.
63
+ Cross-check against `_agent/IN_FLIGHT.md`: every collision should
64
+ correspond to a reservation/ownership violation recorded there.
65
+
66
+ ## Step 2 — Report
67
+
68
+ Lead with a one-line verdict (clean / N issues). Then the punch list,
69
+ grouped by severity: **blocking** (privacy leaks, status/lifecycle
70
+ violations, broken cross-refs), **drift** (INDEX out of sync, missing
71
+ plan files), **hygiene** (stale locks, formatting).
72
+
73
+ ## Step 3 — Offer fixes
74
+
75
+ Offer to fix the **mechanical** issues automatically: regenerate
76
+ `INDEX.md`, create missing `plan/todo` stubs, clear stale locks, fix
77
+ broken relative links. **Do not** auto-edit ADR content, rewrite
78
+ acceptance criteria, or remove suspected privacy leaks without the
79
+ user confirming each — those need judgement. Commit fixes as
80
+ `fix(adr): ...` / `docs: ...` with a `Rationale:` footer where an ADR
81
+ is touched.
@@ -240,8 +240,12 @@ template, fill its placeholders from the assessment answers, then
240
240
  write it into the repo.
241
241
 
242
242
  1. `CONVENTIONS.md` — from `templates/CONVENTIONS.md`. Spec other files
243
- reference.
244
- 2. `AGENTS.md` from `templates/AGENTS.md`.
243
+ reference. Include the **§Concurrency Guardrails** section only if Q5
244
+ is mode 2/3 **or** Q4b is PR-based; omit it for single-agent
245
+ direct-to-main repos (no numbering race).
246
+ 2. `AGENTS.md` — from `templates/AGENTS.md`. Include the concurrency
247
+ guardrails hard-rule bullet (G2/G3) under the same condition as the
248
+ CONVENTIONS section above; omit otherwise.
245
249
  3. `CLAUDE.md` — from `templates/CLAUDE.md` (single line `@AGENTS.md`).
246
250
  4. `adr/0000-template.md` — from `templates/adr-capability.md`.
247
251
  5. `adr/NNNN-template.md` — from `templates/adr-technology.md`, only if
@@ -1,157 +1,169 @@
1
- # AGENTS.md
2
-
3
- This file provides guidance to coding agents working in this repository.
4
-
5
- ## What this repository is
6
-
7
- <One paragraph. Project purpose, current baseline, what the artefacts in
8
- this repo represent.>
9
-
10
- ## Repository structure
11
-
12
- - `adr/0000-template.md` — canonical ADR template.
13
- <!-- If technology-ADR split (Q2): also include `adr/NNNN-template.md` for technology ADRs. -->
14
- - `adr/NNNN-<kebab-slug>.md` — one ADR per decision, contiguous
15
- numbering, no gaps.
16
- - `INDEX.md` — table regenerated from every ADR's metadata block.
17
- - `CONVENTIONS.md` — authoring rules (read before editing anything).
18
- - `plan/todo/NNNN-<slug>.md` — pending work, lower numbers run first.
19
- - `plan/done/<YYYY-MM-DD>-<slug>.md` — shipped work, chronological.
20
- - `_agent/` — multi-agent coordination: `ROLES.md`, `LOCKS.md`,
21
- `WORKLOG.md`, `CURRENT_FOCUS.md`, `HANDOFF.md`, `prompts/`.
22
- <!-- If GLOSSARY.md (Q7): also include `GLOSSARY.md` — shared terms. -->
23
- <!-- If domains/ (Q7): also include `domains/<slug>/README.md`. -->
24
-
25
- ## Hard rules when editing ADRs
26
-
27
- These come from `CONVENTIONS.md` and override default behaviour:
28
-
29
- - **One decision per ADR.** Splits become new ADRs that supersede;
30
- never expand scope inside an existing one.
31
- - **Status lifecycle:** `<from Q3>`.
32
- - **Capability ADR section order:** metadata → Context → Capability
33
- statement → User stories / scenarios → Acceptance criteria → Out of
34
- scope → Open questions → References → Revision History → Approvals.
35
- <!-- If technology-ADR split (Q2): -->
36
- - **Technology ADR section order:** metadata → Context → Decision →
37
- Rationale → Consequences → Acceptance criteria → Out of scope → Open
38
- questions → References → Revision History → Approvals. Rationale must
39
- name alternatives considered with specific rejection reasons.
40
- - **Acceptance criteria are testable and numbered.**
41
- - **ADRs are internal artefacts — never user-visible.** ADR numbers,
42
- ADR titles, and the existence of the ADR catalogue must NEVER appear
43
- in any string the product emits to users: UI copy, API response
44
- bodies, error messages, customer-visible log lines, public
45
- documentation, release notes, marketing copy, or support
46
- communications. The catalogue is a builder's tool, not a user-facing
47
- surface. References ARE allowed in: code comments
48
- (`// see adr/0042-foo.md`), commit messages, PR descriptions,
49
- internal docs, `AGENTS.md`, `CONVENTIONS.md`, `INDEX.md`, and the
50
- `plan/` queue. Rule of thumb: if a non-builder could ever see the
51
- string, the ADR reference comes out.
52
- <!-- Insert any Q10 domain-specific hard rules here as additional bullets. -->
53
-
54
- ## Implementation work
55
-
56
- - Start from the ADRs. Identify which ADRs a code change implements or
57
- affects before changing behaviour.
58
- - If implementation reveals a capability gap or changed decision, update
59
- the relevant ADR rather than silently diverging.
60
- - Add or update tests for implemented behaviour. Map tests back to ADR
61
- acceptance criteria where practical.
62
- - **Do not leak ADR identifiers into user-visible surfaces.** When
63
- writing error messages, UI copy, API responses, log lines that ship
64
- to customers, public docs, or release notes, refer to the behaviour
65
- by its product-level name — never by ADR number, ADR title, or
66
- phrases like "per the ADR catalogue". The ADR link belongs in the
67
- commit message and (optionally) an inline code comment, not in the
68
- string the user reads.
69
-
70
- ## Audit trail and revision discipline
71
-
72
- - Substantive ADR changes append a row to the Revision History table.
73
- Editorial changes (typos, formatting, link fixes) are excluded but
74
- flagged `editorial` in the commit message.
75
- - Approvals table populates when an ADR is Accepted and updates on each
76
- later substantive revision.
77
- - Regenerate `INDEX.md` from ADR metadata after any ADR status change
78
- or new ADR.
79
-
80
- ## Multi-agent workflow
81
-
82
- <!-- Mode 1 — single agent (Q5 default). Keep this block. -->
83
- A single agent owns this repo. The `_agent/` directory tracks live
84
- state and history; LOCKS discipline is not in use.
85
-
86
- <!-- Mode 2 — multi-agent, shared checkout. Replace the block above with: -->
87
- <!--
88
- Work is partitioned across named agents (see `_agent/ROLES.md`).
89
- Coordination rules:
90
- - Before editing a file, claim it in `_agent/LOCKS.md` by appending
91
- `<agent-id> | <path> | <ISO-8601 timestamp>`. Remove the line on
92
- commit. LOCKS is a filesystem mutex — it prevents simultaneous
93
- writes to the same file.
94
- - Append a one-line entry to `_agent/WORKLOG.md` on every commit.
95
- - `_agent/CURRENT_FOCUS.md` is the single in-flight snapshot
96
- (branch, active queue item, blockers, uncommitted work). Update it
97
- when state changes.
98
- -->
99
-
100
- <!-- Mode 3 — multi-agent, separate worktrees / PR branches. Replace
101
- the block above with: -->
102
- <!--
103
- Work is partitioned across named agents (see `_agent/ROLES.md`).
104
- Each agent works in its own git worktree or PR branch.
105
- Coordination rules:
106
- - **GitHub draft PRs / branch assignment are the authoritative lock.**
107
- `_agent/LOCKS.md` is advisory only — append an intent declaration
108
- if it helps coordinate before a PR exists; do not rely on it as a
109
- mutex. The filesystem can't conflict across worktrees, but
110
- duplicated work and contradictory merges still can.
111
- - Append a one-line entry to `_agent/WORKLOG.md` on every commit.
112
- The repo's `.gitattributes` sets `_agent/WORKLOG.md merge=union`
113
- so concurrent appends concatenate instead of conflicting.
114
- - `_agent/CURRENT_FOCUS.md` is local-only per worktree (gitignored).
115
- Update it freely; it never merges.
116
- - The committed cross-worktree dashboard is `_agent/IN_FLIGHT.md` —
117
- one row per active worktree (agent, branch, queue item, started).
118
- Add your row when you start, remove it when the worktree closes.
119
- -->
120
-
121
- ## Plan folder
122
-
123
- - A pending item gets a `plan/todo/NNNN-<slug>.md` file BEFORE work
124
- starts, naming the owning ADR(s), scope, and exit criteria.
125
- - The completion event is: `<from Q4 e.g. merge to main, deploy +
126
- smoke passes, release tag>`. On completion, `git mv` the file to
127
- `plan/done/<YYYY-MM-DD>-<slug>.md` with a footer naming the HEAD SHA
128
- and any artefact id.
129
- - The owning ADR(s) advance `Accepted Implemented` on the same
130
- commit. Regenerate `INDEX.md`.
131
-
132
- ## Git contract
133
-
134
- - Commit messages follow **Conventional Commits**.
135
- - Mandatory `Rationale:` footer on any commit touching an ADR.
136
- - <Signed commits: yes/no per Q6.>
137
- - <ADR-revision tags `adr-NNNN-rN`: yes/no per Q6.>
138
- - <Co-Authored-By trailer: yes/no per Q6 default no.>
139
- - Cross-references between ADRs use relative paths (`adr/NNNN-*.md`).
140
-
141
- <!-- Integration model per Q4b keep one block. -->
142
-
143
- <!-- Direct-to-main:
144
- - **Integration:** direct-to-main, **fast-forward only**. No merge
145
- commits on `main`. The verify gate (`<command from Q8>`) runs
146
- locally and must pass before push. Completion event:
147
- fast-forwarded to `main` + remote push succeeded.
148
- -->
149
-
150
- <!-- PR-based:
151
- - **Integration:** every change ships via a pull request. CI must be
152
- green before merge — the verify gate (`<command from Q8>`) runs in
153
- CI on the PR, not (only) locally. Merge strategy:
154
- <squash | merge | rebase>. Completion event: PR merged to `main`
155
- with CI green.
156
- -->
157
-
1
+ # AGENTS.md
2
+
3
+ This file provides guidance to coding agents working in this repository.
4
+
5
+ ## What this repository is
6
+
7
+ <One paragraph. Project purpose, current baseline, what the artefacts in
8
+ this repo represent.>
9
+
10
+ ## Repository structure
11
+
12
+ - `adr/0000-template.md` — canonical ADR template.
13
+ <!-- If technology-ADR split (Q2): also include `adr/NNNN-template.md` for technology ADRs. -->
14
+ - `adr/NNNN-<kebab-slug>.md` — one ADR per decision, contiguous
15
+ numbering, no gaps.
16
+ - `INDEX.md` — table regenerated from every ADR's metadata block.
17
+ - `CONVENTIONS.md` — authoring rules (read before editing anything).
18
+ - `plan/todo/NNNN-<slug>.md` — pending work, lower numbers run first.
19
+ - `plan/done/<YYYY-MM-DD>-<slug>.md` — shipped work, chronological.
20
+ - `_agent/` — multi-agent coordination: `ROLES.md`, `LOCKS.md`,
21
+ `WORKLOG.md`, `CURRENT_FOCUS.md`, `HANDOFF.md`, `prompts/`.
22
+ <!-- If GLOSSARY.md (Q7): also include `GLOSSARY.md` — shared terms. -->
23
+ <!-- If domains/ (Q7): also include `domains/<slug>/README.md`. -->
24
+
25
+ ## Hard rules when editing ADRs
26
+
27
+ These come from `CONVENTIONS.md` and override default behaviour:
28
+
29
+ - **One decision per ADR.** Splits become new ADRs that supersede;
30
+ never expand scope inside an existing one.
31
+ - **Status lifecycle:** `<from Q3>`.
32
+ - **Capability ADR section order:** metadata → Context → Capability
33
+ statement → User stories / scenarios → Acceptance criteria → Out of
34
+ scope → Open questions → References → Revision History → Approvals.
35
+ <!-- If technology-ADR split (Q2): -->
36
+ - **Technology ADR section order:** metadata → Context → Decision →
37
+ Rationale → Consequences → Acceptance criteria → Out of scope → Open
38
+ questions → References → Revision History → Approvals. Rationale must
39
+ name alternatives considered with specific rejection reasons.
40
+ - **Acceptance criteria are testable and numbered.**
41
+ - **ADRs are internal artefacts — never user-visible.** ADR numbers,
42
+ ADR titles, and the existence of the ADR catalogue must NEVER appear
43
+ in any string the product emits to users: UI copy, API response
44
+ bodies, error messages, customer-visible log lines, public
45
+ documentation, release notes, marketing copy, or support
46
+ communications. The catalogue is a builder's tool, not a user-facing
47
+ surface. References ARE allowed in: code comments
48
+ (`// see adr/0042-foo.md`), commit messages, PR descriptions,
49
+ internal docs, `AGENTS.md`, `CONVENTIONS.md`, `INDEX.md`, and the
50
+ `plan/` queue. Rule of thumb: if a non-builder could ever see the
51
+ string, the ADR reference comes out.
52
+ <!-- Insert any Q10 domain-specific hard rules here as additional bullets. -->
53
+
54
+ ## Implementation work
55
+
56
+ - Start from the ADRs. Identify which ADRs a code change implements or
57
+ affects before changing behaviour.
58
+ - If implementation reveals a capability gap or changed decision, update
59
+ the relevant ADR rather than silently diverging.
60
+ - Add or update tests for implemented behaviour. Map tests back to ADR
61
+ acceptance criteria where practical.
62
+ - **Do not leak ADR identifiers into user-visible surfaces.** When
63
+ writing error messages, UI copy, API responses, log lines that ship
64
+ to customers, public docs, or release notes, refer to the behaviour
65
+ by its product-level name — never by ADR number, ADR title, or
66
+ phrases like "per the ADR catalogue". The ADR link belongs in the
67
+ commit message and (optionally) an inline code comment, not in the
68
+ string the user reads.
69
+
70
+ ## Audit trail and revision discipline
71
+
72
+ - Substantive ADR changes append a row to the Revision History table.
73
+ Editorial changes (typos, formatting, link fixes) are excluded but
74
+ flagged `editorial` in the commit message.
75
+ - Approvals table populates when an ADR is Accepted and updates on each
76
+ later substantive revision.
77
+ - Regenerate `INDEX.md` from ADR metadata after any ADR status change
78
+ or new ADR.
79
+
80
+ ## Multi-agent workflow
81
+
82
+ <!-- Mode 1 — single agent (Q5 default). Keep this block. -->
83
+ A single agent owns this repo. The `_agent/` directory tracks live
84
+ state and history; LOCKS discipline is not in use.
85
+
86
+ <!-- Mode 2 — multi-agent, shared checkout. Replace the block above with: -->
87
+ <!--
88
+ Work is partitioned across named agents (see `_agent/ROLES.md`).
89
+ Coordination rules:
90
+ - Before editing a file, claim it in `_agent/LOCKS.md` by appending
91
+ `<agent-id> | <path> | <ISO-8601 timestamp>`. Remove the line on
92
+ commit. LOCKS is a filesystem mutex — it prevents simultaneous
93
+ writes to the same file.
94
+ - Append a one-line entry to `_agent/WORKLOG.md` on every commit.
95
+ - `_agent/CURRENT_FOCUS.md` is the single in-flight snapshot
96
+ (branch, active queue item, blockers, uncommitted work). Update it
97
+ when state changes.
98
+ -->
99
+
100
+ <!-- Mode 3 — multi-agent, separate worktrees / PR branches. Replace
101
+ the block above with: -->
102
+ <!--
103
+ Work is partitioned across named agents (see `_agent/ROLES.md`).
104
+ Each agent works in its own git worktree or PR branch.
105
+ Coordination rules:
106
+ - **GitHub draft PRs / branch assignment are the authoritative lock.**
107
+ `_agent/LOCKS.md` is advisory only — append an intent declaration
108
+ if it helps coordinate before a PR exists; do not rely on it as a
109
+ mutex. The filesystem can't conflict across worktrees, but
110
+ duplicated work and contradictory merges still can.
111
+ - Append a one-line entry to `_agent/WORKLOG.md` on every commit.
112
+ The repo's `.gitattributes` sets `_agent/WORKLOG.md merge=union`
113
+ so concurrent appends concatenate instead of conflicting.
114
+ - `_agent/CURRENT_FOCUS.md` is local-only per worktree (gitignored).
115
+ Update it freely; it never merges.
116
+ - The committed cross-worktree dashboard is `_agent/IN_FLIGHT.md` —
117
+ one row per active worktree (agent, branch, queue item, started).
118
+ Add your row when you start, remove it when the worktree closes.
119
+ -->
120
+
121
+ <!-- Concurrency guardrails hard rule — bootstrap INCLUDES this bullet
122
+ ONLY for multi-agent (mode 2/3) OR PR-based repos (omit for single-agent
123
+ direct-to-main). See CONVENTIONS.md §Concurrency Guardrails.
124
+
125
+ - **Before integrating, check for number collisions (G2/G3).** Sync onto
126
+ the current `main` and run `/audit`; if your ADR or `plan/todo` number
127
+ now clashes with what landed on `main`, renumber locally before
128
+ integrating. The single-threaded merge gate rejects a duplicate as the
129
+ backstop. Numbers are immutable once merged. (G1 landing the ADR
130
+ before implementation — is recommended guidance, in CONVENTIONS.md.)
131
+ -->
132
+
133
+ ## Plan folder
134
+
135
+ - A pending item gets a `plan/todo/NNNN-<slug>.md` file BEFORE work
136
+ starts, naming the owning ADR(s), scope, and exit criteria.
137
+ - The completion event is: `<from Q4 — e.g. merge to main, deploy +
138
+ smoke passes, release tag>`. On completion, `git mv` the file to
139
+ `plan/done/<YYYY-MM-DD>-<slug>.md` with a footer naming the HEAD SHA
140
+ and any artefact id.
141
+ - The owning ADR(s) advance `Accepted Implemented` on the same
142
+ commit. Regenerate `INDEX.md`.
143
+
144
+ ## Git contract
145
+
146
+ - Commit messages follow **Conventional Commits**.
147
+ - Mandatory `Rationale:` footer on any commit touching an ADR.
148
+ - <Signed commits: yes/no per Q6.>
149
+ - <ADR-revision tags `adr-NNNN-rN`: yes/no per Q6.>
150
+ - <Co-Authored-By trailer: yes/no per Q6 — default no.>
151
+ - Cross-references between ADRs use relative paths (`adr/NNNN-*.md`).
152
+
153
+ <!-- Integration model per Q4b keep one block. -->
154
+
155
+ <!-- Direct-to-main:
156
+ - **Integration:** direct-to-main, **fast-forward only**. No merge
157
+ commits on `main`. The verify gate (`<command from Q8>`) runs
158
+ locally and must pass before push. Completion event:
159
+ fast-forwarded to `main` + remote push succeeded.
160
+ -->
161
+
162
+ <!-- PR-based:
163
+ - **Integration:** every change ships via a pull request. CI must be
164
+ green before merge — the verify gate (`<command from Q8>`) runs in
165
+ CI on the PR, not (only) locally. Merge strategy:
166
+ <squash | merge | rebase>. Completion event: PR merged to `main`
167
+ with CI green.
168
+ -->
169
+
@@ -110,6 +110,17 @@ Each agent works in its own worktree / PR branch.
110
110
  - `_agent/CURRENT_FOCUS.md` is gitignored (local-only per worktree);
111
111
  the committed cross-worktree dashboard is `_agent/IN_FLIGHT.md` —
112
112
  one row per active worktree.
113
+ - **Identifier reservation.** Before parallel worktrees are spawned,
114
+ each is assigned a disjoint block of ADR numbers / `plan/todo` slots
115
+ (recorded in `_agent/IN_FLIGHT.md`). An agent creates new ADRs/plans
116
+ only from its reserved block, so two worktrees never claim the same
117
+ next number. `agent-wave` performs the reservation.
118
+ - **Single writer per artefact.** An ADR body or a given `plan/` item
119
+ is edited by at most one worktree at a time (its owner, per
120
+ `_agent/IN_FLIGHT.md`). Contradictory edits to one ADR across two
121
+ worktrees must never happen — `merge=union` would concatenate them
122
+ silently. `/audit` flags duplicate numbers, duplicate plan ownership,
123
+ and the same ADR edited on two unmerged branches.
113
124
  - Regenerate `INDEX.md` after any ADR status change or new ADR.
114
125
  -->
115
126
 
@@ -128,6 +139,34 @@ When a `plan/todo/` item ships, the file moves to `plan/done/` AND the
128
139
  owning ADR(s)' `status:` advances from `Accepted` to `Implemented`.
129
140
  `INDEX.md` is regenerated to match.
130
141
 
142
+ <!-- Concurrency Guardrails — bootstrap INCLUDES this section (uncommented)
143
+ ONLY for multi-agent (mode 2/3) OR PR-based repos. Single-agent
144
+ direct-to-main repos have no numbering race by construction and OMIT it.
145
+ Adapt "integrate" to the integration model (PR merge / ff-push / pull
146
+ before commit in a shared checkout).
147
+
148
+ ## Concurrency Guardrails
149
+
150
+ ADR and `plan/todo` numbers are contiguous and assigned at authoring
151
+ time, so concurrent branches can pick the same next number. These
152
+ guardrails keep numbering collision-free **without changing the identity
153
+ scheme** — the number stays the stable cross-reference key, immutable
154
+ once merged:
155
+
156
+ - **G1 — decide before do (recommended).** Prefer to merge an ADR and its
157
+ plan items to `main` before implementation work begins, so work
158
+ branches start from a `main` that already carries the numbered ADR.
159
+ - **G2 — check before merge.** Before integrating, sync onto the current
160
+ `main` (`git fetch` + rebase, or pull in a shared checkout) and run
161
+ `/audit`. If your ADR number or `plan/todo` slot now clashes with what
162
+ landed on `main`, renumber locally **before** integrating — a trivial,
163
+ local change (a new ADR/plan names its own number only in its own file
164
+ and `INDEX.md`).
165
+ - **G3 — gate backstop.** Integration is single-threaded; it rejects a
166
+ duplicate number as the last line of defence, and the later author
167
+ renumbers.
168
+ -->
169
+
131
170
  ## Audit Trail Policy
132
171
 
133
172
  Every substantive change to an Accepted ADR appends a new row to its
@@ -12,5 +12,12 @@ gitignored under this mode and stays local to each worktree.
12
12
  If this file disagrees with reality, reality wins — check
13
13
  `git worktree list` and the live PRs, then correct here.
14
14
 
15
- | Agent | Worktree branch | Queue item | Started (ISO-8601) | PR link |
16
- |-------|-----------------|------------|---------------------|---------|
15
+ The **Reserved IDs** column records the disjoint block of ADR numbers /
16
+ `plan/todo` slots an agent may create this wave (assigned by `agent-wave`
17
+ before spawning), so two worktrees never claim the same next number. The
18
+ **Owns** column names the ADR(s) / plan item(s) that worktree is the
19
+ single writer of — no other worktree edits those artefacts until the row
20
+ clears.
21
+
22
+ | Agent | Worktree branch | Queue item | Reserved IDs | Owns | Started (ISO-8601) | PR link |
23
+ |-------|-----------------|------------|--------------|------|---------------------|---------|
@@ -42,6 +42,18 @@ footer required on any commit touching an ADR.
42
42
 
43
43
  ## Step 6 — Integrate
44
44
 
45
+ <!-- Concurrency guardrail G2 (multi-agent / PR-based repos) — keep this
46
+ step if CONVENTIONS.md has a §Concurrency Guardrails section; drop it for
47
+ single-agent direct-to-main repos:
48
+
49
+ - **Check before merge (G2).** Sync onto the current `main`
50
+ (`git fetch` + rebase, or pull in a shared checkout) and run `/audit`.
51
+ If your new ADR or `plan/todo` number now clashes with what landed on
52
+ `main`, renumber locally — in your ADR/plan file and `INDEX.md` —
53
+ before integrating. The merge gate (G3) rejects a duplicate as the
54
+ backstop.
55
+ -->
56
+
45
57
  <!-- Integration model per Q4b — keep ONE of the two blocks below,
46
58
  delete the other. -->
47
59
 
@@ -19,6 +19,34 @@ to the **new-adr** and **new-plan** skills.
19
19
  contradict what already exists, and so dependencies point at real
20
20
  ADRs.
21
21
 
22
+ ## Step 0.5 — Assessment (run first)
23
+
24
+ Run the shared assessment protocol before decomposing:
25
+
26
+ - **Opt-out gate first.** Ask whether to run the assessment or go
27
+ straight to decomposing. Recommend **running** it when the request
28
+ arrived with little or no context; recommend **skipping** when the goal
29
+ and scope are already clear.
30
+ - Ask the questions below **one at a time**, each with a **recommended
31
+ option** and a one-line reason; wait for each answer.
32
+ - Use **structured selection** (single- or multiple-choice). If the host
33
+ exposes a structured single-/multi-select question tool, use it and
34
+ mark the recommended option; otherwise list options A/B/C in plain text
35
+ and name the recommended one. Use **free text only** where an
36
+ enumerable set is impossible (e.g. the goal statement).
37
+ - **The operator decides.** Never proceed past a question without an
38
+ answer, and never guess scope when invoked with no context.
39
+
40
+ Questions (skip any the request already answers):
41
+ 1. **Goal / problem** — free text (the unavoidable open answer) if not
42
+ already given.
43
+ 2. **Output** — candidate ADRs only, or ADRs + plan items.
44
+ *Recommended: ADRs + plan items.*
45
+ 3. **Depth** — quick (top candidates) or thorough (full decomposition).
46
+ *Recommended: quick first, expand on request.*
47
+
48
+ This skill still **writes nothing** until you approve the outline.
49
+
22
50
  ## Step 1 — Understand the problem
23
51
 
24
52
  Ask for the goal/feature/problem if not given. Probe for scope
@@ -18,6 +18,33 @@ Author one new ADR, consistent with this repo's conventions.
18
18
  groupings exist, and the multi-agent mode.
19
19
  3. Read `INDEX.md` and `ls adr/` to learn existing numbers and titles.
20
20
 
21
+ ## Step 0.5 — Assessment (run first)
22
+
23
+ Run the shared assessment protocol before authoring:
24
+
25
+ - **Opt-out gate first.** Ask whether to run the assessment or skip
26
+ straight to authoring. Recommend **running** it when the request
27
+ arrived with little or no context; recommend **skipping** when the
28
+ decision is already fully specified.
29
+ - Ask the questions below **one at a time**, each with a **recommended
30
+ option** and a one-line reason; wait for each answer.
31
+ - Use **structured selection** (single- or multiple-choice). If the host
32
+ exposes a structured single-/multi-select question tool, use it and
33
+ mark the recommended option; otherwise list options A/B/C in plain text
34
+ and name the recommended one. Use **free text only** where an
35
+ enumerable set is impossible (e.g. the title).
36
+ - **The operator decides.** Never proceed past a question without an
37
+ answer, and never guess scope when invoked with no context.
38
+
39
+ Questions (skip any the request already answers):
40
+ 1. **Shape** — capability or technology (only if the repo splits shapes;
41
+ single-shape repos skip this). *Recommended: per the request's intent.*
42
+ 2. **Supersede?** — none, or select the ADR(s) this replaces.
43
+ *Recommended: none.*
44
+ 3. **Initial status** — Proposed or Accepted. *Recommended: Proposed.*
45
+ 4. **Create a plan item now?** — yes / no. *Recommended: yes when Accepted.*
46
+ 5. **Title** — free text (the one unavoidable open answer).
47
+
21
48
  ## Step 1 — Determine shape and number
22
49
 
23
50
  - **Shape.** If the repo uses a single ADR shape, use
@@ -16,6 +16,34 @@ Add one item to the implementation queue.
16
16
  completion event, and `plan/README.md` if present.
17
17
  3. `ls plan/todo/` to learn existing numbers and priority ordering.
18
18
 
19
+ ## Step 0.5 — Assessment (run first)
20
+
21
+ Run the shared assessment protocol before queueing:
22
+
23
+ - **Opt-out gate first.** Ask whether to run the assessment or skip to
24
+ writing the item. Recommend **running** it when the request arrived
25
+ with little or no context; recommend **skipping** when the item is
26
+ already fully specified.
27
+ - Ask the questions below **one at a time**, each with a **recommended
28
+ option** and a one-line reason; wait for each answer.
29
+ - Use **structured selection** (single- or multiple-choice). If the host
30
+ exposes a structured single-/multi-select question tool, use it and
31
+ mark the recommended option; otherwise list options A/B/C in plain text
32
+ and name the recommended one. Use **free text only** where an
33
+ enumerable set is impossible (e.g. the scope summary).
34
+ - **The operator decides.** Never proceed past a question without an
35
+ answer, and never guess scope when invoked with no context.
36
+
37
+ Questions (skip any the request already answers):
38
+ 1. **Owning ADR(s)** — select from the catalogue (single or multiple).
39
+ *Recommended: the ADR named in the request.*
40
+ 2. **Dependencies** — none, or select the plan items / ADRs that must
41
+ land first. *Recommended: none.*
42
+ 3. **Priority / position** — next number, or insert ahead of existing
43
+ items. *Recommended: next number.*
44
+ 4. **Scope & exit criteria** — free text, mapped to the owning ADR's
45
+ numbered acceptance criteria where possible.
46
+
19
47
  ## Step 1 — Identify the owning ADR(s)
20
48
 
21
49
  - Ask which ADR(s) this work implements. Validate they exist in