@mhd-ghaith-abtah/flow 0.8.0-beta.1 → 0.8.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.0-beta.2] — 2026-05-23
10
+
11
+ ### Fixed
12
+ - **Headless `flow init --yes` now drops `.caveman-enable` marker** — closes a parity gap between the slash workflow and the headless orchestrator. The slash `/flow-init` (skills/flow-init/workflow.md step 8b) has always dropped a zero-byte `.caveman-enable` in the project root when Caveman is requested, so allowlist-mode users (`~/.config/caveman/config.json` = `{"defaultMode": "off"}`) get Caveman activated there automatically. The headless orchestrator skipped this step despite README + usage.md both claiming the installer "drops a `.caveman-enable` marker". Surfaced by a user dogfooding the v0.8.0-beta.1 npm tarball into their actual project. Fix: `lib/init/orchestrate.js` now writes the marker after the Caveman dispatcher runs (skipped under `dryRun: true`, idempotent if the file already exists, non-fatal on write failure). 3 new tests cover the marker-written / no-marker-when-subset-none / no-marker-in-dry-run cases. docs/usage.md §16d updated — the manual `touch .caveman-enable` workaround is no longer needed on either install path. 191/191 tests pass.
13
+
14
+ ### Changed
15
+ - **Docs audit + greenfield/Caveman sections** — full sweep of every doc file for staleness post-v0.8.0-beta.1. `docs/quickstart.md` rewritten: bootstrap order now includes the `flow install-skills` step (was missing — same gap users hit before the install-skills command shipped), Q count corrected to 9 (was 8 pre-Q7c), ECC install snippet updated from the dead `./install.sh` path to the github-pin form, `/flow-doctor --fix` (which doesn't exist) replaced with `--repair-upstream`, retro output path corrected from `<date>.md` to `<epic-id>-retro.md`. `docs/migrate-from-bmad.md` stops naming specific BMad slash commands (`/bmad-create-prd`, `/bmad-create-story`) since those changed between BMad versions; now points at the BMad 6+ `/bmad:bmm:<step>` namespace as the current shape. `docs/profiles.md` clarifies that tokens-per-story figures assume Caveman = `full`. README's "When to use which command" table swapped specific BMad slash names for a version-agnostic pointer; the install diagram shows the actual github pin + Caveman fork commands. `docs/usage.md` gains two new sections: §2c "Starting from zero (greenfield + BMad planning)" — the PRD → architecture → stories → import-bmad → /flow-story arc for users with only an idea; and §17 "How Caveman enhances Flow" — the token-math justification, mode reference, fork-pin story, opt-out paths.
16
+
9
17
  ## [0.8.0-beta.1] — 2026-05-23
10
18
 
11
19
  ### Added
package/README.md CHANGED
@@ -97,7 +97,8 @@ flow install
97
97
  ├── Phase B: install Flow's own skills + adapters + templates
98
98
  ├── Phase C: delegate to upstream installers
99
99
  │ ├── npx bmad-method install --modules <curated subset>
100
- └── ECC ./install.sh --profile <curated subset>
100
+ ├── npx -y -p "github:affaan-m/ECC#<commit>" ecc-install --target <user|project> --profile <curated subset>
101
+ │ └── npx -y "github:mhd-ghaith-abtah/caveman#flow-pin-v0.1" # temporary fork, see Caveman FAQ
101
102
  ├── Phase D: install MCP servers (context7, playwright, linear, …)
102
103
  ├── Phase E: scaffold flow.config.yaml + docs/flow/
103
104
  └── Phase F: smoke test (flow doctor)
@@ -111,8 +112,8 @@ After `/flow-init` you'll have slash commands from all three projects active. Us
111
112
 
112
113
  | Goal | Command | Owner |
113
114
  |---|---|---|
114
- | Write a PRD, architecture doc, or epic list | `/bmad-create-prd`, `/bmad-create-architecture`, `/bmad-create-epic` | BMad |
115
- | Generate a fresh story from a BMad epic | `/bmad-create-story` (then `/flow-sprint import-bmad`) | BMad → Flow |
115
+ | Plan a brand-new project (PRD architecture stories) | BMad's own workflow (slash names vary by version — BMad 6 uses `/bmad:bmm:2-plan-workflow`, `/bmad:bmm:3-solutioning`, `/bmad:bmm:4-implementation`) | BMad |
116
+ | Import BMad's planning output into Flow | `/flow-sprint import-bmad` or `flow sprint import-bmad` | BMad → Flow |
116
117
  | Add a story to the current sprint | `/flow-sprint add "<title>" --epic E1` | Flow |
117
118
  | Pick the next story to work on | `/flow-sprint next` | Flow |
118
119
  | **Implement → review → verify → commit → PR** | `/flow-story` | Flow (orchestrates ECC) |
@@ -120,11 +121,11 @@ After `/flow-init` you'll have slash commands from all three projects active. Us
120
121
  | Just run a code review | `/code-review` | ECC |
121
122
  | Just run the documentation updater | `/update-docs` | ECC |
122
123
  | Health-check the whole install | `/flow-doctor` | Flow |
123
- | End-of-sprint retro | `/flow-sprint retro` | Flow |
124
+ | End-of-sprint retro | `/flow-sprint retro E1` (epic-scoped) | Flow |
124
125
 
125
126
  **Rule of thumb:** if you're moving a story through its lifecycle (plan → code → review → ship), use `/flow-story` — it dispatches to the right ECC primitive at the right phase. If you want to invoke an ECC primitive directly (e.g., to re-review uncommitted code without advancing the story), call it by name; Flow won't get in the way.
126
127
 
127
- **Don't mix:** `/bmad-create-story` and `/flow-sprint add` both create story files. Pick one per project — Flow's import-bmad subcommand bridges the two if you start with BMad and want Flow to take over.
128
+ **Don't double-create:** BMad's create-story slash command and `/flow-sprint add` both produce story files. Pick one per project — Flow's `import-bmad` subcommand bridges the two if you start with BMad and want Flow to take over per-story orchestration.
128
129
 
129
130
  ## FAQ
130
131
 
@@ -6,7 +6,7 @@ Flow doesn't replace BMad — it sits on top of it and adds a lightweight per-st
6
6
 
7
7
  - Your BMad PRD, architecture, and epic documents — `/flow-init` does NOT touch these
8
8
  - Your BMad story files in `docs/_bmad-output/stories/` — Flow reads them as references
9
- - The BMad slash commands — `/bmad-create-prd`, `/bmad-create-epic`, `/bmad-create-story` still work
9
+ - The BMad slash commands keep working Flow doesn't remove or rename them. The exact slash names depend on which BMad version is installed (BMad 6+ uses the `/bmad:bmm:<step>` namespace, e.g. `/bmad:bmm:2-plan-workflow`, `/bmad:bmm:3-solutioning`, `/bmad:bmm:4-implementation`; older releases used a flatter `/bmad-*` form). Check `~/.claude/skills/` after install to see what BMad registered.
10
10
  - `_bmad/_config/manifest.yaml` — Flow records the BMad version for repair
11
11
 
12
12
  ## What changes
@@ -17,7 +17,7 @@ Flow doesn't replace BMad — it sits on top of it and adds a lightweight per-st
17
17
  - `journeys/`, `retros/`, `archive/`, `deferred.md`, `artifacts/`
18
18
  - `flow.config.yaml` — adapter + profile config (committed; team-share safe)
19
19
  - A new branch convention: `flow/<story-id>-<slug>` — used by `/flow-story` for auto-branching
20
- - `/flow-story` becomes the per-story orchestrator instead of `/bmad-create-story` + manual stepping
20
+ - `/flow-story` becomes the per-story orchestrator instead of BMad's own per-story workflow + manual stepping
21
21
 
22
22
  ## Migration
23
23
 
@@ -68,14 +68,15 @@ Then create one story stub per entry — `templates/story.md.tmpl` is the shape.
68
68
 
69
69
  ## Coexistence
70
70
 
71
- Once migrated, you can still create new BMad stories with `/bmad-create-story` and import them into Flow:
71
+ Once migrated, you can still create new stories through BMad's own slash commands (whatever your BMad version exposes) and re-import:
72
72
 
73
73
  ```
74
- /bmad-create-story # writes docs/_bmad-output/stories/E1-002-<slug>.md
75
- /flow-sprint import-bmad # detects new BMad story files, generates Flow stubs
74
+ # Run BMad's create-story flow — exact command depends on your BMad version.
75
+ # Then back into Flow:
76
+ /flow-sprint import-bmad # detects new BMad story files, generates Flow stubs
76
77
  ```
77
78
 
78
- The reverse — Flow → BMad — isn't supported. Flow's story stubs are deliberately lighter than BMad's, so round-tripping would lose information. If you need a full BMad-shape story file later, run `/bmad-create-story` and Flow will detect + link it.
79
+ The reverse — Flow → BMad — isn't supported. Flow's story stubs are deliberately lighter than BMad's, so round-tripping would lose information. If you need a full BMad-shape story file later, run BMad's create-story flow and Flow will detect + link it on the next `import-bmad`.
79
80
 
80
81
  ## Rollback
81
82
 
package/docs/profiles.md CHANGED
@@ -4,13 +4,15 @@ Profiles are named bundles that pick the right adapters + upstream subsets + MCP
4
4
 
5
5
  ## At a glance
6
6
 
7
- | Profile | Best for | Tokens/story | Review | E2E | PR | Issue tracker | ECC scope |
7
+ | Profile | Best for | Tokens/story* | Review | E2E | PR | Issue tracker | ECC scope |
8
8
  |---|---|---:|---|---|---|---|---|
9
9
  | `mini` | Solo, one repo, light review | ~20k | `code-review` only | none | GitHub | GitHub Issues | user |
10
10
  | `standard` | Solo/small team, formal review | ~40k | `code-review` + language reviewer + security on risk tags | Playwright MCP | GitHub | GitHub Issues | user |
11
11
  | `team` | Multi-repo, multi-LLM review | ~60k | + adversarial + edge-case + separate-model reviewer | Playwright MCP | GitHub (sibling PRs) | Linear | **project** |
12
12
  | `minimal` | Bare Flow, no upstreams | <10k | none | none | none | none | user |
13
13
 
14
+ *Tokens-per-story figures assume **Caveman is active in `full` mode** — Caveman compresses Claude Code's responses ~46% on input and ~75% on output, which is the only way these numbers are realistic. Without Caveman, multiply by ~3–4×. See [usage.md §17](usage.md#17-how-caveman-enhances-flow) for the math.
15
+
14
16
  ## What each profile changes
15
17
 
16
18
  ### `minimal`
@@ -4,28 +4,41 @@ A 10-minute path from zero to first shipped story.
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- - [Claude Code](https://claude.com/claude-code) installed (`claude` on PATH)
8
- - Node 20+ (for the `flow` CLI; not strictly required if you only use slash commands)
7
+ - [Claude Code](https://claude.com/claude-code) installed (`claude` on PATH) — only required if you want the `/flow-*` slash commands. The headless CLI works without it.
8
+ - Node 20+
9
9
  - Git repo, with `origin` set if you want PRs
10
10
 
11
11
  ## Install
12
12
 
13
- Inside Claude Code, in your project root:
13
+ ```bash
14
+ # 1. Install the Node CLI
15
+ npm install -g @mhd-ghaith-abtah/flow@beta
16
+ flow --version # → 0.8.0-beta.1 (or newer)
14
17
 
18
+ # 2. Bootstrap Claude Code's slash command discovery
19
+ flow install-skills # symlinks 4 skills into ~/.claude/skills/
20
+
21
+ # 3. Pick a path per project:
22
+ flow init --profile mini --yes # headless (no Claude Code needed)
23
+ # OR, inside Claude Code:
24
+ /flow-init # interactive Q&A
15
25
  ```
16
- /flow-init
17
- ```
18
26
 
19
- This launches an interactive installer. It will:
27
+ `flow install-skills` is the bridge — npm puts Flow in `~/.npm-global/lib/node_modules/...` but Claude Code only scans `~/.claude/skills/<name>/`. Without that step, `/flow-init` won't resolve. Re-run after every Flow upgrade to refresh the symlinks (idempotent).
28
+
29
+ ## What the installer does
30
+
31
+ Either path (slash or headless `--yes`) walks the same chain:
20
32
 
21
33
  1. **Detect project shape** — package manager, framework, existing BMad/ECC install, CLAUDE.md presence
22
- 2. **Ask ~8 questions** — profile (mini/standard/team), adapters (issue tracker, PR platform, E2E, verify), upstream subsets (BMad, ECC, Caveman)
23
- 3. **Delegate to upstream installers** `npx bmad-method install --modules <curated>`, `ECC ./install.sh --profile <curated>`, plus Caveman
24
- 4. **Set up MCP servers** — context7, playwright, linear (if selected)
25
- 5. **Scaffold docs/flow/ + flow.config.yaml** — sprint.yaml, stories/, journeys/, retros/, deferred.md
34
+ 2. **Ask ~9 questions** (interactive only `--yes` pre-fills from profile defaults):
35
+ - Q1 profile · Q2–Q5 adapters (issue tracker, PR, E2E, verify) · Q6 BMad subset · Q7 ECC subset · Q7c ECC install scope (user/project) · Q7b Caveman mode · Q8 BMad migration (if detected) · Q9 secrets store
36
+ 3. **Delegate to upstream installers** — `npx bmad-method install --modules <curated>`, `npx -y -p "github:affaan-m/ECC#<commit>" ecc-install --target <user|project>`, Caveman from a Flow-maintained fork pinned at `flow-pin-v0.1` (see [usage.md §6](usage.md#6-ecc-install-scope) for the fork-pin story)
37
+ 4. **Register MCPs** — context7, playwright, linear, etc. (per profile)
38
+ 5. **Scaffold `docs/flow/` + `flow.config.yaml` + `install-state.json`**
26
39
  6. **Optionally migrate** an existing BMad `sprint-status.yaml`
27
40
 
28
- Re-running is idempotent `/flow-init --update` will diff against the recorded state and apply only deltas.
41
+ Re-running is idempotent. To re-resolve against an existing install, see [`flow init --update`](usage.md#8-updating-an-existing-install). To restore deleted scaffold files, see [`flow init --repair`](usage.md#9-repairing-a-broken-install).
29
42
 
30
43
  ## First story
31
44
 
@@ -37,12 +50,12 @@ Re-running is idempotent — `/flow-init --update` will diff against the recorde
37
50
 
38
51
  `/flow-story` auto-detects the current phase (plan / implement / review / verify / e2e / docs / commit / pr) from `sprint.yaml` + git branch + commit state, and invokes the right ECC primitive at each step. It chains phases automatically until it hits a destructive boundary (commit, PR) or a CRITICAL/HIGH review finding, then pauses for your CONFIRM.
39
52
 
40
- **Useful flags:**
53
+ **Useful `/flow-story` flags:**
41
54
 
42
55
  | Flag | Effect |
43
56
  |---|---|
44
57
  | `--auto` | No CONFIRM gates. Use for low-risk stories. |
45
- | `--auto-merge` | After PR opens, poll `gh pr merge --auto` until CI passes (15-min cap). |
58
+ | `--auto-merge` | After PR opens, poll `gh pr merge --auto` until CI passes (90-second wait cap per attempt; longer CI ends the turn + handoff). |
46
59
  | `--hard-review` | Force adversarial + edge-case reviewers regardless of tags. |
47
60
  | `--no-review` | Skip code review. Risky. Use for trivial config tweaks. |
48
61
  | `--no-verify` | Skip the verify command. Risky. |
@@ -53,30 +66,54 @@ Re-running is idempotent — `/flow-init --update` will diff against the recorde
53
66
 
54
67
  ## Closing out a story
55
68
 
56
- After a PR merges, `/flow-story` auto-detects the `merge-done` phase and asks for CONFIRM to flip the story to `done`. Or you can do it manually:
69
+ After a PR merges, `/flow-story` auto-detects the `merge-done` phase and asks for CONFIRM to flip the story to `done`. Or do it manually:
57
70
 
58
- ```
71
+ ```bash
72
+ # Inside Claude Code:
59
73
  /flow-sprint done E1-001
74
+
75
+ # Or headless:
76
+ flow sprint done E1-001 --note "Merged via auto-merge"
60
77
  ```
61
78
 
62
79
  ## End-of-sprint
63
80
 
64
81
  ```
65
- /flow-sprint retro
82
+ /flow-sprint retro E1
66
83
  ```
67
84
 
68
- Generates `docs/flow/retros/<date>.md` from your last sprint's stories: what shipped, what got deferred, review-finding rollup, verify failure rate.
85
+ Generates `docs/flow/retros/E1-retro.md` (one file per epic, not per date) from the epic's archived story files: shipped count, cycle time, deferred carry-forward, plus blank "What worked / What didn't / Carry into next epic" sections for you to edit.
69
86
 
70
87
  ## Health check
71
88
 
72
- ```
89
+ ```bash
90
+ # Inside Claude Code:
73
91
  /flow-doctor
92
+
93
+ # Headless:
94
+ flow doctor
95
+ flow doctor --json
96
+ flow doctor --verbose
97
+ ```
98
+
99
+ Verifies catalog / state / adapter files / MCP registration / required CLIs / upstream installations. Surfaces an ECC scope-collision section when both user-scope and project-scope ECC content exist.
100
+
101
+ To get repair commands for a specific upstream (BMad / ECC / Caveman pin drift):
102
+
103
+ ```bash
104
+ flow doctor --repair-upstream ecc # prints the reinstall command
105
+ flow doctor --repair-upstream bmad
106
+ flow doctor --repair-upstream caveman
74
107
  ```
75
108
 
76
- Verifies catalog / state / adapter files / MCP registration / required CLIs / upstream installations. Probes for known bugs (caveman-shrink mis-registered, severity-label stripping, loose marker matches). Add `--fix` for safe auto-repairs (prints the commands; doesn't auto-run anything destructive).
109
+ The `--repair-upstream` path prints commands but does NOT auto-run them upstream installs touch user-scope state, so the user runs them deliberately.
77
110
 
78
- ## Next
111
+ ## Where to go next
79
112
 
80
- - [profiles.md](profiles.md) choosing mini vs standard vs team
81
- - [adapters.md](adapters.md) — picking + swapping integrations
82
- - [migrate-from-bmad.md](migrate-from-bmad.md) — porting an existing BMad project
113
+ | Goal | Link |
114
+ |---|---|
115
+ | Comprehensive how-to (every flag, every scenario) | [usage.md](usage.md) |
116
+ | Choosing a profile (mini vs standard vs team) | [profiles.md](profiles.md) |
117
+ | Picking + swapping integrations | [adapters.md](adapters.md) |
118
+ | Porting an existing BMad project | [migrate-from-bmad.md](migrate-from-bmad.md) |
119
+ | Starting from zero with planning (PRD → architecture → stories) | [usage.md §2c](usage.md#2c-starting-from-zero-greenfield--bmad-planning) |
package/docs/usage.md CHANGED
@@ -26,6 +26,7 @@ This is the long-form reference. For the 10-minute first-install path, see [quic
26
26
  - [14. Environment variables](#14-environment-variables)
27
27
  - [15. Files Flow writes](#15-files-flow-writes)
28
28
  - [16. Troubleshooting](#16-troubleshooting)
29
+ - [17. How Caveman enhances Flow](#17-how-caveman-enhances-flow)
29
30
 
30
31
  ---
31
32
 
@@ -191,6 +192,89 @@ Plus, depending on profile:
191
192
  - MCPs registered with Claude Code via `claude mcp add`
192
193
  - Secrets in `~/.claude/.env.flow` (chmod 600) if any `api_token` MCP was selected
193
194
 
195
+ ### 2c. Starting from zero (greenfield + BMad planning)
196
+
197
+ If you have only an idea and no code yet, Flow uses BMad's planning workflow to get you from concept → PRD → architecture → stories → first execution, then takes over per-story orchestration.
198
+
199
+ **Setup:**
200
+
201
+ ```bash
202
+ mkdir my-idea && cd my-idea
203
+ git init && echo "# My idea" > README.md
204
+
205
+ npm install -g @mhd-ghaith-abtah/flow@beta
206
+ flow install-skills
207
+
208
+ # Pick a profile that ships BMad full. `standard` is enough for solo dev:
209
+ flow init --profile standard --yes --bmad-subset full
210
+ ```
211
+
212
+ `--bmad-subset full` installs BMad's `bmm` module (Project Manager, Architect, Product Owner, dev workflows) plus its planning-artifacts directory under `docs/_bmad-output/planning-artifacts/`.
213
+
214
+ **The planning loop (inside Claude Code):**
215
+
216
+ Once Flow finishes installing, BMad's slash commands become available. Exact names depend on your BMad version — BMad 6+ uses a `/bmad:bmm:<step>` namespace:
217
+
218
+ ```
219
+ /bmad:bmm:1-analysis # Optional — competitive research / scope scan
220
+ /bmad:bmm:2-plan-workflow # PRD (Project Manager agent)
221
+ /bmad:bmm:3-solutioning # Architecture + tech stack (Architect)
222
+ /bmad:bmm:4-implementation # Story decomposition (Scrum Master + PO)
223
+ ```
224
+
225
+ Each step writes to `docs/_bmad-output/planning-artifacts/`:
226
+ - `prd.md` — product requirements
227
+ - `architecture.md` — system design
228
+ - `epics.md` — high-level work breakdown
229
+ - `stories/E1-S1-*.md` etc. — individual story files
230
+
231
+ **Convert BMad's plan into Flow's sprint:**
232
+
233
+ After BMad produces stories, import them:
234
+
235
+ ```bash
236
+ flow sprint import-bmad
237
+ # OR inside Claude Code:
238
+ /flow-sprint import-bmad
239
+ ```
240
+
241
+ The migrator reads `docs/_bmad-output/implementation-artifacts/sprint-status.yaml`, maps BMad statuses → Flow statuses, and writes `docs/flow/sprint.yaml` with backup-first / rollback-on-failure semantics. BMad's content stays in place — Flow doesn't delete `_bmad/`. See [migrate-from-bmad.md](migrate-from-bmad.md) for the migration mechanics.
242
+
243
+ **Run the first story through Flow:**
244
+
245
+ ```
246
+ /flow-story E1-S1
247
+ ```
248
+
249
+ Flow takes BMad's story file, runs plan → implement → review → ship on it. BMad gave you the **why** (PRD/architecture); Flow drives the **how** (per-story execution, lighter ceremony, ~5× fewer tokens than BMad's own per-story workflow).
250
+
251
+ **The whole greenfield arc in one diagram:**
252
+
253
+ ```
254
+ Idea
255
+
256
+
257
+ flow init --profile standard --yes --bmad-subset full
258
+
259
+
260
+ /bmad:bmm:2-plan-workflow ── PRD
261
+
262
+
263
+ /bmad:bmm:3-solutioning ── architecture, tech stack
264
+
265
+
266
+ /bmad:bmm:4-implementation ── stories + sprint-status.yaml
267
+
268
+
269
+ flow sprint import-bmad ── stories now live in docs/flow/sprint.yaml
270
+
271
+
272
+ /flow-story E1-S1 ── per-story chain
273
+ /flow-story (no args) ── advance whatever's active
274
+ ```
275
+
276
+ You can also stay in BMad's per-story workflow if you prefer its ceremony. Flow's `/flow-story` is the lighter alternative — same outcome, fewer tokens, slightly less hand-holding.
277
+
194
278
  ---
195
279
 
196
280
  ## 3. Daily story workflow
@@ -863,15 +947,19 @@ Workaround: pass `--continue-on-error` to skip past upstream failures and inspec
863
947
 
864
948
  Both `~/.claude/rules/ecc/` and `<project>/.claude/rules/ecc/` exist. Cause: you changed `--ecc-scope` between installs without uninstalling first. The doctor probe reads `install-state.json` to identify the active scope and prints the exact `rm -rf` command for the stale one.
865
949
 
866
- ### d. Caveman MCP not active in this session
950
+ ### d. Caveman not active in this session
951
+
952
+ Caveman activates via `~/.claude/hooks/caveman-config.js` on `SessionStart`. Both the slash `/flow-init` and the headless `flow init --yes` (since v0.8.0-beta.2) drop a `.caveman-enable` marker file in your project root when you pick a non-`none` Caveman subset, so allowlist-mode users (`~/.config/caveman/config.json` = `{"defaultMode": "off"}`) get Caveman activated here automatically.
867
953
 
868
- Caveman activates via `~/.claude/hooks/caveman-config.js` on `SessionStart`. If you have `~/.config/caveman/config.json` set to `{"defaultMode": "off"}` (the recommended allowlist mode), drop a `.caveman-enable` marker in the project root:
954
+ If you're on an older Flow version OR you picked `--caveman-subset none` at install time and changed your mind:
869
955
 
870
956
  ```bash
871
957
  touch .caveman-enable
872
958
  ```
873
959
 
874
- Flow's `/flow-init` drops this automatically. Restart your Claude Code session for the hook to re-fire.
960
+ Then restart your Claude Code session for the hook to re-fire.
961
+
962
+ If the marker exists and Caveman still doesn't activate, run `flow doctor` and look at the Caveman row — `version=not pinned` plus an `installed=false` state record means the upstream installer never ran. Re-run `flow init --update` to fix.
875
963
 
876
964
  ### e. `flow sprint done E1-002` says "expects 'review' or 'doing'"
877
965
 
@@ -930,6 +1018,111 @@ This blows away Flow + Flow's project content + project-scope ECC. Does NOT remo
930
1018
 
931
1019
  ---
932
1020
 
1021
+ ## 17. How Caveman enhances Flow
1022
+
1023
+ [Caveman](https://github.com/JuliusBrussee/caveman) is an output-compression layer that runs at the Claude Code session level. It rewrites Claude's responses to use dense prose patterns while preserving full technical content. Code, error messages, commits, and security-relevant text stay normal. Filler — pleasantries, hedging, articles, restating the question — gets dropped.
1024
+
1025
+ Flow expects Caveman to be active. The token budgets advertised throughout these docs assume Caveman is on. Without it, the realistic numbers are roughly 3–4× higher.
1026
+
1027
+ ### a. The concrete numbers
1028
+
1029
+ - **~46% input token savings** — Caveman compresses your conversation history before sending it to Claude
1030
+ - **~75% output token savings** — Caveman post-processes Claude's responses on the way out
1031
+
1032
+ ### b. Why Flow needs it specifically
1033
+
1034
+ Flow's per-story phase chain runs many small phases (plan → implement → review → docs → commit → PR). Each phase reads context (story file, code diff, review notes) and generates output. Without compression:
1035
+
1036
+ - One `/flow-story` invocation pulls ~30–50k of context per phase
1037
+ - Chained across phases, a single story costs ~100k input + ~50k output ≈ **~150k tokens**
1038
+ - A 10-story sprint ≈ **~1.5M tokens**
1039
+
1040
+ With Caveman in `full` mode:
1041
+
1042
+ - Per-story cost drops to ~30k tokens
1043
+ - 10-story sprint ≈ **~300k tokens**
1044
+
1045
+ Flow's "token-light per-story workflow" tagline only works because Caveman compresses both directions.
1046
+
1047
+ ### c. What it looks like in practice
1048
+
1049
+ Without Caveman, a typical assistant response:
1050
+
1051
+ > Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by a race condition in the authentication middleware where the token expiry check uses a strict less-than comparison instead of less-than-or-equal-to.
1052
+
1053
+ With Caveman in `full` mode:
1054
+
1055
+ > Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:
1056
+
1057
+ Same technical content, ~75% fewer tokens. Code blocks render normally — Caveman doesn't touch them.
1058
+
1059
+ ### d. Modes Flow ships
1060
+
1061
+ | Mode | Compression | Use when |
1062
+ |---|---|---|
1063
+ | `none` | 0 | Disabled. Only if you have a specific reason. |
1064
+ | `lite` | ~20% | Most readable. Demo / pairing sessions. |
1065
+ | `full` | ~75% | **Default for every stock profile.** Recommended baseline. |
1066
+ | `ultra` | ~85% | Aggressive — occasionally harder to skim. |
1067
+ | `wenyan-*` | varies | Classical Chinese variants (experimental). |
1068
+
1069
+ The chosen mode lives in `flow.config.yaml > upstreams.caveman.subset` (the catalog uses the `caveman_subset` field name for the same setting). Override during install via the interactive Q7b prompt; override per-session via Caveman's own `/caveman <mode>` slash command (if installed).
1070
+
1071
+ ### e. Project-scope gating — the fork story
1072
+
1073
+ Caveman's default install activates it **globally** — every Claude Code session on your machine gets compressed output, including unrelated projects. Most users want Caveman only in Flow-managed projects.
1074
+
1075
+ Caveman's `.caveman-enable` / `.caveman-disable` marker files solve this, but the feature is in [JuliusBrussee/caveman#407](https://github.com/JuliusBrussee/caveman/pull/407) — filed 2026-05-19 and still waiting in an upstream queue with ~134 open PRs and ~5 merges/month, so months of wait.
1076
+
1077
+ Flow's catalog pins Caveman to a **temporary fork** ([mhd-ghaith-abtah/caveman @ `flow-pin-v0.1`](https://github.com/mhd-ghaith-abtah/caveman/tree/flow-pin-v0.1)) with the patches applied. The bootstrap order in Flow-managed projects:
1078
+
1079
+ 1. Flow installs Caveman from the fork (transparent — happens during `/flow-init` or `flow init --yes`).
1080
+ 2. Flow's `/flow-init` drops a `.caveman-enable` marker file in the project root.
1081
+ 3. If the user has set `~/.config/caveman/config.json` to `{"defaultMode": "off"}` (allowlist mode), Caveman stays silent everywhere EXCEPT projects with the marker.
1082
+
1083
+ You don't have to do anything — Flow's installer handles all of this. The marker file works identically against upstream Caveman and the fork, so when upstream #407 merges, the catalog swap is a no-op at the project level.
1084
+
1085
+ ### f. How to turn Caveman off in one project
1086
+
1087
+ ```bash
1088
+ touch .caveman-disable # in the project root
1089
+ ```
1090
+
1091
+ Restart your Claude Code session. Caveman ignores this project. Remove the file to re-enable.
1092
+
1093
+ ### g. How to opt OUT entirely on this machine
1094
+
1095
+ Caveman's CLI (`caveman` on your $PATH after install):
1096
+
1097
+ ```bash
1098
+ caveman off # global default off
1099
+ caveman on # global default on
1100
+ caveman <mode> # switch active mode
1101
+ ```
1102
+
1103
+ If you want zero Caveman exposure but still want Flow, install with `--caveman-subset none` (interactive Q7b → `none`) and Flow won't invoke the Caveman installer at all. Flow still works — your tokens-per-story figures go up ~3–4×.
1104
+
1105
+ ### h. Trade-offs Flow accepts
1106
+
1107
+ | Pro | Con |
1108
+ |---|---|
1109
+ | 3–5× lower token bill for the same outcome | Dense responses can be harder to skim for new users |
1110
+ | Phase-chain orchestration becomes affordable | Caveman has its own bug surface; `/flow-doctor` probes for known issues |
1111
+ | Caveman skill bundle is small (~kB-scale) | Adds another dependency the catalog tracks + Flow has to keep current |
1112
+ | The marker-file gating means Caveman doesn't leak into non-Flow projects | The fork pin is temporary — adds a swap-back step when upstream merges #407 |
1113
+
1114
+ ### i. Tracking the upstream merge
1115
+
1116
+ Flow's catalog comments mark Caveman as a temporary fork explicitly. To check upstream merge status yourself:
1117
+
1118
+ ```bash
1119
+ gh pr view 407 --repo JuliusBrussee/caveman --json state,mergedAt
1120
+ ```
1121
+
1122
+ When `state` flips to `MERGED`, Flow's next release will swap `catalog.yaml > upstreams.caveman.installer.cmd` back to the upstream npx command and remove the SWAP PLAN comment block.
1123
+
1124
+ ---
1125
+
933
1126
  ## See also
934
1127
 
935
1128
  - [Quickstart](quickstart.md) — 10-minute first-install path
@@ -24,6 +24,8 @@
24
24
  // files. Integration tests use --dry-run to exercise the full path
25
25
  // without polluting the developer's MCP config / installed upstreams.
26
26
 
27
+ import { existsSync, writeFileSync } from 'node:fs';
28
+ import { join } from 'node:path';
27
29
  import { resolveProfile } from '../catalog.js';
28
30
  import { detect } from './detect.js';
29
31
  import { askAll } from './questions.js';
@@ -114,6 +116,24 @@ export async function runInit(opts) {
114
116
  return halt('caveman upstream failed', { detection, state, upstreamResults });
115
117
  }
116
118
 
119
+ // 4b. Drop the .caveman-enable marker in the project root.
120
+ // Matches what skills/flow-init/workflow.md does on the slash path: when
121
+ // Caveman is requested for this project (subset !== 'none'), put a
122
+ // zero-byte marker so Caveman activates here even when the user has
123
+ // ~/.config/caveman/config.json set to {"defaultMode": "off"} (allowlist
124
+ // mode). Idempotent — if the marker already exists, leave it alone.
125
+ // Headless parity with the slash path; closes the gap where docs claimed
126
+ // the marker landed automatically but only the slash workflow did it.
127
+ const cavemanRequested = (state.answers.cavemanSubset || profile.caveman_subset) !== 'none';
128
+ if (cavemanRequested && !opts.dryRun) {
129
+ const markerPath = join(cwd, '.caveman-enable');
130
+ if (!existsSync(markerPath)) {
131
+ try { writeFileSync(markerPath, ''); } catch {
132
+ // Non-fatal — the install still works; user can `touch .caveman-enable` manually.
133
+ }
134
+ }
135
+ }
136
+
117
137
  // 5. MCP registration. Resolved from profile.mcps; idempotent per mcp.js.
118
138
  const mcpIds = Array.isArray(profile.mcps) ? profile.mcps : [];
119
139
  const mcpDefs = mcpModule.resolveMcps(catalog, mcpIds);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhd-ghaith-abtah/flow",
3
- "version": "0.8.0-beta.1",
3
+ "version": "0.8.0-beta.2",
4
4
  "description": "Token-light per-story workflow for Claude Code. Delegates to BMad + ECC.",
5
5
  "license": "MIT",
6
6
  "type": "module",