@mhd-ghaith-abtah/flow 0.8.0-beta.0 → 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/docs/usage.md ADDED
@@ -0,0 +1,1133 @@
1
+ # Using Flow — the complete guide
2
+
3
+ How to install, configure, run, maintain, and uninstall Flow in every supported scenario.
4
+
5
+ This is the long-form reference. For the 10-minute first-install path, see [quickstart.md](quickstart.md). For per-profile details, see [profiles.md](profiles.md). For adapter mechanics, see [adapters.md](adapters.md). For BMad → Flow migration, see [migrate-from-bmad.md](migrate-from-bmad.md).
6
+
7
+ > **Heads up on availability.** Some flags described here (`flow init --yes`, `--update`, `--repair`, `--remove-project-ecc`, MCP secrets collection) require **v0.8.0-beta.0 or later**. Earlier versions on the `latest` dist-tag have the slash-command path only. Install the beta with `npm install -g @mhd-ghaith-abtah/flow@beta` until `latest` catches up.
8
+
9
+ ---
10
+
11
+ ## Table of contents
12
+
13
+ - [1. Installation paths](#1-installation-paths)
14
+ - [2. First-time install](#2-first-time-install)
15
+ - [3. Daily story workflow](#3-daily-story-workflow)
16
+ - [4. Sprint state management](#4-sprint-state-management)
17
+ - [5. Profiles and customization](#5-profiles-and-customization)
18
+ - [6. ECC install scope](#6-ecc-install-scope)
19
+ - [7. Health checks and maintenance](#7-health-checks-and-maintenance)
20
+ - [8. Updating an existing install](#8-updating-an-existing-install)
21
+ - [9. Repairing a broken install](#9-repairing-a-broken-install)
22
+ - [10. Uninstalling](#10-uninstalling)
23
+ - [11. Inside Claude Code — slash command reference](#11-inside-claude-code--slash-command-reference)
24
+ - [12. Complete CLI flag reference](#12-complete-cli-flag-reference)
25
+ - [13. Common scenarios (recipe book)](#13-common-scenarios-recipe-book)
26
+ - [14. Environment variables](#14-environment-variables)
27
+ - [15. Files Flow writes](#15-files-flow-writes)
28
+ - [16. Troubleshooting](#16-troubleshooting)
29
+ - [17. How Caveman enhances Flow](#17-how-caveman-enhances-flow)
30
+
31
+ ---
32
+
33
+ ## 1. Installation paths
34
+
35
+ Flow ships in two surfaces: a Claude Code skill bundle (interactive) and a Node CLI (`flow`, headless). Both invoke the same underlying installers and write the same files.
36
+
37
+ **Bootstrap order matters.** Claude Code discovers slash commands by scanning `~/.claude/skills/<name>/`. The npm package puts skill files in the install location (typically `~/.npm-global/lib/node_modules/...`), NOT in `~/.claude/skills/`. So `/flow-init` does NOT work after a bare `npm install -g`. You need to run `flow install-skills` once to symlink the four skills into Claude Code's discovery path.
38
+
39
+ ### a. From npm (recommended)
40
+
41
+ ```bash
42
+ # 1. Install the Node CLI
43
+ npm install -g @mhd-ghaith-abtah/flow@beta
44
+ flow --version
45
+
46
+ # 2. Bootstrap Claude Code surface (links 4 skills into ~/.claude/skills/)
47
+ flow install-skills
48
+
49
+ # 3. Now both paths work — pick one per project:
50
+ flow init --profile mini --yes # headless
51
+ # OR, inside Claude Code:
52
+ /flow-init # interactive
53
+ ```
54
+
55
+ `flow install-skills` is idempotent — re-run safely after every upgrade to refresh the symlinks. It refuses to clobber existing real directories at the target without `--force`.
56
+
57
+ ### b. install-skills scope flag
58
+
59
+ By default `flow install-skills` writes to `~/.claude/skills/` (home scope). Override:
60
+
61
+ ```bash
62
+ flow install-skills # default: --scope home
63
+ flow install-skills --scope home # user-wide ~/.claude/skills/
64
+ flow install-skills --scope project # team-commit: <cwd>/.claude/skills/
65
+ flow install-skills --scope both # both
66
+ flow install-skills --dry-run # preview
67
+ flow install-skills --force # replace existing real dirs
68
+ ```
69
+
70
+ The `--scope project` mode is for teams that want every contributor to get Flow's slash commands the moment they `git clone` the repo — commit `<project>/.claude/skills/flow-*` so Claude Code picks them up automatically when the session is opened inside the project. The user still needs the npm package installed because the symlinks point at it.
71
+
72
+ ### c. `npx` — no install
73
+
74
+ ```bash
75
+ npx -y @mhd-ghaith-abtah/flow@beta install-skills # one-time bootstrap
76
+ npx -y @mhd-ghaith-abtah/flow@beta init --profile mini --yes
77
+ ```
78
+
79
+ `npx` works but the symlink targets the npx cache path, which can disappear when the cache rotates. For ongoing use, prefer `npm install -g`.
80
+
81
+ ### d. Development clone
82
+
83
+ ```bash
84
+ git clone https://github.com/mhd-ghaith-abtah/flow.git
85
+ cd flow && npm install && tools/dev-link.sh
86
+ ```
87
+
88
+ `tools/dev-link.sh` is the dev-mode equivalent of `flow install-skills --scope home` — symlinks the four `skills/flow-*` dirs into `~/.claude/skills/` AND puts `flow` on `$PATH` from your clone. Use when you're contributing so changes to skill workflows take effect immediately.
89
+
90
+ `tools/dev-link.sh` symlinks your clone into `$HOME/.claude/skills/flow-*` and onto `$PATH` as `flow`. Use when you're contributing.
91
+
92
+ ### e. Verifying the install
93
+
94
+ ```bash
95
+ flow --version # → 0.8.0-beta.0 (or newer)
96
+ flow doctor # health check
97
+ flow help # subcommand list
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 2. First-time install
103
+
104
+ ### a. Interactive (inside Claude Code)
105
+
106
+ ```
107
+ /flow-init
108
+ ```
109
+
110
+ The skill walks through Q1–Q9:
111
+
112
+ | Q | Asks about |
113
+ |---|---|
114
+ | Q1 | **Profile** — minimal / mini / standard / team (recommended option auto-detected from project shape) |
115
+ | Q2 | **Issue tracker adapter** — linear / github-issues / none |
116
+ | Q3 | **PR adapter** — github / none |
117
+ | Q4 | **E2E adapter** — playwright-mcp / none |
118
+ | Q5 | **Verify adapter** — make / pnpm / custom |
119
+ | Q6 | **BMad subset** — none / planning-only / full / etc. |
120
+ | Q7 | **ECC subset** — none / flow-essentials / flow-essentials-plus-tdd / etc. |
121
+ | Q7c | **ECC install scope** — user / project (asked only when ECC subset ≠ none) |
122
+ | Q7b | **Caveman compression mode** — none / lite / full / ultra / wenyan |
123
+ | Q8 | **Migrate existing BMad state?** — only asked if BMad is detected |
124
+ | Q9 | **Secrets store** — env-file / shell / 1password (only env-file persists; the others print instructions) |
125
+
126
+ Each answer pre-populates from the chosen profile's default. Hit Enter to accept; type to override.
127
+
128
+ ### b. Headless (via the CLI)
129
+
130
+ ```bash
131
+ flow init --profile mini --yes
132
+ ```
133
+
134
+ Pre-fills every answer from the profile's defaults — no prompts. Useful for scripted setup, fresh-machine bootstrap, and CI.
135
+
136
+ Override individual knobs without leaving the profile:
137
+
138
+ ```bash
139
+ flow init --profile team --yes \
140
+ --ecc-scope user \
141
+ --bmad-subset planning-only \
142
+ --ecc-subset flow-essentials
143
+ ```
144
+
145
+ CLI flag → answer mapping:
146
+
147
+ | Flag | Maps to |
148
+ |---|---|
149
+ | `--profile <name>` | Q1 |
150
+ | `--bmad-subset <name>` | Q6 |
151
+ | `--ecc-subset <name>` | Q7 |
152
+ | `--ecc-scope user\|project` | Q7c |
153
+ | `--with adapter:<id>` | Adds to Q2–Q5 picks |
154
+ | `--without adapter:<id>` | Removes a profile-default adapter |
155
+
156
+ Q2–Q5 adapter picks aren't exposed as single flags yet — use the profile default or `--with`/`--without` to compose.
157
+
158
+ ### c. Preview only (no execution)
159
+
160
+ ```bash
161
+ flow init --profile standard --dry-run # plan only
162
+ flow init --profile standard --yes --dry-run # exercise full chain in dry-run mode
163
+ ```
164
+
165
+ The first form prints the resolved bundle from `catalog.yaml`. The second runs the entire orchestrator (detect → upstreams → MCPs → scaffold) without actually writing or shelling out — useful for verifying a fresh setup before committing to it.
166
+
167
+ ### d. What gets installed
168
+
169
+ Regardless of path, a fresh install produces:
170
+
171
+ ```
172
+ <project>/
173
+ ├── .claude/
174
+ │ ├── flow.config.yaml # team-shared config (COMMIT THIS)
175
+ │ └── flow/
176
+ │ └── install-state.json # what Flow did, when
177
+ └── docs/
178
+ └── flow/
179
+ ├── sprint.yaml # SOURCE OF TRUTH for stories (COMMIT THIS)
180
+ ├── deferred.md # one-line backlog items
181
+ ├── stories/ # active story markdown files
182
+ ├── archive/ # completed story files
183
+ ├── journeys/ # E2E journey definitions
184
+ └── retros/ # epic retros
185
+ ```
186
+
187
+ Plus, depending on profile:
188
+ - Skills under `~/.claude/skills/{flow-init,flow-sprint,flow-story,flow-doctor}/`
189
+ - ECC content under `~/.claude/rules/ecc/` + `~/.claude/skills/ecc/` (user scope) OR `<project>/.claude/rules/ecc/` + `skills/ecc/` (project scope — team profile default)
190
+ - BMad in `_bmad/` if BMad subset ≠ none
191
+ - Caveman in `~/.claude/plugins/cache/caveman/` if Caveman subset ≠ none
192
+ - MCPs registered with Claude Code via `claude mcp add`
193
+ - Secrets in `~/.claude/.env.flow` (chmod 600) if any `api_token` MCP was selected
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
+
278
+ ---
279
+
280
+ ## 3. Daily story workflow
281
+
282
+ The per-story phase chain is **Claude Code only** — it's LLM-driven and the CLI doesn't have an equivalent. Inside Claude Code:
283
+
284
+ ```
285
+ /flow-story # advance the active story to its next phase
286
+ /flow-story E1-001 # advance a specific story
287
+ /flow-story status # show the current story-id without advancing
288
+ ```
289
+
290
+ Phases chain automatically:
291
+
292
+ ```
293
+ plan → /prp-implement → /code-review → /update-docs → /prp-commit → /prp-pr
294
+ ```
295
+
296
+ The chain stops on hard halts: CRITICAL review findings, verify failures, e2e failures, PR open (waiting for merge).
297
+
298
+ To run a specific phase manually without going through `/flow-story`:
299
+
300
+ ```
301
+ /plan
302
+ /prp-implement
303
+ /code-review
304
+ /update-docs
305
+ /prp-commit
306
+ /prp-pr
307
+ ```
308
+
309
+ Most users never call these directly — `/flow-story` dispatches to the right one.
310
+
311
+ ---
312
+
313
+ ## 4. Sprint state management
314
+
315
+ Sprint state lives in `docs/flow/sprint.yaml`. Mutate via either surface:
316
+
317
+ ### a. Inside Claude Code (slash)
318
+
319
+ ```
320
+ /flow-sprint add "Story title" --epic E1
321
+ /flow-sprint next
322
+ /flow-sprint status
323
+ /flow-sprint done E1-001
324
+ /flow-sprint done E1-001 --note "PR auto-merged"
325
+ /flow-sprint deferred
326
+ /flow-sprint retro E1
327
+ /flow-sprint scope-review
328
+ /flow-sprint import-bmad
329
+ ```
330
+
331
+ ### b. Headless CLI (pure-YAML ops, no LLM)
332
+
333
+ ```bash
334
+ flow sprint status
335
+ flow sprint status --json
336
+
337
+ flow sprint next # pick first backlog story
338
+ flow sprint next --epic E2 # restrict to one epic
339
+
340
+ flow sprint add --id E1-003 --title "New thing" --epic E1
341
+ flow sprint add --id E1-004 --title "Tagged work" --epic E1 \
342
+ --tags cli,ux --why "Closes the X gap"
343
+
344
+ flow sprint done E1-002
345
+ flow sprint done E1-002 --note "PR auto-merged"
346
+ flow sprint done E1-002 --force # bypass review-only gate
347
+
348
+ flow sprint deferred
349
+ flow sprint deferred --json
350
+
351
+ flow sprint import-bmad # one-shot BMad migration
352
+ ```
353
+
354
+ ### c. What stays slash-only
355
+
356
+ LLM-driven subcommands (`retro`, `scope-review`) live in `skills/flow-sprint/workflow.md` and don't have a CLI equivalent. They synthesize across multiple inputs (story files, git history, deferred items) using the LLM. A CLI stub would inevitably drift from the skill behavior — see [ROADMAP.md](../ROADMAP.md) principle #6.
357
+
358
+ ### d. Sprint YAML round-trip preservation
359
+
360
+ Flow uses the `yaml` library's Document API rather than parse-then-stringify, so your hand-edited comments, blank lines, and key ordering in `sprint.yaml` survive every mutation. You can confidently put load-bearing notes in the file.
361
+
362
+ ---
363
+
364
+ ## 5. Profiles and customization
365
+
366
+ Profiles are pre-built bundles. Pick one based on your situation. Full reference: [profiles.md](profiles.md).
367
+
368
+ | Profile | Best for | Tokens/story | Default ECC scope |
369
+ |---|---|---:|---|
370
+ | `minimal` | Bare Flow, no upstreams | <10k | user |
371
+ | `mini` | Solo dev, one repo | ~20k | user |
372
+ | `standard` | Solo/small team, formal review | ~40k | user |
373
+ | `team` | Multi-LLM review, Linear-driven | ~60k | **project** |
374
+
375
+ ### a. Inspect a profile without installing
376
+
377
+ ```bash
378
+ flow plan --profile team
379
+ flow plan --profile team --json
380
+ ```
381
+
382
+ ### b. Override individual adapters
383
+
384
+ ```bash
385
+ # Add an adapter on top of a profile's defaults:
386
+ flow init --profile mini --with adapter:e2e-playwright-mcp --yes
387
+
388
+ # Remove a profile-default adapter:
389
+ flow init --profile standard --without adapter:issue-tracker-github-issues --yes
390
+ ```
391
+
392
+ ### c. Swap profile mid-life
393
+
394
+ ```bash
395
+ flow init --update --profile team # mini → team
396
+ flow init --update --profile team --dry-run # preview deltas first
397
+ ```
398
+
399
+ `--update` reads recorded answers from `install-state.json`, applies the new profile's defaults for any answer the user didn't pin via CLI, and re-runs the chain. See [Section 8](#8-updating-an-existing-install).
400
+
401
+ ### d. Add or remove single components
402
+
403
+ ```bash
404
+ flow add adapter:e2e-playwright-mcp # adds + installs
405
+ flow add adapter:issue-tracker-linear # swaps issue-tracker family
406
+ flow remove adapter:pr-github # removes
407
+ ```
408
+
409
+ `flow add` and `flow remove` are the canonical adapter-swap mechanism. `flow.config.yaml` hand-edit also works — both routes update install-state.
410
+
411
+ ---
412
+
413
+ ## 6. ECC install scope
414
+
415
+ ECC content can land at two locations:
416
+
417
+ - **user scope:** `~/.claude/rules/ecc` + `~/.claude/skills/ecc` (shared across all your projects)
418
+ - **project scope:** `<projectRoot>/.claude/rules/ecc` + `<projectRoot>/.claude/skills/ecc` (per-repo isolation)
419
+
420
+ The team profile defaults to **project** scope so each Flow-managed repo keeps its own ECC selection. All other stock profiles default to **user** scope.
421
+
422
+ ### a. Override at install time
423
+
424
+ ```bash
425
+ flow init --profile team --ecc-scope user --yes # team but user-scope
426
+ flow init --profile mini --ecc-scope project --yes # mini but project-scope
427
+ flow plan --profile mini --ecc-scope project # preview
428
+ ```
429
+
430
+ Typos like `--ecc-scope=projet` fail loud with a clear error — silent fallback to the profile default would be a confusing UX.
431
+
432
+ ### b. Distribution caveat
433
+
434
+ ECC's `claude-project` install target merged into ECC's `main` branch via [affaan-m/ECC#2006](https://github.com/affaan-m/ECC/pull/2006) on 2026-05-19, but the current `ecc-universal@latest` is `1.10.0` (from 2026-04-15), which predates the merge. Flow's `catalog.yaml` pins to a post-merge github commit (`npx -y -p "github:affaan-m/ECC#98bd5174" ecc-install`) until ECC publishes a 2.x release.
435
+
436
+ You don't have to do anything — Flow's installer handles this transparently. The catalog's `cmd_fallback` field will get swapped back to `npx ecc-universal install` the day ECC 2.x publishes.
437
+
438
+ ### c. Detect scope drift
439
+
440
+ ```bash
441
+ flow doctor # reports both scopes if present
442
+ ```
443
+
444
+ The doctor probe surfaces a `Collisions` section when ECC content exists at BOTH `~/.claude/rules/ecc` AND `<cwd>/.claude/rules/ecc`. Common cause: a user switched `--ecc-scope` between installs without uninstalling first. The probe reads `install-state.json` to identify the active scope and suggests `rm -rf <stale_dir>`.
445
+
446
+ ---
447
+
448
+ ## 7. Health checks and maintenance
449
+
450
+ ### a. `flow doctor` — health check
451
+
452
+ ```bash
453
+ flow doctor # human-readable
454
+ flow doctor --json # scriptable
455
+ flow doctor --verbose # extra detail
456
+ ```
457
+
458
+ Reports:
459
+ - Catalog: parse + schema validation
460
+ - Install state: home + project-scope `install-state.json` presence/validity
461
+ - Config: `flow.config.yaml` presence, required keys
462
+ - Adapters: files present at expected paths (symlink-vs-regular-file detection)
463
+ - CLIs: required CLIs in `$PATH` for the active adapters
464
+ - Upstreams: BMad/ECC/Caveman version pins vs recorded values
465
+ - Collisions: ECC dual-scope content (E7-004)
466
+
467
+ Exit codes:
468
+ - `0` — all OK or only informational
469
+ - `1` — at least one warning
470
+ - `2` — at least one failure
471
+
472
+ ### b. Repair upstream installer pins
473
+
474
+ ```bash
475
+ flow doctor --repair-upstream bmad
476
+ flow doctor --repair-upstream ecc
477
+ flow doctor --repair-upstream caveman
478
+ ```
479
+
480
+ Prints (does NOT auto-run) the exact reinstall commands for one upstream, parameterized by the pinned version recorded in `install-state.json`. For ECC, output is scope-aware — user-scope vs project-scope produces different commands.
481
+
482
+ ### c. Re-register MCPs that drifted
483
+
484
+ There's no dedicated `flow mcp` command; running `flow init --update` re-registers any MCPs missing from `claude mcp list`. The `mcp.js` dispatcher is idempotent — already-registered MCPs are skipped.
485
+
486
+ ---
487
+
488
+ ## 8. Updating an existing install
489
+
490
+ `flow init --update` re-runs the chain against an existing install with the same — or overridden — answers.
491
+
492
+ ### a. No-op check
493
+
494
+ ```bash
495
+ flow init --update
496
+ ```
497
+
498
+ Reads `install-state.json`, computes the delta against the resolved profile, and reports "No changes — install matches the requested state." Useful as a sanity check.
499
+
500
+ ### b. Swap profile
501
+
502
+ ```bash
503
+ flow init --update --profile team
504
+ flow init --update --profile team --dry-run # preview deltas first
505
+ ```
506
+
507
+ Output shows per-key deltas before applying:
508
+
509
+ ```
510
+ ━━━ flow init (update) ━━━
511
+ was: profile=mini → now: profile=team cwd=... dry-run=false
512
+
513
+ Changes:
514
+ Δ profile: mini → team
515
+ Δ issueTracker: github-issues → linear
516
+ Δ bmadSubset: none → full
517
+ Δ eccSubset: flow-essentials → flow-essentials-plus-tdd
518
+ Δ eccScope: user → project
519
+ ```
520
+
521
+ ### c. Bump individual knobs
522
+
523
+ ```bash
524
+ flow init --update --bmad-subset full
525
+ flow init --update --ecc-subset security
526
+ ```
527
+
528
+ ### d. Force-rewrite flow.config.yaml
529
+
530
+ ```bash
531
+ flow init --update --force
532
+ ```
533
+
534
+ Useful when the catalog template logic changed between Flow versions and you want your `flow.config.yaml` regenerated even though nothing in your answers changed.
535
+
536
+ ### e. What `--update` refuses
537
+
538
+ `--update` halts with an explicit uninstall+reinstall recipe when:
539
+
540
+ - **install_scope changes** (user → project or vice versa). Scope swaps need filesystem cleanup at the old location. The error message includes the exact `flow uninstall` command including `--remove-project-ecc` when applicable.
541
+
542
+ ```
543
+ ✗ flow init --update: install_scope change (user → project) is not supported mid-flight
544
+ Suggested:
545
+ flow uninstall --execute --yes
546
+ flow init --profile team --ecc-scope project --yes
547
+ ```
548
+
549
+ ### f. What `--update` does NOT do
550
+
551
+ - Doesn't *remove* MCPs you've unselected (destructive; explicit `claude mcp remove` needed)
552
+ - Doesn't *uninstall* upstreams whose subset changed to `none` (manual cleanup)
553
+ - Doesn't run `git pull` on `_bmad/` or `~/.claude/rules/ecc/` — version pinning stays whatever the upstream installer wrote
554
+
555
+ ---
556
+
557
+ ## 9. Repairing a broken install
558
+
559
+ Use `flow init --repair` when scaffold files have been deleted but the install otherwise looks intact:
560
+
561
+ ```bash
562
+ flow init --repair # restore missing docs/flow/sprint.yaml etc.
563
+ flow init --repair --dry-run # preview
564
+ ```
565
+
566
+ ### a. What `--repair` does
567
+
568
+ - Loads `profile` + `answers` from `install-state.json`
569
+ - Runs `scaffold()` with `force: false` so existing files are preserved
570
+ - Recreates ONLY the missing scaffold files (sprint.yaml, deferred.md, install-state.json, etc.)
571
+ - Skips upstream installers, MCP registration, BMad migration entirely
572
+
573
+ ### b. What `--repair` refuses
574
+
575
+ - No `install-state.json` present → exit 1 with hint to run `flow init --profile <name> --yes` for a fresh install
576
+ - Corrupt `install-state.json` → exit 2 with parse error
577
+
578
+ ### c. When to use `--repair` vs `--update`
579
+
580
+ | Symptom | Command |
581
+ |---|---|
582
+ | `docs/flow/sprint.yaml` deleted | `flow init --repair` |
583
+ | `flow.config.yaml` deleted | `flow init --repair` |
584
+ | Want to swap profile | `flow init --update --profile <new>` |
585
+ | Want to change ECC scope | `flow uninstall ... && flow init ...` |
586
+ | Want to rotate MCP api_token | `flow init --update` (re-prompts) |
587
+ | Recorded answers look right but `flow doctor` reports drift | `flow init --repair` first; if not enough, `--update` |
588
+
589
+ ---
590
+
591
+ ## 10. Uninstalling
592
+
593
+ ### a. Project-scope (default)
594
+
595
+ ```bash
596
+ flow uninstall # dry-run by default
597
+ flow uninstall --execute --yes # actually remove
598
+ ```
599
+
600
+ Removes:
601
+ - `<project>/.claude/flow/` (install-state, runtime state)
602
+ - `<project>/flow.config.yaml` + `flow.config.local.yaml`
603
+ - (with `--remove-stories`) `<project>/docs/flow/`
604
+ - (with `--remove-project-ecc`) `<project>/.claude/rules/ecc/` + `<project>/.claude/skills/ecc/`
605
+
606
+ Keeps:
607
+ - `<project>/docs/flow/` (your stories — your content) unless `--remove-stories`
608
+ - `<project>/.claude/rules/ecc/` and `skills/ecc/` unless `--remove-project-ecc`
609
+ - BMad, user-scope ECC, Caveman (owned by their respective installers)
610
+
611
+ ### b. Home-scope
612
+
613
+ ```bash
614
+ flow uninstall --scope home --execute --yes
615
+ ```
616
+
617
+ Removes:
618
+ - `~/.claude/skills/{flow-init,flow-sprint,flow-story,flow-doctor}/`
619
+ - `~/.claude/flow/`
620
+
621
+ ### c. Both scopes
622
+
623
+ ```bash
624
+ flow uninstall --scope both --execute --yes --remove-stories --remove-project-ecc
625
+ ```
626
+
627
+ ### d. Removing the upstream installers themselves
628
+
629
+ Flow does NOT remove BMad, ECC, or Caveman because they were installed by their own installers. `flow uninstall` prints the manual commands at the end:
630
+
631
+ ```
632
+ BMad: rm -rf _bmad/ docs/_bmad-output/ (or `npx bmad-method uninstall`)
633
+ ECC: ~/.claude/rules/uninstall.sh (or rm -rf ~/.claude/rules/)
634
+ Caveman: rm -rf ~/.claude/plugins/cache/caveman/ and `claude mcp remove caveman-shrink`
635
+ ```
636
+
637
+ ### e. Refused without `--yes`
638
+
639
+ `--execute` without `--yes` shows the plan + asks for explicit confirmation:
640
+
641
+ ```
642
+ ⚠ About to remove the above. Re-run with --execute --yes to confirm.
643
+ ```
644
+
645
+ This is intentional — `--execute` alone won't accidentally delete files.
646
+
647
+ ---
648
+
649
+ ## 11. Inside Claude Code — slash command reference
650
+
651
+ The slash commands have CLI equivalents for the LLM-free operations:
652
+
653
+ | Slash (Claude Code) | Headless CLI | LLM dependency |
654
+ |---|---|---|
655
+ | `/flow-init` | `flow init --yes` | None |
656
+ | `/flow-init --update` | `flow init --update` | None |
657
+ | `/flow-init --repair` | `flow init --repair` | None |
658
+ | `/flow-sprint add` | `flow sprint add` | None |
659
+ | `/flow-sprint next` | `flow sprint next` | None |
660
+ | `/flow-sprint status` | `flow sprint status` | None |
661
+ | `/flow-sprint done` | `flow sprint done` | None |
662
+ | `/flow-sprint deferred` | `flow sprint deferred` | None |
663
+ | `/flow-sprint import-bmad` | `flow sprint import-bmad` | None |
664
+ | `/flow-sprint retro` | — | **Yes** (synthesizes archive + git log + retros) |
665
+ | `/flow-sprint scope-review` | — | **Yes** (audits scope creep across the sprint) |
666
+ | `/flow-doctor` | `flow doctor` | Some (probes MCP responsiveness) |
667
+ | `/flow-story` | — | **Yes** (per-story phase chain) |
668
+
669
+ Inside Claude Code, default to slash. Outside Claude Code, the CLI covers everything except `/flow-story`, `retro`, and `scope-review`.
670
+
671
+ ---
672
+
673
+ ## 12. Complete CLI flag reference
674
+
675
+ ### Global flags (work on every command)
676
+
677
+ | Flag | Meaning |
678
+ |---|---|
679
+ | `--yes`, `-y` | Skip confirmation prompts (CI mode) |
680
+ | `--dry-run` | Print plan, don't execute |
681
+ | `--json` | Machine-readable output |
682
+ | `--force` | Overwrite existing files |
683
+ | `--verbose` | Show extra detail |
684
+ | `--scope home\|project\|both` | Install/uninstall scope |
685
+
686
+ ### `flow init` flags
687
+
688
+ | Flag | Meaning |
689
+ |---|---|
690
+ | `--profile <name>` | minimal / mini / standard / team |
691
+ | `--update` | Re-run chain against existing install |
692
+ | `--repair` | Recreate missing scaffold (no upstreams) |
693
+ | `--ecc-scope user\|project` | Override profile's ECC scope |
694
+ | `--bmad-subset <name>` | Override BMad subset |
695
+ | `--ecc-subset <name>` | Override ECC subset |
696
+ | `--with adapter:<id>` | Add an adapter to the profile bundle |
697
+ | `--without adapter:<id>` | Remove a profile-default adapter |
698
+ | `--continue-on-error` | Don't halt at first upstream failure |
699
+ | `--migrate-bmad` | Run BMad migration (if BMad detected) |
700
+
701
+ ### `flow sprint <subcommand>` flags
702
+
703
+ | Subcommand | Required / common flags |
704
+ |---|---|
705
+ | `status` | `--json` |
706
+ | `next` | `--epic <id>` (optional) |
707
+ | `add` | `--id <id> --title <t> --epic <E?>`, plus `--tags`, `--why`, `--issue`, `--status` |
708
+ | `done <id>` | `--note <s>`, `--force` |
709
+ | `deferred` | `--json` |
710
+ | `import-bmad` | `--project <name>` |
711
+
712
+ ### `flow uninstall` flags
713
+
714
+ | Flag | Meaning |
715
+ |---|---|
716
+ | `--scope project\|home\|both` | Default: project |
717
+ | `--execute` | Required to actually remove (otherwise dry-run) |
718
+ | `--yes` | Required with `--execute` |
719
+ | `--remove-stories` | Also remove `docs/flow/` (user content) |
720
+ | `--remove-project-ecc` | Also remove `<project>/.claude/{rules,skills}/ecc` |
721
+ | `--remove-backups` | Also remove `*.flow-backup-*` files |
722
+
723
+ ### `flow doctor` flags
724
+
725
+ | Flag | Meaning |
726
+ |---|---|
727
+ | `--repair-upstream <bmad\|ecc\|caveman>` | Print reinstall commands for one upstream |
728
+ | `--mcp <id>` | Probe a specific MCP only |
729
+
730
+ ### `flow plan` flags
731
+
732
+ | Flag | Meaning |
733
+ |---|---|
734
+ | `--profile <name>` | Profile to resolve |
735
+ | `--with`, `--without`, `--ecc-scope` | Same as `flow init` |
736
+ | `--json` | Machine-readable plan |
737
+
738
+ ---
739
+
740
+ ## 13. Common scenarios (recipe book)
741
+
742
+ ### a. Solo dev, single repo, light review
743
+
744
+ ```bash
745
+ flow init --profile mini --yes
746
+ ```
747
+
748
+ ### b. Solo dev with several side projects, want ECC isolation per repo
749
+
750
+ ```bash
751
+ flow init --profile mini --yes --ecc-scope project
752
+ ```
753
+
754
+ ### c. Small team using Linear + Playwright + cross-model code review
755
+
756
+ ```bash
757
+ flow init --profile team --yes
758
+ # team defaults to project-scope ECC + Linear adapter + Playwright MCP
759
+ ```
760
+
761
+ ### d. Just want Flow's state model, no upstreams
762
+
763
+ ```bash
764
+ flow init --profile minimal --yes
765
+ ```
766
+
767
+ ### e. Existing BMad project, want to migrate
768
+
769
+ ```bash
770
+ flow init --profile standard --yes --migrate-bmad
771
+ # Or, after a first install:
772
+ flow sprint import-bmad
773
+ ```
774
+
775
+ ### f. Try before you commit
776
+
777
+ ```bash
778
+ flow plan --profile team # preview profile
779
+ flow init --profile team --yes --dry-run # exercise full chain in dry-run
780
+ ```
781
+
782
+ ### g. Rotate an MCP API token
783
+
784
+ ```bash
785
+ flow init --update # re-prompts for any required env vars
786
+ ```
787
+
788
+ ### h. Profile bump
789
+
790
+ ```bash
791
+ flow init --update --profile team # mini → team
792
+ flow init --update --profile team --dry-run # preview first
793
+ ```
794
+
795
+ ### i. Wrong ECC scope at install time, want to swap
796
+
797
+ ```bash
798
+ flow uninstall --execute --yes --remove-project-ecc
799
+ flow init --profile team --ecc-scope user --yes
800
+ ```
801
+
802
+ ### j. Forgot what's installed
803
+
804
+ ```bash
805
+ flow doctor
806
+ flow doctor --json | jq .
807
+ cat .claude/flow/install-state.json | jq .
808
+ ```
809
+
810
+ ### k. Build a fresh project from scratch in CI
811
+
812
+ ```bash
813
+ # .github/workflows/setup-flow.yml
814
+ - run: npm install -g @mhd-ghaith-abtah/flow@beta
815
+ - run: flow init --profile mini --yes --dry-run # smoke first
816
+ - run: flow init --profile mini --yes # real install
817
+ - run: flow doctor # gate
818
+ ```
819
+
820
+ ### l. Replace Caveman fork once upstream merges
821
+
822
+ When [JuliusBrussee/caveman#407](https://github.com/JuliusBrussee/caveman/pull/407) merges, Flow's `catalog.yaml` will be updated to point at upstream Caveman instead of `mhd-ghaith-abtah/caveman#flow-pin-v0.1`. Users get the swap automatically on the next Flow release. No action required on your end.
823
+
824
+ ### m. Inspect Flow's install scripts before they run
825
+
826
+ ```bash
827
+ export FLOW_INSPECT_INSTALL_SCRIPTS=1
828
+ flow init --profile mini --yes
829
+ # Each upstream halts before exec and prints the command + a hint at
830
+ # how to review the source (e.g. `gh repo view ...` for the Caveman fork).
831
+ ```
832
+
833
+ ### n. Re-run the full install chain after a major version bump
834
+
835
+ ```bash
836
+ npm install -g @mhd-ghaith-abtah/flow@beta # get the new version
837
+ flow init --update --force # rewrite flow.config.yaml + re-run
838
+ ```
839
+
840
+ ### o. Open a fresh `/flow-story` cycle from the CLI
841
+
842
+ You can't — `/flow-story` is LLM-driven. But you can prep the state from the CLI:
843
+
844
+ ```bash
845
+ flow sprint add --id E1-001 --title "Bootstrap" --epic E1 --tags ci,setup
846
+ flow sprint next # flip to doing
847
+ # Then inside Claude Code:
848
+ /flow-story E1-001
849
+ ```
850
+
851
+ ### p. Headless story bookkeeping during a marathon session
852
+
853
+ If you're driving multiple stories from one Claude Code session, the slash command updates sprint.yaml automatically. If you're driving from a script (CI, shell loop), use the CLI:
854
+
855
+ ```bash
856
+ for id in E1-001 E1-002 E1-003; do
857
+ flow sprint done "$id" --note "scripted close"
858
+ done
859
+ flow sprint status
860
+ ```
861
+
862
+ ---
863
+
864
+ ## 14. Environment variables
865
+
866
+ | Variable | Meaning |
867
+ |---|---|
868
+ | `FLOW_REPO_ROOT` | Override catalog/templates location. Used internally when the slash command dispatches to the CLI. |
869
+ | `FLOW_INSPECT_INSTALL_SCRIPTS=1` | Don't auto-run upstream installers. Each dispatcher halts before exec, prints the command + a hint, and returns `inspect_only: true` in the state record. |
870
+ | `FLOW_DEBUG=1` | Show stack traces on CLI errors. |
871
+ | `HOME` | Standard. Used for user-scope paths (`~/.claude/...`) and the secrets file. |
872
+ | `CLAUDECODE` / `CLAUDE_CODE` | Auto-detected. Outside Claude Code, `flow init` falls through to the headless path. Inside, it nudges to the slash command. |
873
+
874
+ ---
875
+
876
+ ## 15. Files Flow writes
877
+
878
+ ### a. Project tree (committed)
879
+
880
+ ```
881
+ <project>/
882
+ ├── .claude/
883
+ │ ├── flow.config.yaml # team-shared, COMMIT THIS
884
+ │ ├── flow/
885
+ │ │ └── install-state.json # what Flow did, COMMIT IT (helps `--repair`, `--update`)
886
+ │ ├── rules/ecc/ # team profile only — owned by ECC, gitignore optional
887
+ │ └── skills/ecc/ # team profile only — owned by ECC, gitignore optional
888
+ └── docs/
889
+ └── flow/
890
+ ├── sprint.yaml # SOURCE OF TRUTH for stories, COMMIT THIS
891
+ ├── deferred.md # open one-liners, COMMIT THIS
892
+ ├── stories/ # active story files, COMMIT THIS
893
+ ├── archive/ # completed stories, COMMIT THIS
894
+ ├── journeys/ # E2E journey definitions, COMMIT THIS
895
+ └── retros/ # epic retros, COMMIT THIS
896
+ ```
897
+
898
+ ### b. Gitignored
899
+
900
+ ```
901
+ flow.config.local.yaml # per-developer overrides
902
+ ```
903
+
904
+ ### c. User-scope (never committed)
905
+
906
+ ```
907
+ ~/.claude/
908
+ ├── skills/{flow-init,flow-sprint,flow-story,flow-doctor}/
909
+ ├── flow/install-state.json # if you installed user-scope
910
+ ├── .env.flow # secrets, chmod 600
911
+ ├── rules/ecc/ # mini/standard profile only
912
+ └── skills/ecc/ # mini/standard profile only
913
+ ```
914
+
915
+ ### d. Backup files from BMad migration
916
+
917
+ ```
918
+ docs/_bmad-output/implementation-artifacts/sprint-status.yaml.flow-backup-<ts>
919
+ docs/_bmad-output/implementation-artifacts/deferred-work.md.flow-backup-<ts>
920
+ ```
921
+
922
+ These get created by `flow sprint import-bmad` (or `/flow-init --migrate-bmad`) before any write. Delete them after you're confident the migration is correct, or pass `--remove-backups` to `flow uninstall`.
923
+
924
+ ---
925
+
926
+ ## 16. Troubleshooting
927
+
928
+ ### a. `flow: command not found`
929
+
930
+ `npm install -g @mhd-ghaith-abtah/flow@beta` didn't put `flow` on `$PATH`. Check `npm config get prefix` — that directory's `bin/` needs to be on your shell `$PATH`. Or use `npx`:
931
+
932
+ ```bash
933
+ npx -y @mhd-ghaith-abtah/flow@beta --version
934
+ ```
935
+
936
+ ### b. `flow init --yes` exits with "ECC upstream failed"
937
+
938
+ The github-pinned ECC fallback can fail if:
939
+
940
+ 1. **No network during install.** `npx -y -p "github:..."` needs to clone. Retry with network access.
941
+ 2. **GitHub rate-limited.** Wait 5 min and retry.
942
+ 3. **The pinned commit was force-pushed away.** Open an issue — Flow needs to re-pin.
943
+
944
+ Workaround: pass `--continue-on-error` to skip past upstream failures and inspect the resulting state with `flow doctor`.
945
+
946
+ ### c. `flow doctor` shows "ECC scope collision"
947
+
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.
949
+
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.
953
+
954
+ If you're on an older Flow version OR you picked `--caveman-subset none` at install time and changed your mind:
955
+
956
+ ```bash
957
+ touch .caveman-enable
958
+ ```
959
+
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.
963
+
964
+ ### e. `flow sprint done E1-002` says "expects 'review' or 'doing'"
965
+
966
+ Story is in a state Flow won't auto-flip to done. Either:
967
+
968
+ - Move it to `review` first (typical when the PR is open and waiting)
969
+ - Pass `--force` to skip the gate (typical for backfilled offline stories)
970
+
971
+ ```bash
972
+ flow sprint done E1-002 --force
973
+ ```
974
+
975
+ ### f. `flow init --repair` says "no install-state.json found"
976
+
977
+ Repair needs an authoritative install to read from. If you never ran `flow init`, run it first:
978
+
979
+ ```bash
980
+ flow init --profile mini --yes
981
+ ```
982
+
983
+ ### g. `flow init --update` says "install_scope change is not supported mid-flight"
984
+
985
+ Scope swaps need filesystem cleanup at the old location. Follow the printed recipe:
986
+
987
+ ```bash
988
+ flow uninstall --execute --yes --remove-project-ecc # cleanup
989
+ flow init --profile team --ecc-scope user --yes # reinstall with new scope
990
+ ```
991
+
992
+ ### h. `npm publish` fails with `EOTP` / `E401`
993
+
994
+ Authentication or 2FA issue. Run `npm login` to refresh auth, then retry the publish with `--otp=<code>`:
995
+
996
+ ```bash
997
+ npm publish --tag beta --access public --otp=123456
998
+ ```
999
+
1000
+ ### i. CI fails with `actions/checkout@v4` auth error
1001
+
1002
+ Transient GitHub Actions infrastructure flake. Rerun the failed jobs:
1003
+
1004
+ ```bash
1005
+ gh run rerun <run-id> --failed
1006
+ ```
1007
+
1008
+ This has hit us 3+ times in 2026-05; consistently resolves on rerun.
1009
+
1010
+ ### j. Want to start over completely
1011
+
1012
+ ```bash
1013
+ flow uninstall --scope both --execute --yes --remove-stories --remove-project-ecc
1014
+ flow init --profile <name> --yes
1015
+ ```
1016
+
1017
+ This blows away Flow + Flow's project content + project-scope ECC. Does NOT remove BMad, user-scope ECC, or Caveman — those need their own uninstall commands (printed at the end of `flow uninstall`).
1018
+
1019
+ ---
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
+
1126
+ ## See also
1127
+
1128
+ - [Quickstart](quickstart.md) — 10-minute first-install path
1129
+ - [Profiles](profiles.md) — per-profile details and ECC scope mechanics
1130
+ - [Adapters](adapters.md) — adapter contract and how to add new ones
1131
+ - [BMad migration](migrate-from-bmad.md) — specifics on the BMad → Flow state migration
1132
+ - [ROADMAP](../ROADMAP.md) — the multi-epic arc + guiding principles
1133
+ - [CHANGELOG](../CHANGELOG.md) — what shipped when