@manhquy/flow-skill 0.7.1-next.0 → 0.7.2

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 (38) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +5 -5
  3. package/README_VN.md +5 -5
  4. package/package.json +1 -1
  5. package/skills/flow/SKILL.md +108 -221
  6. package/skills/flow/_templates/01-research.md +3 -2
  7. package/skills/flow/_templates/02-scope.md +2 -0
  8. package/skills/flow/_templates/03-prd.md +2 -1
  9. package/skills/flow/_templates/05-contract.md +1 -0
  10. package/skills/flow/_templates/card.md +5 -1
  11. package/skills/flow/law/CLAUDE.md +6 -5
  12. package/skills/flow/law/CODING.md +37 -0
  13. package/skills/flow/references/agent-detection.md +11 -9
  14. package/skills/flow/references/agent-stage-mapping.md +47 -12
  15. package/skills/flow/references/auto-run.md +37 -7
  16. package/skills/flow/references/clarify.md +7 -7
  17. package/skills/flow/references/command-dispatch.md +51 -51
  18. package/skills/flow/references/concierge.md +2 -2
  19. package/skills/flow/references/debt-and-halts.md +20 -5
  20. package/skills/flow/references/gate-00.md +10 -0
  21. package/skills/flow/references/gate-01.md +18 -0
  22. package/skills/flow/references/gate-02.md +16 -0
  23. package/skills/flow/references/gate-03.md +10 -0
  24. package/skills/flow/references/gate-04.md +12 -0
  25. package/skills/flow/references/gate-05.md +33 -0
  26. package/skills/flow/references/gate-assess.md +13 -0
  27. package/skills/flow/references/gate-card.md +25 -0
  28. package/skills/flow/references/gate-consistency.md +24 -0
  29. package/skills/flow/references/gate-constitution.md +19 -0
  30. package/skills/flow/references/gate-debt.md +5 -0
  31. package/skills/flow/references/gate-eval.md +6 -3
  32. package/skills/flow/references/gate-examples.md +78 -0
  33. package/skills/flow/references/gate-rules.md +40 -241
  34. package/skills/flow/references/gate-shared.md +37 -0
  35. package/skills/flow/references/ground-truth-gates.md +1 -1
  36. package/skills/flow/references/mode-work.md +13 -10
  37. package/skills/flow/runner/flow.sh +223 -24
  38. package/skills-manifest.json +16 -2
@@ -0,0 +1,16 @@
1
+ ## Stage 02 — Scope (the decision stage)
2
+ Mechanical: every feature has Impact (H/M/L) + Grade (A/B/C), no L-above-A in v1, cut list,
3
+ GO/KILL, no FILL.
4
+ **Challenge — watch for GRADE LAUNDERING:**
5
+ - Compare to `gate-examples.md` §02 (PASS = C called C; FLAG = C-launder, realtime graded B).
6
+ - Shared OD/authority: `gate-shared.md`.
7
+ - Is any expensive feature quietly graded B when it's really C? (realtime, payments from
8
+ scratch, custom auth, autonomous agentic pipeline, heavy concurrency = C). Call C a C.
9
+ - For every C in scope, is it justified as one of: (1) C IS the product -> it goes FIRST;
10
+ (2) re-architected C->B (e.g. multi-step agent -> single structured call; auto-send ->
11
+ human-approves-draft; custom -> managed service); (3) irreducible -> KILL/re-budget?
12
+ - Classic failure: v1 full of A-grade L-impact features (cheap to build, worthless to sell).
13
+ - If the product itself is a C, is it FIRST in build order with sibling Cs on the cut list?
14
+ - **Offer the forge-idea ritual (opt-in-with-prompt — `references/forge-idea.md`)** when a
15
+ GO/KILL call is genuinely close. It informs the decision; it never decides it — the
16
+ operator still calls GO or KILL.
@@ -0,0 +1,10 @@
1
+ ## Stage 03 — PRD
2
+ Mechanical: filled from stage 02, numeric success metric, pain&gain table, no FILL.
3
+ **Challenge:**
4
+ - Shared OD/authority: `gate-shared.md`.
5
+ - Is the success metric a real NUMBER ("first response < 2h"), not "save time" / "better UX"?
6
+ - The pain&gain table is the spine: does *every pain* cite evidence (a stage-01 quote or
7
+ named observation) AND name the v1 feature that kills it? Does *every v1 feature* kill at
8
+ least one pain? Orphans on either side = scope drift.
9
+ - Could a stranger build v1 from this without asking the operator anything?
10
+ - 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.
@@ -0,0 +1,12 @@
1
+ ## Stage 04 — ADR
2
+ Mechanical: each decision has why + rejected, NOT-doing list, covers storage/auth/deploy.
3
+ **Challenge:** Does each decision name a *real* rejected alternative (not a strawman)? Are
4
+ data storage, auth approach, and deploy target all actually decided (not "TBD")? Is the
5
+ NOT-doing list honest about what's deferred?
6
+ - **Offer the native persona-debate ritual** (`native-rituals.md` §1 — the guaranteed
7
+ baseline, no external skill required) before locking a non-trivial decision: a 5-lens
8
+ debate (architect/security/ops/user-advocate/cost) that surfaces defects while reversal
9
+ is still cheap. Output INFORMS this challenge; it never passes the gate. Skip on a
10
+ trivial ADR.
11
+ - **If `ck-predict` is installed**, it is a richer alternative to the native ritual (same
12
+ INFORMS-only rule, opt-in-with-prompt — see `claudekit-skills.md`).
@@ -0,0 +1,33 @@
1
+ ## Stage 05 — Contract (the seam)
2
+ Mechanical: every PRD feature -> >=1 interface, every interface has input+output shapes,
3
+ access/effects column filled, no FILL.
4
+ **The "interface" is the project type's seam** (`/flow project-type`): web=endpoint,
5
+ cli=command+flags+output/exit, library=public function+args+return, skill=command/file.
6
+ **Challenge — this is where producer/consumer drift is born (every type):**
7
+ - Shared OD/authority: `gate-shared.md`.
8
+ - Does every PRD feature map to at least one interface, and vice versa?
9
+ - Does every interface have BOTH input and output shapes, with field/flag names that will not
10
+ drift (the #1 AI-build failure: backend ships `player_email`, UI assumed `email`, both green;
11
+ the cli equivalent: `--out` vs `--output`)?
12
+ - Is the access/effects column real for every interface (web: public/token/admin · non-web:
13
+ writes/side-effects or "none")? Do NOT let a web product blank the access column.
14
+ - 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.
15
+ - One-way rule: this file is planning source of truth. For web the served spec
16
+ (`/openapi.json`) is the runtime artifact of the SAME contract (amend file -> code -> spec).
17
+ For non-web there is no served spec — the no-drift check is the per-type done-evidence.
18
+ - **Self-consistency pass (the contract is ground truth every downstream card trusts).** Before
19
+ passing this gate, read the contract AGAINST any doc it names as its own source of truth and
20
+ re-state each shared rule in your own words — a contradiction here ships as "passed" and every
21
+ card inherits it. (This gate once passed an internally-inconsistent seam that only a later
22
+ cross-model review caught — catch that class HERE, at its source, where it is cheapest.) When the
23
+ **codex tier is USABLE**, an OPTIONAL opt-in **cross-model** check of the contract is the
24
+ highest-value single Codex call in a run — a different engine breaks the same-model blind spot at
25
+ the one artifact whose drift is most expensive downstream.
26
+ - **Offer the native edge-case ritual** (`native-rituals.md` §2 — the guaranteed
27
+ baseline) to harden the seam: each case becomes an acceptance criterion + a per-type
28
+ no-drift check, so the contract is exhaustive before any card trusts it. Complements
29
+ `/flow consistency` (it *generates* cases; consistency checks *coherence*). INFORMS
30
+ the gate; never auto-passes it.
31
+ - **If `ck-scenario` is installed**, it is a richer 12-dimension alternative to the
32
+ native ritual (same INFORMS-only rule, opt-in-with-prompt — see
33
+ `claudekit-skills.md`).
@@ -0,0 +1,13 @@
1
+ ## Brownfield assess (flow/00-inspect.md)
2
+
3
+ Separate from Stage 00 Idea. After `flow.sh assess` mechanical PASS (no `[FILL]`, boxes
4
+ checked), apply this semantic challenge before planning:
5
+
6
+ - Are material claims in the **Evidence ledger** tagged
7
+ (Authoritative / Observed / Derived / Decision required / Unknown)?
8
+ - Is any **Observed** or **Derived** claim silently promoted to must-build product law
9
+ without operator authority?
10
+ - Are **Decision required** / **Unknown** items listed for the operator — not invented into
11
+ Scope/PRD?
12
+ - If the ledger is empty or only `[FILL]` rows remain while the gate boxes are checked,
13
+ the assessment is hollow — report mechanically-passed-but-qualitatively-weak.
@@ -0,0 +1,25 @@
1
+ ## Card gate (`/flow check C-NNN`)
2
+ Mechanical: no FILL, valid status, required sections, if done -> verify boxes checked +
3
+ evidence non-empty.
4
+ **Challenge:**
5
+ - Compare to `gate-examples.md` §Card (PASS names URL/curl/path; FLAG = process-only / artifact-less).
6
+ - Is the scope ONE thing? If it's two, split the card.
7
+ - **Independent test:** if the field is empty, missing on a value card, or is
8
+ "unit tests pass" / "code merged", split or rewrite. A value card names a
9
+ user-visible proof ("resident files a ticket at /new and sees it on /tickets").
10
+ Scaffold/CI/contract-test/e2e may say `infra` or `none`. Mechanical leftover
11
+ `[FILL]` fails `check` only while the heading remains (the heading is not a
12
+ required `cmd_check` section — §1.6 is cut).
13
+ - Does the diff touch only `## Allowed files`? Drift outside = stop, amend the card first.
14
+ - Do request/response shapes match `flow/05-contract.md` exactly? No improvised shapes.
15
+ - For UI cards: reviewed against `law/DESIGN.md` (tokens, affordance ladder, object-first,
16
+ no engine words, no emoji, no gradient on inputs/tables)?
17
+ - **Is `## Evidence` real world-state** — a clickable URL, real curl output, a DB row — and
18
+ NOT "tests pass" / "code merged" / "deployed successfully"? Merge != shipped: the proof is
19
+ the live surface changing, verified as a user.
20
+ - **Does every `## Evidence` item name its artifact (path/URL) or the command that produced
21
+ it?** Plausible prose that names neither is still hollow even when the mechanical floor
22
+ passes (`ground-truth-gates.md` rule 8).
23
+ - **If this card fixes a bug/regression**, the evidence includes the red→green proof that the
24
+ new test was actually tied to the bug (`ground-truth-gates.md` → "Bug-fix cards"), not just a
25
+ green run.
@@ -0,0 +1,24 @@
1
+ ## Cross-artifact consistency (`/flow consistency`)
2
+ Run after the Contract gate and before building cards (advisory; never blocks the build path).
3
+ The runner does the **precise, ID-based** passes mechanically: every PRD `FRn` is claimed by a
4
+ card (`implements:`) and served by an interface, the success metric carries a number, no leftover
5
+ placeholders. **You do the passes that need judgment, not string-matching:**
6
+ - **Hollow coverage:** an `FRn` is "covered" by a card whose scope does not actually deliver it
7
+ (the id is referenced but the work isn't there). Mechanical coverage can be gamed by pasting an
8
+ id; read the card scope against the feature.
9
+ - **Conflicting requirements:** two artifacts state incompatible things (PRD says no-login, ADR
10
+ decides OAuth; scope cut a feature the PRD still lists). The runner won't catch a contradiction
11
+ expressed in different words — you must.
12
+ - **Cut-list contradiction:** a feature on the stage-02 cut list reappears (by name, not id) as a
13
+ v1 PRD feature or a card. Scope drift in disguise.
14
+ - **Terminology drift:** the same entity named differently across artifacts (`ticket`/`issue`/
15
+ `request`) — the seed of producer/consumer drift the contract gate guards against.
16
+ If you find any, report *"`consistency` passed mechanically, but <artifact> contradicts <artifact>
17
+ on <thing>"* and let the operator decide — same posture as every other gate.
18
+
19
+ **Canonical form the mechanical pass expects** (deviate and coverage silently can't map — the runner
20
+ then prints "no FR ids found" rather than a false pass, but be aware): FR ids are **uppercase `FRn`**,
21
+ declared in the PRD's **`## Features`** section (ids in prose or the pain table are intentionally
22
+ ignored so a legacy mention can't inflate the set). A blank success-metric body is the gate's job, not
23
+ this probe's (it only checks "if a metric exists, it carries a number"). When `consistency` reports
24
+ "no FR ids found", treat it as *coverage-unverified*, not *coverage-clean*.
@@ -0,0 +1,19 @@
1
+ ## Constitution challenge (operator invariants — run at scope/PRD/contract)
2
+
3
+ `flow.sh constitution` is the mechanical half: it proves the `flow/constitution.md` table is
4
+ well-formed (no placeholder, every invariant has an ID) and scans any declared grep-marker. It
5
+ **cannot** tell whether the artifact you just wrote actually *honors* the invariant — that is your
6
+ job. After the mechanical pass, for each invariant whose `applies-at` includes the current stage,
7
+ challenge the stage artifact against it:
8
+
9
+ - Read each invariant (e.g. "all PII access is facility-scoped", "no API surface ships without a
10
+ `flow/05-contract.md` entry").
11
+ - Walk the current artifact (scope / PRD / contract) and ask: does anything here *violate* it, or
12
+ quietly assume an exception? A contract endpoint exposing cross-tenant data violates a
13
+ facility-scoped invariant even though the table is structurally clean.
14
+ - If you find a violation, report *"constitution passed mechanically, but `<artifact>` violates
15
+ invariant `<ID>` (`<rule>`)"* and let the operator decide — same posture as every other gate.
16
+
17
+ This is **advisory and per-project**; it never auto-blocks `next`, and it does NOT replace the
18
+ security-class Tier-C halt (a constitution rule may *restate* a security concern, but the halt is
19
+ the enforcement). Low-noise by design: the mechanical layer is structural, the judgement is yours.
@@ -0,0 +1,5 @@
1
+ ## Debt (deliberate skips)
2
+ If the operator deliberately skips/reorders a gate, ensure a line opens in `DEBT.md` naming
3
+ the skip, the concrete exposure, and the close condition. **Security-class skips** (auth,
4
+ admin exposure, tenancy, payments) are never silent and never your decision — the operator
5
+ accepts the exposure in writing. In `/flow auto`, that is a Tier-C halt.
@@ -63,9 +63,12 @@ separately from a real mismatch — never silently counted as a gate pass or fai
63
63
  ## Cost
64
64
 
65
65
  `eval` is **opt-in and billable** — it makes real `claude -p` API calls. Zero cost when the
66
- `claude` CLI isn't on `PATH` (clean skip, exit 0). When present, exactly one minimal probe call
67
- is made to confirm the CLI runs headless before any real judging starts; a probe failure means
68
- one billable call was made, then a clean skip. The artifact manifest is 11 rows; a full
66
+ `claude` CLI isn't on `PATH` (clean skip, exit 0). That skip is **unmeasured, not a semantic
67
+ pass**: `eval`, `eval --stage routing`, and `eval --stage converge` each print
68
+ `semantic layer unmeasured on this host` and return 0. Live eval is not a merge gate
69
+ (scorecard table above). Replay never counts toward the eval floor. When present, exactly one
70
+ minimal probe call is made to confirm the CLI runs headless before any real judging starts; a
71
+ probe failure means one billable call was made, then a clean skip. The artifact manifest is 11 rows; a full
69
72
  default batch judges the 9 heading-mapped fixtures (01 / 02 / card) × N=3 = 27 judge calls
70
73
  + the 1 probe = 28 calls. The two Stage 05 rows fail closed before a call. Plan accounting
71
74
  for a complete re-record is 11 × 3 = 33 + probe.
@@ -0,0 +1,78 @@
1
+ # Gate examples — hot-path PASS / FLAG
2
+
3
+ After `flow.sh` mechanical PASS, compare the artifact to these excerpts. Same challenges as `gate-rules.md`; **no new rules**. Full fixtures live in `eval/fixtures/` (f01a/f01b, f02a/f02b, f05a/f05b, fcda). `fcdb` is a mechanical FAIL (`flow.sh check` exits 1) — not a semantic FLAG after PASS.
4
+
5
+ ## §01 Research
6
+
7
+ **PASS** (f01a) — named tool + working link; the note reads like someone opened it:
8
+
9
+ > 1. Splitwise (splitwise.com) — handles group expense splitting well, but its recurring-bill view buries anything not tagged "rent"; three of our pilot households gave up trying to track a shared internet bill inside it and moved back to a spreadsheet.
10
+
11
+ Same PASS shape: Tricount (tricount.com) + the export paywall they actually hit; a named Google Sheet as the incumbent, with a concrete concurrent-edit failure.
12
+
13
+ **FLAG** (f01b) — unsourced competitors; could be written without opening anything:
14
+
15
+ > 1. Splitwise — a well known bill-splitting app used by a lot of people, and honestly one of the first names that comes up whenever this category is discussed.
16
+
17
+ Same FLAG class: quotes with no URL ("users online"); "social media" as the first-10 channel. A later hostname floor is not "opened 3 competitors."
18
+
19
+ ## §02 Scope
20
+
21
+ **PASS** (f02a) — C called C, path written next to the feature:
22
+
23
+ > Debt-simplification nudge (who-owes-whom, minimized transaction count) — impact H (the differentiator named in stage-01: "I want a nudge, not a number") — grade C (a real graph-minimization algorithm, not off-the-shelf) — path 1: this C IS the product's differentiator, so it goes FIRST in build order, and no sibling C features are scoped alongside it in v1.
24
+
25
+ **FLAG** (f02b-class C-launder) — **realtime graded B**. Impact is M, grade is B: the joined-bullet L-above-A scanner will not catch this. Judgment must.
26
+
27
+ > Real-time balance sync across all household members' devices — impact M (keeps everyone on the same page without needing to manually refresh, which matters for a shared-use app like this one) — grade B (can build this alongside the nudge feature using similar techniques, since the underlying data layer is shared between the two anyway)
28
+
29
+ `gate-rules.md` Stage 02: realtime, payments-from-scratch, custom auth, autonomous agentic pipeline, heavy concurrency = C. Call C a C. "Shared data layer / similar techniques" is the launder. Sibling tells: empty cut list; GO on vibe; "no C-grade items." Do **not** treat L-impact + B/C as this class (that fail is mechanical).
30
+
31
+ ## §03 PRD
32
+
33
+ **PASS** — numeric success metric; pain table maps evidence → v1 feature; FR1 is action→result with empty/fail:
34
+
35
+ > Success metric: 10 named Facebook-group households settle a recurring bill through the nudge in week 1; median time-to-nudge < 2h.
36
+ >
37
+ > | P1 | Roommate who owns the internet bill | Recurring bills not tagged rent vanish; households bounce to a spreadsheet | stage-01: "I want a nudge, not a number." — reddit.com/r/personalfinance/comments/17k2xq1 | Shared Google Sheet that breaks under concurrent edits | Debt-simplification nudge (FR1) | Group balance shows "Alice owes Bob $12.50" instead of a pairwise table |
38
+ >
39
+ > FR1: As a roommate who paid the internet bill, I open the group balance, and I see the minimized who-owes-whom nudge; empty: none; fail: pairwise table plus "couldn't simplify".
40
+
41
+ **FLAG** — unquantified adjective in Features, or a feature that kills no pain:
42
+
43
+ > FR2: As a roommate, I get a fast, intuitive balance view.
44
+ >
45
+ > Pain table has P1 (spreadsheet concurrent-edit) but Features also lists "in-app chat", which kills no named pain.
46
+
47
+ Same FLAG class: "save time" / "better UX" as the success metric; an `FRn` with no empty/fail/`none`.
48
+
49
+ ## §05 Contract
50
+
51
+ **PASS** (f05a) — shaped table: method / path / request / response / errors / owner:
52
+
53
+ > | Method | Path | Request | Response | Errors | Owner |
54
+ > |---|---|---|---|---|---|
55
+ > | GET | /healthz | none | `{ "ok": true }` | 503 if deps down | platform |
56
+
57
+ Auth is explicit (public `/healthz` only; other routes bearer session; 401 if missing). Error model is machine-readable.
58
+
59
+ **FLAG** (f05b) — vibe / auth-optional; prose APIs, no shapes:
60
+
61
+ > We will expose some APIs as needed. Endpoints are flexible and will evolve.
62
+ > Auth might be optional depending on context. Errors should be helpful.
63
+
64
+ Same FLAG class: Access/effects is a vibe word (secure / authenticated / restricted); missing failure shape on a write.
65
+
66
+ ## §Card (`/flow check C-NNN`)
67
+
68
+ **PASS** (fcda) — every evidence item names a URL, curl/command, or path:
69
+
70
+ > Staging URL: https://staging.householdsplit.app/g/demo-4person/balance (live; group seeded via `scripts/seed-demo-group.ts`)
71
+ > Test run: `PASS src/balance/simplify.test.ts` — 14 cases
72
+ > Screenshot: `docs/evidence/C-001-staging-balance-screen.png` — nudge text "Alice owes Bob $12.50" replacing the raw pairwise table
73
+
74
+ **Mechanical FAIL** (fcdb) — `flow.sh check` exits 1. Process-only / artifact-less. CI green, two approvals, release notes. No URL, curl, or path:
75
+
76
+ > The pull request went through the normal review process, picked up the two required approvals, and the CI pipeline stayed green the whole way through. The branch was merged into main and is now included in this cycle's release notes under "new features," so the nudge is part of the current build going forward.
77
+
78
+ Merge ≠ shipped. Plausible prose that names neither artifact nor the command that produced it is still hollow (`ground-truth-gates.md` rule 8). Do not treat this as a semantic FLAG after mechanical PASS — the script already fails it.
@@ -1,241 +1,40 @@
1
- # Gate rules — the semantic layer
2
-
3
- The runner (`flow.sh`) checks the mechanical gate: no `[FILL]`, no unchecked `- [ ]`, valid
4
- card status, non-empty evidence. **This file is what YOU check after the script passes.**
5
- The script cannot judge truth or quality; you can. For each stage, after a mechanical PASS,
6
- run the challenge below. If it fails, tell the operator: *"mechanically passed, but
7
- qualitatively weak: <reason>"* and let them decide — never silently advance a hollow
8
- artifact, never silently block a sound one.
9
-
10
- > Rule of behavior: in `teach` mode you do NOT edit the artifact or tick boxes. You report.
11
- > In `work` mode you authored it, so you self-challenge before presenting.
12
-
13
- > Authoring note (when editing these challenges): **match the form to the failure.** A challenge
14
- > that fights a *discipline drift* — the agent rationalizing a hollow artifact through (grade
15
- > laundering, fabricated quotes, "merge ≈ shipped") — is rightly a prohibition + the specific
16
- > rationalization it counters. A challenge that fixes a *wrong-shaped artifact* (a missing field, a
17
- > drifted name) is better written as a positive recipe — "every interface has both shapes, names
18
- > that won't drift" — than as a ban; a bare prohibition on a shaping problem can produce *more* of
19
- > the bad shape, not less, and a hedging "unless it matters" clause turns a crisp recipe noisy. Pick
20
- > the form deliberately; don't reflexively reach for another "do NOT".
21
-
22
- ## Brownfield assess (flow/00-inspect.md)
23
-
24
- Separate from Stage 00 Idea. After `flow.sh assess` mechanical PASS (no `[FILL]`, boxes
25
- checked), apply this semantic challenge before planning:
26
-
27
- - Are material claims in the **Evidence ledger** tagged
28
- (Authoritative / Observed / Derived / Decision required / Unknown)?
29
- - Is any **Observed** or **Derived** claim silently promoted to must-build product law
30
- without operator authority?
31
- - Are **Decision required** / **Unknown** items listed for the operator — not invented into
32
- Scope/PRD?
33
- - If the ledger is empty or only `[FILL]` rows remain while the gate boxes are checked,
34
- the assessment is hollow — report mechanically-passed-but-qualitatively-weak.
35
-
36
- ## Stage 00 — Idea
37
- Mechanical: pitch present, one real person named, no FILL.
38
- **Challenge:** Is the pitch really 3 sentences (who / pain / what)? Is the named person a
39
- *real, specific* person or group ("my uncle's 20-unit building"), not "people who..." or
40
- "users"? Is the pain concrete, not a category?
41
- - **Offer the forge-idea ritual (opt-in-with-prompt — `native-rituals.md`'s sibling
42
- `references/forge-idea.md`).** Before drafting the pitch, or when the operator sounds
43
- unsure, offer to pressure-test the idea through persona interrogation until it
44
- hardens, proves out, or dies cheaply. Never auto-fired; never a condition this gate
45
- checks for — a killed idea and a hardened idea both still go through the normal gate.
46
-
47
- ## Stage 01 — Research
48
- Mechanical: 7 boxes checked, no FILL.
49
- **Apply the lens by project type (`/flow project-type`, default web):**
50
- - **web / market product** → the strict version below. Reject the soft "non-web" framing for a
51
- product that has a real market: a real product DOES have online complaints + a GTM channel,
52
- and dodging them is the failure this gate exists to catch.
53
- - **cli / library / skill / internal tool** → items 2+4 use first-party friction + who-benefits.
54
- Demand it be *concrete and real* (a named observed pain, named beneficiaries) — not vague.
55
- "No market channel" is expected here and is NOT a kill signal.
56
- **Challenge (highest fabrication risk):**
57
- - Were 3 competitors *actually opened*? Each note should read like someone used the tool. (all types)
58
- - web: are the 3 complaints *real quotes with working source links*? · non-web: is the
59
- first-party friction *concrete and observed* (who hit it, when), not a guess?
60
- - Are competitor/status-quo costs *real* (web: prices+who-pays · non-web: time/manual-work spent today)?
61
- - web: is the first-10-users channel a *specific place* (reject "social media"/"online") ·
62
- non-web: are the *named beneficiaries* + how-they-learn real?
63
- - Does the switch reason name what makes the *named* users move off today's workaround?
64
-
65
- ## Stage 02 — Scope (the decision stage)
66
- Mechanical: every feature has Impact (H/M/L) + Grade (A/B/C), no L-above-A in v1, cut list,
67
- GO/KILL, no FILL.
68
- **Challenge — watch for GRADE LAUNDERING:**
69
- - **Material-authority stop:** if materially different externally observable product choices
70
- remain open (quota, identity key, tenancy model, response contract, enforcement owner, …),
71
- **stop** — list the choice and consequences. Configurable defaults are not authority.
72
- - Is any expensive feature quietly graded B when it's really C? (realtime, payments from
73
- scratch, custom auth, autonomous agentic pipeline, heavy concurrency = C). Call C a C.
74
- - For every C in scope, is it justified as one of: (1) C IS the product -> it goes FIRST;
75
- (2) re-architected C->B (e.g. multi-step agent -> single structured call; auto-send ->
76
- human-approves-draft; custom -> managed service); (3) irreducible -> KILL/re-budget?
77
- - Classic failure: v1 full of A-grade L-impact features (cheap to build, worthless to sell).
78
- - If the product itself is a C, is it FIRST in build order with sibling Cs on the cut list?
79
- - **Offer the forge-idea ritual (opt-in-with-prompt — `references/forge-idea.md`)** when a
80
- GO/KILL call is genuinely close. It informs the decision; it never decides it — the
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.
91
-
92
- ## Stage 03 — PRD
93
- Mechanical: filled from stage 02, numeric success metric, pain&gain table, no FILL.
94
- **Challenge:**
95
- - **Material-authority stop:** if the PRD invents policy (who can access what, retention,
96
- billing rules) with no prior operator/ADR authority, stop and list Decision-required items.
97
- - Is the success metric a real NUMBER ("first response < 2h"), not "save time" / "better UX"?
98
- - The pain&gain table is the spine: does *every pain* cite evidence (a stage-01 quote or
99
- named observation) AND name the v1 feature that kills it? Does *every v1 feature* kill at
100
- least one pain? Orphans on either side = scope drift.
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.
110
-
111
- ## Stage 04 — ADR
112
- Mechanical: each decision has why + rejected, NOT-doing list, covers storage/auth/deploy.
113
- **Challenge:** Does each decision name a *real* rejected alternative (not a strawman)? Are
114
- data storage, auth approach, and deploy target all actually decided (not "TBD")? Is the
115
- NOT-doing list honest about what's deferred?
116
- - **Offer the native persona-debate ritual** (`native-rituals.md` §1 — the guaranteed
117
- baseline, no external skill required) before locking a non-trivial decision: a 5-lens
118
- debate (architect/security/ops/user-advocate/cost) that surfaces defects while reversal
119
- is still cheap. Output INFORMS this challenge; it never passes the gate. Skip on a
120
- trivial ADR.
121
- - **If `ck-predict` is installed**, it is a richer alternative to the native ritual (same
122
- INFORMS-only rule, opt-in-with-prompt — see `claudekit-skills.md`).
123
-
124
- ## Stage 05 — Contract (the seam)
125
- Mechanical: every PRD feature -> >=1 interface, every interface has input+output shapes,
126
- access/effects column filled, no FILL.
127
- **The "interface" is the project type's seam** (`/flow project-type`): web=endpoint,
128
- cli=command+flags+output/exit, library=public function+args+return, skill=command/file.
129
- **Challenge — this is where producer/consumer drift is born (every type):**
130
- - **Material-authority stop:** access/effects (public/token/admin, writes) that encode product
131
- policy without operator authority → stop; do not invent tenancy/auth from convenience.
132
- - Does every PRD feature map to at least one interface, and vice versa?
133
- - Does every interface have BOTH input and output shapes, with field/flag names that will not
134
- drift (the #1 AI-build failure: backend ships `player_email`, UI assumed `email`, both green;
135
- the cli equivalent: `--out` vs `--output`)?
136
- - Is the access/effects column real for every interface (web: public/token/admin · non-web:
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.
147
- - One-way rule: this file is planning source of truth. For web the served spec
148
- (`/openapi.json`) is the runtime artifact of the SAME contract (amend file -> code -> spec).
149
- For non-web there is no served spec — the no-drift check is the per-type done-evidence.
150
- - **Self-consistency pass (the contract is ground truth every downstream card trusts).** Before
151
- passing this gate, read the contract AGAINST any doc it names as its own source of truth and
152
- re-state each shared rule in your own words — a contradiction here ships as "passed" and every
153
- card inherits it. (This gate once passed an internally-inconsistent seam that only a later
154
- cross-model review caught — catch that class HERE, at its source, where it is cheapest.) When the
155
- **codex tier is USABLE**, an OPTIONAL opt-in **cross-model** check of the contract is the
156
- highest-value single Codex call in a run — a different engine breaks the same-model blind spot at
157
- the one artifact whose drift is most expensive downstream.
158
- - **Offer the native edge-case ritual** (`native-rituals.md` §2 — the guaranteed
159
- baseline) to harden the seam: each case becomes an acceptance criterion + a per-type
160
- no-drift check, so the contract is exhaustive before any card trusts it. Complements
161
- `/flow consistency` (it *generates* cases; consistency checks *coherence*). INFORMS
162
- the gate; never auto-passes it.
163
- - **If `ck-scenario` is installed**, it is a richer 12-dimension alternative to the
164
- native ritual (same INFORMS-only rule, opt-in-with-prompt — see
165
- `claudekit-skills.md`).
166
-
167
- ## Card gate (`/flow check C-NNN`)
168
- Mechanical: no FILL, valid status, required sections, if done -> verify boxes checked +
169
- evidence non-empty.
170
- **Challenge:**
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).
178
- - Does the diff touch only `## Allowed files`? Drift outside = stop, amend the card first.
179
- - Do request/response shapes match `flow/05-contract.md` exactly? No improvised shapes.
180
- - For UI cards: reviewed against `law/DESIGN.md` (tokens, affordance ladder, object-first,
181
- no engine words, no emoji, no gradient on inputs/tables)?
182
- - **Is `## Evidence` real world-state** — a clickable URL, real curl output, a DB row — and
183
- NOT "tests pass" / "code merged" / "deployed successfully"? Merge != shipped: the proof is
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).
188
- - **If this card fixes a bug/regression**, the evidence includes the red→green proof that the
189
- new test was actually tied to the bug (`ground-truth-gates.md` → "Bug-fix cards"), not just a
190
- green run.
191
-
192
- ## Cross-artifact consistency (`/flow consistency`)
193
- Run after the Contract gate and before building cards (advisory; never blocks the build path).
194
- The runner does the **precise, ID-based** passes mechanically: every PRD `FRn` is claimed by a
195
- card (`implements:`) and served by an interface, the success metric carries a number, no leftover
196
- placeholders. **You do the passes that need judgment, not string-matching:**
197
- - **Hollow coverage:** an `FRn` is "covered" by a card whose scope does not actually deliver it
198
- (the id is referenced but the work isn't there). Mechanical coverage can be gamed by pasting an
199
- id; read the card scope against the feature.
200
- - **Conflicting requirements:** two artifacts state incompatible things (PRD says no-login, ADR
201
- decides OAuth; scope cut a feature the PRD still lists). The runner won't catch a contradiction
202
- expressed in different words — you must.
203
- - **Cut-list contradiction:** a feature on the stage-02 cut list reappears (by name, not id) as a
204
- v1 PRD feature or a card. Scope drift in disguise.
205
- - **Terminology drift:** the same entity named differently across artifacts (`ticket`/`issue`/
206
- `request`) — the seed of producer/consumer drift the contract gate guards against.
207
- If you find any, report *"`consistency` passed mechanically, but <artifact> contradicts <artifact>
208
- on <thing>"* and let the operator decide — same posture as every other gate.
209
-
210
- **Canonical form the mechanical pass expects** (deviate and coverage silently can't map — the runner
211
- then prints "no FR ids found" rather than a false pass, but be aware): FR ids are **uppercase `FRn`**,
212
- declared in the PRD's **`## Features`** section (ids in prose or the pain table are intentionally
213
- ignored so a legacy mention can't inflate the set). A blank success-metric body is the gate's job, not
214
- this probe's (it only checks "if a metric exists, it carries a number"). When `consistency` reports
215
- "no FR ids found", treat it as *coverage-unverified*, not *coverage-clean*.
216
-
217
- ## Constitution challenge (operator invariants — run at scope/PRD/contract)
218
-
219
- `flow.sh constitution` is the mechanical half: it proves the `flow/constitution.md` table is
220
- well-formed (no placeholder, every invariant has an ID) and scans any declared grep-marker. It
221
- **cannot** tell whether the artifact you just wrote actually *honors* the invariant — that is your
222
- job. After the mechanical pass, for each invariant whose `applies-at` includes the current stage,
223
- challenge the stage artifact against it:
224
-
225
- - Read each invariant (e.g. "all PII access is facility-scoped", "no API surface ships without a
226
- `flow/05-contract.md` entry").
227
- - Walk the current artifact (scope / PRD / contract) and ask: does anything here *violate* it, or
228
- quietly assume an exception? A contract endpoint exposing cross-tenant data violates a
229
- facility-scoped invariant even though the table is structurally clean.
230
- - If you find a violation, report *"constitution passed mechanically, but `<artifact>` violates
231
- invariant `<ID>` (`<rule>`)"* and let the operator decide — same posture as every other gate.
232
-
233
- This is **advisory and per-project**; it never auto-blocks `next`, and it does NOT replace the
234
- security-class Tier-C halt (a constitution rule may *restate* a security concern, but the halt is
235
- the enforcement). Low-noise by design: the mechanical layer is structural, the judgement is yours.
236
-
237
- ## Debt (deliberate skips)
238
- If the operator deliberately skips/reorders a gate, ensure a line opens in `DEBT.md` naming
239
- the skip, the concrete exposure, and the close condition. **Security-class skips** (auth,
240
- admin exposure, tenancy, payments) are never silent and never your decision — the operator
241
- accepts the exposure in writing. In `/flow auto`, that is a Tier-C halt.
1
+ # Gate rules — semantic layer (index)
2
+
3
+ The runner (`flow.sh`) checks the mechanical gate: no `[FILL]`, no unchecked `- [ ]`,
4
+ valid card status, non-empty evidence. After mechanical PASS, load the **one** stage
5
+ file below (and `gate-shared.md` when the stage has open decisions). Report
6
+ *"mechanically passed, but qualitatively weak: <reason>"* — never silently advance a
7
+ hollow artifact, never silently block a sound one.
8
+
9
+ > Teach: report only; do not edit the artifact or tick boxes.
10
+ > Work: self-challenge before presenting.
11
+
12
+ > Authoring note: match the form to the failure. Discipline drift (grade laundering,
13
+ > fabricated quotes, "merge ≈ shipped") is a prohibition plus the rationalization it
14
+ > counters. A wrong-shaped artifact is a positive recipe, not a bare ban.
15
+
16
+ Open-decision / material-authority unique home: `gate-shared.md`.
17
+
18
+ | Stage | Mechanical | File | Examples |
19
+ |---|---|---|---|
20
+ | Assess | no FILL, boxes | `gate-assess.md` | — |
21
+ | 00 Idea | pitch, named person, no FILL | `gate-00.md` | — |
22
+ | 01 Research | 7 boxes, no FILL | `gate-01.md` | §01 |
23
+ | 02 Scope | Impact+Grade, no L-above-A in v1, cut, GO/KILL | `gate-02.md` | §02 |
24
+ | 03 PRD | numeric metric, pain table, no FILL | `gate-03.md` | §03 |
25
+ | 04 ADR | why+rejected, NOT-doing, storage/auth/deploy | `gate-04.md` | — |
26
+ | 05 Contract | feature→interface, both shapes, access/effects | `gate-05.md` | §05 |
27
+ | Card | no FILL, status, evidence if done | `gate-card.md` | §Card |
28
+ | Consistency | advisory ID coverage | `gate-consistency.md` | — |
29
+ | Constitution | table well-formed | `gate-constitution.md` | — |
30
+ | Debt | DEBT.md line | `gate-debt.md` | — |
31
+
32
+ Hot-path first check — compare to `gate-examples.md`:
33
+ - 01: §01 (PASS = named tool + link; FLAG = unsourced competitors).
34
+ - 02: §02 (PASS = C called C; FLAG = C-launder, realtime graded B).
35
+ - 03: §03 (PASS = numeric metric + pain table + FR1 action→result; FLAG = unquantified adjective or feature with no pain).
36
+ - 05: §05 (PASS = method/path/request/response/errors/owner; FLAG = vibe/auth-optional).
37
+ - Card: §Card (PASS names URL/curl/path; FLAG = process-only / artifact-less).
38
+
39
+ `flow.sh eval` extracts `## Stage 01` / `## Stage 02` / `## Card gate` from those files,
40
+ not this index. Rituals: `native-rituals.md`, `forge-idea.md`, `clarify.md`.
@@ -0,0 +1,37 @@
1
+ # Shared gate rules — open decisions and material authority
2
+
3
+ Unique home for OD / material-authority. Stages 02 / 03 / 05 point here; do not copy.
4
+
5
+ ## Material authority
6
+
7
+ If materially different externally observable product choices remain open (quota,
8
+ identity key, tenancy model, response contract, enforcement owner, …), **stop** —
9
+ list the choice and consequences. Configurable defaults are not authority.
10
+
11
+ If the artifact invents policy (who can access what, retention, billing rules) with
12
+ no prior operator/ADR authority, stop and list Decision-required items.
13
+
14
+ Access/effects (public/token/admin, writes) that encode product policy without
15
+ operator authority → stop; do not invent tenancy/auth from convenience.
16
+
17
+ ## Assumption vs open decision
18
+
19
+ Read `## Assumptions`. A bullet that encodes product law (who can access what,
20
+ tenancy, retention, billing, enforcement owner) with no operator/ADR authority is
21
+ an **open decision or a stop**, not a silent default — move it under
22
+ `## Open decisions` (a line like `- [ ] which tenant key?`) or halt. Do not invent
23
+ auth/tenancy/retention/billing to clear `[FILL]`.
24
+
25
+ Contract has no `## Assumptions` section; do not invent one. Access/effects or
26
+ shared shapes that encode product law (tenancy, auth, retention, billing) with no
27
+ operator/ADR authority are an **open decision or a stop** — add a
28
+ `## Open decisions` bullet or halt.
29
+
30
+ ## Open decisions — mechanical
31
+
32
+ **More than 5 markdown bullets under `## Open decisions` fails `scan_gate`.**
33
+ Leftover `- [ ]` still fails boxes. Clarify (`references/clarify.md`) is opt-in,
34
+ never a `next` prereq.
35
+
36
+ If the section is a pile after that floor, assume or cut rather than interview
37
+ everything. Offer clarify when any open decision remains.
@@ -13,7 +13,7 @@ and used only to add color, never to pass a gate.
13
13
  | Card behavior works | the card's `## Verify` steps RUN for real (curl/click/command + expected output) | "the code should work" / "tests would pass" |
14
14
  | Story proof | `flow.sh harness story verify <id>` -> `verify_command` exit 0 | "I wrote tests" |
15
15
  | Build merged-safe | review green (adversarial) + `flow.sh check` pass | "the diff is small" |
16
- | Card DONE | deploy ran + **live URL verified as a user** (world-state evidence pasted) | "merged" / "deploy succeeded" / "tests pass" |
16
+ | Card DONE | per-type world-state evidence pasted (deployed URL for web; install+run for cli/library/skill) | "merged" / "deploy succeeded" / "tests pass" |
17
17
  | Card DONE (mechanical floor) | `flow.sh check` / `card done`: `## Evidence` multi-signal score ≥2 (URL + curl/command/test-log/path/DB/skill categories; denylist example.com etc.) | process-only prose (PR approvals, CI green, release notes alone); empty/placeholder |
18
18
  | Dep ready / parallel | `ready` + graph deps-met: dep `status=done` **and** same Evidence multi-signal floor | hand-edit `status: done` with hollow Evidence |
19
19
  | Auto activation | risk set valid + current Stage 05 `semantic_gate` receipt (`attestations.md`) | prose “planning looks done” |