@manhquy/flow-skill 0.1.0-rc.1

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 (76) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +152 -0
  4. package/README_VN.md +134 -0
  5. package/SECURITY.md +69 -0
  6. package/bin/cli.mjs +382 -0
  7. package/package.json +52 -0
  8. package/skills/flow/SKILL.md +234 -0
  9. package/skills/flow/_templates/00-idea.md +16 -0
  10. package/skills/flow/_templates/00-inspect.md +42 -0
  11. package/skills/flow/_templates/01-research.md +59 -0
  12. package/skills/flow/_templates/02-scope.md +71 -0
  13. package/skills/flow/_templates/03-prd.md +57 -0
  14. package/skills/flow/_templates/04-adr.md +21 -0
  15. package/skills/flow/_templates/05-contract.md +59 -0
  16. package/skills/flow/_templates/card.md +26 -0
  17. package/skills/flow/_templates/constitution.md +22 -0
  18. package/skills/flow/eval/fixtures/f01a/flow/01-research.md +77 -0
  19. package/skills/flow/eval/fixtures/f01b/flow/01-research.md +75 -0
  20. package/skills/flow/eval/fixtures/f02a/flow/02-scope.md +56 -0
  21. package/skills/flow/eval/fixtures/f02b/flow/02-scope.md +65 -0
  22. package/skills/flow/eval/fixtures/fcda/.flow/.gitkeep +0 -0
  23. package/skills/flow/eval/fixtures/fcda/cards/C-001.md +46 -0
  24. package/skills/flow/eval/fixtures/fcdb/.flow/.gitkeep +0 -0
  25. package/skills/flow/eval/fixtures/fcdb/cards/C-001.md +35 -0
  26. package/skills/flow/eval/manifest.tsv +7 -0
  27. package/skills/flow/harness/README.md +117 -0
  28. package/skills/flow/harness/_db.py +228 -0
  29. package/skills/flow/harness/_domain.py +161 -0
  30. package/skills/flow/harness/_presence.py +109 -0
  31. package/skills/flow/harness/flow_harness.py +1103 -0
  32. package/skills/flow/harness/repo_map.py +93 -0
  33. package/skills/flow/harness/schema/001-init.sql +129 -0
  34. package/skills/flow/harness/schema/002-story-verify.sql +9 -0
  35. package/skills/flow/harness/schema/003-tool-registry.sql +15 -0
  36. package/skills/flow/harness/schema/004-intervention.sql +15 -0
  37. package/skills/flow/harness/schema/005-tool-extensions.sql +20 -0
  38. package/skills/flow/harness/schema/009-accessed-count.sql +11 -0
  39. package/skills/flow/harness/schema/010-usage-event.sql +42 -0
  40. package/skills/flow/harness/schema/011-usage-gate-reason.sql +8 -0
  41. package/skills/flow/harness/schema/012-usage-ephemeral.sql +10 -0
  42. package/skills/flow/law/CLAUDE.md +140 -0
  43. package/skills/flow/law/DESIGN.md +141 -0
  44. package/skills/flow/law/RETRO.md +13 -0
  45. package/skills/flow/playbooks/README.md +28 -0
  46. package/skills/flow/playbooks/cloudflare-ai-gateway-qwen.md +346 -0
  47. package/skills/flow/playbooks/docker-deploy-stale-cache.md +32 -0
  48. package/skills/flow/playbooks/rag-lite-postgres-cloudflare.md +192 -0
  49. package/skills/flow/playbooks/windows-gitbash-jsonl-telemetry.md +57 -0
  50. package/skills/flow/references/adversarial-review.md +197 -0
  51. package/skills/flow/references/agent-detection.md +88 -0
  52. package/skills/flow/references/agent-stage-mapping.md +114 -0
  53. package/skills/flow/references/antigravity-integration.md +92 -0
  54. package/skills/flow/references/auto-run.md +81 -0
  55. package/skills/flow/references/claudekit-skills.md +128 -0
  56. package/skills/flow/references/codex-integration.md +104 -0
  57. package/skills/flow/references/command-dispatch.md +54 -0
  58. package/skills/flow/references/debt-and-halts.md +41 -0
  59. package/skills/flow/references/design-review-checklist.md +42 -0
  60. package/skills/flow/references/gate-eval.md +186 -0
  61. package/skills/flow/references/gate-rules.md +171 -0
  62. package/skills/flow/references/ground-truth-gates.md +49 -0
  63. package/skills/flow/references/loop-harness-2026-principles.md +52 -0
  64. package/skills/flow/references/mode-work.md +37 -0
  65. package/skills/flow/references/project-types.md +42 -0
  66. package/skills/flow/references/stage-state-machine.md +47 -0
  67. package/skills/flow/references/ui-patterns-tcr.md +49 -0
  68. package/skills/flow/runner/flow.cmd +18 -0
  69. package/skills/flow/runner/flow.sh +3297 -0
  70. package/skills-manifest.json +70 -0
  71. package/src/constants.mjs +65 -0
  72. package/src/detect.mjs +36 -0
  73. package/src/help.mjs +42 -0
  74. package/src/installer.mjs +231 -0
  75. package/src/prompt.mjs +60 -0
  76. package/src/tty.mjs +11 -0
@@ -0,0 +1,16 @@
1
+ # Stage 00 — Idea
2
+
3
+ ## Gate — check ALL before `/flow next`
4
+ - [ ] The pitch below is 3 sentences, no more
5
+ - [ ] I can name at least ONE real person/group who has this pain (named below)
6
+ - [ ] No FILL placeholders remain in this file
7
+
8
+ ## Pitch (3 sentences: who, pain, what you'd build)
9
+
10
+ [FILL: sentence 1 — who has the problem]
11
+ [FILL: sentence 2 — what the pain is, concretely]
12
+ [FILL: sentence 3 — what you would build]
13
+
14
+ ## One real person/group with this pain
15
+
16
+ [FILL: name a real person, community, or group you have actually seen express this pain]
@@ -0,0 +1,42 @@
1
+ # Stage 00-inspect — Brownfield assessment (existing codebase)
2
+
3
+ Run this BEFORE planning when the project ALREADY EXISTS. Goal: an honest current-state map so
4
+ planning starts from reality, not a blank page. Fill every section from EVIDENCE (read the code),
5
+ then check the gate. `/flow assess` seeds the auto-scan and validates this gate.
6
+
7
+ ## Gate — check ALL before planning
8
+ - [ ] I detected the stack / build / test / run commands (from real files; listed below)
9
+ - [ ] I mapped the main components/modules and entry points
10
+ - [ ] I assessed current functionality state (works / partial / broken) with file evidence
11
+ - [ ] I assessed UI/UX state vs the product's stated goals (or noted "no UI")
12
+ - [ ] I listed the top risks / tech-debt / known issues
13
+ - [ ] I noted the test + quality baseline (what is covered vs not)
14
+ - [ ] A human reviewed this assessment (brownfield assessment is operator-gated)
15
+ - [ ] No FILL placeholders remain in this file
16
+
17
+ ## Detected (auto-scan)
18
+ [FILL: replace with the `/flow assess` auto-scan output — stack, CI, context files]
19
+
20
+ ## Ranked surfaces (auto-scan — read these first)
21
+ The auto-scan ranks source files by how widely their symbols are referenced (highest-leverage
22
+ code first). Start your functionality + risk assessment from the top of that list — the surfaces
23
+ most of the codebase depends on are where a hidden cross-cutting risk (e.g. unscoped data access)
24
+ is most likely to hide. [FILL: note which ranked surfaces you inspected + what you found.]
25
+
26
+ ## What this product is (from docs/specs/code, not guesses)
27
+ [FILL: 2-3 sentences — the real product + who it's for + the core job]
28
+
29
+ ## Current functionality state (evidence)
30
+ [FILL: per major feature — works / partial / stub / missing, each with file:line]
31
+
32
+ ## UI / UX state vs product goals
33
+ [FILL: screens/flows present + gaps vs the stated goals; or "no UI"]
34
+
35
+ ## Risks / tech-debt / known issues
36
+ [FILL: top items, ranked; cite where]
37
+
38
+ ## Test + quality baseline
39
+ [FILL: what is tested vs not; how to run the suite; coverage if known]
40
+
41
+ ## Verdict
42
+ [FILL: is the codebase healthy enough to build on? what must be fixed first?]
@@ -0,0 +1,59 @@
1
+ # Stage 01 — Research (inspect first)
2
+
3
+ Rule: INSPECT what already exists. Evidence required — links, quotes, screenshots.
4
+ "I think there's nothing like this" without searching = gate fail.
5
+
6
+ > Project type (`/flow project-type`, default `web`): items 2 and 4 below are written for a
7
+ > **web / market-facing product**. For an **internal tool / cli / library / skill** (no public
8
+ > market), use the non-web framing in each item — it is still real evidence (first-party
9
+ > friction, who-benefits), NOT an excuse to skip. The semantic gate refuses a market product
10
+ > that hides behind the soft framing.
11
+
12
+ ## Gate — check ALL before `/flow next`
13
+ - [ ] I actually OPENED 3 existing tools/competitors (links below, with one honest note each)
14
+ - [ ] **(web)** I found 3 REAL user complaints online, quoted, with source links — **OR (non-web/internal)** I named the concrete first-party friction / observed pain that justifies this
15
+ - [ ] I wrote what competitors CHARGE (real prices) and who pays — **OR (non-web)** what people spend AROUND this problem today (time, a worse tool, manual work)
16
+ - [ ] **(web)** I named the ONE channel my first 10 users come from (a place, not "social media") — **OR (non-web/internal)** I named who benefits and how they hear about it (release notes / team), and noted "no market channel" is NOT a kill signal for an internal tool
17
+ - [ ] I wrote why those users would pick this over the status quo (one honest paragraph)
18
+ - [ ] I wrote what is technically free vs hard for this idea
19
+ - [ ] No FILL placeholders remain in this file
20
+
21
+ ## What exists already (3 — open them, don't guess)
22
+
23
+ 1. [FILL: name + link — what it does well / where it falls short]
24
+ 2. [FILL]
25
+ 3. [FILL]
26
+
27
+ ## What users say (web: 3 real complaints quoted+linked · non-web: real first-party friction)
28
+
29
+ 1. > [FILL: a real user complaint quoted, with a source link — OR, for an internal tool, a concrete observed friction/pain (who hit it, when)]
30
+ 2. > [FILL]
31
+ 3. > [FILL]
32
+
33
+ ## GTM & business reality
34
+
35
+ Building is the cheap part now. Distribution and willingness-to-pay are where ideas die —
36
+ research them BEFORE planning, not after shipping.
37
+
38
+ ### Who pays today, and how much (pricing reference points)
39
+
40
+ - [FILL: competitor/status-quo → real price → who pays it (link). 2-3 rows. "It's free"
41
+ counts: then what do people pay AROUND the problem (time, staff, a bigger suite)?]
42
+
43
+ ### The first-10-users channel (web) · who-benefits (non-web/internal)
44
+
45
+ [FILL: WEB — the specific place/community/list where the first 10 users come from, and why
46
+ you can reach them there (a named Zalo/FB group, a building, a forum, YOUR audience — not
47
+ "social media" / "word of mouth"); if you cannot name one, that is a KILL signal at scope.
48
+ NON-WEB/INTERNAL — who benefits (which users/teams) and how they learn about it (release
49
+ notes, internal docs); "no market channel" is expected and is NOT a kill signal here.]
50
+
51
+ ### Why switch (vs the status quo)
52
+
53
+ [FILL: one honest paragraph — what makes the named users move off what they do today?
54
+ Cheaper / faster / local-fit / removes a named pain? "Mine is better" is not an answer.]
55
+
56
+ ## Technically free vs hard
57
+
58
+ - Free (solved by libraries/platforms): [FILL]
59
+ - Hard (custom work, real risk): [FILL]
@@ -0,0 +1,71 @@
1
+ # Stage 02 — Scope (go/no-go)
2
+
3
+ Scope = features chosen by IMPACT × COST, inside your time budget.
4
+ KILL here is cheap and smart. Killing a weak idea at this gate is a SUCCESS outcome.
5
+
6
+ ## Impact rubric (business value — score BEFORE looking at cost)
7
+
8
+ | Impact | Meaning |
9
+ |---|---|
10
+ | H | moves money or the core promise: gets users in (acquisition), gets them paying (revenue), or delivers the one job they came for |
11
+ | M | keeps users / saves real time weekly (retention, operations) |
12
+ | L | nice-to-have; nobody would pay for or switch over it |
13
+
14
+ Decision matrix: **H-impact features justify B/C cost** (via the C-paths below).
15
+ **L-impact features must be grade A or they're cut** — and even grade-A L-features are
16
+ cut when the budget is tight. The classic failure is a v1 full of A-grade L-impact
17
+ features: cheap to build, worthless to sell.
18
+
19
+ ## AI coding grade rubric
20
+
21
+ | Grade | Meaning | Examples |
22
+ |---|---|---|
23
+ | A | cheap for AI | CRUD, forms, dashboards, content sites, API wrappers |
24
+ | B | moderate | file processing, 3rd-party integrations, auth via library, single LLM call, HITL AI drafts |
25
+ | C | expensive | realtime, payments from scratch, custom auth, autonomous agentic AI pipelines, heavy concurrency |
26
+
27
+ **Grade is a COST estimate, not a permission.** The gate is fit(grades, budget), not "no C allowed."
28
+ When a C feature is the real need, three honest paths:
29
+ 1. **The C feature IS the product** → invert the cut: C goes FIRST (riskiest assumption first),
30
+ everything else is minimized to serve it, and the budget is renegotiated against reality.
31
+ But: one C proves the value prop — its siblings are v2 cards, not v1 scope.
32
+ 2. **Re-architect C down to B** (highest-leverage move): multi-step agent → single LLM call;
33
+ auto-send → human-approves-draft; custom pipeline → managed service / library.
34
+ Same user value, one grade cheaper.
35
+ 3. **Irreducible C that doesn't fit the budget** → KILL or re-budget. Both are honest.
36
+
37
+ ## Gate — check ALL before `/flow next`
38
+ - [ ] Every feature below has an IMPACT (H/M/L with the business reason) AND a grade (A/B/C)
39
+ - [ ] No L-impact feature above grade A survives in v1
40
+ - [ ] The suggested-features section was actually considered (each suggestion has an in/out decision)
41
+ - [ ] fit(grades, budget) holds — every C in scope is justified as path 1, 2, or 3 above (written next to the feature)
42
+ - [ ] If the product IS a C feature: it is FIRST in build order, and its sibling C features are on the cut list
43
+ - [ ] The cut list is written (what I am NOT building in v1)
44
+ - [ ] GO / KILL decision is written below
45
+ - [ ] No FILL placeholders remain in this file
46
+
47
+ ## Time budget
48
+
49
+ [FILL: e.g. "2 weekends" / "20 hours"]
50
+
51
+ ## Features in v1 (each with impact AND grade)
52
+
53
+ - [FILL: feature — impact H/M/L (business reason: acquisition/revenue/retention/core job) — grade A/B/C — why]
54
+
55
+ ## Suggested features (impact-first — proposed, not decided)
56
+
57
+ Up to 3 features NOT in the original idea, each chosen for business impact (how does this
58
+ get users in / get money in / keep users?). Grounded in the stage-01 GTM findings — e.g.
59
+ the first-10-users channel often implies a share/invite/referral surface; the pricing
60
+ research often implies an upsell or a paid tier. Default is OUT; each needs an explicit
61
+ decision.
62
+
63
+ - [FILL: suggestion — impact + why (tie to GTM research) — grade — IN or OUT + reason]
64
+
65
+ ## Cut list (NOT in v1 — deferred, not deleted)
66
+
67
+ - [FILL: feature — why deferred]
68
+
69
+ ## Decision
70
+
71
+ [FILL: GO or KILL — one sentence why]
@@ -0,0 +1,57 @@
1
+ # Stage 03 — PRD
2
+
3
+ 1-2 pages max. Test: could a stranger build v1 from this without asking you anything?
4
+
5
+ ## Gate — check ALL before `/flow next`
6
+ - [ ] Every section below is filled from MY scope decision (stage 02), not re-expanded
7
+ - [ ] Success metric is a NUMBER, not vibes ("save time" fails; "first response < 2h" passes)
8
+ - [ ] Each feature names the user action and the observable result, tagged with a stable `FRn:` id
9
+ - [ ] Pain & gain is a MAPPING TABLE: every pain cites evidence (a stage-01 quote or a named observation), and names the v1 feature that kills it; every v1 feature kills at least one pain
10
+ - [ ] A stranger could build v1 from this without asking me anything
11
+ - [ ] No FILL placeholders remain in this file
12
+
13
+ ## Context
14
+
15
+ [FILL: 3-5 sentences — the situation this product enters]
16
+
17
+ ## Target users
18
+
19
+ [FILL: persona(s) — who, demographic, behavior. Reuse stage 00/01 evidence.]
20
+
21
+ ## Pain & gain (mapping table — the traceability spine of the PRD)
22
+
23
+ Every row: a concrete pain, the evidence it's real, what people do about it today, the
24
+ ONE v1 feature that kills it, and the observable gain. If a feature kills no pain, cut
25
+ it; if a pain has no feature, it goes to the "not addressed" list — honestly.
26
+
27
+ | # | Persona | Pain (concrete) | Evidence (stage-01 quote/source or named observation) | Today's workaround | V1 feature that kills it | Observable gain |
28
+ |---|---|---|---|---|---|---|
29
+ | P1 | [FILL] | [FILL] | [FILL] | [FILL] | [FILL] | [FILL] |
30
+
31
+ ### Pains NOT addressed in v1 (deliberate — tie to the scope cut list)
32
+
33
+ - [FILL: pain → why deferred / which v2 item covers it]
34
+
35
+ ## Problem statement
36
+
37
+ [FILL: 1-2 sentences]
38
+
39
+ ## Features (user-centric — action → observable result)
40
+
41
+ Tag each v1 feature with a stable id `FRn:` (functional requirement) — the traceability
42
+ anchor. Every `FRn` must later be claimed by a card (`implements: FRn`) and served by an
43
+ interface in the contract (`FRn →`); `/flow consistency` checks this mechanically.
44
+
45
+ - [FILL: "FR1: As a <user>, I <action>, and I see <result>" — one per v1 feature from stage 02]
46
+
47
+ ## Non-functional requirements
48
+
49
+ [FILL: only the ones that matter for v1 — e.g. mobile-first, page load, no-login]
50
+
51
+ ## Tech stack
52
+
53
+ [FILL: backend / db / frontend / deploy target — name specific choices]
54
+
55
+ ## Success metric (numbers only)
56
+
57
+ [FILL: e.g. "10 tickets filed by real residents in week 1; median first-response < 2h"]
@@ -0,0 +1,21 @@
1
+ # Stage 04 — ADR (architecture decisions)
2
+
3
+ Short. The most valuable section is what you are NOT doing and why.
4
+
5
+ ## Gate — check ALL before `/flow next`
6
+ - [ ] Each decision has a one-line "why" and a one-line "what I rejected"
7
+ - [ ] The NOT-doing list is written
8
+ - [ ] Decisions cover: data storage, auth approach, deploy target
9
+ - [ ] No FILL placeholders remain in this file
10
+
11
+ ## Decisions
12
+
13
+ | # | Decision | Why | Rejected alternative |
14
+ |---|---|---|---|
15
+ | 1 | [FILL: e.g. Postgres single schema] | [FILL] | [FILL] |
16
+ | 2 | [FILL: e.g. magic-link tokens, no accounts] | [FILL] | [FILL] |
17
+ | 3 | [FILL: e.g. deploy on X] | [FILL] | [FILL] |
18
+
19
+ ## NOT doing in v1 (and why it's safe to skip)
20
+
21
+ - [FILL]
@@ -0,0 +1,59 @@
1
+ # Stage 05 — Interface Contract (the seam)
2
+
3
+ The contract is whatever sits between your core and its consumer. For a web app that's
4
+ API endpoints (the table below). For a CLI it's commands + flags + output shapes; for a
5
+ plugin it's hooks + filters; for a pipeline it's input/output file schemas. Keep the
6
+ table's SPIRIT — every feature maps to an interface, every interface has its shapes
7
+ written before code — and adapt the columns to your project's shape.
8
+
9
+ Written BEFORE any code. Backend cards build TO this table; UI cards consume FROM it.
10
+ The #1 AI-build failure is producer/consumer drift — backend ships one shape, UI assumes
11
+ another, both look green. This file is the cheap fix.
12
+
13
+ ## Gate — check ALL before `/flow next`
14
+ - [ ] Every PRD feature maps to at least one INTERFACE below (web: endpoint · cli: command · library: public function · skill: command/file)
15
+ - [ ] Every interface has its INPUT and OUTPUT shapes written (web: request+response · cli: flags+output/exit code · library: args+return)
16
+ - [ ] Access/effects column filled for every interface (web: public/token/admin · non-web: writes/side-effects, or "none")
17
+ - [ ] No FILL placeholders remain in this file
18
+
19
+ ## OpenAPI / Swagger rule (web only — N/A for cli/library/skill)
20
+
21
+ For non-web types there is no served spec; the equivalent "no producer/consumer drift" check
22
+ is the per-type done-evidence (the command runs / the API imports / the skill installs+runs).
23
+ For `web`:
24
+
25
+ This table is the PLANNING source of truth. If the framework serves a spec (FastAPI →
26
+ `/openapi.json` + `/docs`), the served spec is the RUNTIME artifact of this same contract:
27
+ - Path/method/shapes here and in the served spec must agree — the contract-test card
28
+ asserts every endpoint in this table exists in the live `/openapi.json` with matching
29
+ request/response shapes.
30
+ - Change flows ONE way: amend this file first, then the code, then the spec follows.
31
+ - **Docs land with the API, not after**: the served spec is live from the vertical-slice
32
+ card onward, and every backend card's verify checks its endpoints appear in the live
33
+ `/docs` with correct schemas. The contract-test card later asserts full agreement —
34
+ but by then the docs have been growing card by card, never a catch-up task.
35
+ - Keep `/docs` enabled at least until v1 ships — it's the free human-readable contract.
36
+
37
+ ## Interfaces (web: endpoints · cli: commands · library: functions · skill: commands)
38
+
39
+ Adapt the columns to your project type. Web: Method/Path/Access(=auth: public/token/admin)/
40
+ Request/Response. CLI: Command/Flags/Access(=side-effects)/Input/Output+exit. Library:
41
+ Function/—/Access(=none)/Args/Return. The shared column below is "Access/Effects".
42
+
43
+ | Method/Interface | Path/Name | Access/Effects | Input shape | Output shape |
44
+ |---|---|---|---|---|
45
+ | [FILL] | [FILL] | [FILL] | [FILL] | [FILL] |
46
+
47
+ ## Shared shapes (objects used by multiple interfaces)
48
+
49
+ ```
50
+ [FILL: e.g. (web) Ticket { id, category, status: open|in_progress|resolved, created_at, ... }
51
+ e.g. (cli) --output json|table ; exit 0=ok 1=usage 2=error ]
52
+ ```
53
+
54
+ ## Feature → interface map
55
+
56
+ Reference each PRD feature by its `FRn` id so the mapping is machine-checkable
57
+ (`/flow consistency` flags any `FRn` with no interface here).
58
+
59
+ - [FILL: FR1 → interface(s) that serve it]
@@ -0,0 +1,26 @@
1
+ # C-NNN — [FILL: one-line scope, ONE thing]
2
+
3
+ status: todo
4
+ deps: [FILL: card ids this depends on, e.g. "C-001, C-002" — or "none"]
5
+ implements: [FILL: PRD feature ids this card delivers, e.g. "FR1, FR2" — or "infra"/"none" for non-feature cards]
6
+
7
+ ## Scope
8
+
9
+ [FILL: exactly what this card builds. If it's two things, split it.]
10
+
11
+ ## Allowed files
12
+
13
+ [FILL: which files/dirs this card may touch — keeps the diff reviewable]
14
+
15
+ ## Verify (run these before calling the card done)
16
+
17
+ - [ ] [FILL: a concrete check — a curl, a click, a command + expected output]
18
+
19
+ ## Done-evidence (world-state proof, named BEFORE building)
20
+
21
+ [FILL: what will be observable in the world when this is done — a URL you can click,
22
+ a curl output, a deployed page. "Tests pass" / "code merged" are NOT done-evidence.]
23
+
24
+ ## Evidence (paste the actual proof here when done)
25
+
26
+ (empty until done)
@@ -0,0 +1,22 @@
1
+ # Project Constitution — operator-authored invariants
2
+
3
+ Non-negotiable rules for THIS project, enforced as a **two-layer advisory gate**:
4
+ - **mechanical** — `flow.sh constitution` checks structure (no leftover placeholder, every
5
+ invariant has a stable ID) and advisory-scans any declared grep-marker under `src/`.
6
+ - **semantic** — at the scope / PRD / contract gates, Claude challenges each artifact against
7
+ these invariants (see `references/gate-rules.md` → "Constitution challenge").
8
+
9
+ This is **advisory and per-project**. It does NOT replace the security-class Tier-C halt. It is
10
+ intentionally **NOT wired into `/flow next`** — run it yourself at the scope/PRD/contract seam.
11
+
12
+ ## Invariants
13
+
14
+ Each row: a stable **ID**, the **rule**, the **stages** it applies at, an OPTIONAL **grep-marker**
15
+ (a regex that should appear in code when the invariant holds — put `-` for semantic-only rules; if
16
+ the regex needs a literal `|` alternation, escape it as `\|` so it survives the table cell),
17
+ and the **rationale**.
18
+
19
+ | ID | Invariant | Applies-at | grep-marker (optional) | Rationale |
20
+ |----|-----------|-----------|------------------------|-----------|
21
+ | INV-1 | [FILL: e.g. all PII access is facility-scoped] | scope,prd,contract | [FILL: e.g. facility_id — or -] | [FILL: why this must always hold] |
22
+ | INV-2 | [FILL: e.g. no API surface ships without an entry in flow/05-contract.md] | contract,cards | - | [FILL] |
@@ -0,0 +1,77 @@
1
+ # Stage 01 — Research (inspect first)
2
+
3
+ Rule: INSPECT what already exists. Evidence required — links, quotes, screenshots.
4
+ "I think there's nothing like this" without searching = gate fail.
5
+
6
+ ## Gate — check ALL before `/flow next`
7
+ - [x] I actually OPENED 3 existing tools/competitors (links below, with one honest note each)
8
+ - [x] I found 3 REAL user complaints online, quoted, with source links
9
+ - [x] I wrote what competitors CHARGE (real prices) and who pays
10
+ - [x] I named the ONE channel my first 10 users come from (a place, not "social media")
11
+ - [x] I wrote why those users would pick this over the status quo (one honest paragraph)
12
+ - [x] I wrote what is technically free vs hard for this idea
13
+ - [x] No FILL placeholders remain in this file
14
+
15
+ ## What exists already (3 — open them, don't guess)
16
+
17
+ 1. Splitwise (splitwise.com) — handles group expense splitting well, but its recurring-bill
18
+ view buries anything not tagged "rent"; three of our pilot households gave up trying to
19
+ track a shared internet bill inside it and moved back to a spreadsheet.
20
+ 2. Tricount (tricount.com) — clean mobile UI, free tier caps a group at 1 currency and no
21
+ CSV export unless you pay; the export paywall is the exact friction our target users hit
22
+ when they try to reconcile at month-end.
23
+ 3. A shared Google Sheet template (the informal incumbent most of our interviewees actually
24
+ use today) — zero cost, but no reminders, no per-person balance view, and it silently
25
+ breaks when two people edit the same cell at once (three separate households reported
26
+ losing an entry this way in the last three months).
27
+
28
+ ## What users say (3 real complaints quoted+linked)
29
+
30
+ 1. > "Splitwise is great until someone doesn't open the app for two weeks and the balance
31
+ > just sits there. I want a nudge, not a number."
32
+ — u/frugal_flatmate, r/personalfinance thread "How do you actually get roommates to pay
33
+ you back?" (reddit.com/r/personalfinance/comments/17k2xq1)
34
+ 2. > "We tried three apps and gave up and went back to a spreadsheet because none of them
35
+ > let us split a bill three unequal ways without doing the math ourselves first."
36
+ — comment on Tricount's App Store listing (apps.apple.com/us/app/tricount/id594204643,
37
+ review dated within the last 6 months)
38
+ 3. > "Every month it's the same fight about who forgot to pay for internet. I don't need
39
+ > another budgeting app, I need someone to just tell me the number."
40
+ — reply on r/Roommates, thread "what bill split apps have worked for you long term"
41
+ (reddit.com/r/Roommates/comments/1a8j9k2m/what_bill_split_apps_have_worked_for_you/), posted
42
+ by u/threeway_hcol_split within the last 4 months
43
+
44
+ ## GTM & business reality
45
+
46
+ Building is the cheap part now. Distribution and willingness-to-pay are where ideas die —
47
+ research them BEFORE planning, not after shipping.
48
+
49
+ ### Who pays today, and how much (pricing reference points)
50
+
51
+ - Splitwise Pro — $3/month or $30/year, paid by the household member who "owns" the group.
52
+ - Tricount CSV export — one-time IAP of $2.99, paid by whoever needs the bank reconciliation.
53
+ - Manual spreadsheet — $0 cash cost, but our pilot households estimate ~25 minutes/month of
54
+ someone's unpaid time reconciling it, which is the real cost we are competing against.
55
+
56
+ ### The first-10-users channel
57
+
58
+ The Facebook group "Da Nang Expat Roommates & Housing" (11k members, admin-approved posts
59
+ only on Mondays) — two of the founders already have posting rights there from a prior
60
+ apartment-hunting post that got 40 comments; that thread is where 6 of our 8 pilot
61
+ households were originally recruited from.
62
+
63
+ ### Why switch (vs the status quo)
64
+
65
+ The named households in that Facebook group are currently using a shared Google Sheet that
66
+ breaks under concurrent edits and has no reminder mechanism; they already told us (during
67
+ the pilot interviews) that they'd pay a small one-time fee to stop the monthly "who forgot"
68
+ argument, provided the switch takes under 5 minutes and doesn't require the whole household
69
+ to create new accounts.
70
+
71
+ ## Technically free vs hard
72
+
73
+ - Free (solved by libraries/platforms): auth via a magic-link email provider, expense CRUD,
74
+ push notifications via a managed service (OneSignal free tier covers our pilot scale).
75
+ - Hard (custom work, real risk): the "who forgot" nudge logic needs a debt-simplification
76
+ algorithm (minimize the number of repayment transactions across an N-person group) — this
77
+ is a small graph problem, not off-the-shelf, and the first version will hand-roll it.
@@ -0,0 +1,75 @@
1
+ # Stage 01 — Research (inspect first)
2
+
3
+ Rule: INSPECT what already exists. Evidence required — links, quotes, screenshots.
4
+ "I think there's nothing like this" without searching = gate fail.
5
+
6
+ ## Gate — check ALL before `/flow next`
7
+ - [x] I actually OPENED 3 existing tools/competitors (links below, with one honest note each)
8
+ - [x] I found 3 REAL user complaints online, quoted, with source links
9
+ - [x] I wrote what competitors CHARGE (real prices) and who pays
10
+ - [x] I named the ONE channel my first 10 users come from (a place, not "social media")
11
+ - [x] I wrote why those users would pick this over the status quo (one honest paragraph)
12
+ - [x] I wrote what is technically free vs hard for this idea
13
+ - [x] No FILL placeholders remain in this file
14
+
15
+ ## What exists already (3 — open them, don't guess)
16
+
17
+ 1. Splitwise — a well known bill-splitting app used by a lot of people, and honestly one of
18
+ the first names that comes up whenever this category is discussed. It covers the basics
19
+ of group expense tracking reasonably well, and most people who have shared a household
20
+ or gone on a group trip have probably at least heard of it, even if they haven't used
21
+ every feature it offers.
22
+ 2. Tricount — another popular option in this space, generally well reviewed by the people
23
+ who use it, with a clean enough interface that most users seem to figure it out without
24
+ much trouble. It's often mentioned alongside Splitwise as one of the go-to choices when
25
+ this kind of problem comes up in conversation.
26
+ 3. Various spreadsheet templates people use informally, which is honestly still the default
27
+ fallback for a lot of households — there are plenty of templates floating around online,
28
+ and they get the job done for people who don't want to bother installing another app for
29
+ something they might only need occasionally.
30
+
31
+ ## What users say (3 real complaints quoted+linked)
32
+
33
+ 1. > "This kind of app never really works for my group."
34
+ — users online, in a discussion I came across while looking into this space generally
35
+ 2. > "I wish there was something better for splitting bills with roommates."
36
+ — a comment I saw somewhere while browsing around for feedback on existing tools
37
+ 3. > "Everyone I know complains about this problem."
38
+ — general sentiment from users, based on conversations and things people have mentioned
39
+ in passing when this topic comes up among people I know
40
+
41
+ ## GTM & business reality
42
+
43
+ Building is the cheap part now. Distribution and willingness-to-pay are where ideas die —
44
+ research them BEFORE planning, not after shipping.
45
+
46
+ ### Who pays today, and how much (pricing reference points)
47
+
48
+ - Splitwise has a paid tier, roughly a few dollars a month, paid by people who use it a lot
49
+ and want the extra features that come with the paid version, though most casual users
50
+ probably just stick with the free tier and never bother upgrading.
51
+ - Tricount also has some kind of paid option for extra features, similar in spirit to how
52
+ Splitwise structures things, aimed at people who need more than the basic functionality.
53
+ - Spreadsheets are free but take time, which has some cost to people even if it's not a
54
+ direct cash expense — the time adds up, especially for groups that update it often.
55
+
56
+ ### The first-10-users channel
57
+
58
+ Social media — we'll post about it and see who's interested, probably starting with some
59
+ online groups and general word of mouth once we launch, since that tends to be how a lot
60
+ of similar apps have found their early users historically, from what I understand.
61
+
62
+ ### Why switch (vs the status quo)
63
+
64
+ Users would switch because our app is simpler and better designed than what's currently
65
+ out there, and people generally prefer a nicer experience once they try it, especially
66
+ once they see how much smoother the whole process feels compared to what they're used to.
67
+
68
+ ## Technically free vs hard
69
+
70
+ - Free (solved by libraries/platforms): most of the basic app functionality, using standard
71
+ tools and frameworks that are widely available and well documented, so there shouldn't be
72
+ much reinventing of the wheel needed for the core plumbing.
73
+ - Hard (custom work, real risk): making the whole thing feel polished and handling all the
74
+ edge cases that come up once real users start using it in ways we didn't originally plan
75
+ for, which tends to be where a lot of the actual effort ends up going in practice.
@@ -0,0 +1,56 @@
1
+ # Stage 02 — Scope (go/no-go)
2
+
3
+ Scope = features chosen by IMPACT × COST, inside your time budget.
4
+ KILL here is cheap and smart. Killing a weak idea at this gate is a SUCCESS outcome.
5
+
6
+ ## Gate — check ALL before `/flow next`
7
+ - [x] Every feature below has an IMPACT (H/M/L with the business reason) AND a grade (A/B/C)
8
+ - [x] No L-impact feature above grade A survives in v1
9
+ - [x] The suggested-features section was actually considered (each suggestion has an in/out decision)
10
+ - [x] fit(grades, budget) holds — every C in scope is justified as path 1, 2, or 3 above (written next to the feature)
11
+ - [x] If the product IS a C feature: it is FIRST in build order, and its sibling C features are on the cut list
12
+ - [x] The cut list is written (what I am NOT building in v1)
13
+ - [x] GO / KILL decision is written below
14
+ - [x] No FILL placeholders remain in this file
15
+
16
+ ## Time budget
17
+
18
+ 3 weekends (roughly 24 hours of build time)
19
+
20
+ ## Features in v1 (each with impact AND grade)
21
+
22
+ - Expense entry + equal/unequal split — impact H (core job: this is the one thing users
23
+ came for) — grade A (CRUD form over a shared-group data model)
24
+ - Magic-link email auth — impact H (acquisition: no password friction for the first-10
25
+ household to onboard) — grade B (third-party auth library, not custom) — path 2:
26
+ re-architected from a custom session system to a managed magic-link provider
27
+ - Debt-simplification nudge (who-owes-whom, minimized transaction count) — impact H (this
28
+ is the actual differentiator named in stage-01 research: "I want a nudge, not a number")
29
+ — grade C (a real graph-minimization algorithm, not off-the-shelf) — path 1: this C IS
30
+ the product's differentiator, so it goes FIRST in build order (before auth polish or
31
+ CSV export), and no sibling C features are scoped alongside it in v1
32
+ - Push reminder when a balance sits unpaid for 7+ days — impact M (retention: keeps the
33
+ household using it instead of drifting back to the spreadsheet) — grade A (managed push
34
+ notification service, OneSignal free tier)
35
+
36
+ ## Suggested features (impact-first — proposed, not decided)
37
+
38
+ - CSV export for bank reconciliation — impact M (retention/trust: matches the exact
39
+ friction named in stage-01, "we gave up because we couldn't reconcile at month-end") —
40
+ grade A (structured data → CSV is a solved problem) — IN: cheap and directly answers a
41
+ named pain, added to v1 cut list re-evaluation next cycle, deferred to v1.1 because the
42
+ 3-weekend budget is already fully allocated to the four features above
43
+ - Multi-currency support — impact L (nobody in the named first-10 household group travels
44
+ or splits in a second currency) — grade B (real but not trivial: exchange-rate handling)
45
+ — OUT: L-impact above grade A is cut per the gate rule
46
+
47
+ ## Cut list (NOT in v1 — deferred, not deleted)
48
+
49
+ - CSV export — deferred to v1.1, see suggested-features reasoning above
50
+ - Multi-currency support — deferred indefinitely unless a pilot household actually needs it
51
+ - In-app chat between household members — nice-to-have, no named user asked for it
52
+
53
+ ## Decision
54
+
55
+ GO — the core differentiator (debt-simplification nudge) is a real but bounded C feature,
56
+ sequenced first per path 1, and the rest of v1 stays at grade A/B within the 24-hour budget.