@evolvehq/docflow 0.5.0 → 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/USAGE.md CHANGED
@@ -233,6 +233,32 @@ it no longer applies); to make it enforceable, add the test command to
233
233
  the verify gate. Any other "we should always X" practice is enabled the
234
234
  same way — `/add-convention` is the single path.
235
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
+
236
262
  ## 6. Customising or extending
237
263
 
238
264
  The templates are deliberately small and self-contained. To customise:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolvehq/docflow",
3
- "version": "0.5.0",
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",
@@ -102,9 +102,14 @@ every merge.
102
102
  Spawn N subagents in parallel, each in an isolated worktree
103
103
  (`isolation: worktree`). Brief each with: its assigned queue item, the
104
104
  instruction to follow `_agent/prompts/autonomous.md` end-to-end for that
105
- one item (orient → implement → verify → integrate per the repo's model
106
- ship), and to report back a structured result (item, pass/fail, HEAD or
107
- 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.)
108
113
 
109
114
  ## Step 4 — Collect and checkpoint
110
115
 
@@ -49,9 +49,11 @@ relevant):
49
49
  11. **Cross-worktree collisions** (mode 3, or when auditing across
50
50
  unmerged branches). These catch semantic conflicts that a
51
51
  line-level git merge cannot:
52
- - **Duplicate ADR numbers** — two ADR files (across branches/
53
- worktrees) claiming the same `NNNN`. Distinct from check 1, which
54
- only sees one tree.
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.
55
57
  - **Duplicate plan ownership** — two `plan/todo/` items naming the
56
58
  same owning ADR for the same scope, i.e. two worktrees building
57
59
  the same thing.
@@ -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
@@ -118,6 +118,18 @@ Coordination rules:
118
118
  Add your row when you start, remove it when the worktree closes.
119
119
  -->
120
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
+
121
133
  ## Plan folder
122
134
 
123
135
  - A pending item gets a `plan/todo/NNNN-<slug>.md` file BEFORE work
@@ -139,6 +139,34 @@ When a `plan/todo/` item ships, the file moves to `plan/done/` AND the
139
139
  owning ADR(s)' `status:` advances from `Accepted` to `Implemented`.
140
140
  `INDEX.md` is regenerated to match.
141
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
+
142
170
  ## Audit Trail Policy
143
171
 
144
172
  Every substantive change to an Accepted ADR appends a new row to its
@@ -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