@manhquy/flow-skill 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +6 -5
  3. package/README_VN.md +7 -6
  4. package/package.json +1 -1
  5. package/skills/flow/SKILL.md +14 -6
  6. package/skills/flow/_templates/02-scope.md +9 -0
  7. package/skills/flow/_templates/03-prd.md +11 -0
  8. package/skills/flow/_templates/05-contract.md +8 -0
  9. package/skills/flow/_templates/card.md +4 -0
  10. package/skills/flow/eval/fixtures/converge/conv-01/cards/C-001.md +21 -0
  11. package/skills/flow/eval/fixtures/converge/conv-01/flow/03-prd.md +7 -0
  12. package/skills/flow/eval/fixtures/converge/conv-01/src/app.py +3 -0
  13. package/skills/flow/eval/fixtures/converge/gap-01/cards/C-001.md +21 -0
  14. package/skills/flow/eval/fixtures/converge/gap-01/cards/C-002.md +21 -0
  15. package/skills/flow/eval/fixtures/converge/gap-01/flow/03-prd.md +8 -0
  16. package/skills/flow/eval/fixtures/converge/gap-01/flow/05-contract.md +7 -0
  17. package/skills/flow/eval/fixtures/converge/gap-01/src/app.py +11 -0
  18. package/skills/flow/eval/fixtures/converge/manifest.tsv +3 -0
  19. package/skills/flow/eval/fixtures/fcdd/cards/C-001.md +34 -0
  20. package/skills/flow/eval/fixtures/fcde/cards/C-001.md +46 -0
  21. package/skills/flow/eval/manifest.tsv +2 -0
  22. package/skills/flow/law/CLAUDE.md +7 -0
  23. package/skills/flow/references/artifact-lifecycle.md +58 -0
  24. package/skills/flow/references/clarify.md +191 -0
  25. package/skills/flow/references/command-dispatch.md +5 -2
  26. package/skills/flow/references/concierge.md +2 -0
  27. package/skills/flow/references/converge.md +109 -0
  28. package/skills/flow/references/flow-catalog.tsv +2 -0
  29. package/skills/flow/references/gate-eval.md +51 -9
  30. package/skills/flow/references/gate-rules.md +35 -0
  31. package/skills/flow/references/ground-truth-gates.md +7 -0
  32. package/skills/flow/references/mode-work.md +11 -1
  33. package/skills/flow/references/stage-state-machine.md +9 -1
  34. package/skills/flow/runner/attestations.sh +69 -26
  35. package/skills/flow/runner/flow.sh +597 -28
  36. package/skills-manifest.json +16 -2
@@ -0,0 +1,191 @@
1
+ # Clarify ritual — resolve leftover open decisions (Scope / PRD / Contract)
2
+
3
+ Bounded, sequential write-back for open product decisions. Ported in *shape* from
4
+ Spec Kit's `/speckit.clarify` protocol; rewritten in Flow nouns. Open decisions
5
+ are unchecked `- [ ]` bullets under `## Open decisions` on `02-scope.md`,
6
+ `03-prd.md`, and `05-contract.md`. The existing line-anchored box scanner in
7
+ `scan_gate` already fails `next` / `gate` / `planning_complete` on those bullets.
8
+ This file is how you *clear* them.
9
+
10
+ **Not a planning stage. Not a `next` prerequisite command.** `flow.sh clarify`
11
+ only prints leftover bullets (section-scoped). The interview is this ritual.
12
+ Never auto-fired. Offer it (opt-in-with-prompt) when `scan_gate` lists unchecked
13
+ boxes under `## Open decisions`, the same way forge-idea is offered at Idea/Scope.
14
+
15
+ Does **not** replace:
16
+ - `forge-idea.md` — persona pressure-test of the *idea* (kill/harden), not write-back
17
+ - `mode-work.md` — one batch interview up front; leftover open decisions are the
18
+ *only* reason to ask more after that batch
19
+ - `native-rituals.md` §2 — edge-case *generation* for the contract
20
+ - `gate-rules.md` material-authority stop — detect invented policy; this ritual
21
+ *asks* then writes the answer
22
+
23
+ Informs, never judges: a finished clarify session does not pass the gate.
24
+ `flow.sh next` still has to see zero `[FILL]` / unchecked boxes, and you still
25
+ run the stage's semantic challenge.
26
+
27
+ ## When
28
+
29
+ - Stage 02, 03, or 05 has one or more unchecked `- [ ]` bullets under
30
+ `## Open decisions` (mechanical fail), **or**
31
+ - The operator asks to pin a Decision-required item before it gets invented into
32
+ the artifact.
33
+ - Skip at 00 / 01 / 04 — those stages have forge-idea / research / ADR rituals.
34
+
35
+ Cap: **at most 5 questions asked** in one session (retries on the same question
36
+ do not count). There is no mechanical cap on how many open-decision bullets a
37
+ file may carry (every leftover `- [ ]` already fails the gate). If the section
38
+ is a pile, that is a **semantic** "too many — assume or cut" judgment (see
39
+ `gate-rules.md`), not a runner count.
40
+
41
+ ## Token rules (authoring, before this ritual)
42
+
43
+ When drafting 02 / 03 / 05 (especially in `mode work`):
44
+
45
+ 1. **Write it** if the operator said it or the previous stage locked it.
46
+ 2. **Assume + record** if a reasonable industry default exists and the choice
47
+ does not change scope, security/privacy, or UX. On 02/03 record it under
48
+ `## Assumptions`. On **05 (contract) there is no `## Assumptions` section** —
49
+ do not invent one (`gate-rules.md` forbids it); assume by writing the
50
+ access/effects cell or shared shape, or cut.
51
+ Reasonable defaults (do **not** open-decide these): data retention for the
52
+ domain, ordinary error-message tone, session/OAuth2 for a standard web app
53
+ unless tenancy/SSO is the product, REST vs GraphQL when the stack is already
54
+ picked.
55
+ 3. **Add a line like `- [ ] which tenant key?` under `## Open decisions`** only
56
+ when: the choice changes scope, security/privacy, or UX; several
57
+ interpretations have different implications; **and** no honest default exists.
58
+ Priority: scope > security/privacy > UX > technical.
59
+ 4. Never invent auth, tenancy, retention, billing, or enforcement-owner to clear
60
+ `[FILL]`. That is the failure this section exists to stop.
61
+
62
+ ## Taxonomy (coverage scan — internal)
63
+
64
+ Walk the current artifact. Mark each category Clear / Partial / Missing. Do not
65
+ print the raw map unless you will ask zero questions (then print a one-line
66
+ "all Clear" summary).
67
+
68
+ | Category | Look for |
69
+ |---|---|
70
+ | Functional scope | who it is for, v1 vs cut list, GO/KILL still standing |
71
+ | Domain & data | entities, identity/uniqueness, lifecycle |
72
+ | Interaction / UX | critical journey, empty/error/loading |
73
+ | Non-functional | latency, scale, availability — only if v1-load-bearing |
74
+ | Integration | external services, failure modes |
75
+ | Edge / failure | negative path, conflict, throttle |
76
+ | Constraints / tradeoffs | stack already locked in ADR? rejected alternatives |
77
+ | Terminology | one canonical noun (`ticket` vs `issue`) |
78
+ | Completion | numeric success metric; observable result per FRn |
79
+ | Placeholders | leftover open-decision bullets, vague adjectives ("robust", "secure") |
80
+
81
+ Skip a candidate question if answering it would not change implementation,
82
+ validation, or the cut list — or if it belongs in ADR (stage 04), not here.
83
+
84
+ Queue at most 5, ranked Impact × Uncertainty. Prefer one high-impact security
85
+ or tenancy question over two low-impact wording questions.
86
+
87
+ ## Sequential loop
88
+
89
+ Present **exactly one** question at a time. Never reveal the rest of the queue.
90
+
91
+ **Question writing:**
92
+ - Lead with `**Question:**` and a full interrogative that ends in `?`.
93
+ - Optional suffix after the `?`: `(FR3)` or `(scope)`. Never use a label as the
94
+ question (`Acceptance device matrix` is invalid).
95
+ - Next line: one plain "Why it matters" sentence (the stake for shipping).
96
+ - Everyday wording. A reader who does not know Flow must be able to answer
97
+ from the Question line alone.
98
+
99
+ **Multiple choice (preferred):**
100
+ - Pick a **Recommended** option first (best default given project type, risk
101
+ reduction, anything already locked in scope/ADR). One or two sentences why.
102
+ - Then a table:
103
+
104
+ | Option | Description |
105
+ |--------|-------------|
106
+ | A | … |
107
+ | B | … |
108
+ | C | … (D/E if needed, max 5) |
109
+ | Short | different answer, ≤5 words |
110
+
111
+ - After the table: `Reply with the letter, "yes"/"recommended" to accept, or a short answer.`
112
+
113
+ **Short answer (no honest discrete options):**
114
+ - `**Suggested:** <≤5 words> — <one-line why>`
115
+ - `Format: ≤5 words. Reply "yes"/"suggested" to accept, or your own answer.`
116
+
117
+ After the operator answers:
118
+ - "yes" / "recommended" / "suggested" → use your stated recommendation.
119
+ - Otherwise map to one option or accept a ≤5-word phrase.
120
+ - Ambiguous → re-ask (does not consume a new slot).
121
+ - Then write back (next section) **before** asking the next question.
122
+
123
+ **Stop when:**
124
+ - remaining queued items are no longer necessary, or
125
+ - the operator says done / good / no more / stop / proceed, or
126
+ - you have asked 5 questions, or
127
+ - no valid question existed at the start.
128
+
129
+ If the quota is hit with high-impact leftovers, list them under **Deferred**
130
+ with a one-line rationale (better as an Assumption, a cut-list item, or a later
131
+ ADR). Do not leave them as unchecked open-decision bullets if you can honestly
132
+ assume or cut.
133
+
134
+ ## Write-back (after EACH accepted answer)
135
+
136
+ Target file = the stage you are clarifying (`flow/02-scope.md` / `03-prd.md` /
137
+ `05-contract.md`). Teach mode: the operator writes; you propose the exact
138
+ patch. Work mode: you write, then self-challenge.
139
+
140
+ 1. Ensure a `## Clarifications` section exists. Create it **just above**
141
+ `## Assumptions` (or at the end if Assumptions is missing). Under it, a
142
+ `### Session YYYY-MM-DD` subheading for today.
143
+ 2. Append `- Q: <question> → A: <final answer>`.
144
+ 3. Patch the *real* section — do not leave the answer only in the log:
145
+ - scope / cut / GO-KILL → Features in v1, Cut list, or Decision
146
+ - actor / journey → Target users or Features (`FRn:`)
147
+ - data / entity → Shared shapes (contract) or Features
148
+ - NFR / metric → Success metric or Non-functional requirements (must stay
149
+ numeric / observable)
150
+ - edge / failure → a named bullet, or a contract failure shape
151
+ - term → one canonical noun everywhere you just touched
152
+ 4. **Remove the `- [ ]` bullet** this answer resolved (or tick it only if you
153
+ keep a resolved record in-place — prefer delete so the section stays empty
154
+ when work is done). Leave no contradictory earlier sentence.
155
+ 5. Save after each answer (overwrite the file). Do not reorder unrelated
156
+ headings. Keep each insertion short and testable.
157
+
158
+ Allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD` only.
159
+
160
+ ## Assumptions challenge (after the loop, and after a mechanical PASS)
161
+
162
+ Read `## Assumptions` on the artifact you just touched. For each bullet:
163
+
164
+ - Is this a real default (industry-standard, or already locked by the operator
165
+ / ADR), or is it **product law** (who can access what, tenancy, retention,
166
+ billing, enforcement owner) wearing an assumption hat?
167
+ - If it is product law with no operator/ADR authority → treat it as
168
+ Decision-required: either add an open-decision bullet (and ask it) or
169
+ **stop** and list it the same way `gate-rules.md` material-authority stop
170
+ does. Do not silently keep it.
171
+
172
+ A clean mechanical gate with a sneaky assumption is the exact hollow-pass this
173
+ ritual exists to catch.
174
+
175
+ ## Completion report (to the operator)
176
+
177
+ - Questions asked & answered (count).
178
+ - File(s) patched.
179
+ - Sections touched.
180
+ - Open-decision bullets remaining (should be zero on the file you cleared;
181
+ say so if not).
182
+ - Coverage one-liner per taxonomy row: Resolved / Deferred / Clear / Outstanding.
183
+ - Suggested next: `/flow next` if open decisions are gone; otherwise another
184
+ clarify pass or an honest cut/assume.
185
+
186
+ ## Done when
187
+
188
+ Every accepted answer is in `## Clarifications` *and* in the real section.
189
+ Resolved open-decision bullets are gone from the file. Assumptions were
190
+ challenged for silent policy invention. No `cmd_next` / `cmd_clarify` coupling
191
+ was implied — the operator (or you, after they agree) runs `next` themselves.
@@ -10,7 +10,7 @@ install dir; run from the project root so `flow/` and `cards/` resolve.
10
10
  | `/flow resume` | `bash <skill>/runner/flow.sh resume` | Read-only, no lock. Relay all four sections verbatim (last session, in-flight + dwell, gate state, NEXT ->). Run this FIRST when entering a project mid-cycle with no prior context this session. Never expand on or guess at raw args it didn't print — it deliberately shows command names only. |
11
11
  | `/flow next` | `bash <skill>/runner/flow.sh next` | If FAIL: relay the exact violations + line numbers; offer help, don't author/tick in teach mode. If PASS: run the stage's challenge in `gate-rules.md`; flag hollow content, let operator decide. |
12
12
  | `/flow assess` | `bash <skill>/runner/flow.sh assess` | Brownfield only: fill `flow/00-inspect.md` from EVIDENCE (read the code) — functionality/UI/UX vs product, risks, test baseline, **Evidence ledger** claim tags. After mechanical PASS, apply gate-rules **Brownfield assess** challenge (no Observed→product-law promotion). Reuse `scout`/`researcher`. Gate is operator-reviewed; then proceed to `/flow next`. |
13
- | `/flow card` | `bash <skill>/runner/flow.sh card` | Confirm the new card id; remind: fill Scope (one thing) / Allowed files / Verify / Done-evidence per `law/CLAUDE.md`. |
13
+ | `/flow card` | `bash <skill>/runner/flow.sh card` | Confirm the new card id; remind: fill Scope (one thing) / Independent test / Allowed files / Verify / Done-evidence per `law/CLAUDE.md`. |
14
14
  | `/flow card start C-NNN` | `bash <skill>/runner/flow.sh card start C-NNN` | Optional: mark the card in flight (operator-visible in-progress, shown in `/flow status`). Portable `cards/.inflight` registry; does NOT touch the gated `status:` field. Coexists with hand-edit. |
15
15
  | `/flow card done C-NNN` | `bash <skill>/runner/flow.sh card done C-NNN` | Optional convenience: CLI-owned flip to `done`, gated by the SAME done-rules as `check` (reverts on fail — never a hollow done). Then still apply the semantic card review (diff-vs-scope, contract shapes, real evidence) as with `check`. |
16
16
  | `/flow check C-NNN` | `bash <skill>/runner/flow.sh check C-NNN` | If PASS mechanically: review diff-vs-scope, allowed-files drift, contract-shape match, DESIGN.md for UI, evidence = real world-state. |
@@ -20,8 +20,11 @@ install dir; run from the project root so `flow/` and `cards/` resolve.
20
20
  | `/flow coherence` | `bash <skill>/runner/flow.sh coherence` | Flags version drift across declared version fields (package.json / pyproject / src app_version). The cheap doc-vs-code slice; semantic contradictions stay a human gate-challenge. |
21
21
  | `/flow consistency` | `bash <skill>/runner/flow.sh consistency` | After the contract gate, before cards: every PRD `FRn` is claimed by a card (`implements:`) and served by a contract interface; numeric success metric; no leftover placeholders. Then apply the semantic cross-artifact passes in `gate-rules.md` (hollow coverage, conflicting requirements, terminology drift). Advisory. |
22
22
  | `/flow constitution` | `bash <skill>/runner/flow.sh constitution` | At the scope/PRD/contract seam: checks `flow/constitution.md` is well-formed (no placeholder, every invariant has an ID) + scans declared grep-markers. **Advisory, NOT a `next` gate** — then apply the semantic challenge in `gate-rules.md`. |
23
- | `/flow eval [--stage 01\|02\|card] [--fixture <id>] [--n 3] [--timeout <s>]` | `bash <skill>/runner/flow.sh eval [...]` | **Billable** (skips cleanly, zero calls, if `claude` CLI absent). Relay the scorecard verbatim. See `references/gate-eval.md` before running: what it measures (a fresh-judge lower bound, not the work-mode self-challenge), cost, and thresholds. Never wired into `next`/`check` gating — informative only. |
23
+ | `/flow clarify` | `bash <skill>/runner/flow.sh clarify` | List leftover `- [ ]` bullets under `## Open decisions` on 02/03/05 (section-scoped). **Advisory, NOT a `next` gate** — write-back is `references/clarify.md` (opt-in). Never invent auth/tenancy/retention/billing to clear FILL. |
24
+ | `/flow converge` | `bash <skill>/runner/flow.sh converge [--file <payload>]` | Flow-back closer: assess present code vs plan per `references/converge.md`, write a `flow-converge/v1` payload to `.flow/converge-pending.md`, then run to **append** remainder cards. Transactional (all or none), append-only (never edits an existing card), prints `CONVERGED` + writes nothing when there is no gap. Present the findings table to the operator first. |
25
+ | `/flow eval [--stage 01\|02\|card] [--fixture <id>] [--n 3] [--timeout <s>]` | `bash <skill>/runner/flow.sh eval [...]` | **Billable** (live mode skips cleanly, zero calls, if `claude` CLI absent). `--replay` does **not** inherit that SKIP — missing fixtures exit 1. Relay the scorecard verbatim. See `references/gate-eval.md` before running: what it measures (a fresh-judge lower bound, not the work-mode self-challenge), cost, and thresholds. Never wired into `next`/`check` gating — informative only. |
24
26
  | `/flow eval --report` | `bash <skill>/runner/flow.sh eval --report` | Offline, zero calls. Relay the last complete batch's scorecard + drift vs the prior complete batch. |
27
+ | `/flow eval --replay` | `bash <skill>/runner/flow.sh eval --replay` | Keyless. Replay recorded stripped transcripts through parse → vote → per-fixture match lines (no scorecard; replay writes no results rows). Not a fresh-judge; verdicts never count toward the eval floor. Stale `gate_rules_sha` → exit 1 (re-record live). |
25
28
  | `/flow project-type <web\|cli\|library\|skill>` | `bash <skill>/runner/flow.sh project-type [t]` | Set/read the project type that selects the per-type gate lens + done-evidence definition (`references/project-types.md`). Confirm the type matches reality before planning. |
26
29
  | `/flow usage [--global\|--prune]` | `bash <skill>/runner/flow.sh usage [...]` | Roll up the JSONL usage log and relay the analytics (cycle-time, gate fail-rate, per-stage + per-card dwell, command breakdown). Local-only; `--prune [--keep N]` caps the log. Read-only — nothing to author. |
27
30
  | `/flow skip <stage> --reason ...` | `bash <skill>/runner/flow.sh skip <stage> --reason ...` | Advance past a gate that has a matching open `DEBT.md` line. **Security-class skips are operator-only and HALT** — never auto-skip; the operator accepts the exposure in writing first. |
@@ -45,6 +45,7 @@ SKILL.md's Forbidden list). When a brand-new user's ask requires you to draft so
45
45
  - contract
46
46
  - tokens
47
47
  - constitution
48
+ - clarify
48
49
  - design
49
50
  - doctor
50
51
  - ready
@@ -68,6 +69,7 @@ operator-authority-only):
68
69
  - unlock
69
70
  - retro
70
71
  - eval
72
+ - converge
71
73
 
72
74
  **Default-deny:** any verb not explicitly listed under May-run above is must-ask — this
73
75
  includes any verb added to flow after this file was written. When in doubt, ask.
@@ -0,0 +1,109 @@
1
+ # Converge — append-only remainder cards (plan vs present code)
2
+
3
+ Flow can prove a *card* is not hollow (Verify + world-state Evidence). It cannot prove the
4
+ *plan* was fully expressed in the card tree. `converge` closes that gap: assess present code
5
+ against the plan, then **append** remainder cards for whatever is still missing. It never
6
+ rewrites history and never touches application code.
7
+
8
+ `converge` is the **flow-back closer** named in `references/artifact-lifecycle.md`.
9
+
10
+ ## When
11
+ - After the originally planned cards are `done` but you want to confirm the codebase actually
12
+ expresses every PRD `FRn`, contract interface, and constitution `INV-n`.
13
+ - Mid-cycle when code drifted ahead of (or behind) the plan and you need to reconcile.
14
+ - Not a `next` gate. Opt-in. The runner half only *appends* cards from a payload you produce.
15
+
16
+ ## Operating constraints (non-negotiable)
17
+ - **Append-only.** Never edit, renumber, or delete an existing `cards/C-*.md`.
18
+ - **Never touch application code.** `converge` emits cards; a human/`auto` builds them later.
19
+ - **Byte-identical when converged.** If nothing remains, write nothing and print `CONVERGED`.
20
+ - **Assess present code, not a diff.** Read what the tree does now vs what the plan requires;
21
+ this is not a git-diff or branch comparison.
22
+ - **Transactional.** Either every remainder card is written, or none is (no partial append).
23
+
24
+ ## Intent inventory (what you load)
25
+ From the plan: PRD `## Features` (`FRn` + observable result), `05-contract.md` interfaces
26
+ (request/response/failure shapes, access), constitution `INV-n` MUST rows, the card set and
27
+ their claimed scope. This is the set of promises the code must keep.
28
+
29
+ ## Code-scope map (what you check it against)
30
+ Read the source the cards claim to have built. For each promise, decide whether the present
31
+ code keeps it. Judge behaviour and interfaces, not line counts.
32
+
33
+ ## Gap taxonomy (closed set)
34
+ - **missing** — a promised `FRn` / interface / MUST has no implementation in the tree.
35
+ - **partial** — implemented but incomplete against its observable result / failure shape.
36
+ - **contradicts** — the code does something the plan/contract forbids or specifies differently.
37
+ - **unrequested** — code surface exists that no `FRn`/interface/decision asked for.
38
+
39
+ ## Severity (closed set)
40
+ - **CRITICAL** — a constitution MUST or a P1/baseline `FRn` is missing or contradicted.
41
+ - **HIGH** — a non-baseline `FRn` or a named contract interface missing/partial.
42
+ - **MED / LOW** — partials with a workaround; cosmetic contradictions.
43
+
44
+ ## Disposition
45
+ - `missing` / `partial` / `contradicts` → a remainder card (`implements:` the `FRn`/interface,
46
+ `## Scope` citing the source-ref + gap-type, `deps:` on the last related card).
47
+ - `unrequested` → a **review card** (or a `DEBT` line), never an instruction to delete code.
48
+
49
+ ## Present the findings first
50
+ Emit a findings table (id, gap-type, severity, source-ref, one-line) to the operator BEFORE
51
+ any card is written. Then hand the payload to the runner, which appends the cards.
52
+
53
+ ## Payload schema (`flow-converge/v1`)
54
+ Write findings to `.flow/converge-pending.md` (run-state, gitignored — so a `CONVERGED` run
55
+ never dirties `cards/`), then run `/flow converge` (or `flow.sh converge --file <path>`). The
56
+ runner is transactional: it appends every card or none. Format — a header, then one `---`-fenced
57
+ block per finding:
58
+
59
+ ```
60
+ schema: flow-converge/v1
61
+ findings: 2
62
+
63
+ ---
64
+ gap-type: missing
65
+ severity: HIGH
66
+ implements: FR2
67
+ source-ref: 03-prd.md:FR2
68
+ title: implement the mark-task-done endpoint
69
+ deps: C-002
70
+ allowed: src/app.py
71
+ ---
72
+ gap-type: unrequested
73
+ severity: LOW
74
+ implements: none
75
+ source-ref: src/app.py:debug_dump
76
+ title: the debug_dump surface no feature asked for
77
+ deps:
78
+ allowed: src/app.py
79
+ ```
80
+
81
+ Each block: `gap-type` (missing|partial|contradicts|unrequested — the runner rejects anything
82
+ else and writes nothing), `title` (required), and optional `severity`/`implements`/`deps`/
83
+ `source-ref`/`allowed`. `unrequested` becomes a **review** card (`implements: none`) — never a
84
+ delete instruction. Zero findings (or no payload) → the runner prints `CONVERGED` and writes
85
+ nothing. Appended cards ship with `[FILL]` Verify/Done-evidence (they are not built yet).
86
+
87
+ ## Converge challenge
88
+
89
+ *(Sliced by the converge eval judge. This section is the criteria a reviewer applies when
90
+ asked whether a codebase still owes work against its plan.)*
91
+
92
+ A codebase is **converged** only when every promise in the plan is kept by the present code:
93
+
94
+ - Every PRD `FRn` has code that produces its stated observable result — not a stub, not a
95
+ handler that returns the shape without the behaviour, not a sibling feature standing in.
96
+ - Every contract interface exists with its request/response **and failure** shape.
97
+ - Every constitution MUST is honoured.
98
+ - No code contradicts a stated decision, and no unrequested surface is silently load-bearing.
99
+
100
+ Report a **GAP** when at least one promise is not kept by the present code — most commonly a
101
+ declared `FRn` that the source never implements while its card is marked done. Report
102
+ **CONVERGED** only when the present code keeps every declared promise. When the evidence is
103
+ ambiguous, prefer **GAP** — an unflagged missing feature is the failure this check exists to
104
+ catch. A card marked done is not evidence the feature exists; read the source.
105
+
106
+ ## Done when
107
+ - [ ] Findings table presented before any write
108
+ - [ ] Remainder cards appended (or `CONVERGED` printed and nothing written)
109
+ - [ ] No existing card edited; no application code touched
@@ -16,3 +16,5 @@ adr-decision-ask stage-04 next offers the native persona-debate ritual before lo
16
16
  contract-hardening-ask stage-05 contract offers the native edge-case decomposition ritual to harden the seam before the Contract gate ck-scenario flow
17
17
  security-review-ask security-class-card check runs the native STRIDE ritual on every security-class card (guaranteed baseline) ck-security flow
18
18
  loop-fix-ask build-verify-numeric-gap status offers the native loop protocol (flow.sh loop-prep/loop-log) when a fix needs more than one attempt against a numeric target ck-loop flow
19
+ open-decision-ask stage-02-or-03-or-05 clarify lists ## Open decisions bullets; skill offers references/clarify.md write-back (opt-in, never a next prereq) - flow
20
+ close-the-gap-ask cards-done-verify-plan converge assess present code vs plan per references/converge.md, then append-only remainder cards (transactional; CONVERGED writes nothing) - flow
@@ -25,14 +25,18 @@ rule text is enforceable by *a* judge," not "this build's self-review caught eve
25
25
 
26
26
  ## Fixtures and thresholds
27
27
 
28
- Seven shipped fixtures (`skills/flow/eval/fixtures/`, manifest `skills/flow/eval/manifest.tsv`):
28
+ Eleven shipped fixtures (`skills/flow/eval/fixtures/`, manifest `skills/flow/eval/manifest.tsv`):
29
29
  sound/hollow pairs for Stage 01 (Research — fabricated quotes, vague "users"), Stage 02 (Scope —
30
- grade laundering, a real C quietly graded B), and the card gate:
30
+ grade laundering, a real C quietly graded B), Stage 05 (listed; heading map does not yet judge
31
+ them), and the card gate:
31
32
  - **fcda** — sound multi-signal Evidence (mechanical PASS, semantic PASS)
32
33
  - **fcdb** — process-only hollow (mechanical **FAIL** after hollow-done floor; still listed for
33
34
  historical FLAG text / offline inspection)
34
35
  - **fcdc** — hollow-with-decoy multi-signal (mechanical PASS, semantic **FLAG** — the residual
35
36
  attack class the mechanical floor does not claim to close)
37
+ - **fcdd** — B1-S artifact-less Evidence prose (mechanical PASS, semantic **FLAG** — names no
38
+ path/URL/command; the semantic-only catch for `ground-truth-gates.md` rule 8)
39
+ - **fcde** — B1-S same story with concrete artifact refs (mechanical PASS, semantic PASS)
36
40
 
37
41
  Fixture content maps 1:1 to the failure modes already documented in `gate-rules.md`, not an
38
42
  invented taxonomy. The v1 input set is **manifest-listed shipped fixtures only** — `eval` never
@@ -61,8 +65,10 @@ separately from a real mismatch — never silently counted as a gate pass or fai
61
65
  `eval` is **opt-in and billable** — it makes real `claude -p` API calls. Zero cost when the
62
66
  `claude` CLI isn't on `PATH` (clean skip, exit 0). When present, exactly one minimal probe call
63
67
  is made to confirm the CLI runs headless before any real judging starts; a probe failure means
64
- one billable call was made, then a clean skip. A full default batch is 7 fixtures × N=3 = 21
65
- judge calls + the 1 probe = 22 calls.
68
+ one billable call was made, then a clean skip. The artifact manifest is 11 rows; a full
69
+ default batch judges the 9 heading-mapped fixtures (01 / 02 / card) × N=3 = 27 judge calls
70
+ + the 1 probe = 28 calls. The two Stage 05 rows fail closed before a call. Plan accounting
71
+ for a complete re-record is 11 × 3 = 33 + probe.
66
72
 
67
73
  **Measured real cost** (this machine, 2026-07-10, default/unforced model, no `--bare` available
68
74
  under an OAuth/subscription session — see the build's spike notes): roughly **$0.30–0.37 per
@@ -78,6 +84,39 @@ fresh-judge eval is to reflect a realistic judge, not the cheapest one that pass
78
84
  `--report` (below) is the free, offline way to re-read a prior batch's numbers without spending
79
85
  anything.
80
86
 
87
+ **macOS without `timeout`/`gtimeout`:** live `flow.sh eval` (not `--report`, not `--replay`) refuses
88
+ by default. The watchdog fallback cannot bound a stuck `claude` call, so a hung judge is an
89
+ unbounded-billing risk. Install GNU coreutils (`gtimeout`) or export `FLOW_EVAL_UNBOUNDED=1` to
90
+ accept that risk for one run. `--report` and `--replay` never hit this guard. `--record` is live
91
+ and does.
92
+
93
+ ## Modes
94
+
95
+ | Mode | Calls | What it proves |
96
+ |------|-------|----------------|
97
+ | live (default) | Billable `claude -p` | Fresh-judge catch-rate (eval floor) |
98
+ | `--report` | Zero | Last complete **live** batch + advisory drift |
99
+ | `--record` | Same as live | Writes stripped transcripts under `eval/replay/` |
100
+ | `--replay` | Zero | Parse → vote → per-fixture match lines (no scorecard; no results rows) + gate-rules **hash** staleness |
101
+
102
+ `--record|--replay` are artifact-modality only (not `--stage routing|converge`, not `--report`).
103
+
104
+ **Replay is not a fresh-judge.** Gate-rules text is embedded in the live prompt; recorded
105
+ responses are frozen. Replay cannot test rules *effectiveness* — that stays live and billable.
106
+ What it can do: hard-fail when `_eval_gate_rules_sha` ≠ the recorded hash (`fixtures stale —
107
+ re-record live per ADR re-baseline rule`). Replay verdicts **never count toward the eval floor**.
108
+
109
+ **Refresh protocol:** edit both sides of a rules change, run a live `--record` batch (11 × `--n 3`
110
+ = 33 judge calls + 1 probe; 9 heading-mapped fixtures bill 27 + probe today) on a host with
111
+ real `timeout`/`gtimeout`, commit the stripped `eval/replay/` tree (verdict lines only — no
112
+ `session_id` / `cwd` envelopes) **in the same change** as the `gate-rules.md` edit. No
113
+ operator-recorded batch exists yet — the `eval-replay` CI job skip-with-notice until then;
114
+ the recorded-sha staleness check is unchanged.
115
+
116
+ **B1 escalation:** if hollow-done decoys that name no artifact/command recur in dogfood or
117
+ live eval after the B1-S addendum lands, escalate to full structured lineage evidence. Replay
118
+ verdicts never count toward that trigger.
119
+
81
120
  ## Running it
82
121
 
83
122
  ```
@@ -86,6 +125,8 @@ flow.sh eval --stage card # only the card-gate fixtures
86
125
  flow.sh eval --fixture fcdb --n 1 # one fixture, one run (cheap smoke check)
87
126
  flow.sh eval --timeout 180 # override the per-call timeout (default 120s)
88
127
  flow.sh eval --report # OFFLINE: last complete batch's scorecard + drift
128
+ flow.sh eval --record --n 3 # LIVE: write stripped replay fixtures (billable)
129
+ flow.sh eval --replay --n 3 # KEYLESS: replay recorded transcripts
89
130
  ```
90
131
 
91
132
  Exit code: `0` = every evaluated fixture majority-matched its expected verdict (or a clean
@@ -146,9 +187,10 @@ yet (the same "measure, don't assume" discipline that gated this build in the fi
146
187
  platform: a signal arriving while the runner is blocked on a foreground judge call was not
147
188
  observed to preempt that call promptly. Cleanup between fixtures/calls fires reliably; a
148
189
  normal (uninterrupted) run always cleans up its temp files immediately.
149
- - **Small fixture corpus (seven)**: enough to prove the mechanism and give a real number, not
150
- enough for statistical confidence across every stage/failure-mode combination. Widening the
151
- corpus is a natural v1.x follow-up, not a v1 blocker.
190
+ - **Small fixture corpus (eleven manifest rows, nine heading-mapped)**: enough to prove the
191
+ mechanism and give a real number, not enough for statistical confidence across every
192
+ stage/failure-mode combination. Widening the corpus is a natural v1.x follow-up, not a
193
+ v1 blocker.
152
194
 
153
195
  ## Failure modes and postmortem (v0.21)
154
196
 
@@ -174,8 +216,8 @@ window; the mechanism was never confirmed at the time (rate-limit vs hook conten
174
216
  4. **Circuit breaker.** The FIRST evaluated fixture coming back UNRELIABLE (`invalid_count*3 > n`)
175
217
  aborts the batch with a distinct nonzero exit code (2) and NO `done` trailer written — the
176
218
  junk batch is invisible to `--report`/drift, so it cannot poison the baseline. `--keep-going`
177
- forces the full batch; document worst case (≤ N_fixtures × n × 2 + 1 probe ≈ 37 calls at
178
- default 7 × 3).
219
+ forces the full batch; document worst case (≤ N_fixtures × n × 2 + 1 probe ≈ 55 calls at
220
+ default 9 heading-mapped × 3).
179
221
 
180
222
  ### Rate-limit visibility (advisory, best-effort)
181
223
 
@@ -79,6 +79,15 @@ GO/KILL, no FILL.
79
79
  - **Offer the forge-idea ritual (opt-in-with-prompt — `references/forge-idea.md`)** when a
80
80
  GO/KILL call is genuinely close. It informs the decision; it never decides it — the
81
81
  operator still calls GO or KILL.
82
+ - **Assumption vs open decision:** read `## Assumptions`. A bullet that encodes product
83
+ law (who can access what, tenancy, retention, billing, enforcement owner) with no
84
+ operator/ADR authority is an **open decision or a stop**, not a silent default — move
85
+ it under `## Open decisions` (a line like `- [ ] which tenant key?`) or halt. Do not
86
+ invent auth/tenancy/retention/billing to clear `[FILL]`.
87
+ - **Too many open decisions** is a semantic judgment (there is no mechanical cap): if
88
+ the section is a pile, assume or cut rather than interview everything. Offer the
89
+ clarify ritual (`references/clarify.md`, opt-in, never a `next` prereq) when any
90
+ open decision remains.
82
91
 
83
92
  ## Stage 03 — PRD
84
93
  Mechanical: filled from stage 02, numeric success metric, pain&gain table, no FILL.
@@ -90,6 +99,14 @@ Mechanical: filled from stage 02, numeric success metric, pain&gain table, no FI
90
99
  named observation) AND name the v1 feature that kills it? Does *every v1 feature* kill at
91
100
  least one pain? Orphans on either side = scope drift.
92
101
  - Could a stranger build v1 from this without asking the operator anything?
102
+ - Read Features and NFRs as a reviewer of English, not of code: any unquantified adjective (fast/secure/intuitive) or an `FRn` with no named failure/empty case is a rewrite, not a vibe.
103
+ - **Assumption vs open decision:** read `## Assumptions`. A bullet that encodes product
104
+ law (who can access what, tenancy, retention, billing, enforcement owner) with no
105
+ operator/ADR authority is an **open decision or a stop**, not a silent default — move
106
+ it under `## Open decisions` or halt. Do not invent policy to clear `[FILL]`.
107
+ - **Too many open decisions** is a semantic judgment (no mechanical cap): assume or
108
+ cut rather than interview a pile. Offer the clarify ritual (`references/clarify.md`,
109
+ opt-in, never a `next` prereq) when any open decision remains.
93
110
 
94
111
  ## Stage 04 — ADR
95
112
  Mechanical: each decision has why + rejected, NOT-doing list, covers storage/auth/deploy.
@@ -118,6 +135,15 @@ cli=command+flags+output/exit, library=public function+args+return, skill=comman
118
135
  the cli equivalent: `--out` vs `--output`)?
119
136
  - Is the access/effects column real for every interface (web: public/token/admin · non-web:
120
137
  writes/side-effects or "none")? Do NOT let a web product blank the access column.
138
+ - Read each write interface as a reviewer of English, not of code: if the failure shape is missing or Access/effects is a vibe word (secure/authenticated/restricted), the seam is not written yet.
139
+ - **Assumption vs open decision:** access/effects or shared shapes that encode product
140
+ law (tenancy, auth, retention, billing) with no operator/ADR authority are an **open
141
+ decision or a stop**, not a silent default — add a `## Open decisions` bullet or halt.
142
+ (Contract has no `## Assumptions` section; do not invent one.) Do not invent
143
+ tenancy/auth from convenience to clear `[FILL]`.
144
+ - **Too many open decisions** is a semantic judgment (no mechanical cap): assume or
145
+ cut rather than interview a pile. Offer the clarify ritual (`references/clarify.md`,
146
+ opt-in, never a `next` prereq) when any open decision remains.
121
147
  - One-way rule: this file is planning source of truth. For web the served spec
122
148
  (`/openapi.json`) is the runtime artifact of the SAME contract (amend file -> code -> spec).
123
149
  For non-web there is no served spec — the no-drift check is the per-type done-evidence.
@@ -143,6 +169,12 @@ Mechanical: no FILL, valid status, required sections, if done -> verify boxes ch
143
169
  evidence non-empty.
144
170
  **Challenge:**
145
171
  - Is the scope ONE thing? If it's two, split the card.
172
+ - **Independent test:** if the field is empty, missing on a value card, or is
173
+ "unit tests pass" / "code merged", split or rewrite. A value card names a
174
+ user-visible proof ("resident files a ticket at /new and sees it on /tickets").
175
+ Scaffold/CI/contract-test/e2e may say `infra` or `none`. Mechanical leftover
176
+ `[FILL]` fails `check` only while the heading remains (the heading is not a
177
+ required `cmd_check` section — §1.6 is cut).
146
178
  - Does the diff touch only `## Allowed files`? Drift outside = stop, amend the card first.
147
179
  - Do request/response shapes match `flow/05-contract.md` exactly? No improvised shapes.
148
180
  - For UI cards: reviewed against `law/DESIGN.md` (tokens, affordance ladder, object-first,
@@ -150,6 +182,9 @@ evidence non-empty.
150
182
  - **Is `## Evidence` real world-state** — a clickable URL, real curl output, a DB row — and
151
183
  NOT "tests pass" / "code merged" / "deployed successfully"? Merge != shipped: the proof is
152
184
  the live surface changing, verified as a user.
185
+ - **Does every `## Evidence` item name its artifact (path/URL) or the command that produced
186
+ it?** Plausible prose that names neither is still hollow even when the mechanical floor
187
+ passes (`ground-truth-gates.md` rule 8).
153
188
  - **If this card fixes a bug/regression**, the evidence includes the red→green proof that the
154
189
  new test was actually tied to the bug (`ground-truth-gates.md` → "Bug-fix cards"), not just a
155
190
  green run.
@@ -40,6 +40,13 @@ and used only to add color, never to pass a gate.
40
40
  7. **Hand-edit `status: done` is not trusted for deps** until Evidence **and** Verify boxes
41
41
  pass the same floor (`ready` re-validates Evidence + unchecked Verify + `[FILL]`; graph
42
42
  executor mirrors).
43
+ 8. **Every done-evidence item names its artifact or command.** Each `## Evidence` item must
44
+ name the path/URL of the artifact or the command that produced it. Plausible prose that
45
+ names neither is hollow even when the mechanical multi-signal floor passes — the card
46
+ gate's semantic challenge catches it (`gate-rules.md` → Card gate). Old prose-only
47
+ evidence still passes `flow.sh check` (the floor is unchanged). **Escalate to full
48
+ structured lineage evidence (B1)** only if hollow-done decoys of this class recur in
49
+ dogfood or live eval after this addendum lands.
43
50
 
44
51
  ## Bug-fix cards: prove the test was tied to the bug
45
52
  When a card's job is fixing a bug/regression (not new behavior), a passing test is not yet
@@ -21,10 +21,15 @@
21
21
  in work mode — scope is the operator's call, and killing here is cheap.
22
22
  4. **Draft 03 -> 05.** PRD (numeric metric, pain->feature mapping), ADR (delegate to
23
23
  `architect`/`bmad-create-architecture`), Contract (the seam; consider `bmad-spec` kernel).
24
- Run each gate.
24
+ Run each gate. After drafting 02 / 03 / 05, leftover bullets under `## Open decisions`
25
+ are the **only *scheduled*** reason to ask more (via `/flow clarify` + `references/clarify.md`);
26
+ the assumption challenge after a mechanical PASS can still halt (see Rules below).
27
+ Never invent auth, tenancy, retention, or billing to clear `[FILL]`.
25
28
  5. **Deliver the card set as one summary.** After stage 05 passes, run `/flow card` to
26
29
  create the cards, fill their scopes, and present the whole set + build order + which are
27
30
  parallel-safe (`/flow ready`) in a single summary for the operator to review.
31
+ Group cards under PRD `FRn` (the user-visible story), not under layer (all models, then
32
+ all services). Every value card fills `## Independent test`.
28
33
 
29
34
  ## Rules that still hold in work mode
30
35
  - Every gate must pass mechanically (`flow.sh`) AND semantically (`gate-rules.md`). Drafting
@@ -33,5 +38,10 @@
33
38
  - Research must be real (opened competitors, quoted complaints with links) — no fabrication.
34
39
  This is the highest-risk stage for an AI author; verify every quote has a source.
35
40
  - Scope honesty: do not grade-launder your own C features to B. Call C a C, justify the path.
41
+ - After 02 / 03 / 05, leftover open decisions are the only *scheduled* reason to ask more (via
42
+ clarify). Even with none, the assumption-vs-open-decision challenge after a mechanical PASS
43
+ can still halt or add a bullet (a policy-encoding `## Assumptions` line with no operator/ADR
44
+ authority is an open decision, not a silent default). Never invent auth / tenancy / retention
45
+ / billing to clear FILL.
36
46
  - Done is still world-state evidence; you cannot mark a card done without real proof.
37
47
  - Write durable records (intake/decision/story) as you go, same as teach mode.
@@ -32,7 +32,7 @@ honored outcome, not a failure of the flow.
32
32
  | 03 PRD | `flow/03-prd.md` | numeric success metric, pain&gain mapping table, user-action->observable-result features |
33
33
  | 04 ADR | `flow/04-adr.md` | decisions with why+rejected covering storage/auth/deploy, NOT-doing list |
34
34
  | 05 Contract | `flow/05-contract.md` | every feature->endpoint, request+response shapes, auth per endpoint |
35
- | Card | `cards/C-NNN.md` | one-thing scope, deps, allowed files, verify steps, named done-evidence, pasted evidence when done |
35
+ | Card | `cards/C-NNN.md` | one-thing scope, Independent test (user-visible sentence or infra/none), deps, allowed files, verify steps, named done-evidence, pasted evidence when done |
36
36
 
37
37
  ## Shipping stages live inside cards
38
38
  Build -> Review -> Deploy -> Verify-live are NOT `/flow next` stages. They happen inside
@@ -40,6 +40,14 @@ each card: the `## Verify` checklist (run for real) and `## Evidence` (world-sta
40
40
  Card sequence (scaffold/CI -> vertical slice -> backend -> contract-tests -> UI mock ->
41
41
  frontend -> e2e) is governed by `law/CLAUDE.md`.
42
42
 
43
+ ## After a change (artifact lifecycle)
44
+
45
+ Unlock order is not a mutation policy. Default: **living plan + append-only
46
+ cards** — amend `flow/*.md` in place; never rewrite issued cards; a v2 cycle
47
+ is new cards + a plan amendment, not a `specs/` tree. The three named models
48
+ (living / cycle-forward / flow-back) and the converge closer live in
49
+ `references/artifact-lifecycle.md`.
50
+
43
51
  ## Runner contract
44
52
  - `flow.sh` exit `0` = pass/advanced, `1` = gate fail or usage error.
45
53
  - Reads/writes `flow/`, `cards/`, `MODE`, `RETRO.md`, and seeds `DESIGN.md` once, under `FLOW_PROJECT_ROOT` (default `$PWD`).