its-magic 0.1.3-3 → 0.1.3-4

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.
@@ -1,9 +1,3984 @@
1
- # its-magic metadata home
1
+ # its-magic AI dev team
2
2
 
3
- This directory is installer-owned and stores framework metadata surfaces that are
4
- not part of product/project artifacts.
3
+ [GitHub Repository](https://github.com/fl0wm0ti0n/its-magic)
5
4
 
6
- Current metadata:
5
+ You bring the idea; its-magic is your structured **AI dev team** in Cursor — PO, Tech
6
+ Lead, Dev, QA, Release, and Curator — that turns ideas into shipped software through
7
+ explicit phases and handoff artifacts.
7
8
 
8
- - `.its-magic-version` (installed framework version marker)
9
- - this operator-oriented README surface
9
+ State lives in repo files (`docs/product`, `handoffs`, `sprints`, `decisions`) — not
10
+ chat-only memory. Run `/intake` with your idea, then follow intake → discovery →
11
+ architecture → sprint plan → execute → QA → release; pause/resume and decision gates
12
+ keep you in control when you want to steer. Implementers: see `docs/developer/README.md`
13
+ for the DEV shard.
14
+
15
+ When you want hands-off delivery, enable **`AUTO_FLOW_MODE=full_autonomy`**
16
+ (default-off), run **`/auto` once in Cursor**, and let the native in-chat auto-chain
17
+ drain your backlog — self-verify UAT, bounded block retry, and advance to the next OPEN
18
+ story or bug without re-invoking each phase manually. The outer driver is **optional**
19
+ (**fallback** for headless/CI or when native chain is unavailable). Guided and
20
+ decision-gated modes remain the default.
21
+
22
+ ## Features (what its-magic can do)
23
+
24
+ ### Autonomous AI workflow
25
+
26
+ - Run `/intake` through `/release` with explicit phase handoffs and fresh subagent contexts.
27
+ - Use `/pause` and `/resume` with checkpoints when you want to steer; escalate blocking
28
+ choices to `decisions/DEC-xxxx.md`.
29
+ - Enable **`AUTO_FLOW_MODE=full_autonomy`** (default-off), run **`/auto` once in Cursor**,
30
+ and drain backlog in-chat; outer driver is **optional** / **fallback** for headless/CI.
31
+ - Team mode routes work across PO, Tech Lead, Dev, QA, Release, and Curator roles.
32
+ - Backlog and bug drain advance OPEN items without re-invoking each phase manually.
33
+ - See the catalog in **Commands and workflow** for phase commands and orchestration details.
34
+
35
+ ### Quality & verification gates
36
+
37
+ - 3-layer quality chain: AI execute/QA loop → local `validate-and-push` → CI auto-fix.
38
+ - Phase gates include `/plan-verify`, `/qa`, `/verify-work`, and `/uat` with fail-closed stops.
39
+ - `/acceptance` blocks README ↔ backlog drift; user-visible metadata guard on operator scripts.
40
+ - Browser UAT probes with structured fallback when live browser checks are unavailable.
41
+ - Release gates enforce coverage, parity, and evidence before publish.
42
+ - See the catalog in **Features** (`/acceptance`) and **Commands and workflow** for gate commands.
43
+
44
+ ### Distribution & install
45
+
46
+ - Global install via npm, npx, Chocolatey, or Homebrew; apply to any repo with
47
+ `its-magic --target`.
48
+ - Modes: `missing` (safe merge), `overwrite` (+ `--backup`), `upgrade` (framework only),
49
+ and `--clean-repo`.
50
+ - Lifecycle QA matrix validates fresh install, upgrade, backup, and clean-repo paths.
51
+ - Multi-target release publish with confirmation gates for npm/choco/brew.
52
+ - See the **Feature coverage catalog** below for distribution-tagged items.
53
+
54
+ ### Operator control & ergonomics
55
+
56
+ - Scratchpad flags and `scratchpad.local.md` tune behavior without rewriting framework files.
57
+ - Guided intake packs structure your first `/intake` conversation.
58
+ - Caveman voice mode and optional input compression for terse operator UX.
59
+ - `TOKEN_PROFILE` cost profiles slim context packs without changing workflow semantics.
60
+ - Voice input shortcuts and permissions/runtime connectivity for remote execution.
61
+ - See the catalog in **Other useful capabilities** for scratchpad and governance flags.
62
+
63
+ <!-- readme-feature-coverage-catalog -->
64
+
65
+ ### Feature coverage catalog (US-0091)
66
+
67
+ - `/acceptance` — README ↔ backlog/acceptance feature coverage backfill + blocking drift gate (`US-0091`).
68
+ - `README.md` — Visionary intro + tiered feature hierarchy (autonomous AI dev team positioning, root/template parity) (`US-0094`).
69
+ - `/auto` — Native in-chat auto-chain + full-autonomy mode (`US-0095`, `US-0092`).
70
+ - `/bin` — POSIX npm installer + Linux remote test targets (WSL / SSH / Docker) (`US-0084`).
71
+ - `/choco` — Configurable Multi-Target Release Publish with Confirmation Gate (`US-0054`).
72
+ - `/devops` — First-Class Bug Issue Workflow (Open/Closed) (`US-0079`).
73
+ - `/engineering` — Agent-Driven Codebase Map Bootstrap (`US-0082`).
74
+ - `/engineering` — Remote Runtime Connectivity Contract for QA/Release/Publish (`US-0064`).
75
+ - `/install` — Template/install payload omits intake gate scripts (`BUG-0001`).
76
+ - `/installed` — its-magic ships its OWN packaging CI into generated repos, breaking CI in every created project (`BUG-0009`).
77
+ - `/intake` — Optional Caveman-style input compression (safe file scope) (`US-0090`).
78
+ - `/lint` — CI/CD Workflows (`US-0007`).
79
+ - `/or` — Cursor Caveman mode (scratchpad-configurable terse responses) (`US-0089`).
80
+ - `/push` — Multiplatform Distribution (`US-0009`).
81
+ - `/run-tests` — Baseline Regression Cleanup for Installer and Version Sync Checks (`US-0074`).
82
+ - `/template` — End-to-End Lifecycle QA for `its-magic` Install/Upgrade/Clean (`US-0041`).
83
+ - `/upgrade` — Missing scripts still occur on install modes missing/upgrade (`BUG-0003`).
84
+ - `/usr` — Global Linux install fails: empty `install_include_paths` when manifest is CRLF (`BUG-0008`).
85
+ - `/workdir` — installer.sh fails in shell path with `set: Illegal option -` (`BUG-0004`).
86
+ - `MIGRATION` scratchpad flag — Smart Upgrade Mode (`US-0018`).
87
+ - `US-0016` scratchpad flag — Homebrew Version Sync (`US-0016`).
88
+ - `/release` — Self-Healing Deploy Loop (post-deploy smoke probe + bounded repair) (`US-0109`).
89
+
90
+ ## Setup
91
+
92
+ its-magic is an installer you run once per repo. It copies the AI dev team
93
+ workflow files (`.cursor/` commands, rules, agents, hooks, skills, plus `docs/`,
94
+ `sprints/`, `handoffs/`, etc.) into your project.
95
+
96
+ Starter artifacts are shipped as clean placeholders (no preloaded sprint/demo
97
+ history), so `/intake` starts from your own idea.
98
+
99
+ ### 1) Install its-magic (once)
100
+
101
+ Pick one method:
102
+
103
+ | Method | Install command |
104
+ |--------|----------------|
105
+ | npm | `npm install -g its-magic` |
106
+ | npx | `npx its-magic --target . --mode missing` |
107
+ | Chocolatey | `choco install its-magic` (Admin shell) |
108
+ | Homebrew | `brew tap USER/tap && brew install its-magic` |
109
+
110
+ ### Global Linux install: empty `install_include_paths` (CRLF manifest)
111
+
112
+ If **`its-magic --target <repo> --mode missing`** fails with **`[INSTALL_MANIFEST_ERROR] install_include_paths section is empty`** on Debian/Linux while the packaged manifest still lists paths, the global install likely has **CRLF** line endings in **`installer-owned-paths.manifest`** (visible as **`^M$`** with **`cat -A`**). **Fix in-tree** from **`0.1.2-41`**: **`installer.sh`** strips trailing carriage returns before section matching; **`.gitattributes`** keeps **`*.manifest`** LF; **`prepublishOnly`** runs **`guard_installer_publish`**. **Upgrade**: install a build **≥ `0.1.2-41`** (or reinstall from a fresh **`npm pack`** tarball after pull). Older tarballs such as **`its-magic@0.1.2-40`** may remain broken until republished — see **`docs/engineering/architecture.md`** **`# BUG-0008`**.
113
+
114
+ ### 2) Apply to a repo
115
+
116
+ New repo:
117
+
118
+ ```bash
119
+ mkdir my-project && cd my-project
120
+ git init
121
+ its-magic --target . --mode missing --create
122
+ ```
123
+
124
+ Existing repo (safe merge):
125
+
126
+ ```bash
127
+ its-magic --target . --mode missing
128
+ ```
129
+
130
+ Existing repo (overwrite + backup):
131
+
132
+ ```bash
133
+ its-magic --target . --mode overwrite --backup
134
+ ```
135
+
136
+ ### Upgrading an existing repo
137
+
138
+ When you update its-magic to a newer version (`npm update -g its-magic`), run
139
+ upgrade mode to update framework files while preserving your project data:
140
+
141
+ ```bash
142
+ its-magic --target . --mode upgrade
143
+ ```
144
+
145
+ What upgrade does:
146
+
147
+ - **Framework files** (commands, rules, agents, hooks, skills, CI, scripts) are
148
+ updated to the latest version.
149
+ - **User data** (docs, sprints, handoffs, decisions, runbook) is never touched.
150
+ - **Mixed files** (`README.md`) are preserved. If the template version has new
151
+ content, a review notice is printed.
152
+ - **Scratchpad baseline (DEC-0055 / US-0073, Model B):** `.cursor/scratchpad.md`
153
+ is not copied as a manifest file; the installer **materializes** it from the
154
+ packaged template when missing and validates required merged keys (Python
155
+ required). Legacy repos that already committed `.cursor/scratchpad.md` keep it on
156
+ upgrade (not overwritten).
157
+ - A canonical version marker is stored at `its_magic/.its-magic-version` in your repo.
158
+ - Installer bootstrap is OS-aware + stack-aware for runbook command defaults
159
+ (`TEST_COMMAND`, optional `LINT_COMMAND`/`TYPECHECK_COMMAND`) and preserves
160
+ explicit user overrides.
161
+
162
+ Upgrade with backup (backs up framework files before updating):
163
+
164
+ ```bash
165
+ its-magic --target . --mode upgrade --backup
166
+ ```
167
+
168
+ ### 3) Open in Cursor
169
+
170
+ 1. Open the project folder
171
+ 2. Run `/intake` with your idea
172
+ 3. Follow the workflow
173
+
174
+ ### CLI quick commands
175
+
176
+ ```bash
177
+ # Show banner + help
178
+ its-magic
179
+
180
+ # Show version only
181
+ its-magic --version
182
+
183
+ # Install workflow files into current repo
184
+ its-magic --target . --mode missing
185
+
186
+ # Clean previously installed workflow artifacts
187
+ its-magic --clean-repo --target .
188
+ ```
189
+
190
+ ### Installer options
191
+
192
+ **Install options**
193
+
194
+ | Flag | Description |
195
+ |------|-------------|
196
+ | `--target <path>` | Path to the repository where workflow files are installed. If omitted you are prompted interactively. |
197
+ | `--mode missing` | **Default.** Only copy files that do not exist yet. Safe for repos that already have some workflow files. |
198
+ | `--mode overwrite` | Replace every file, even if it already exists. Combine with `--backup` to keep a snapshot first. |
199
+ | `--mode interactive` | Ask per file whether to overwrite or skip. Useful when you want to cherry-pick updates. |
200
+ | `--mode upgrade` | Update framework files (commands, rules, agents, hooks, skills, CI, scripts) while preserving user data (docs, sprints, handoffs, decisions). Use after updating its-magic to a newer version. |
201
+ | `--backup` | Before overwriting, save existing files to `backups/<timestamp>/`. Ignored in `missing` mode (nothing gets replaced). |
202
+ | `--create` | Create the target directory if it does not exist. |
203
+
204
+ **Clean options**
205
+
206
+ | Flag | Description |
207
+ |------|-------------|
208
+ | `--clean-repo` | Remove installer-owned its-magic workflow artifacts from the target repo (manifest-owned paths including `.cursor`, `docs/product`, `docs/engineering`, `docs/user-guides`, `sprints`, `handoffs`, `decisions`, workflow scripts, CI files, installer metadata in `its_magic/`, and legacy `.its-magic-version`). Your own source code is never touched. |
209
+ | `--yes` | Skip the confirmation prompt when cleaning. |
210
+
211
+ **Info**
212
+
213
+ | Flag | Description |
214
+ |------|-------------|
215
+ | `--help`, `-h` | Show banner, version, repo URL, and full usage reference. |
216
+ | `--version`, `-v` | Print the installed its-magic version and exit. |
217
+
218
+ ### Lifecycle QA matrix (US-0041)
219
+
220
+ `its-magic` lifecycle behavior is validated in both installer and CLI paths.
221
+ Primary coverage:
222
+
223
+ | Scenario | Local coverage | CI coverage | Expected evidence |
224
+ |---|---|---|---|
225
+ | Fresh install (`missing`) | `tests/run-tests.ps1`, `tests/run-tests.sh` | npm/brew/choco jobs | Required files + `its_magic/.its-magic-version` |
226
+ | Overwrite + backup | `tests/run-tests.ps1`, `tests/run-tests.sh` | lifecycle subset in CI jobs | Backup snapshot contains overwritten framework file |
227
+ | Upgrade lifecycle | `tests/run-tests.ps1`, `tests/run-tests.sh`, npm local package tests | lifecycle subset in CI jobs | Framework file restored, user-data preserved |
228
+ | Clean-repo safety | `tests/run-tests.ps1`, `tests/run-tests.sh`, npm local package tests | lifecycle subset in CI jobs | Framework artifacts removed, non-framework marker preserved |
229
+ | Negative-path invalid mode/args | `tests/run-tests.ps1`, `tests/run-tests.sh` | lifecycle subset in CI jobs | Non-zero fail-fast behavior |
230
+
231
+ Run locally:
232
+
233
+ ```bash
234
+ sh tests/run-tests.sh
235
+ powershell -ExecutionPolicy Bypass -File tests/run-tests.ps1
236
+ ```
237
+
238
+ ## How-to
239
+
240
+ ### Command usage pattern
241
+
242
+ - Best practice: use `/<command>` + 1-3 lines context.
243
+ - For quick ops (`/pause`, `/resume`, `/refresh-context`) command-only is fine.
244
+
245
+ ### What gets installed
246
+
247
+ ```text
248
+ your-project/
249
+ .cursor/commands/ Cursor slash commands
250
+ .cursor/rules/ AI behavior rules
251
+ .cursor/agents/ Subagent definitions
252
+ .cursor/skills/ Reusable skills
253
+ .cursor/hooks/ Automation hooks
254
+ .cursor/scratchpad.md Materialized shared defaults (Model B; not manifest-copied)
255
+ .cursor/scratchpad.local.example.md Framework default key catalog
256
+ docs/ Engineering & product docs, runbook
257
+ sprints/ Sprint tracking artifacts
258
+ handoffs/ Phase handoff artifacts
259
+ decisions/ Decision records
260
+ scripts/validate-and-push.ps1 Local test-fix-push loop (Windows)
261
+ scripts/validate-and-push.sh Local test-fix-push loop (Linux/Mac)
262
+ .github/workflows/ CI with auto-fix loop
263
+ README.md
264
+ ```
265
+
266
+ ### Team mode local overrides (recommended)
267
+
268
+ Use three layers (merge precedence: **local > materialized baseline > example**,
269
+ `DEC-0055`):
270
+
271
+ - Framework catalog: `.cursor/scratchpad.local.example.md` (installed; refreshed on upgrade)
272
+ - Shared team baseline: `.cursor/scratchpad.md` (materialized on install when missing; commit as you prefer)
273
+ - Personal overrides: `.cursor/scratchpad.local.md` (gitignored; never overwritten by install/upgrade)
274
+
275
+ Setup:
276
+
277
+ 1. Run `its-magic` — baseline is materialized and merged validation runs (requires Python on PATH for `installer.ps1` / `installer.sh`).
278
+ 2. Optionally copy `.cursor/scratchpad.local.example.md` to `.cursor/scratchpad.local.md` for personal values (`TEAM_MEMBER`, `ACTIVE_TASK_IDS`, …).
279
+
280
+ Recovery if `.cursor/scratchpad.md` is missing or merge validation fails:
281
+
282
+ ```bash
283
+ python installer.py --scratchpad-postinstall --target . --mode missing
284
+ ```
285
+
286
+ Upgrade behavior (US-0057 / DEC-0057):
287
+ - Aligns with **DEC-0039** (example vs local ownership), **DEC-0057** (example-first
288
+ ordering relative to baseline materialization), and Model B baseline rules below.
289
+
290
+ - `.cursor/scratchpad.local.example.md` is framework-owned and always refreshed from
291
+ the shipped template during post-install **before** baseline handling (`DEC-0057` **AC-1..AC-3**).
292
+ - `.cursor/scratchpad.local.md` is user-owned and preserved on `--mode upgrade`.
293
+ - Existing `.cursor/scratchpad.md` is left untouched on upgrade unless missing (then
294
+ materialized) or `overwrite` / fresh materialize paths apply (Model B).
295
+ - Installer output uses `[SCRATCHPAD_LAYER]` lines to distinguish example refresh,
296
+ baseline materialize/skip, and user-local preservation (`DEC-0057` **AC-5**).
297
+ - Paired catalog parity (baseline vs `.cursor/scratchpad.local.example.md`, active and
298
+ `template/`): `python scripts/check-scratchpad-pair-parity.py --repo .` (wired into
299
+ `tests/run-tests.ps1` / `tests/run-tests.sh`; **AC-11**).
300
+
301
+ Deterministic ordering behavior (US-0058):
302
+ - Mutable artifacts follow `docs/engineering/artifact-ordering-policy.md`.
303
+ - `state.md` checkpoints are append-bottom; `backlog.md` and `acceptance.md`
304
+ remain sorted-canonical by story ID.
305
+ - Commands fail closed on ambiguous placement anchors using
306
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`.
307
+ - Commands fail closed on non-monotonic state checkpoint timestamps using
308
+ `STATE_TIMESTAMP_NON_MONOTONIC`.
309
+
310
+ Intake runtime safety behavior (US-0059):
311
+ - `/intake` requires role-specific `po` capability by default and fails fast with
312
+ `SUBAGENT_CAPABILITY_UNAVAILABLE` when unavailable.
313
+ - Silent in-band fallback is disabled by default and only allowed with explicit
314
+ `INTAKE_SUBAGENT_FALLBACK=allow`.
315
+ - Drift detection distinguishes self-write updates from external concurrent
316
+ writers; true conflicting external writes fail safe with
317
+ `INTAKE_CONCURRENT_WRITER_DETECTED`.
318
+
319
+ Runtime QA autopilot behavior (US-0065):
320
+ - Generated-project QA must include runtime proof chain:
321
+ `startup -> readiness/connectivity -> log scan -> bounded retry -> verdict`.
322
+ - Deterministic runtime fail codes:
323
+ `RUNTIME_STARTUP_FAILED`, `RUNTIME_ENDPOINT_UNREACHABLE`,
324
+ `RUNTIME_LOG_CRITICAL_DETECTED`, `RUNTIME_RETRY_BUDGET_EXHAUSTED`,
325
+ `RUNTIME_STACK_PROFILE_UNRESOLVED`.
326
+ - Runtime evidence must include startup command/profile, runtime mode
327
+ (`local|remote`), health result, retry ledger, and log severity summary.
328
+ - Stack-aware runtime profile resolution is required for Node/Python/Go/Java/.NET;
329
+ unresolved stacks fail closed (no generic silent PASS fallback).
330
+ - For webapp contexts, QA includes browser-surface verification with
331
+ console/network error signals.
332
+
333
+ Generated test scaffolding + auto-run behavior (US-0066):
334
+ - `/execute` resolves stack profile (`node|python|go|java|dotnet`) and generates
335
+ missing baseline unit/integration/acceptance tests only.
336
+ - Generation is non-destructive by default: preserve user-authored tests/config,
337
+ fill only missing baseline assets, keep reruns idempotent.
338
+ - `TEST_COMMAND` wiring is deterministic:
339
+ - preserve existing non-empty user command,
340
+ - set stack baseline only when command is missing/unset.
341
+ - `/qa` automatically runs the generated baseline tests and records deterministic
342
+ evidence (`command`, `result`, `output ref`, `generated paths ref`).
343
+ - Fail-closed scaffold diagnostics:
344
+ `TEST_SCAFFOLD_STACK_UNRESOLVED`,
345
+ `TEST_SCAFFOLD_UNSUPPORTED_STACK`,
346
+ `TEST_SCAFFOLD_GENERATION_FAILED`.
347
+ - Static baseline test pass does not bypass runtime autopilot; runtime verdict
348
+ remains mandatory for QA PASS.
349
+
350
+ ## Commands and workflow
351
+
352
+ ### Core commands
353
+
354
+ - `/ask`: ask questions using project context (read-only, no artifacts created).
355
+ - `/intake`: capture idea, backlog, acceptance.
356
+ - `/discovery`: collect UX/product references.
357
+ - `/research`: risks, patterns, dependencies.
358
+ - `/architecture`: technical approach and decisions.
359
+ - `/sprint-plan`: sprint and task list.
360
+ - `/plan-verify`: acceptance coverage check.
361
+ - `/execute`: implement tasks.
362
+ - `/qa`: test and report findings.
363
+ - `/verify-work`: UAT.
364
+ - `/release`: release notes + runbook updates.
365
+ - `/memory-audit`: read-only memory drift check with advisory report.
366
+ - `/pause`, `/resume`, `/refresh-context`.
367
+ - `/auto`: orchestration mode that spawns a fresh subagent per phase.
368
+
369
+ ### Guided intake behavior (US-0033)
370
+
371
+ `/intake` supports two PO interaction modes via `.cursor/scratchpad.md`:
372
+
373
+ - `INTAKE_GUIDED_MODE=1` (default)
374
+ - asks targeted follow-up only when needed for concrete acceptance
375
+ - presents options/alternatives before recommendation
376
+ - preserves user decision authority
377
+ - runs intake-time research and persists R-xxxx evidence
378
+ - `INTAKE_GUIDED_MODE=0` (low-touch)
379
+ - skips proactive follow-up/options/research overhead unless user requests it
380
+ - still performs duplicate/overlap check against backlog
381
+
382
+ ### Intake decomposition + risk-aware questioning (US-0051)
383
+
384
+ When guided mode is enabled, `/intake` now supports bounded decomposition for
385
+ broad/high-risk requests:
386
+
387
+ - runs deterministic breadth/risk heuristics (feature/workflow count,
388
+ cross-cutting impact, acceptance breadth, unknown dependencies)
389
+ - proposes bounded multi-story decomposition when heuristics indicate broad
390
+ scope; keeps single-story default for narrow scope
391
+ - enforces vertical-slice/workflow-step split quality (independently valuable,
392
+ testable stories; avoid technical-layer-only splits by default)
393
+ - preserves user control before persistence: accept, merge, or adjust split
394
+ - asks additional targeted questions on high-risk/high-impact intake (not
395
+ ambiguity-only), but keeps rounds bounded and concise
396
+ - keeps low-touch compatibility: no forced decomposition when
397
+ `INTAKE_GUIDED_MODE=0` unless explicitly requested
398
+ - records decomposition/questioning evidence in intake artifacts
399
+ (`docs/product/backlog.md`, `docs/product/acceptance.md`,
400
+ `handoffs/po_to_tl.md`)
401
+
402
+ ### Mandatory intake question packs (US-0068)
403
+
404
+ `/intake` now enforces deterministic minimum questionnaire packs before
405
+ backlog/acceptance persistence:
406
+
407
+ - `first-intake-pack` for first/new/broad requests
408
+ - `small-intake-pack` for narrow follow-up requests
409
+
410
+ Fail-closed coverage behavior:
411
+
412
+ - required topic answers must be covered for the selected pack before write
413
+ - unknown/ambiguous stack cues fail closed to `first-intake-pack`
414
+ - persistence blocks with deterministic reason codes when required coverage is
415
+ incomplete and assumptions are not explicitly confirmed
416
+
417
+ Deterministic reason codes:
418
+
419
+ - `INTAKE_REQUIRED_TOPIC_MISSING`
420
+ - `INTAKE_REQUIRED_PACK_INCOMPLETE`
421
+ - `INTAKE_ASSUMPTION_CONFIRMATION_REQUIRED`
422
+ - `INTAKE_PERSISTENCE_BLOCKED`
423
+
424
+ Intake artifacts must persist coverage evidence fields:
425
+
426
+ - `asked_topics`
427
+ - `missing_topics`
428
+ - `assumptions_confirmed`
429
+
430
+ ### Interactive intake evidence + validator (US-0078 / DEC-0060)
431
+
432
+ **US-0078** closes silent persistence: every intake that mutates backlog/acceptance must pass the
433
+ deterministic **`intake_evidence`** gate — **`topic_coverage`** with valid **`ie:`** refs,
434
+ asked-vs-covered alignment, and **`assumption_confirmation_ref`** when assumptions are affirmative.
435
+
436
+ - Run `python scripts/intake_evidence_validate.py --self-test` (also exercised via `tests/run-tests.*` §26k).
437
+ - **Packaged installs (BUG-0001 / DEC-0063)**: the intake gate modules (`intake_evidence_validate.py`, `intake_evidence_lib.py`, `intake_bug_routing_guard.py`) ship under **`template/scripts/`** and hydrate consumer repos at **`scripts/`** (npm **`files`**, Chocolatey/Homebrew **`template/`** tree, **`installer.ps1` / `installer.sh`** + **`installer-owned-paths.manifest`**). **`--mode upgrade`** treats them as framework files (added/updated like other shipped scripts). CI parity: **`python scripts/check_intake_template_parity.py --repo .`** (`tests/run-tests.*` §26N).
438
+ - Operator docs: **`decisions/DEC-0060.md`**, **`docs/engineering/architecture.md`** **`# US-0078`**, runbook section **Interactive intake evidence validation (US-0078 / DEC-0060)**.
439
+ - **Guided** and **low-touch** share the **same pre-persistence validation pipeline**; low-touch does not bypass mandatory pack coverage.
440
+
441
+ ### Bug issues + intake routing (US-0079 / DEC-0061)
442
+
443
+ Defects use **`BUG-####`** under **`docs/product/backlog.md`** **`## Bug issues (canonical)`** with **`OPEN`/`DONE`** only and minimum reproducibility fields. Intake must not silently file defect prose as **`US-xxxx`**: set merged scratchpad **`INTAKE_WORK_ITEM_KIND=bug`** and/or use **`/intake bug`**, then run **`python scripts/intake_bug_routing_guard.py --kind story --file <prose.txt>`** before story allocation when in doubt.
444
+
445
+ - Validators: `python scripts/bug_issue_validate.py --self-test`; `python scripts/bug_issue_validate.py --backlog docs/product/backlog.md --check-acceptance`.
446
+ - Operator docs: **`decisions/DEC-0061.md`**, **`docs/engineering/architecture.md`** **`# US-0079`**, runbook **Bug issues (US-0079 / DEC-0061)**.
447
+
448
+ ### Optional ID namespace bootstrap (US-0052)
449
+
450
+ Fresh-project ID bootstrap behavior is explicit and default-off:
451
+
452
+ - `ID_NAMESPACE_BOOTSTRAP=0|1` in `.cursor/scratchpad.md` (default `0`)
453
+
454
+ When enabled (`1`), workflows use deterministic freshness checks before first ID
455
+ creation:
456
+
457
+ - no `US-` IDs in `docs/product/backlog.md`
458
+ - no `DEC-` IDs in `docs/engineering/decisions.md` / `decisions/DEC-*.md`
459
+ - no `R-` IDs in `docs/engineering/research.md`
460
+
461
+ If eligible, first IDs start at `US-0001`, `DEC-0001`, and `R-0001`. If not
462
+ eligible (or mode is off), generation continues from highest existing IDs.
463
+ Historical IDs are never rewritten or renumbered. Ineligible bootstrap requests
464
+ emit deterministic diagnostic `ID_BOOTSTRAP_NOT_FRESH`.
465
+
466
+ ### Context compaction + tiered token profile (US-0053)
467
+
468
+ Token-cost behavior is controlled by `.cursor/scratchpad.md`:
469
+
470
+ - `TOKEN_PROFILE=lean|balanced|full` (default `balanced`)
471
+
472
+ Profile behavior:
473
+
474
+ - `lean`: reduce non-critical overhead defaults (automation/research/context
475
+ breadth) while keeping mandatory quality gates intact.
476
+ - `balanced`: preserve current capabilities with moderate overhead.
477
+ - `full`: maximize context breadth/autonomy for high-uncertainty work.
478
+
479
+ Manual override precedence:
480
+
481
+ - Explicit scratchpad flag values override profile defaults for that flag.
482
+ - Profile mode never disables mandatory `/qa` -> `/verify-work` -> `/release`
483
+ gate semantics.
484
+
485
+ Compaction behavior:
486
+
487
+ - `docs/engineering/state.md` is the active hot surface.
488
+ - Historical checkpoints move to append-only packs under
489
+ `docs/engineering/state-archive/`.
490
+ - `docs/engineering/decisions.md` stays a compact index with bounded summaries
491
+ and canonical links to `decisions/DEC-xxxx.md`.
492
+ - Enforced rollover thresholds:
493
+ - `STATE_HOT_MAX_LINES` (default `1200`)
494
+ - `STATE_HOT_MAX_CHECKPOINTS` (default `80`)
495
+ - `PO_TO_TL_HOT_MAX_LINES` (default `800`)
496
+ - `PO_TO_TL_HOT_MAX_SECTIONS` (default `60`)
497
+ - `ARCH_HOT_MAX_LINES` (default `3500`)
498
+ - `ARCH_HOT_MAX_STORY_SECTIONS` (default `120`)
499
+ Triad hot surfaces (`state.md`, `handoffs/po_to_tl.md`,
500
+ `docs/engineering/architecture.md`) must stay within merged scratchpad caps.
501
+
502
+ ### Token-cost measurement and low-cache patterns (US-0080 / DEC-0062)
503
+
504
+ - Prefer **fresh subagent/chat boundaries** per `/auto` phase spawn (see `.cursor/commands/auto.md`).
505
+ - Use explicit **`/auto start-from=<phase>`** when resuming so **`resolved_phase_plan`**
506
+ intersection stays deterministic (**`DEC-0052`**).
507
+ - Select **`TOKEN_PROFILE=lean`** when compatible with your work to reduce scratchpad-driven
508
+ breadth; mandatory gates (**`US-0048`**, **`US-0056`**, **`US-0069`**, **`US-0039`**) stay on.
509
+ - **Comparable** cache-read baselines require identical **`run_class_hash`**; otherwise
510
+ **`TOKEN_COST_RUN_CLASS_MISMATCH`** (no cross-plan gaming).
511
+ - Committed metrics: **`handoffs/token_cost_runs/<orchestrator_run_id>.md`**; link from
512
+ **`docs/engineering/state.md`** via **`token_cost_evidence_ref`**.
513
+ - Tooling: **`scripts/token_cost_lib.py`**, **`scripts/token_cost_compare.py`**,
514
+ **`python scripts/check_token_cost_parity.py --repo .`**.
515
+ Use `python scripts/enforce-triad-hot-surface.py --check` before completing a
516
+ phase that mutates them; use `--rollover` to archive oldest material into
517
+ deterministic packs when over cap (DEC-0054).
518
+ Archive verification mismatch fails with
519
+ `STATE_ARCHIVE_VERIFICATION_FAILED`.
520
+
521
+ ### Cross-phase artifact ownership guard (US-0061)
522
+
523
+ To prevent accidental history loss across workflow phases:
524
+
525
+ - canonical ownership policy: `docs/engineering/artifact-ownership-policy.md`
526
+ - non-authorized phases must not delete or rewrite other-phase owned sections
527
+ - `docs/engineering/architecture.md` is history-preserving (append or
528
+ target-section-only mutation)
529
+ - deterministic fail-safe diagnostics:
530
+ `PHASE_OWNERSHIP_VIOLATION`,
531
+ `PHASE_OVERRIDE_EVIDENCE_MISSING`,
532
+ `ARCH_HISTORY_DELETION_DETECTED`
533
+
534
+ `/ask` policy (read-only):
535
+
536
+ - question-scoped retrieval first
537
+ - targeted sections before broad file reads
538
+ - bounded expansion only when unresolved
539
+ - explicit "not found in artifacts" when still unresolved
540
+
541
+ ### Configurable multi-target publish + confirmation gate (US-0054)
542
+
543
+ Post-release publish behavior is configurable per repository:
544
+
545
+ - `RELEASE_PUBLISH_MODE=disabled|confirm|auto` (default `confirm`)
546
+ - `RELEASE_TARGETS_FILE=docs/engineering/release-targets.json`
547
+ - `RELEASE_TARGETS_DEFAULT=` optional comma-separated default targets
548
+
549
+ Supported target types include:
550
+
551
+ - `npm`, `choco`, `brew`, `git`, `docker`, `cloud`
552
+ - `custom` (generic command target)
553
+ - `ssh` (generic server deployment over SSH)
554
+ - Connectivity metadata for remote/local operator context:
555
+ - `runtime.mode` (`local|remote`)
556
+ - endpoint fields (`domainEnv|ipEnv|hostEnv`, `port`, `protocol`)
557
+ - optional Traefik/ingress metadata
558
+ - optional `dockerOverSsh` contract for remote Docker execution over SSH
559
+
560
+ Safety defaults:
561
+
562
+ - Mandatory `/release` gates are unchanged and must pass first.
563
+ - `confirm` mode enforces explicit operator approval before publish execution.
564
+ - Sensitive values are env-referenced (for example `tokenEnv`, `authEnv`), not
565
+ inline literals.
566
+ - Remote connectivity config errors fail fast with
567
+ `REMOTE_CONNECTIVITY_CONFIG_INVALID`.
568
+ - Release/QA outputs use canonical operator connectivity doc:
569
+ `docs/engineering/runtime-connectivity.md`.
570
+
571
+ ### Deterministic status reconciliation command (US-0055)
572
+
573
+ Use `/status-reconcile` to normalize status drift between canonical and derived
574
+ workflow artifacts before continuation:
575
+
576
+ - canonical source: `docs/product/backlog.md` story status
577
+ - derived targets: `docs/product/acceptance.md`, `docs/engineering/state.md`,
578
+ `handoffs/resume_brief.md`
579
+ - deterministic outcomes: apply/no-op/fail-safe reason codes with audit evidence
580
+ in `docs/engineering/status-normalization-report.md`
581
+
582
+ This command is the bounded repair counterpart to `/memory-audit`
583
+ (read-only detection).
584
+
585
+ ### Optional cross-repo observability (US-0034)
586
+
587
+ Use optional compatibility visibility with default-safe off behavior:
588
+
589
+ - `CROSS_REPO_OBSERVABILITY=0|1` (default `0`)
590
+ - `COMPATIBILITY_GATE_ON_CRITICAL=0|1` (default `1`)
591
+ - `COMPATIBILITY_SOURCES=` monitored `repo/module/contract/docs` declarations
592
+
593
+ When disabled (`0`), workflow adds zero required compatibility overhead.
594
+
595
+ When enabled (`1`), compatibility signals/findings are tracked in:
596
+
597
+ - `docs/engineering/compatibility-signals.md`
598
+ - `docs/engineering/compatibility-report.md`
599
+ - `docs/engineering/manifests/registry.manifest.yaml`
600
+ - `docs/engineering/manifests/repo.manifest.yaml`
601
+
602
+ If unresolved critical findings remain and
603
+ `COMPATIBILITY_GATE_ON_CRITICAL=1`, release progression must stop for a
604
+ decision gate (`COMPATIBILITY_CRITICAL_OPEN`).
605
+
606
+ ### Optional component-scoped execution (US-0035)
607
+
608
+ Enable scoped workflow behavior with:
609
+
610
+ - `COMPONENT_SCOPE_MODE=0|1` (default `0`)
611
+ - `TARGET_COMPONENTS=<comma-separated-component-ids>`
612
+
613
+ When disabled (`0`), workflow adds zero required scope overhead.
614
+
615
+ When enabled (`1`):
616
+
617
+ - Scope declaration is tracked in `docs/engineering/component-scope.md`.
618
+ - Sprint tasks should declare target components and expected impacted interfaces.
619
+ - QA records unaffected-component protection checks in
620
+ `docs/engineering/component-scope-report.md`.
621
+ - Unapproved out-of-scope impact must block release via decision gate
622
+ (`COMPONENT_SCOPE_VIOLATION_UNAPPROVED`).
623
+
624
+ ### Optional spec-pack documentation (US-0031)
625
+
626
+ Optional Design Concept, CRS, and Technical Specification artifacts are
627
+ controlled by:
628
+
629
+ - `SPEC_PACK_MODE=0|1` (default `0`)
630
+
631
+ When disabled (`0`), intake/architecture/execute/qa/release add no required
632
+ spec-pack steps (zero overhead).
633
+
634
+ When enabled (`1`):
635
+
636
+ - Canonical paths per story: `docs/engineering/spec-pack/<story_id>-design-concept.md`,
637
+ `docs/engineering/spec-pack/<story_id>-crs.md`,
638
+ `docs/engineering/spec-pack/<story_id>-technical-specification.md`.
639
+ - Minimum required sections and ownership are in `docs/engineering/runbook.md`.
640
+ - Release gate validates completeness and blocks with `SPEC_PACK_INCOMPLETE` when
641
+ required sections are missing.
642
+
643
+ ### Optional user-guide documentation (US-0032)
644
+
645
+ Optional per-feature user guides (end-user how-to docs) are controlled by:
646
+
647
+ - `USER_GUIDE_MODE=0|1` (default `0`)
648
+
649
+ When disabled (`0`), intake/architecture/sprint-plan/execute/qa/release add no
650
+ required user-guide steps or blocking checks (zero overhead).
651
+
652
+ When enabled (`1`):
653
+
654
+ - Canonical path per feature story: `docs/user-guides/US-xxxx.md`.
655
+ - Minimum required sections: Purpose, Prerequisites, Usage steps, Example,
656
+ Limitations, Troubleshooting (see `docs/engineering/runbook.md` and
657
+ `docs/user-guides/README.md`).
658
+ - Release gate validates guide completeness and blocks with `USER_GUIDE_INCOMPLETE`
659
+ when enabled and required sections are missing.
660
+ - User guides are end-user only; they do not duplicate spec-pack (US-0031) content.
661
+
662
+ ### Release notes model (US-0040)
663
+
664
+ Release history is sprint-scoped and queue-backed:
665
+
666
+ - Canonical sprint notes: `handoffs/releases/Sxxxx-release-notes.md`
667
+ - Canonical queue tracker: `handoffs/release_queue.md`
668
+ - Legacy compatibility pointer: `handoffs/release_notes.md`
669
+
670
+ Deterministic release semantics:
671
+ - Only target sprint artifacts/queue row may be mutated during one `/release` run.
672
+ - Entering release flow sets target row to `unreleased`.
673
+ - Successful finalization transitions same row to `released`.
674
+ - Unresolved sprint identity or queue/notes mismatch fails closed with reason
675
+ codes and remediation guidance; no destructive reconciliation by default.
676
+
677
+ ### Post-QA release issue workflow (US-0042)
678
+
679
+ Release gate chain (US-0039): `/release` enforces mandatory gates in order — check-in test, QA completion, UAT completion — then finalization. Blank optional runbook keys (`LINT_COMMAND`, `TYPECHECK_COMMAND`) do not block release; they are reported as skipped.
680
+
681
+ If a problem appears **after QA** (during `/release`), record it separately from
682
+ QA findings:
683
+
684
+ - Release findings artifact: `sprints/Sxxxx/release-findings.md`
685
+ - Release-to-dev handoff: `handoffs/release_to_dev.md`
686
+
687
+ Boundary:
688
+ - QA-phase issues -> `sprints/Sxxxx/qa-findings.md`
689
+ - Post-QA release-gate issues -> `sprints/Sxxxx/release-findings.md`
690
+
691
+ Each blocked release finding should include reason code, evidence refs,
692
+ remediation, and rerun criteria.
693
+
694
+ ### Backlog reconciliation invariant (US-0043)
695
+
696
+ Release completion must not leave stale backlog status for target sprint stories.
697
+ At release finalization:
698
+
699
+ - reconcile target story status to `DONE` using canonical release evidence;
700
+ - reconcile target story acceptance checkboxes to checked state;
701
+ - mutate only target sprint stories (never unrelated backlog entries);
702
+ - fail safe with `BACKLOG_STATUS_DRIFT` if contradiction remains (e.g. released
703
+ sprint but backlog still `OPEN`/unchecked).
704
+
705
+ ### Canonical story status + normalization guard (US-0045)
706
+
707
+ - `docs/product/backlog.md` is canonical for story `OPEN|DONE` status.
708
+ - `docs/product/acceptance.md` and `docs/engineering/state.md` are derived views
709
+ reconciled from canonical backlog status plus release evidence.
710
+ - One-time normalization baseline is recorded in
711
+ `docs/engineering/status-normalization-report.md`.
712
+ - Contradictory resolution at release/reconciliation boundaries fails safe with:
713
+ - `BACKLOG_STATUS_DRIFT`
714
+ - `CANONICAL_STATUS_CONFLICT`
715
+
716
+ ### Agent isolation model
717
+
718
+ - Every phase command runs in a fresh agent/subagent context.
719
+ - Handoff files are the only cross-phase memory (`handoffs/*.md` + artifact
720
+ files).
721
+ - Never rely on "ignore prior chat"; use a new context boundary instead.
722
+ - `/auto` is orchestration only: it calls phase subagents and transfers context
723
+ through artifacts.
724
+
725
+ #### Per-phase isolation evidence (US-0048 / DEC-0029)
726
+
727
+ Isolation is enforced with auditable evidence written to `docs/engineering/state.md`.
728
+ Each phase run appends:
729
+
730
+ - `phase_id`, `role`, `fresh_context_marker`, `timestamp`, `evidence_ref`
731
+
732
+ Missing/invalid/stale evidence fails closed with reason codes:
733
+ `PHASE_CONTEXT_ISOLATION_MISSING`, `PHASE_CONTEXT_ISOLATION_VIOLATION`,
734
+ `ISOLATION_EVIDENCE_STALE`, `ISOLATION_EVIDENCE_INVALID`.
735
+
736
+ #### Strict runtime proof (US-0056 / DEC-0038)
737
+
738
+ Per-phase isolation also requires strict runtime attestation tuples at
739
+ boundaries (not artifact fields alone):
740
+
741
+ - `orchestrator_run_id`, `runtime_proof_id`, `phase_id`, `role`
742
+ - `proof_issued_at`, `proof_ttl_seconds`, `proof_hash`
743
+
744
+ Fail-closed reason codes:
745
+ `RUNTIME_PROOF_MISSING`, `RUNTIME_PROOF_INVALID`, `RUNTIME_PROOF_REUSED`,
746
+ `RUNTIME_PROOF_STALE`, `RUNTIME_PROOF_AMBIGUOUS_LINK`.
747
+
748
+ `/auto`, `/verify-work`, and `/release` must validate these tuples before
749
+ continuation/finalization.
750
+
751
+ #### `/auto` phase→role enforcement (US-0069 / DEC-0051)
752
+
753
+ `/auto` uses a deterministic **phase→role matrix** plus scratchpad alternates
754
+ (`AUTO_ROLE_RESEARCH`, `AUTO_ROLE_PLAN_VERIFY`, `AUTO_ROLE_REFRESH_CONTEXT`).
755
+ Before each phase spawn it runs a **preflight capability gate**; missing
756
+ capability stops with `PHASE_ROLE_CAPABILITY_MISSING` (no unrelated-role
757
+ substitution). After each phase, isolation `role` and strict-proof `role` must
758
+ match the same expected role or the run stops with `PHASE_ROLE_MISMATCH`.
759
+ `execute` defaults to `dev`; non-`dev` requires
760
+ `AUTO_EXECUTE_ROLE_OVERRIDE=allowed_non_dev_execute` **and**
761
+ `EXECUTE_OVERRIDE_GOVERNANCE_REF` pointing to a parseable approved waiver. See
762
+ `docs/engineering/runbook.md` and `decisions/DEC-0051.md`.
763
+
764
+ #### `/auto` phase selection policy (US-0070 / DEC-0052)
765
+
766
+ `/auto` builds a **resolved phase plan** from scratchpad before spawning phases:
767
+ exactly one of `AUTO_PHASE_PLAN` (default `full`), `AUTO_PHASE_EXCLUDE`,
768
+ `AUTO_PHASE_INCLUDE`, or `AUTO_PHASE_PROFILE` applies; conflicting selectors
769
+ stop with `PHASE_POLICY_CONFLICT`. Non-skippable safety gates (`qa`,
770
+ `verify-work`, `release`) and evidence-chain closure reinstate omitted phases
771
+ with breadcrumb reasons such as `non_skippable_gate`. `start-from` and resume
772
+ anchors **intersect** with the plan (`START_FROM_PHASE_PLAN_EMPTY_INTERSECTION`
773
+ when empty). Backlog-drain, bulk execute, and team-mode runs **recompute** the
774
+ plan each boundary. See `/auto`, `docs/engineering/runbook.md`, and
775
+ `decisions/DEC-0052.md`.
776
+
777
+ ### Lightweight interaction
778
+
779
+ Use `/ask` when you want to query the project without triggering the workflow:
780
+
781
+ - "What's the current sprint status?"
782
+ - "Which stories are still open?"
783
+ - "How does the upgrade mode work?"
784
+ - "What decision was made about X?"
785
+
786
+ `/ask` reads the project artifacts (state, backlog, architecture, decisions, sprint
787
+ progress) and answers from them. It never creates or modifies files. If your question
788
+ reveals a bug or feature idea, it will suggest running `/intake`.
789
+
790
+ ### Memory drift auditing
791
+
792
+ Use `/memory-audit` to check whether project memory artifacts still match
793
+ repository reality. This is a read-only, non-blocking command that produces an
794
+ advisory report at `docs/engineering/memory-drift-report.md`.
795
+
796
+ **When to run:**
797
+
798
+ - **Pre-handoff**: before writing any role handoff artifact.
799
+ - **Pre-QA**: before `/qa` or `/verify-work`.
800
+ - **Pre-release**: before `/release`.
801
+ - **Ad-hoc**: after external code changes, long pauses, or whenever artifacts
802
+ feel stale.
803
+
804
+ **How to interpret output:**
805
+
806
+ The report contains a severity summary (`high` / `medium` / `low`) and a
807
+ findings table with concrete evidence for each inconsistency. High-severity
808
+ findings should be resolved before the next handoff or release. Medium and low
809
+ findings can be addressed during `/refresh-context` or the next sprint.
810
+
811
+ The report also includes a reference-only "Template drift" section. Template
812
+ drift remediation belongs to US-0017 — `/memory-audit` only flags it for
813
+ awareness.
814
+
815
+ **Follow-up commands:**
816
+
817
+ - `/refresh-context` — update stale artifacts.
818
+ - `/sprint-plan` — if new work is discovered.
819
+ - `/verify-work` — if acceptance status needs re-validation.
820
+ - `/intake` — if findings reveal a new story or bug.
821
+
822
+ ### Workflow diagrams
823
+
824
+ ```mermaid
825
+ flowchart TD
826
+ Intake[/intake/] --> Discovery[/discovery/]
827
+ Discovery --> Research[/research/]
828
+ Research --> Architecture[/architecture/]
829
+ Architecture --> SprintPlan[/sprint-plan/]
830
+ SprintPlan --> PlanVerify[/plan-verify/]
831
+ PlanVerify --> Execute[/execute/]
832
+ Execute --> QA[/qa/]
833
+ QA -->|fixes needed| Execute
834
+ QA --> VerifyWork[/verify-work/]
835
+ VerifyWork --> Release[/release/]
836
+ Release --> Refresh[/refresh-context/]
837
+ Execute --> Pause[/pause/]
838
+ QA --> Pause
839
+ Release --> Pause
840
+ Pause --> Resume[/resume/]
841
+ Resume --> Execute
842
+ ```
843
+
844
+ ```mermaid
845
+ flowchart TD
846
+ Start[Idea] --> Intake2[/intake/]
847
+ Intake2 -->|DecisionGate| Decision{DecisionRequired}
848
+ Decision -->|ChooseOption| Discovery2[/discovery/]
849
+ Decision -->|ChooseOption| Research2[/research/]
850
+ Decision -->|ChooseOption| Architecture2[/architecture/]
851
+ Decision -->|ChooseOption| SprintPlan2[/sprint-plan/]
852
+ Decision -->|ChooseOption| PlanVerify2[/plan-verify/]
853
+ Decision -->|ChooseOption| Execute2[/execute/]
854
+ Decision -->|ChooseOption| QA2[/qa/]
855
+ Decision -->|ChooseOption| VerifyWork2[/verify-work/]
856
+ Decision -->|ChooseOption| Release2[/release/]
857
+ Decision -->|ChooseOption| Refresh2[/refresh-context/]
858
+ Decision -->|ChooseOption| Pause2[/pause/]
859
+ Discovery2 --> Research2
860
+ Research2 --> Architecture2
861
+ Architecture2 --> SprintPlan2
862
+ SprintPlan2 --> PlanVerify2
863
+ PlanVerify2 --> Execute2
864
+ Execute2 --> QA2
865
+ QA2 -->|fixes needed| Execute2
866
+ QA2 --> VerifyWork2
867
+ VerifyWork2 --> Release2
868
+ Release2 --> Refresh2
869
+ Execute2 --> Pause2
870
+ QA2 --> Pause2
871
+ Release2 --> Pause2
872
+ Pause2 --> Resume2[/resume/]
873
+ Resume2 --> Execute2
874
+ Execute2 --> HandoffDevQA[handoffs/dev_to_qa.md]
875
+ QA2 --> HandoffQAD[handoffs/qa_to_dev.md]
876
+ Intake2 --> HandoffPOTL[handoffs/po_to_tl.md]
877
+ SprintPlan2 --> HandoffTLDev[handoffs/tl_to_dev.md]
878
+ ```
879
+
880
+ ### Automation modes
881
+
882
+ Configure in `.cursor/scratchpad.md`:
883
+
884
+ - `AUTO_FLOW_MODE=manual|auto_until_decision`
885
+ - `manual`: you trigger each phase/command yourself.
886
+ - `auto_until_decision`: `/auto` continues by spawning fresh phase subagents until a decision gate, blocker, or pause boundary.
887
+ - `PHASE_MODE=interactive|auto`
888
+ - `interactive`: agent asks clarifying questions more often.
889
+ - `auto`: agent minimizes prompts and proceeds with best effort.
890
+ - `PERMISSION_MODE=interactive|auto`
891
+ - `interactive`: ask before routine actions.
892
+ - `auto`: reduce routine permission prompts.
893
+ - `RUN_TESTS_ON_EDIT=0|1`
894
+ - `1`: runs configured tests after meaningful edits.
895
+ - `0`: tests only when you explicitly run QA/test phases.
896
+ - `LOOP_UNTIL_GREEN=0|1`
897
+ - `1`: keep iterating fix -> test until green (bounded).
898
+ - `0`: run one pass and report failures.
899
+ - `AUTO_IMPLEMENTATION_LOOP=0|1`
900
+ - `1`: enables execute -> QA -> execute loop automatically with new Dev/QA subagent instances on each cycle.
901
+ - `AUTO_LOOP_MAX_CYCLES=<n>`
902
+ - safety cap for auto loops (recommended `3-7`, default `5`).
903
+ - `AUTO_PAUSE_REQUEST=0|1`
904
+ - `1`: request graceful stop at next safe boundary.
905
+ - `AUTO_PAUSE_POLICY=after_task|after_phase`
906
+ - `after_task`: faster stop, more frequent boundaries.
907
+ - `after_phase`: cleaner checkpoints, fewer interruptions.
908
+
909
+ ### Sync policy (US-0038)
910
+
911
+ Phase-triggered sync is policy-controlled and safe by default.
912
+
913
+ Scratchpad controls:
914
+
915
+ - `SYNC_POLICY_MODE=disabled|manual|by_phase|by_milestone|custom_phase_list`
916
+ - `SYNC_CUSTOM_PHASES=<comma-separated canonical phases>`
917
+ - `ALLOW_AUTO_PUSH=0|1`
918
+ - `AUTO_PUSH_BRANCH_ALLOWLIST=<comma-separated branches/patterns>`
919
+
920
+ Default-safe behavior:
921
+
922
+ - Default mode is `manual` with `ALLOW_AUTO_PUSH=0` (no automatic push).
923
+ - `disabled` and `manual` add near-zero overhead and preserve manual workflows.
924
+ - Sync policy is evaluated only at completed phase boundaries.
925
+
926
+ Guarded auto-push conditions (all must pass):
927
+
928
+ 1. Boundary matches configured mode.
929
+ 2. Auto-push is explicitly enabled (`ALLOW_AUTO_PUSH=1`).
930
+ 3. QA-first safety holds (feature work cannot auto-push pre-QA).
931
+ 4. No unresolved blocking QA findings/critical issues.
932
+ 5. Branch safety holds (protected/default branches denied unless allowlisted).
933
+ 6. Check chain passes (`TEST_COMMAND` required; optional lint/typecheck only if configured).
934
+
935
+ Deterministic reason codes include:
936
+ `SYNC_DISABLED`, `MANUAL_MODE_NO_AUTO`, `PRE_QA_AUTOPUSH_FORBIDDEN`,
937
+ `BLOCKING_QA_FINDINGS`, `BRANCH_NOT_ALLOWLISTED`, `TEST_COMMAND_MISSING`,
938
+ `TEST_FAILED`, `TEST_TIMEOUT`, `OPTIONAL_CHECK_FAILED`, `SYNC_PUSHED`.
939
+
940
+ ### Sovereign-loop era (US-0103–US-0112) umbrella section
941
+
942
+ The sovereign-loop era features form an opt-in orchestration layer that adds
943
+ institutional memory, adversarial review, deferral drain, parallel dev
944
+ arbitrage, self-healing deploy, and goal-based convergence on top of the base
945
+ `/auto` chain. Every feature in this family is **default-off** — when its master
946
+ enable flag is `0` (or `phase_driven` for US-0110), the framework is
947
+ byte-identical to the pre-sovereign-loop baseline (zero overhead, no schema
948
+ changes, no extra spawns, no extra file writes).
949
+
950
+ **Recommended enable order** (each gate builds on the previous):
951
+
952
+ 1. `AI_DECISION_LEDGER=1` (`US-0103`) — foundation audit ledger; every other
953
+ sovereign-loop feature reads or appends to it.
954
+ 2. `SOVEREIGN_MEMORY=1` (`US-0105`) — bounded institutional memory injection.
955
+ 3. `CROSS_MODEL_REVIEW=1` (`US-0104`) — adversarial critic before QA.
956
+ 4. `SOVEREIGN_GOAL_MODE=goal_convergence` (`US-0110`) — terminal predicate.
957
+ 5. `AUTO_SOVEREIGN=1` (`US-0107`) — orchestrator deferral drain + notifications
958
+ (requires `SOVEREIGN_GOAL_MODE=goal_convergence` — fail-closed
959
+ `SOVEREIGN_LOOP_GOAL_MODE_REQUIRED`).
960
+ 6. `SOVEREIGN_PARALLEL_DEV=1` (`US-0108`) — parallel dev arbitrage (cost
961
+ multiplier; enable only for high-stakes execute cycles).
962
+ 7. `AUTO_SOVEREIGN_SELF_HEALING_DEPLOY=1` (`US-0109`) — post-deploy smoke probe
963
+ + bounded retry (requires a deployed surface —
964
+ `AUTO_SOVEREIGN_DEPLOY_HEALTH_ENDPOINT` must resolve via US-0085 compose).
965
+ 8. `RELEASE_TRIGGER_SOURCE=github|npm|git_tag|auto` (`US-0111`) —
966
+ release-trigger adapter dispatch (default `manual` = byte-identical to
967
+ pre-US-0111 path).
968
+ 9. Model-catalog example presets (`US-0112`) — passive payload; opt in by
969
+ copying an example file to `.cursor/model-catalog.local.json`.
970
+
971
+ **Runbook pointer:** See the per-feature runbook sections (cross-linked in
972
+ each subsection below) for reason-code inventories, troubleshooting recipes,
973
+ and compose-guard matrices.
974
+
975
+ **Zero-overhead-when-off contract:** When all master enable flags are at their
976
+ defaults (`AI_DECISION_LEDGER=0`, `CROSS_MODEL_REVIEW=0`, `SOVEREIGN_MEMORY=0`,
977
+ `AUTO_SOVEREIGN=0`, `SOVEREIGN_PARALLEL_DEV=0`,
978
+ `AUTO_SOVEREIGN_SELF_HEALING_DEPLOY=0`, `SOVEREIGN_GOAL_MODE=phase_driven`,
979
+ `RELEASE_TRIGGER_SOURCE=manual`), the framework is byte-identical to the
980
+ pre-sovereign-loop era baseline.
981
+
982
+ #### US-0103 — AI Decision Ledger + Plan Fidelity
983
+
984
+ Per-run audit ledger (`handoffs/sovereign_decisions/<run_id>.jsonl`) recording
985
+ every phase-level decision tuple (`decision_type`, `payload`, `timestamp`,
986
+ `orchestrator_run_id`, ...). When enabled, plan-fidelity policy enforces that
987
+ the producer phase does not drop, reorder, or scope-add tasks against the
988
+ locked sprint plan without an explicit ledger entry. Sovereign-loop foundation
989
+ — every other sovereign-loop feature reads or appends to this ledger.
990
+
991
+ - `AI_DECISION_LEDGER=0|1` (default `0`) — master enable. When `0`: no ledger
992
+ reads/writes/schema checks.
993
+ - `AUTO_PLAN_FIDELITY=strict|relaxed|extended` (default `strict`) — active only
994
+ when ledger enabled. `strict` = any unapproved drop/reorder/scope-add →
995
+ `PLAN_FIDELITY_VIOLATION` hard stop. `relaxed` = drop/reorder allowed
996
+ (ledger entry); scope-add still hard stop. `extended` = scope-add allowed
997
+ (extension report); drop/reorder allowed.
998
+
999
+ When `AI_DECISION_LEDGER=0`, no ledger reads/writes/schema checks — zero
1000
+ overhead.
1001
+
1002
+ Runbook cross-link: `docs/engineering/runbook.md` § AI Decision Ledger
1003
+ (US-0103 / DEC-0103).
1004
+
1005
+ #### US-0104 — Cross-Model Adversarial Critic
1006
+
1007
+ Spawns a second model instance (the "critic") with one of three review lenses
1008
+ (security / perf / correctness) to adversarially review the producer's artifact
1009
+ before QA. Emits `sovereign_critic_findings.jsonl` with an aggregate
1010
+ anti-slop score (0–10) and per-lens findings. If the aggregate falls below the
1011
+ threshold, the producer is re-spawned up to the rework cap. Optional degraded
1012
+ fallback when the second model is unavailable.
1013
+
1014
+ - `CROSS_MODEL_REVIEW=0|1` (default `0`) — master enable.
1015
+ - `CROSS_MODEL_ANTISLOP_THRESHOLD=int 0-10` (default `6`) — aggregate floor.
1016
+ - `CROSS_MODEL_REWORK_MAX=int >=0` (default `2`) — producer re-spawn cap per
1017
+ (run, phase).
1018
+
1019
+ When `CROSS_MODEL_REVIEW=0`, zero overhead — no critic spawn, no findings
1020
+ writes, no anti-slop gate.
1021
+
1022
+ Runbook cross-link: `docs/engineering/runbook.md` § Cross-Model Adversarial
1023
+ Critic (US-0104).
1024
+
1025
+ #### US-0105 — Sovereign Memory
1026
+
1027
+ Project-level institutional memory substrate — four JSONL families (patterns,
1028
+ mistakes, decisions, retrospectives) read by
1029
+ `sovereign_memory_lib.assemble_sovereign_memory_digest(...)` at phase-context
1030
+ narrow-read time. Bounded injection into producer prompts (hard char cap).
1031
+ Default-off; when off, no JSONL writes/reads, no digest assembly, no
1032
+ injection.
1033
+
1034
+ - `SOVEREIGN_MEMORY=0|1` (default `0`) — master enable.
1035
+ - `SOVEREIGN_MEMORY_TOP_N=int >=0` (default `5`) — global recent pool (all four
1036
+ JSONL families).
1037
+ - `SOVEREIGN_MEMORY_TOP_K=int >=0` (default `3`) — high-impact pool (patterns
1038
+ + mistakes only).
1039
+ - `SOVEREIGN_MEMORY_MAX_CHARS=int >=0` (default `2048`) — hard cap on
1040
+ assembled digest text.
1041
+ - `SOVEREIGN_MEMORY_JSONL_MAX_LINES=int >=1` (default `500`) — active JSONL
1042
+ line cap before archive rollover.
1043
+
1044
+ When `SOVEREIGN_MEMORY=0`, zero overhead — no JSONL writes, no injection
1045
+ reads, no spawn digest assembly.
1046
+
1047
+ Runbook cross-link: `docs/engineering/runbook.md` § Sovereign Memory
1048
+ (US-0105).
1049
+
1050
+ #### US-0107 — Sovereign Loop Mode (AUTO_SOVEREIGN)
1051
+
1052
+ Project-level orchestration loop that maintains a deferral register
1053
+ (`handoffs/sovereign_deferrals.jsonl`), drains open deferrals via
1054
+ `advance_sovereign_loop(...)`, and emits operator notifications. When enabled,
1055
+ requires `SOVEREIGN_GOAL_MODE=goal_convergence` (fail-closed
1056
+ `SOVEREIGN_LOOP_GOAL_MODE_REQUIRED`). The orchestrator continues per the
1057
+ deferral policy when deferrals are present — it does NOT halt.
1058
+
1059
+ - `AUTO_SOVEREIGN=0|1` (default `0`) — master enable.
1060
+ - `AUTO_SOVEREIGN_DEFERRAL_MAX=int >=1` (default `50`) — max open deferral
1061
+ rows.
1062
+ - `AUTO_SOVEREIGN_DRAIN_GENERATE_MAX=int >=0` (default `3`) — drain-generate
1063
+ iterations per run.
1064
+ - `AUTO_SOVEREIGN_DEFERRAL_POLICY=stop|skip|resolve_first` (default
1065
+ `resolve_first`) — orchestrator behavior when deferrals present.
1066
+ - `SOVEREIGN_NOTIFY_TARGET=off|ntfy|email|hook` (default `off`).
1067
+ - `SOVEREIGN_NOTIFY_NTFY_TOPIC`, `SOVEREIGN_NOTIFY_NTFY_BASE`,
1068
+ `SOVEREIGN_NOTIFY_HOOK_URL`, `SOVEREIGN_NOTIFY_EMAIL_TO` (default empty —
1069
+ local-only).
1070
+
1071
+ When `AUTO_SOVEREIGN=0`, zero overhead — no deferral reads/writes, no advance,
1072
+ no notifications.
1073
+
1074
+ Runbook cross-link: `docs/engineering/runbook.md` § Sovereign Loop Mode
1075
+ (US-0107).
1076
+
1077
+ #### US-0108 — Parallel Instance Arbitrage for dev phase
1078
+
1079
+ Under `SOVEREIGN_PARALLEL_DEV=1`, the execute phase spawns N dev subagents in
1080
+ isolated git worktrees for the same task, runs a parallel QA cross-review
1081
+ across all N, selects a winner deterministically (PASS → highest anti-slop →
1082
+ earliest proof), and merges the winner to main. A system-wide resource guard
1083
+ caps total parallel instances. Loser worktrees are cleaned up unless retention
1084
+ is enabled.
1085
+
1086
+ - `SOVEREIGN_PARALLEL_DEV=0|1` (default `0`) — global enable gate.
1087
+ - `AUTO_SOVEREIGN_PARALLEL_N=int >=1` (default `3`) — instances per execute
1088
+ cycle.
1089
+ - `AUTO_SOVEREIGN_PARALLEL_MAX_TOTAL=int >=1` (default `6`) — system-wide
1090
+ instance cap.
1091
+ - `AUTO_SOVEREIGN_MERGE_RESOLVE=first_pass_wins|last_pass_wins|winner_takes_all|manual`
1092
+ (default `first_pass_wins`).
1093
+ - `AUTO_SOVEREIGN_WORKTREE_KEEP=0|1` (default `0`) — retain loser worktrees
1094
+ for debugging.
1095
+ - `AUTO_SOVEREIGN_PARALLEL_QA=0|1` (default `0`) — enable parallel QA
1096
+ cross-review (v2).
1097
+ - `AUTO_SOVEREIGN_PARALLEL_QA_ARBITER=critic_first_pass|majority_vote`
1098
+ (default `critic_first_pass`).
1099
+ - `AUTO_SOVEREIGN_PARALLEL_ANTI_SLOP_THRESHOLD=int 0-10` (default `6`) —
1100
+ anti-slop floor.
1101
+ - `AUTO_SOVEREIGN_PARALLEL_REWORK_MAX=int >=0` (default `2`) — per-instance
1102
+ rework cap.
1103
+ - `AUTO_SOVEREIGN_PARALLEL_MERGE_TIMEOUT_SEC=int >=10` (default `60`) —
1104
+ merge timeout.
1105
+ - `AUTO_SOVEREIGN_PARALLEL_MODEL_<idx>`, `AUTO_SOVEREIGN_PARALLEL_LENS_<idx>`
1106
+ (optional, per-instance overrides).
1107
+
1108
+ When `SOVEREIGN_PARALLEL_DEV=0`, zero overhead — no worktrees, no parallel QA,
1109
+ no pick JSON, no resource guard.
1110
+
1111
+ Runbook cross-link: `docs/engineering/runbook.md` § Parallel Instance
1112
+ Arbitrage (US-0108).
1113
+
1114
+ #### US-0109 — Self-Healing Deploy Loop
1115
+
1116
+ Post-publish smoke probe + bounded retry loop layered on top of the publish
1117
+ chain. After the publish step succeeds, a two-stage smoke probe (health HTTP
1118
+ GET + acceptance smoke runner) validates the deployed artifact. On probe FAIL,
1119
+ the publish path is re-entered idempotently up to the retry cap. After
1120
+ retry-cap exhaustion, a `DEPLOY_DEFERRED` tuple is written to the US-0107
1121
+ deferral register.
1122
+
1123
+ - `AUTO_SOVEREIGN_SELF_HEALING_DEPLOY=0|1` (default `0`) — global gate.
1124
+ - `AUTO_SOVEREIGN_DEPLOY_RETRY_MAX=int >=1` (default `3`) — max retry
1125
+ attempts after probe FAIL.
1126
+ - `AUTO_SOVEREIGN_DEPLOY_SMOKE_TIMEOUT_SEC=int >=1` (default `30`) —
1127
+ per-stage probe HTTP timeout.
1128
+ - `AUTO_SOVEREIGN_DEPLOY_PROBE_KIND=health_endpoint|acceptance_smoke|both`
1129
+ (default `both`).
1130
+ - `SOVEREIGN_DEPLOY_ACCEPTANCE_SMOKE_PATH=repo-relative path` (default
1131
+ `tests/deploy_smoke/`).
1132
+ - `AUTO_SOVEREIGN_DEPLOY_HEALTH_ENDPOINT=names-only env ref` (default empty
1133
+ = unresolvable; US-0085 compose).
1134
+
1135
+ When `AUTO_SOVEREIGN_SELF_HEALING_DEPLOY=0`, zero overhead, byte-identical
1136
+ publish path — no probe, no retry, no deferral, no execute healing steps.
1137
+
1138
+ Runbook cross-link: `docs/engineering/runbook.md` § Self-Healing Deploy Loop
1139
+ (US-0109 / DEC-0109).
1140
+
1141
+ #### US-0110 — Goal-Based Convergence Loops
1142
+
1143
+ Sovereign-loop terminal predicate. When `SOVEREIGN_GOAL_MODE=goal_convergence`,
1144
+ the orchestrator evaluates an explicit or auto-derived goal at phase
1145
+ boundaries and emits a `goal_progress` block. Iteration-count cap bounds the
1146
+ loop; `0` = disabled (not wall-clock). When `SOVEREIGN_GOAL_MODE=phase_driven`,
1147
+ zero overhead — no evaluation, no `goal_progress` block, no partial-delivery
1148
+ write.
1149
+
1150
+ - `SOVEREIGN_GOAL_MODE=phase_driven|goal_convergence` (default
1151
+ `phase_driven`) — master enable (mode-gated).
1152
+ - `SOVEREIGN_GOAL=explicit goal text` (default empty; wins over vision
1153
+ auto-derive).
1154
+ - `SOVEREIGN_GOAL_TOP_N=int >=1` (default `3`) — vision paragraph count for
1155
+ auto-derive.
1156
+ - `SOVEREIGN_GOAL_MAX_CHARS=int >=64` (default `512`) — truncation cap.
1157
+ - `SOVEREIGN_GOAL_TIMEOUT_MAX=int >=0` (default `0` = disabled;
1158
+ iteration-count cap, not wall-clock).
1159
+
1160
+ When `SOVEREIGN_GOAL_MODE=phase_driven`, zero overhead — no evaluation, no
1161
+ `goal_progress` block, no partial-delivery write.
1162
+
1163
+ Runbook cross-link: `docs/engineering/runbook.md` § Goal-Based Convergence
1164
+ (US-0110 / DEC-0110).
1165
+
1166
+ #### US-0111 — Release Trigger Adapters (sovereign-loop angle)
1167
+
1168
+ Extends version-scoped changelog generation with an adapter registry that
1169
+ dispatches by release trigger source (GitHub webhook, npm publish, git tag
1170
+ push, manual `/release`). Sovereign-loop angle: the adapter dispatch emits a
1171
+ release event tuple to the US-0103 ledger (consumer-only append), and
1172
+ `SOVEREIGN_NOTIFY_TARGET=hook` can be wired so release-trigger events surface
1173
+ as sovereign-loop notifications. See US-0114 for release-workflow operator
1174
+ docs on this feature (trigger-source dispatch + changelog derivation
1175
+ mechanics).
1176
+
1177
+ - `RELEASE_TRIGGER_SOURCE=manual|github|npm|git_tag|auto` (default `manual`)
1178
+ — adapter dispatch selector. `manual` = byte-identical to pre-US-0111
1179
+ `/release` path.
1180
+ - `RELEASE_TRIGGER_TIMEOUT_SEC=int >=1` (default `10`) — adapter subprocess
1181
+ timeout.
1182
+ - `RELEASE_TRIGGER_FALLBACK_TO_LOCAL=0|1` (default `0`) — npm adapter offline
1183
+ fallback.
1184
+
1185
+ Default source is `manual` — byte-identical to pre-US-0111 `/release` path
1186
+ (zero behavior change when not configured).
1187
+
1188
+ Runbook cross-link: `docs/engineering/runbook.md` § Release Trigger Adapters
1189
+ (US-0111 / DEC-0111).
1190
+
1191
+ #### US-0112 — Ship Model-Catalog Example Presets on install/upgrade (sovereign-loop angle)
1192
+
1193
+ Ships a curated set of model-catalog example presets in the installer payload,
1194
+ so operators can bootstrap a local catalog without hand-authoring JSON.
1195
+ Sovereign-loop angle: presets tune `MODEL_TIER`, `TOKEN_PROFILE`,
1196
+ `DELIVERY_MODE`, `ID_NAMESPACE_BOOTSTRAP` — values that the sovereign loop
1197
+ reads at phase boundaries (model-tier resolver, sovereign-loop spawn,
1198
+ convergence predicate). US-0112 is the only in-scope sovereign-era feature
1199
+ without a dedicated sovereign-loop scratchpad block. See US-0114 for
1200
+ release-workflow operator docs on this feature (installer payload + version
1201
+ sync mechanics).
1202
+
1203
+ US-0112 has no dedicated sovereign-loop scratchpad block. Operators tune the
1204
+ sovereign loop's behavior via the existing delivery/catalog keys documented in
1205
+ the **Delivery & lifecycle** region of `.cursor/scratchpad.md`:
1206
+
1207
+ - `DELIVERY_MODE=ultra_lean|mega_quick|balanced|highend` (default `balanced`)
1208
+ — sovereign loop reads at phase-context narrow-read.
1209
+ - `TOKEN_PROFILE=lean|balanced|rich` (default `balanced`) — context-pack
1210
+ slimming.
1211
+ - `ID_NAMESPACE_BOOTSTRAP=0|1` (default `0`) — ID namespace fresh-start
1212
+ policy.
1213
+ - `MODEL_TIER=...` — per-phase model tier.
1214
+
1215
+ US-0112 itself is a passive payload — there is no master enable flag.
1216
+ Presets are written to `template/.cursor/model-catalog.local.example.*.json`
1217
+ on install/upgrade; operators opt in by copying an example to
1218
+ `.cursor/model-catalog.local.json`. When no preset is copied to the active
1219
+ catalog path, the sovereign loop reads its existing resolver defaults — zero
1220
+ behavior change.
1221
+
1222
+ Runbook cross-link: `docs/engineering/runbook.md` § Model-catalog example
1223
+ preset delivery (US-0112 / DEC-0112).
1224
+
1225
+ ### Release & distribution (US-0041 / US-0062 / US-0111 / US-0112) umbrella section
1226
+
1227
+ The release & distribution family covers installer lifecycle QA (`US-0041`), the
1228
+ installer-owned `its_magic/` metadata boundary (`US-0062`), release-trigger
1229
+ adapters (`US-0111`), and model-catalog example preset delivery (`US-0112`).
1230
+ Every runtime feature in this family is **default-off or passive** —
1231
+ `RELEASE_TRIGGER_SOURCE=manual` is byte-identical to pre-`US-0111`, `US-0112` is
1232
+ a passive payload until an operator opts in, `US-0041` is a quality-gate invoked
1233
+ only by `tests/run-tests.*` or CI, and `US-0062`'s `PROJECT_README_ENFORCE=1` is
1234
+ post-bootstrap default but the gate only fires at `/release` step 3g.
1235
+
1236
+ **Recommended enable order** (each step composes with the previous):
1237
+
1238
+ 1. `PROJECT_README_ENFORCE=1` (`US-0062`) — installer-owned boundary; verify
1239
+ the project README coverage gate is enabled post-bootstrap.
1240
+ 2. `tests/run-tests.ps1` / `tests/run-tests.sh` (`US-0041`) — validate the
1241
+ installer/CLI lifecycle on your environment.
1242
+ 3. Model-catalog example presets (`US-0112`) — browse
1243
+ `template/.cursor/model-catalog.local.example*.json`, copy a preset to
1244
+ `.cursor/model-catalog.local.json` if desired.
1245
+ 4. `RELEASE_TRIGGER_SOURCE=github|npm|git_tag|auto` (`US-0111`) — release
1246
+ trigger adapter dispatch; default `manual` is byte-identical to pre-`US-0111`.
1247
+
1248
+ **Runbook pointer:** See the per-feature runbook sections (cross-linked in each
1249
+ subsection below) for reason-code inventories, troubleshooting recipes, and
1250
+ compose-guard matrices. Runbook anchors: `## Lifecycle QA matrix (US-0041)`,
1251
+ `## Project README coverage validation (US-0097 / DEC-0083)` (US-0062 boundary),
1252
+ `## Release Trigger Adapters (US-0111 / DEC-0111)`, `## Model-catalog example
1253
+ preset delivery (US-0112 / DEC-0112)`.
1254
+
1255
+ **Zero-overhead-when-off contract:** When the release & distribution master
1256
+ flags are at their defaults (`RELEASE_TRIGGER_SOURCE=manual`,
1257
+ `RELEASE_PUBLISH_MODE=disabled` (kit repo) or `confirm` (consumer default),
1258
+ `PROJECT_README_ENFORCE=1` post-bootstrap with `FRAMEWORK_KIT_REPO=0` in
1259
+ consumer repos, and no preset copied to `.cursor/model-catalog.local.json`),
1260
+ the framework is byte-identical to the pre-release-distribution baseline for
1261
+ runtime behavior — `US-0041` adds no runtime path; `US-0062`'s gate only fires
1262
+ at `/release`; `US-0111` spawns no adapter subprocess; `US-0112` ships as passive
1263
+ installer payload. Zero overhead, no schema changes, no extra spawns, no extra
1264
+ file writes.
1265
+
1266
+ #### US-0041 — End-to-End Lifecycle QA for `its-magic` install/upgrade/clean
1267
+
1268
+ Validates end-to-end installer/CLI lifecycle behavior across fresh install
1269
+ (`missing`), overwrite+backup, upgrade, clean-repo, and negative-path invalid
1270
+ mode/args scenarios. Coverage lives in `tests/run-tests.ps1` and
1271
+ `tests/run-tests.sh` (local) plus npm/brew/choco CI jobs. Post-install invariant
1272
+ checks every path in `[required_install_script_paths]` from
1273
+ `docs/engineering/context/installer-owned-paths.manifest`; missing paths fail
1274
+ closed with `INSTALL_COMPLETENESS_FAILED` / `INSTALL_REQUIRED_SCRIPT_MISSING:<path>`.
1275
+
1276
+ `US-0041` has no dedicated lifecycle-QA scratchpad block — lifecycle QA is
1277
+ runbook-anchored + test-marker-anchored + installer-completeness-reason-code
1278
+ anchored. The cross-cutting scratchpad keys that govern the shared release /
1279
+ install surface are:
1280
+
1281
+ - `AUTO_INSTALL_DEPS=0|1` (default `1`) — when `0`, the agent will not
1282
+ auto-install deps/runtimes. Operators running lifecycle QA on a clean
1283
+ environment may flip to `0` to validate the no-deps path.
1284
+ - `AUTO_RELEASE_NOTES=0|1` (default `1`) — when `0`, skip auto-generation of
1285
+ `handoffs/release_notes.md`. Lifecycle QA on the release path tests both
1286
+ states.
1287
+
1288
+ `US-0041` adds zero runtime overhead — lifecycle QA runs only when an operator
1289
+ or CI invokes `tests/run-tests.ps1` / `tests/run-tests.sh` or when the
1290
+ installer completeness gate triggers post-install. The default `/auto` chain
1291
+ does not invoke lifecycle QA on every phase.
1292
+
1293
+ Runbook cross-link: `docs/engineering/runbook.md` § Lifecycle QA matrix
1294
+ (US-0041). Secondary cross-link: installer completeness gate reason codes
1295
+ (`INSTALL_COMPLETENESS_FAILED`, `INSTALL_REQUIRED_SCRIPT_MISSING:<path>`,
1296
+ `INSTALL_MANIFEST_ERROR`) documented under the runbook's packaged-installs
1297
+ section.
1298
+
1299
+ #### US-0062 — Installer-Owned `its_magic/` folder for framework metadata
1300
+
1301
+ Establishes `its_magic/` as the installer-owned canonical metadata boundary —
1302
+ the framework-version marker (`.its-magic-version`), the framework README, and
1303
+ the installer-owned-paths manifest entries all live under `its_magic/` rather
1304
+ than at the repo root. `DEC-0045` declared the boundary; `DEC-0083` (`US-0097`)
1305
+ amended `DEC-0045` to separate the framework catalog gate (`US-0091`,
1306
+ `its_magic/README.md`) from the project root README gate (`US-0097`, project
1307
+ `README.md` bootstrap + per-story growth).
1308
+
1309
+ - `PROJECT_README_ENFORCE=0|1` (default `1` post-bootstrap) — master enforce
1310
+ flag for `US-0097`'s project-README coverage gate (`/release` step 3g). When
1311
+ `0`: `/release` step 3g skips (migration/grandfathering only). When `1`:
1312
+ blocking. Flip `0`→`1` only after `validate_project_readme_coverage.py
1313
+ --report` shows `coverage_missing: []`.
1314
+ - `FRAMEWORK_KIT_REPO=0|1` (default `0`; kit-repo exception) — when `1`
1315
+ (its-magic dev kit repo only): skip execute 23a/23b and the project
1316
+ validator root check. Consumer repos never set `FRAMEWORK_KIT_REPO=1`.
1317
+
1318
+ When `PROJECT_README_ENFORCE=0` and `FRAMEWORK_KIT_REPO=0` (consumer repo
1319
+ defaults), the installer-owned `its_magic/` boundary exists passively — no gate
1320
+ runs at release unless the project README coverage check (`US-0097` step 3g)
1321
+ is invoked. `FRAMEWORK_KIT_REPO=1` is the kit-repo-only exception; consumer
1322
+ repos never set it. Zero runtime overhead for consumer repos.
1323
+
1324
+ Runbook cross-link: `docs/engineering/runbook.md` § Project README coverage
1325
+ validation (US-0097 / DEC-0083) (US-0062 installer ownership boundary amended
1326
+ by US-0097 / DEC-0083; original DEC-0045 referenced from
1327
+ `docs/engineering/decisions.md` § DEC-0045).
1328
+
1329
+ #### US-0111 — Release Trigger Adapters (release-workflow angle)
1330
+
1331
+ Extends version-scoped changelog generation with an adapter registry that
1332
+ dispatches by release trigger source (GitHub webhook, npm publish, git tag
1333
+ push, manual `/release`). Release-workflow angle: the adapter's `TriggerContext`
1334
+ flows into `release_changelog_lib` without modification, so changelog
1335
+ derivation mechanics are trigger-source-agnostic. The 5 trigger sources:
1336
+
1337
+ - `manual` (default) — local-only / safe default; byte-identical to pre-`US-0111`
1338
+ `/release` path.
1339
+ - `github` — webhook-driven CI release.
1340
+ - `npm` — publish-event-driven release.
1341
+ - `git_tag` — tag-push-driven release.
1342
+ - `auto` — auto-detect from environment.
1343
+
1344
+ The master dispatch selector and operator controls are:
1345
+
1346
+ - `RELEASE_TRIGGER_SOURCE=manual|github|npm|git_tag|auto` (default `manual`) —
1347
+ adapter dispatch selector.
1348
+ - `RELEASE_TRIGGER_TIMEOUT_SEC=int >=1` (default `10`) — adapter subprocess
1349
+ timeout. Lower = fail-fast on slow networks; higher = tolerant of GitHub/npm
1350
+ latency.
1351
+ - `RELEASE_TRIGGER_FALLBACK_TO_LOCAL=0|1` (default `0`) — npm adapter offline
1352
+ fallback. When `0`: hard fail on npm registry unreachable. When `1`: fall
1353
+ back to local `package-lock.json` last-known-published version (tradeoff:
1354
+ local lockfile may be stale vs hard-fail).
1355
+
1356
+ Publish-mode composition (cross-link to the existing `### Configurable
1357
+ multi-target publish + confirmation gate (US-0054)` section above for the
1358
+ canonical key rows of `RELEASE_PUBLISH_MODE` / `RELEASE_TARGETS_FILE` /
1359
+ `RELEASE_TARGETS_DEFAULT` — `US-0114` does not duplicate those rows here).
1360
+
1361
+ Default source is `manual` — byte-identical to pre-`US-0111` `/release` path
1362
+ (zero behavior change when not configured). When `RELEASE_TRIGGER_SOURCE=manual`,
1363
+ no adapter subprocess spawns, no GitHub/npm/git-tag network calls fire, no
1364
+ fallback path evaluates. When `RELEASE_PUBLISH_MODE=disabled`, no post-release
1365
+ publish target execution.
1366
+
1367
+ See `### Sovereign-loop era (US-0103–US-0112)` → `#### US-0111 — Release
1368
+ Trigger Adapters (sovereign-loop angle)` above for the sovereign-loop angle on
1369
+ this feature (release-trigger adapter as a sovereign-loop notification/hook
1370
+ surface).
1371
+
1372
+ Runbook cross-link: `docs/engineering/runbook.md` § Release Trigger Adapters
1373
+ (US-0111 / DEC-0111). Secondary cross-link: `### Configurable multi-target
1374
+ publish + confirmation gate (US-0054)` (above) for publish-controls composition.
1375
+
1376
+ #### US-0112 — Ship Model-Catalog Example Presets on install/upgrade (release-workflow angle)
1377
+
1378
+ Ships a curated set of model-catalog example presets in the installer payload,
1379
+ so operators can bootstrap a local catalog without hand-authoring JSON.
1380
+ Release-workflow angle: presets ship as 8 committed
1381
+ `model-catalog.local.example*.json` files (role-based-balanced /
1382
+ role-based-highend / role-based-budget, etc.) delivered via
1383
+ `docs/engineering/context/installer-owned-paths.manifest`
1384
+ `[install_include_paths]`. Presets are tagged to the framework version in
1385
+ `its_magic/.its-magic-version`; `its-magic --mode upgrade` syncs presets to the
1386
+ framework's current version. Operators bootstrap a local catalog by copying an
1387
+ example to `.cursor/model-catalog.local.json` — opt-in, no runtime behavior
1388
+ change when no preset is copied.
1389
+
1390
+ `US-0112` is a passive installer payload — there is no master enable flag for
1391
+ the preset shipping mechanic; the installer manifest delivers the example files
1392
+ unconditionally, and operator opt-in happens by copying an example to the
1393
+ active catalog path. For `DELIVERY_MODE` / `TOKEN_PROFILE` /
1394
+ `ID_NAMESPACE_BOOTSTRAP` / `MODEL_TIER` keys that presets tune, see
1395
+ `### Sovereign-loop era keys (US-0103–US-0112)` above.
1396
+
1397
+ When no preset is copied to `.cursor/model-catalog.local.json`, the framework
1398
+ reads its existing resolver defaults (no preset loaded, no runtime behavior
1399
+ change). The example presets add zero runtime overhead until an operator
1400
+ explicitly opts in by copying one to the active catalog path.
1401
+
1402
+ See `### Sovereign-loop era (US-0103–US-0112)` → `#### US-0112 — Ship
1403
+ Model-Catalog Example Presets on install/upgrade (sovereign-loop angle)` above
1404
+ for the sovereign-loop angle on this feature (presets as a sovereign-loop
1405
+ bootstrap aid tuning `MODEL_TIER` / `TOKEN_PROFILE` / `DELIVERY_MODE`).
1406
+
1407
+ Runbook cross-link: `docs/engineering/runbook.md` § Model-catalog example
1408
+ preset delivery (US-0112 / DEC-0112).
1409
+
1410
+ ### Integration & observability (US-0034 / US-0084 / US-0086 / US-0093 / US-0096 / US-0101 / US-0102) umbrella section
1411
+
1412
+ The integration & observability family covers cross-repo compatibility
1413
+ observability (`US-0034`), the codebase map freshness gate (`US-0084`), the
1414
+ handoff hygiene validator (`US-0086`), the scratchpad drift detector
1415
+ (`US-0093`), active context handoff (`US-0096`), model tier resolution
1416
+ (`US-0101`), and the role-based model catalog (`US-0102`). The family splits
1417
+ into two postures: **optional features** that are default-off and impose zero
1418
+ overhead when disabled (`US-0034` cross-repo observability, `US-0096` active
1419
+ context handoff, `US-0101` model tier resolution, `US-0102` role-based model
1420
+ catalog), and **always-on machinery** that fires automatically at its
1421
+ triggering lifecycle event — publish, `/qa`, or `/verify-work` (`US-0084`
1422
+ codebase map freshness gate at `npm publish`, `US-0086` handoff hygiene
1423
+ validator routing, `US-0093` scratchpad drift detector during `/qa` and
1424
+ `/verify-work`). Always-on guards are framed as "automatic when running
1425
+ `npm publish` / `/qa` / `/verify-work`" rather than "enable to turn on".
1426
+
1427
+ **Recommended enable order** (each step composes with the previous; optional
1428
+ master toggles first in dependency order, always-on guards last — the latter
1429
+ need no enable and are listed for the operator narrative):
1430
+
1431
+ 1. `CROSS_REPO_OBSERVABILITY=1` (`US-0034`) — opt in to compatibility
1432
+ visibility; default `0` is byte-identical to the pre-`US-0034` baseline.
1433
+ 2. `DELIVERY_MODE=ultra_lean` (`US-0096`) — select a delivery mode (default
1434
+ `standard`); then layer `LEAN_MEMORY_READ` / `LEAN_MEMORY_WRITE` and
1435
+ `AUTO_DELIVERY_ROUTING` for active-context-handoff routing.
1436
+ 3. `MODEL_TIER_DEFAULT=balanced` (`US-0101`) — set the model tier baseline;
1437
+ then `MODEL_CATALOG` / `MODEL_RESOLVE` / `MODEL_FALLBACK` /
1438
+ `MODEL_PROVIDER_MODE` configure the resolver chain.
1439
+ 4. `MODEL_SLUG_<PHASE_ID>=<slug>` (`US-0102`) — compose per-phase role-based
1440
+ slug overrides on top of `US-0101`'s `MODEL_CATALOG`.
1441
+ 5. `tests/run-tests.ps1` / `tests/run-tests.sh` (`US-0084`) — the
1442
+ publish-time freshness gate fires automatically via
1443
+ `guard_installer_publish.py` (`npm publish` `prepublishOnly`); no scratchpad
1444
+ enable needed.
1445
+ 6. `/qa` + `/verify-work` (`US-0086`) — the handoff hygiene validator runs
1446
+ automatically inside the QA pipeline; `REMOTE_EXECUTION=1` +
1447
+ `AUTO_REMOTE_AUTOMATION_PROFILE=deterministic_v1` opt into deterministic-CI
1448
+ routing.
1449
+ 7. `/qa` + `/verify-work` (`US-0093`) — the scratchpad drift detector runs
1450
+ automatically via the `browser_smoke` probe; no scratchpad enable needed.
1451
+
1452
+ **Runbook pointer:** See the per-feature runbook sections (cross-linked in
1453
+ each subsection below) for reason-code inventories, troubleshooting recipes,
1454
+ and compose-guard matrices. Parent runbook umbrella: `## Runtime QA autopilot
1455
+ contract (US-0065 / DEC-0047)`. Per-feature anchors: `## Optional cross-repo
1456
+ observability mode (US-0034)`, `### Published npm installer.sh / POSIX dash
1457
+ (US-0084)` + `### Automated checks (US-0084)`, `### Manual vs automation
1458
+ routing (US-0086)` + `### Optional deterministic CI routing recipe (US-0086)`,
1459
+ `### Browser UAT self-test (US-0093)`, `### Delivery modes (US-0096 /
1460
+ DEC-0082)`, `## Per-phase model tier selection (US-0101 / DEC-0086)`,
1461
+ `## Direct per-phase model slug override + role catalog (US-0102 / DEC-0087)`.
1462
+
1463
+ **Zero-overhead-when-off contract:** When the optional master flags are at
1464
+ their defaults (`CROSS_REPO_OBSERVABILITY=0`, `DELIVERY_MODE=standard`,
1465
+ `LEAN_MEMORY_READ=1` / `LEAN_MEMORY_WRITE=1` with no pack/active-context
1466
+ paths present, no `MODEL_TIER_DEFAULT` override, no `MODEL_SLUG_<PHASE_ID>`
1467
+ overrides), the framework's runtime behavior is byte-identical to the
1468
+ pre-integration-observability baseline — `US-0034` adds no compatibility
1469
+ probing; `US-0096` falls back to standard cold reads; `US-0101` falls back
1470
+ to the framework default tier; `US-0102` falls back to `MODEL_TIER_DEFAULT`
1471
+ (`US-0101`). Always-on guards (`US-0084` / `US-0086` / `US-0093`) only fire
1472
+ at their triggering lifecycle event (`npm publish` / `/qa` / `/verify-work`)
1473
+ and add no runtime cost outside those phases. Zero overhead, no schema
1474
+ changes, no extra spawns, no extra file writes when optional features are off.
1475
+
1476
+ #### US-0034 — Cross-repo compatibility observability
1477
+
1478
+ See `### Optional cross-repo observability (US-0034)` above for the operator
1479
+ guide on compatibility visibility (master enable, gate posture, monitored
1480
+ sources, signals/reports, decision-gate rule). This entry records the
1481
+ integration & observability family angle: `US-0034` is the **default-off
1482
+ master toggle** for the optional-features wing of the family — flipping
1483
+ `CROSS_REPO_OBSERVABILITY=0`→`1` activates compatibility signal tracking and
1484
+ the optional release-blocking gate (`COMPATIBILITY_GATE_ON_CRITICAL=1`,
1485
+ default `1`); the `COMPATIBILITY_SOURCES=` semicolon-separated
1486
+ `repo=/module=/contract=/docs=` declarations select which sources are probed.
1487
+
1488
+ When `CROSS_REPO_OBSERVABILITY=0` (default), the workflow adds zero required
1489
+ compatibility overhead — no source probing, no gate evaluation, no release
1490
+ block. The feature composes cleanly with the rest of the integration &
1491
+ observability family: enabling it first (step 1 of the recommended enable
1492
+ order) is purely informational for the operator narrative — none of the
1493
+ other family features depend on it.
1494
+
1495
+ Runbook cross-link: `docs/engineering/runbook.md` § Optional cross-repo
1496
+ observability mode (US-0034).
1497
+
1498
+ #### US-0084 — Codebase map freshness gate
1499
+
1500
+ `US-0084` is an **always-on publish-time guard**, not a default-off optional
1501
+ feature. It enforces two invariants when an operator or CI invokes
1502
+ `npm publish`: (1) the shipped POSIX `installer.sh` uses LF line endings and
1503
+ portable `set` tokens (no bash-only `pipefail` / `-o errexit` / `-u` bundles
1504
+ on the unconditional startup path) so the script runs cleanly under
1505
+ `/bin/sh` → dash on Debian/Ubuntu; (2) the agent-driven codebase map surface
1506
+ stays fresh at publish time. The guard runs via `scripts/guard_installer_publish.py`
1507
+ wired into npm `prepublishOnly`, and the test counterpart lives at
1508
+ `tests/installer_shell_bug0004_test.py`.
1509
+
1510
+ Failure mode: the publish aborts with the shared `INSTALL_MANIFEST_ERROR`
1511
+ reason code (also surfaced by `US-0062` / `US-0041` per the release &
1512
+ distribution reference extension). `US-0084` has no dedicated scratchpad key
1513
+ block — its normative surface is runbook-anchored plus the shared reason code.
1514
+ No "enable to turn on" wording applies: the guard fires automatically whenever
1515
+ `npm publish` runs; outside that lifecycle event it adds zero runtime cost.
1516
+
1517
+ Runbook cross-links: `docs/engineering/runbook.md` § Published npm
1518
+ `installer.sh` / POSIX dash (US-0084) (L1441) + § Automated checks (US-0084)
1519
+ (L1459).
1520
+
1521
+ #### US-0086 — Handoff hygiene validator
1522
+
1523
+ `US-0086` is an **always-on routing guard** for the handoff hygiene
1524
+ validator. It selects between three routing modes: (1) manual operator
1525
+ terminal (default — `AUTO_REMOTE_AUTOMATION_PROFILE=off`), (2) automation CI
1526
+ (`AUTO_REMOTE_AUTOMATION_PROFILE=deterministic_v1` with `REMOTE_EXECUTION=1`),
1527
+ and (3) the optional deterministic-CI recipe (the same keys with a
1528
+ `.cursor/remote.json` target). The routing decision is recorded as the
1529
+ `AUTO_REMOTE_ENVIRONMENT_LABEL` names-only evidence label
1530
+ (`local`/`docker`/`ssh`).
1531
+
1532
+ The remote-execution keys governing this routing — `REMOTE_EXECUTION=0|1`
1533
+ (default `0`), `REMOTE_CONFIG=.cursor/remote.json`,
1534
+ `AUTO_REMOTE_AUTOMATION_PROFILE=off|deterministic_v1` (default `off`),
1535
+ `AUTO_REMOTE_ENVIRONMENT_LABEL=local|docker|ssh` — are already documented in
1536
+ the main scratchpad reference list above (pre-`US-0113` reference surface).
1537
+ `US-0115` adds a grouped cross-link pointer only, no duplicate rows (mirrors
1538
+ `US-0114`'s `AUTO_INSTALL_DEPS` / `AUTO_RELEASE_NOTES` grouped cross-link
1539
+ pattern). When `REMOTE_EXECUTION=0` (default) and
1540
+ `AUTO_REMOTE_AUTOMATION_PROFILE=off` (default), the workflow adds zero
1541
+ remote-execution overhead — no Docker/SSH probing, no environment-label
1542
+ injection. Manual operator terminal is the default routing.
1543
+
1544
+ Runbook cross-links: `docs/engineering/runbook.md` § Manual vs automation
1545
+ routing (US-0086) (L1398) + § Optional deterministic CI routing recipe
1546
+ (US-0086) (L1471).
1547
+
1548
+ #### US-0093 — Scratchpad drift detector
1549
+
1550
+ `US-0093` is an **always-on QA-time guard**. It runs the `browser_smoke`
1551
+ probe during `/qa` and `/verify-work` invocations to detect two drift
1552
+ classes: (1) scratchpad header drift (the canonical scratchpad header is
1553
+ out of sync with the active/template example mirrors) and (2) backlog status
1554
+ drift (a story's backlog status diverges from its state.md checkpoint).
1555
+ Outside `/qa` and `/verify-work`, the detector adds no runtime cost.
1556
+
1557
+ The `probe_kind=browser_smoke` used here is distinct from the
1558
+ post-deploy `two_stage` smoke probe used by the self-healing deploy loop
1559
+ family — `browser_smoke` is a read-only UAT-class probe, not a publish-path
1560
+ probe. Failure modes surface as the `SCRATCHPAD_HEADER_DRIFT` and
1561
+ `BACKLOG_STATUS_DRIFT` reason codes. `US-0093` has no dedicated scratchpad key
1562
+ block — its normative surface is runbook-anchored plus the two reason codes.
1563
+ No "enable to turn on" wording applies.
1564
+
1565
+ Runbook cross-link: `docs/engineering/runbook.md` § Browser UAT self-test
1566
+ (US-0093) (L1999; parent h2 = `## Runtime QA autopilot contract (US-0065 /
1567
+ DEC-0047)` L1486).
1568
+
1569
+ #### US-0096 — Active context handoff (lean memory)
1570
+
1571
+ `US-0096` is the **default-off** master surface for active-context-handoff
1572
+ routing. It exposes three delivery modes — `standard` (default),
1573
+ `ultra_lean`, `mega_quick` — that shape the lifecycle and artifact surfaces
1574
+ per story. This repo dogfoods `ultra_lean`; the documentation default remains
1575
+ `standard` so consumer repos see no behavior change until they opt in. On
1576
+ top of the delivery mode, layered per-story lean memory keys bound the
1577
+ active-context paths:
1578
+
1579
+ - `LEAN_MEMORY_READ=0|1` (default `1` when pack/active-context paths exist)
1580
+ — toggle the lean pack / active-context read paths.
1581
+ - `LEAN_MEMORY_WRITE=0|1` (default `1`) — toggle the lean pack / active-
1582
+ context write paths.
1583
+ - `LEAN_COLD_READ_MAX_SECTIONS` (default `4`) — bound cold reads to a
1584
+ section-count cap.
1585
+ - `LEAN_STATE_INDEX_ROWS` (default `80`) — bound the state.md index rows
1586
+ retained on the hot surface.
1587
+ - `AUTO_DELIVERY_ROUTING=scratchpad_only|backlog_then_scratchpad` (default
1588
+ `scratchpad_only`) — select scratchpad-only vs backlog-then-scratchpad
1589
+ routing for the active-context handoff.
1590
+
1591
+ The canonical `DELIVERY_MODE` row lives in `### Release & distribution keys
1592
+ (US-0041 / US-0062 / US-0111 / US-0112)` above (owned by `US-0114` per
1593
+ byte-stability); `US-0096` documents the active-context-handoff angle here,
1594
+ not the release-workflow angle. When `LEAN_MEMORY_READ=0` and
1595
+ `LEAN_MEMORY_WRITE=0`, the lean pack / active-context paths are disabled
1596
+ and the workflow falls back to standard cold reads.
1597
+
1598
+ Runbook cross-link: `docs/engineering/runbook.md` § Delivery modes (US-0096 /
1599
+ DEC-0082) (L591).
1600
+
1601
+ #### US-0101 — Model tier resolution (resolver mechanics angle)
1602
+
1603
+ `US-0101` is the **default-off** model-tier resolver. Five keys configure
1604
+ the resolution chain:
1605
+
1606
+ - `MODEL_TIER_DEFAULT=cheap|balanced|strong` (default `balanced`) — the
1607
+ fallback tier when no per-phase override applies.
1608
+ - `MODEL_CATALOG=<path>` (default `.cursor/model-catalog.local.json`) —
1609
+ path to the local slug catalog consulted when `MODEL_RESOLVE` is
1610
+ `local_catalog` or `role_catalog`.
1611
+ - `MODEL_RESOLVE=alias_only|local_catalog|role_catalog` (default
1612
+ `alias_only`) — resolution strategy. `alias_only` uses Cursor-stable
1613
+ aliases (`cheap`→`fast`, `balanced`→`inherit`, `strong`→omit `model:`);
1614
+ `local_catalog` looks up vendor slugs from `MODEL_CATALOG`; `role_catalog`
1615
+ opts into the `US-0102` phase→role→catalog lookup and falls through on
1616
+ miss.
1617
+ - `MODEL_FALLBACK=<strategy>` (default `inherit`) — fallback when a catalog
1618
+ lookup fails.
1619
+ - `MODEL_PROVIDER_MODE=cursor|api` (default `cursor`) — `cursor` routes
1620
+ subagents through Cursor-managed infrastructure; `api` opts into BYOK via
1621
+ Cursor Settings → Models → API Key (known limitation: subagents do NOT
1622
+ inherit custom API keys / base URLs).
1623
+
1624
+ `US-0101` is independent of `TOKEN_PROFILE` (context breadth) and
1625
+ `DELIVERY_MODE` (lifecycle shape) — none substitutes for the other. When no
1626
+ `MODEL_TIER_DEFAULT` override is set, the resolver falls back to the
1627
+ framework default tier. See `### Release & distribution` → `#### US-0112 —
1628
+ Ship Model-Catalog Example Presets on install/upgrade (release-workflow
1629
+ angle)` for the installer-payload angle on `US-0112` preset shipping
1630
+ (angle-distinct narrative: `US-0115` owns resolver mechanics; `US-0114` owns
1631
+ installer payload + version sync).
1632
+
1633
+ Runbook cross-link: `docs/engineering/runbook.md` § Per-phase model tier
1634
+ selection (US-0101 / DEC-0086) (L653).
1635
+
1636
+ #### US-0102 — Role-based model catalog (role catalog angle)
1637
+
1638
+ `US-0102` is the **default-off** role-based model catalog overlay. It
1639
+ composes on `US-0101` / `DEC-0086` — set `MODEL_CATALOG` first (the catalog
1640
+ path), then layer per-phase role-based slug overrides:
1641
+
1642
+ - `MODEL_SLUG_<PHASE_ID>=<your-vendor-slug>` — direct vendor slug override
1643
+ for a canonical phase id (`ask`, `refresh-context`, `memory-audit`,
1644
+ `status-reconcile`, `pause`, `intake`, `discovery`, `research`, `release`,
1645
+ `plan-verify`, `architecture`, `execute`, `quick`, `qa`, `verify-work`,
1646
+ `security-review`, `auto`). Set in `.cursor/scratchpad.local.md` only —
1647
+ use `<your-vendor-slug>` placeholders in committed files. `MODEL_ASK`
1648
+ participates in step 1 like any other phase (no special-case bypass).
1649
+
1650
+ The precedence chain (deterministic, per canonical `phase_id`) is:
1651
+ `MODEL_<PHASE>` (direct slug, highest) → `MODEL_TIER_<PHASE>` (DEC-0086
1652
+ tier→alias / `local_catalog` chain) → `role_catalog` lookup (only when
1653
+ `MODEL_RESOLVE=role_catalog`; miss falls through) → `MODEL_TIER_DEFAULT`
1654
+ (DEC-0086 tier chain) → Cursor stable alias (DEC-0086 built-in mapping).
1655
+ When no `MODEL_SLUG_<PHASE_ID>` overrides are set, the catalog falls back
1656
+ to `MODEL_TIER_DEFAULT` (`US-0101`). See `### Release & distribution` →
1657
+ `#### US-0112 — Ship Model-Catalog Example Presets on install/upgrade
1658
+ (release-workflow angle)` for the installer-payload angle on `US-0112`
1659
+ preset shipping (angle-distinct narrative: `US-0115` owns the role catalog
1660
+ DEC-0087; `US-0114` owns installer payload + version sync).
1661
+
1662
+ Runbook cross-link: `docs/engineering/runbook.md` § Direct per-phase model
1663
+ slug override + role catalog (US-0102 / DEC-0087) (L771).
1664
+
1665
+ ### Delivery & lifecycle (US-0092 / US-0095 / US-0098 / US-0099) umbrella section
1666
+
1667
+ The delivery & lifecycle family covers the full-autonomy outer driver
1668
+ (`US-0092`), the native in-chat auto-chain (`US-0095`), the dev environment
1669
+ auto-launch gate (`US-0098`), and the install-time dev-environment
1670
+ copy-when-missing bootstrap (`US-0099`). The family splits into two
1671
+ postures: **optional runtime features** that are default-off and impose zero
1672
+ overhead when disabled (`US-0092` full-autonomy outer driver and `US-0095`
1673
+ native in-chat auto-chain, both opt-in via `AUTO_FLOW_MODE=full_autonomy`
1674
+ which defaults to `manual`; `US-0098` dev environment auto-launch opt-in via
1675
+ `DEV_AUTO_LAUNCH_PROFILE` which defaults to `off`), and an **install-time
1676
+ bootstrap** that runs automatically on `missing` / `upgrade` / npm
1677
+ `postinstall` (`US-0099` copy-when-missing bootstrap — zero runtime cost
1678
+ because it only fires at install/upgrade time). Install-time bootstraps are
1679
+ framed as "automatic at install time" rather than "enable to turn on".
1680
+
1681
+ **Recommended enable order** (each step composes with the previous;
1682
+ install-time baseline first → runtime auto-launch layered on top → primary
1683
+ IDE recipe → optional fallback last):
1684
+
1685
+ 1. `US-0099` install-time bootstrap — the copy-when-missing baseline runs
1686
+ automatically on `missing` / `upgrade` / npm `postinstall`; no scratchpad
1687
+ enable needed (zero runtime cost).
1688
+ 2. `DEV_AUTO_LAUNCH_PROFILE=deterministic_v1` (`US-0098`) — opt in to
1689
+ execute-phase bounded rebuild/relaunch of dev stacks layered on the
1690
+ `US-0099` bootstrap baseline; default `off` is byte-identical to the
1691
+ pre-`US-0098` baseline.
1692
+ 3. `AUTO_FLOW_MODE=full_autonomy` + `/auto` once in Cursor (`US-0095`) — the
1693
+ primary IDE recipe for hands-off delivery; orchestrator self-chains
1694
+ in-chat across phases and drain segments.
1695
+ 4. `python scripts/auto_outer_driver.py --repo .` (`US-0092`) — the
1696
+ **optional fallback** outer driver for headless/CI or when the native
1697
+ in-chat chain is unavailable (`NATIVE_CHAIN_UNAVAILABLE`); not required
1698
+ for IDE drain.
1699
+
1700
+ **Runbook pointer:** See the per-feature runbook sections (cross-linked in
1701
+ each subsection below) for reason-code inventories, troubleshooting recipes,
1702
+ and compose-guard matrices. Parent runbook umbrella: `## Auto continuation
1703
+ resume contract` (L1587). Per-feature anchors: `### Native in-chat auto-chain
1704
+ (US-0095)` (L1900), `### Full-autonomy outer driver (US-0092) — fallback`
1705
+ (L1958) + `#### Security (US-0092 / DEC-0078)` (L1989), `## Dev environment
1706
+ auto-launch (US-0098 / DEC-0084)` (L244) with the `US-0099` install-time
1707
+ bootstrap paragraph at L250 + normative contract anchor at L301.
1708
+
1709
+ **Zero-overhead-when-off contract:** When the optional runtime master
1710
+ flags are at their defaults (`AUTO_FLOW_MODE=manual` so both `US-0092` and
1711
+ `US-0095` are inert, and `DEV_AUTO_LAUNCH_PROFILE=off` so `US-0098` is
1712
+ disabled), the framework's runtime behavior is byte-identical to the
1713
+ pre-delivery-lifecycle baseline — `US-0092` spawns no outer-driver
1714
+ subprocess; `US-0095` runs no native in-chat chain; `US-0098` skips execute
1715
+ step 24 with zero overhead. `US-0099` is install-time only and adds no
1716
+ runtime cost outside `missing` / `upgrade` / npm `postinstall`. Zero
1717
+ overhead, no schema changes, no extra spawns, no extra file writes when
1718
+ optional features are off.
1719
+
1720
+ #### US-0092 — Full-autonomy outer driver (security posture + fallback)
1721
+
1722
+ `US-0092` is the **default-off** full-autonomy outer driver. Opt-in
1723
+ `AUTO_FLOW_MODE=full_autonomy` (exact literal, default-off per `US-0092` /
1724
+ `DEC-0078`) also enables the shipped stdlib outer driver
1725
+ (`scripts/auto_outer_driver.py`) as **optional** / **fallback** for
1726
+ headless/CI or when the native in-chat chain (`US-0095`) is unavailable
1727
+ (`NATIVE_CHAIN_UNAVAILABLE`). Spawn-only preserved per `BUG-0006` — the
1728
+ driver loops hook invocations; it never performs phase-role work.
1729
+
1730
+ Security posture (`DEC-0078`): no auto-read `.env` or secret paths; no
1731
+ intake evidence mutation under automation; no publish without explicit
1732
+ `RELEASE_PUBLISH_MODE=auto` opt-in (default-off); the block-retry ledger
1733
+ (`handoffs/auto_block_retry/<orchestrator_run_id>.jsonl`) is names-only —
1734
+ no secrets, no file contents. Hard caps: `AUTO_LOOP_MAX_CYCLES` (loop
1735
+ safety guard, default `5`), `AUTO_BACKLOG_MAX_STORIES` (drain cap, default
1736
+ `10`), `AUTO_BLOCK_RETRY_MAX` (default `3`). The `AUTO_FLOW_MODE`,
1737
+ `AUTO_IMPLEMENTATION_LOOP`, `AUTO_PAUSE_REQUEST`, `AUTO_PAUSE_POLICY`,
1738
+ `AUTO_LOOP_MAX_CYCLES`, and `AUTO_BACKLOG_MAX_STORIES` rows already live in
1739
+ the main `### Automation modes` (L880) and main reference list above
1740
+ (pre-`US-0113` reference surface); the `ALLOW_AUTO_PUSH` and
1741
+ `AUTO_PUSH_BRANCH_ALLOWLIST` rows live in `### Sync policy (US-0038)`
1742
+ (L909). `US-0116` adds a grouped cross-link pointer only — no duplicate key
1743
+ rows in the `### Delivery & lifecycle keys` sub-block below.
1744
+
1745
+ Relationship to native in-chat chain: `US-0095` is **primary** in the
1746
+ Cursor IDE; `US-0092` is **optional fallback** for headless/CI or when the
1747
+ native chain is unavailable. The primary/fallback boundary mirrors runbook
1748
+ L1921–L1926 (see `#### US-0095` below). When `AUTO_FLOW_MODE` is at its
1749
+ default `manual`, both `US-0092` and `US-0095` are inert and the framework
1750
+ is byte-identical to the pre-`US-0092` baseline — zero overhead, no
1751
+ subprocess spawns, no extra file writes.
1752
+
1753
+ Runbook cross-links: `docs/engineering/runbook.md` § Full-autonomy outer
1754
+ driver (US-0092) — fallback (L1958) + § Security (US-0092 / DEC-0078)
1755
+ (L1989; parent h2 = `## Auto continuation resume contract` L1587).
1756
+
1757
+ #### US-0095 — Native in-chat auto-chain (primary IDE recipe)
1758
+
1759
+ `US-0095` is the **primary IDE recipe** for hands-off delivery when
1760
+ `AUTO_FLOW_MODE=full_autonomy` (default-off). Run `/auto` once in Cursor —
1761
+ the orchestrator self-chains in-chat across phases and drain segments via
1762
+ a **foreground sequential** Task loop in the **same `/auto` orchestrator
1763
+ session**, without mandatory outer-driver re-invocation between segments.
1764
+
1765
+ Distinct from `US-0092` (outer-driver fallback): `US-0095` is **primary** in
1766
+ the Cursor IDE; `US-0092` is **optional fallback** for headless/CI or when
1767
+ the native chain is unavailable (`NATIVE_CHAIN_UNAVAILABLE`). The
1768
+ primary/fallback boundary mirrors runbook L1921–L1926:
1769
+
1770
+ | Context | Native in-chat chain | Outer driver |
1771
+ |---------|----------------------|--------------|
1772
+ | Cursor IDE + `full_autonomy` | **Primary** | Optional fallback |
1773
+ | Headless / CI | Unavailable | Recommended |
1774
+ | `--invoke-cmd` | N/A | Required bridge |
1775
+ | `NATIVE_CHAIN_UNAVAILABLE` | Stops | Suggested (optional tone) |
1776
+
1777
+ Compose-on-`US-0044`: `AUTO_BACKLOG_DRAIN=1` enables drain (grouped
1778
+ cross-link pointer to `### Optional /auto backlog-drain mode (US-0044)`
1779
+ L2370 — no duplicate rows in the `### Delivery & lifecycle keys` sub-block
1780
+ below). The `AUTO_BACKLOG_DRAIN`, `AUTO_BACKLOG_MAX_STORIES`,
1781
+ `AUTO_STORY_SELECTION`, `AUTO_BACKLOG_ON_BLOCK`, `AUTO_BUG_QUEUE`,
1782
+ `AUTO_BUG_TARGET`, `AUTO_BUG_MAX_ITEMS`, and `AUTO_BUG_ON_BLOCK` rows already
1783
+ live in the pre-`US-0116` README surfaces (`### Optional /auto
1784
+ backlog-drain mode (US-0044)` L2370 + `US-0087` / `US-0088` catalog
1785
+ one-liners at L2261 / L2263). Drain-advance routine prose is suppressed
1786
+ when `AUTO_QUIET=1` (the `AUTO_QUIET` row lives in the main reference list
1787
+ above). `US-0095` is angle-distinct from `US-0096`'s `LEAN_MEMORY_*`
1788
+ family: `US-0095` owns the process angle (orchestrator self-chain
1789
+ mechanism), `US-0096` owns the memory angle (the `LEAN_MEMORY_*` family
1790
+ documented in `### Integration & observability keys` above). When
1791
+ `AUTO_FLOW_MODE` is at its default `manual`, `US-0095` is inert and the
1792
+ framework is byte-identical to the pre-`US-0095` baseline — zero overhead,
1793
+ no in-chat chain, no extra spawns.
1794
+
1795
+ Runbook cross-link: `docs/engineering/runbook.md` § Native in-chat
1796
+ auto-chain (US-0095) (L1900; parent h2 = `## Auto continuation resume
1797
+ contract` L1587).
1798
+
1799
+ #### US-0098 — Dev environment auto-launch
1800
+
1801
+ `US-0098` is the **default-off** execute-phase bounded rebuild/relaunch of
1802
+ dev stacks plus **Connect** surfacing after implementation changes. It is
1803
+ distinct from `US-0065` phase QA, `US-0086` test routing, and `US-0067`
1804
+ release hints, and orthogonal to `AUTO_REMOTE_AUTOMATION_PROFILE` (remote
1805
+ execution — `US-0086` remote wins over docker-host-local per `DEC-0084` §3
1806
+ detection precedence). When `DEV_AUTO_LAUNCH_PROFILE=off` (default),
1807
+ execute step 24 is skipped with zero overhead. Flip
1808
+ `DEV_AUTO_LAUNCH_PROFILE=off`→`deterministic_v1` to activate the gate; the
1809
+ profile path is selected by `DEV_ENVIRONMENT_CONFIG` (repo-relative path,
1810
+ default `.cursor/dev-environment.json`).
1811
+
1812
+ The `DEV_AUTO_LAUNCH_PROFILE` and `DEV_ENVIRONMENT_CONFIG` rows are the
1813
+ **only true net-new scratchpad key rows** in the `### Delivery & lifecycle
1814
+ keys` sub-block below (per R-0104 grep — no pre-`US-0116` README
1815
+ documentation of these keys). The `DEV_ENV_*` profile and relaunch
1816
+ reason-code families (`DEV_ENV_PROFILE_DISABLED`, `DEV_ENV_PROFILE_INVALID`,
1817
+ `DEV_ENV_DETECT_AMBIGUOUS`, `DEV_ENV_COMPOSE_UNRESOLVED`,
1818
+ `DEV_ENV_TARGET_DISABLED`, `DEV_ENV_SECRET_SURFACE_VIOLATION`,
1819
+ `DEV_ENV_RELAUNCH_SKIPPED_NO_SURFACE`,
1820
+ `DEV_ENV_RELAUNCH_SKIPPED_PROFILE_OFF`, `DEV_ENV_RELAUNCH_FAILED`,
1821
+ `DEV_ENV_RELAUNCH_RETRY_EXHAUSTED`, `DEV_ENV_RELAUNCH_TIMEOUT`,
1822
+ `DEV_ENV_CONNECT_UNAVAILABLE`) are runbook-anchored (L280–L286) and are
1823
+ not re-documented as scratchpad key rows here — `US-0116` documents the
1824
+ auto-launch operator angle in this subsection, not the reason-code
1825
+ inventory. Compose-with-`US-0099`: the install-time bootstrap
1826
+ (`US-0099`) seeds the profile baseline; `US-0098` layers the execute-phase
1827
+ runtime gate on top.
1828
+
1829
+ Runbook cross-link: `docs/engineering/runbook.md` § Dev environment
1830
+ auto-launch (US-0098 / DEC-0084) (L244 — top-level h2).
1831
+
1832
+ #### US-0099 — Dev-environment copy-when-missing bootstrap
1833
+
1834
+ `US-0099` is the **install-time copy-when-missing bootstrap** for the dev
1835
+ environment profile. On `missing` / `upgrade` / npm `postinstall`, the
1836
+ framework copies `template/.cursor/dev-environment.json.example` → resolved
1837
+ profile path (`.cursor/dev-environment.json` by default) **only when the
1838
+ target file is absent** — it never overwrites operator-customized profiles.
1839
+ Customize **after** bootstrap (compose `service` and `*Env` connect refs in
1840
+ the copied profile); manual copy is no longer a prerequisite to enable the
1841
+ `US-0098` gate.
1842
+
1843
+ `US-0099` has no dedicated scratchpad key block — its normative surface is
1844
+ runbook-anchored plus the `DEV_ENV_BOOTSTRAP_*` reason-code family (5
1845
+ codes: `DEV_ENV_BOOTSTRAP_COPIED`, `DEV_ENV_BOOTSTRAP_SKIPPED_EXISTS`,
1846
+ `DEV_ENV_BOOTSTRAP_PATH_INVALID`, `DEV_ENV_BOOTSTRAP_SOURCE_MISSING`) and
1847
+ the `DEV_ENV_PROFILE_MISSING` remediation code (if bootstrap skipped or
1848
+ profile deleted — re-run install/upgrade or
1849
+ `python scripts/dev_environment_lib.py --bootstrap --target <repo>` then
1850
+ customize). The 5 reason codes are surfaced as reason-code-only entries in
1851
+ the `### Delivery & lifecycle keys` sub-block below (mirrors `US-0114`'s
1852
+ `INSTALL_MANIFEST_ERROR` and `US-0115`'s `SCRATCHPAD_HEADER_DRIFT` /
1853
+ `BACKLOG_STATUS_DRIFT` reason-code-only pattern). No "enable to turn on"
1854
+ wording applies: the bootstrap fires automatically at install/upgrade
1855
+ time; outside that lifecycle event it adds zero runtime cost. Compose-with
1856
+ `US-0098`: the bootstrap seeds the profile baseline; `US-0098` layers the
1857
+ execute-phase runtime gate on top.
1858
+
1859
+ Runbook cross-links: `docs/engineering/runbook.md` § Dev environment
1860
+ auto-launch (US-0098 / DEC-0084) (L244 — parent h2) with the install-time
1861
+ bootstrap paragraph at L250 + the normative contract anchor at L301
1862
+ (`# US-0098` / `# US-0099` bootstrap posture).
1863
+
1864
+ ### Phase & role governance (US-0069 / US-0070 / US-0071 / US-0072 / US-0075 / US-0076 / US-0077 / US-0078 / US-0079 / US-0080 / US-0081 / US-0082 / US-0083 / US-0085 / US-0087 / US-0088 / US-0089 / US-0090) umbrella section
1865
+
1866
+ The phase & role governance family closes the operator-documentation gap for
1867
+ the largest family in the 5-story drain: the phase→role matrix and phase
1868
+ selection policy (`US-0069` / `US-0070`), context governance validators and
1869
+ concepts (`US-0071` metadata sanitization, `US-0072` context slimming,
1870
+ `US-0075` scratchpad example-first refresh, `US-0076` codebase map freshness
1871
+ gate, `US-0077` delegation policy, `US-0078` env file bootstrap, `US-0085`
1872
+ fresh-context markers), bug queue and quiet-mode operators (`US-0079`,
1873
+ `US-0080`), caveman voice + codebase map bootstrap + delivery keys
1874
+ (`US-0081`, `US-0082`, `US-0083`), and the automation-modes cluster
1875
+ (`US-0087` full-autonomy mode, `US-0088` automation modes, `US-0089` auto
1876
+ orchestration, `US-0090` caveman input compression). The "phase governance
1877
+ integration" concept lives at this umbrella level — it is the introductory
1878
+ framing that ties the 18 features into a single governance surface, not a
1879
+ separate feature subsection. The family splits into three postures:
1880
+ **always-on validators** that are static gates with zero runtime cost
1881
+ (`US-0071` metadata sanitization, `US-0077` delegation policy, `US-0085`
1882
+ fresh-context markers), **install-time bootstraps** that run only on
1883
+ `missing` / `upgrade` / npm `postinstall` and add zero runtime cost outside
1884
+ that lifecycle event (`US-0075` scratchpad example-first refresh, `US-0078`
1885
+ env file bootstrap), and **optional runtime features** that are default-off
1886
+ and impose zero overhead when disabled (`US-0087` via `AUTO_FLOW_MODE`,
1887
+ `US-0088` via `AUTO_BACKLOG_DRAIN` / `AUTO_EXECUTE_BULK`, `US-0081` via
1888
+ `CAVEMAN_MODE`, `US-0090` via `CAVEMAN_COMPRESS_INPUT`).
1889
+
1890
+ **Recommended enable order** (each step composes with the previous; phase
1891
+ governance + selection first → sanitization + slimming + example-first +
1892
+ codebase map + delegation + env file + bug queue + quiet mode + caveman
1893
+ voice + codebase map bootstrap + delivery keys + fresh-context markers +
1894
+ full-autonomy + automation modes + auto orchestration + caveman input
1895
+ compression last):
1896
+
1897
+ 1. `AUTO_ROLE_RESEARCH` / `AUTO_ROLE_PLAN_VERIFY` / `AUTO_ROLE_REFRESH_CONTEXT`
1898
+ (`US-0069`) — pin a role per canonical `/auto` phase; empty defaults let
1899
+ the orchestrator pick the role catalog default per `US-0102`.
1900
+ 2. `AUTO_PHASE_PLAN` + `AUTO_PHASE_INCLUDE` / `AUTO_PHASE_EXCLUDE` +
1901
+ `AUTO_PHASE_PROFILE` (`US-0070`) — override the resolved phase plan per
1902
+ story; empty defaults keep the ultra_lean / standard / minimal macro
1903
+ schedule.
1904
+ 3. `US-0071` metadata sanitization — always-on validator gate (no scratchpad
1905
+ key; runs in `/acceptance` + intake evidence validation).
1906
+ 4. `US-0072` context slimming — concept only; runtime toggle is `TOKEN_PROFILE`
1907
+ (owned by `US-0080` step 10 + main reference list); `LEAN_MEMORY_*` family
1908
+ mechanics owned by `US-0115` (cross-link only).
1909
+ 5. `US-0075` scratchpad example-first refresh — install-time bootstrap (runs
1910
+ on `missing` / `upgrade` / npm `postinstall`; no scratchpad key).
1911
+ 6. `US-0076` codebase map freshness gate — always-on validator gate (no
1912
+ scratchpad key; toggle `CODEBASE_MAP_REFRESH_ON_ROLLOVER` owned by
1913
+ `US-0082` step 12).
1914
+ 7. `US-0077` delegation policy — always-on validator gate (no scratchpad key;
1915
+ runs in intake evidence validation).
1916
+ 8. `US-0078` env file bootstrap — install-time bootstrap (runs on `missing` /
1917
+ `upgrade` / npm `postinstall`; no scratchpad key).
1918
+ 9. `AUTO_BUG_QUEUE=1` + `AUTO_BUG_TARGET=<bug-id>` + `AUTO_BUG_MAX_ITEMS=N` +
1919
+ `AUTO_BUG_ON_BLOCK=skip|drain` (`US-0079`) — bug queue routing; default
1920
+ `AUTO_BUG_QUEUE=0` is byte-identical to the pre-`US-0079` baseline.
1921
+ 10. `AUTO_QUIET=0|1` + `TOKEN_PROFILE=lean|full|cheap` (`US-0080`) — auto
1922
+ quiet mode + token-cost profile (DEC-0035); `AUTO_QUIET` default `0` and
1923
+ `TOKEN_PROFILE` default per main reference list.
1924
+ 11. `CAVEMAN_MODE=1` + `CAVEMAN_LEVEL=terse|full|off` (`US-0081`) — caveman
1925
+ voice mode; default `CAVEMAN_MODE=0` is byte-identical to the
1926
+ pre-`US-0081` baseline.
1927
+ 12. `CODEBASE_MAP_REFRESH_ON_ROLLOVER=1` (`US-0082`) — codebase map bootstrap
1928
+ mechanism (rolls the map on `/refresh-context`); default `0` is
1929
+ byte-identical to the pre-`US-0082` baseline.
1930
+ 13. `AUTO_DELIVERY_ROUTING=scratchpad_only|backlog_then_scratchpad`
1931
+ (`US-0083`) — scratchpad delivery keys extension; default
1932
+ `scratchpad_only` preserves the pre-`US-0083` delivery posture.
1933
+ `DELIVERY_MODE` is owned by `US-0114` (cross-link only).
1934
+ 14. `US-0085` fresh-context markers — always-on validator gate (no scratchpad
1935
+ key; enforced in every phase checkpoint per `US-0048` / `DEC-0029`).
1936
+ 15. `AUTO_FLOW_MODE=full_autonomy` + `AUTO_IMPLEMENTATION_LOOP=1` +
1937
+ `AUTO_LOOP_MAX_CYCLES=N` + `AUTO_BLOCK_RETRY_MAX=N` + sovereign-memory +
1938
+ cross-model critic + goal-mode family (`US-0087`) — full-autonomy mode
1939
+ cluster; default `AUTO_FLOW_MODE=manual` is byte-identical to the
1940
+ pre-`US-0087` baseline.
1941
+ 16. `AUTO_BACKLOG_DRAIN=1` + `AUTO_BACKLOG_MAX_STORIES=N` +
1942
+ `AUTO_BACKLOG_ON_BLOCK=skip|drain` + `AUTO_STORY_SELECTION=<policy>` +
1943
+ `AUTO_EXECUTE_BULK=0|1` + `AUTO_EXECUTE_MAX_ITEMS=N` +
1944
+ `AUTO_EXECUTE_ON_BLOCK=skip|drain` + `AUTO_EXECUTE_SELECTION=<policy>` +
1945
+ `AUTO_TEAM_SCOPE_ENFORCE=1` (`US-0088`) — automation modes (backlog drain
1946
+ + bulk execute); all default-off, byte-identical to the pre-`US-0088`
1947
+ baseline when disabled.
1948
+ 17. `AUTO_PAUSE_REQUEST=0|1` + `AUTO_REMOTE_AUTOMATION_PROFILE=off|<profile>`
1949
+ (`US-0089`) — auto orchestration (pause/resume + remote automation
1950
+ profile); defaults `0` and `off` are byte-identical to the pre-`US-0089`
1951
+ baseline.
1952
+ 18. `CAVEMAN_COMPRESS_INPUT=0|1` + `CAVEMAN_FILE_SCOPE=<glob>` (`US-0090`) —
1953
+ caveman input compression; default `CAVEMAN_COMPRESS_INPUT=0` is
1954
+ byte-identical to the pre-`US-0090` baseline.
1955
+
1956
+ **Runbook pointer:** See the per-feature runbook sections (cross-linked in
1957
+ each subsection below) for reason-code inventories, troubleshooting recipes,
1958
+ and compose-guard matrices. Parent runbook anchors: `## Strict /auto
1959
+ phase→role enforcement (US-0069 / DEC-0051)` (L1711), `## Configurable
1960
+ /auto phase plan (US-0070 / DEC-0052)` (L1753), `## User-visible internal
1961
+ metadata guard (US-0071 / DEC-0053)` (L303), `## Context compaction and
1962
+ token profile mode (US-0053 / DEC-0035)` (L550), `### Scratchpad example
1963
+ parity` (L1949) + `## Scratchpad example upgrade contract (US-0057 /
1964
+ DEC-0039 / DEC-0057)` (L2535), `## Codebase map bootstrap (US-0082 /
1965
+ DEC-0065)` (L63), `## Documentation profile validation (US-0077 /
1966
+ DEC-0059)` (L98), `## Interactive intake evidence validation (US-0078 /
1967
+ DEC-0060 / US-0083 / DEC-0067)` (L479), `## Bug issues (US-0079 /
1968
+ DEC-0061)` (L512), `### Token-cost evidence + comparability (US-0080 /
1969
+ DEC-0062)` (L570), `### Caveman mode (US-0089)` (L2032 — note: runbook
1970
+ h2 US-id collides with `US-0089` in this 18-feature family; the caveman
1971
+ voice/level narrative is owned by `US-0081` here, and `US-0089` owns auto
1972
+ orchestration — see the per-feature subsections below), `### Caveman input
1973
+ compression (US-0090)` (L2099), `## Per-phase subagent isolation evidence
1974
+ (US-0048 / DEC-0029)` (L1628), `## Targeted bug auto drain (US-0087)`
1975
+ (L1809) + `### Full-autonomy outer driver (US-0092) — fallback` (L1958),
1976
+ `## Continuous /auto + backlog drain (US-0088)` (L1838), `### Manual vs
1977
+ automation routing (US-0086)` (L1398), `### Scratchpad delivery keys`
1978
+ (L591, under `## Interactive intake evidence validation`).
1979
+
1980
+ **Zero-overhead-when-off contract:** When the optional runtime master
1981
+ flags are at their defaults (`AUTO_FLOW_MODE=manual` so `US-0087` is inert,
1982
+ `AUTO_BACKLOG_DRAIN=0` and `AUTO_EXECUTE_BULK=0` so `US-0088` is disabled,
1983
+ `CAVEMAN_MODE=0` so `US-0081` is disabled, `CAVEMAN_COMPRESS_INPUT=0` so
1984
+ `US-0090` is disabled, `AUTO_BUG_QUEUE=0` so `US-0079` is disabled,
1985
+ `AUTO_PAUSE_REQUEST=0` and `AUTO_REMOTE_AUTOMATION_PROFILE=off` so
1986
+ `US-0089` is disabled, `AUTO_DELIVERY_ROUTING=scratchpad_only` so `US-0083`
1987
+ preserves the pre-feature delivery posture), the framework's runtime
1988
+ behavior is byte-identical to the pre-phase-role-governance baseline.
1989
+ Always-on validators (`US-0071`, `US-0077`, `US-0085`, `US-0076` freshness
1990
+ gate) are static gates with zero runtime cost. Install-time bootstraps
1991
+ (`US-0075`, `US-0078`) run only at `missing` / `upgrade` / npm `postinstall`
1992
+ and add zero runtime cost outside that lifecycle event. Zero overhead, no
1993
+ schema changes, no extra spawns, no extra file writes when optional features
1994
+ are off.
1995
+
1996
+ #### US-0069 — Phase→role matrix
1997
+
1998
+ `US-0069` pins a producing role to each canonical `/auto` phase so the
1999
+ orchestrator spawns the right subagent fresh per phase (BUG-0006 / US-0048
2000
+ isolation). The three scratchpad keys — `AUTO_ROLE_RESEARCH`,
2001
+ `AUTO_ROLE_PLAN_VERIFY`, `AUTO_ROLE_REFRESH_CONTEXT` — override the role
2002
+ catalog default (`US-0102`) for the research, plan-verify, and
2003
+ refresh-context phases respectively; empty values (the default) keep the
2004
+ catalog default. The matrix is consultative: setting a key never spawns a
2005
+ phase that the resolved phase plan excludes.
2006
+
2007
+ Default-off posture does not apply here — the matrix is always consulted
2008
+ during `/auto`, but empty defaults mean zero behavior change relative to the
2009
+ pre-`US-0069` baseline (the catalog default wins). There is no runtime cost
2010
+ when the keys are empty; the matrix is a static lookup, not a runtime gate.
2011
+
2012
+ Runbook: § `## Strict /auto phase→role enforcement (US-0069 / DEC-0051)`
2013
+ (`docs/engineering/runbook.md` L1711 h2).
2014
+
2015
+ #### US-0070 — Phase selection policy
2016
+
2017
+ `US-0070` lets the operator override the resolved phase plan per story via
2018
+ four scratchpad keys: `AUTO_PHASE_PLAN` (custom macro schedule),
2019
+ `AUTO_PHASE_INCLUDE` (force-include phases), `AUTO_PHASE_EXCLUDE`
2020
+ (force-exclude phases), and `AUTO_PHASE_PROFILE` (named profile such as
2021
+ `ultra_lean` / `standard` / `minimal`). Empty defaults keep the
2022
+ story-boundary macro recomputed per `US-0044` / `DEC-0022`. Exactly one
2023
+ active mode after merge; a conflict emits `PHASE_POLICY_CONFLICT` (no plan)
2024
+ and an unknown phase name emits `PHASE_PLAN_UNKNOWN_PHASE`.
2025
+
2026
+ Default-off posture: empty values (the default) keep the catalog-computed
2027
+ macro, so the framework's runtime behavior is byte-identical to the
2028
+ pre-`US-0070` baseline. There is no runtime cost when the keys are empty;
2029
+ the policy is resolved at sprint-plan time, not at every phase spawn.
2030
+
2031
+ Runbook: § `## Configurable /auto phase plan (US-0070 / DEC-0052)`
2032
+ (`docs/engineering/runbook.md` L1753 h2).
2033
+
2034
+ #### US-0071 — Metadata sanitization
2035
+
2036
+ `US-0071` is an always-on validator gate that strips internal IDs
2037
+ (`DEC-xxxx`, `R-xxxx`, reason codes, internal breadcrumbs) from
2038
+ user-visible narrative before publishing framework surfaces. It has no
2039
+ scratchpad key block — it is a static validator (`scripts/check-user-visible-metadata.py`
2040
+ + `scripts/validate_doc_profile.py`) that runs in `/acceptance` and intake
2041
+ evidence validation. Always-on framing: zero runtime cost because it is a
2042
+ static check; the gate fires on the documentation surface, not on the
2043
+ runtime workflow.
2044
+
2045
+ The gate is non-bypassable in CI (per `US-0091` coverage gate +
2046
+ `US-0097` project README parity guard); a leak fails the validator and
2047
+ blocks release. Operators never toggle it — it is part of the framework's
2048
+ permanent hygiene contract.
2049
+
2050
+ Runbook: § `## User-visible internal metadata guard (US-0071 / DEC-0053)`
2051
+ (`docs/engineering/runbook.md` L303 h2).
2052
+
2053
+ #### US-0072 — Context slimming
2054
+
2055
+ `US-0072` is the context-slimming concept: the framework can pack a
2056
+ narrower context per phase to reduce token cost without changing workflow
2057
+ semantics. The runtime toggle is `TOKEN_PROFILE` (owned by `US-0080`
2058
+ below + the main reference list — grouped cross-link, not re-documented
2059
+ here). The `LEAN_MEMORY_*` family mechanics (read/write gating, cold-read
2060
+ max sections, state-index rows) are owned by `US-0115`'s integration &
2061
+ observability keys block (L2077 in this README) — `US-0072` adds the
2062
+ cross-link pointer only, default omit per R-0105 (angle-distinct: `US-0072`
2063
+ owns the concept, `US-0080` owns the `TOKEN_PROFILE` runtime toggle,
2064
+ `US-0115` owns the memory-layer mechanics).
2065
+
2066
+ No scratchpad key block for `US-0072` — it is a prose-only / concept
2067
+ subsection. The default `TOKEN_PROFILE` (per main reference list) preserves
2068
+ the pre-`US-0072` baseline; flipping to `lean` slims context packs but
2069
+ does not change the workflow phases or role assignments.
2070
+
2071
+ Runbook: § `## Context compaction and token profile mode (US-0053 /
2072
+ DEC-0035)` (`docs/engineering/runbook.md` L550 h2 — shared with `US-0080`).
2073
+
2074
+ #### US-0075 — Scratchpad example-first refresh
2075
+
2076
+ `US-0075` is an install-time bootstrap: on `missing` / `upgrade` / npm
2077
+ `postinstall`, the installer refreshes the shipped
2078
+ `template/.cursor/scratchpad.local.example.md` to match the canonical
2079
+ `.cursor/scratchpad.md` shape, applying the example-first parity contract
2080
+ (BUG-0013 ownership). It has no scratchpad key block — it is runbook-anchored
2081
+ and fires only at install/upgrade time, so it adds zero runtime cost
2082
+ outside that lifecycle event. The bootstrap is framed as "automatic at
2083
+ install time" rather than "enable to turn on"; operators never toggle a
2084
+ flag to invoke it.
2085
+
2086
+ The parity contract is enforced by `tests/scratchpad_example_parity_test.py`
2087
+ (4 tests) in CI; a drift fails the test and blocks release. `US-0075`
2088
+ governs the install-time refresh surface; `US-0057` (BUG-0013) owns the
2089
+ example upgrade contract.
2090
+
2091
+ Runbook: § `### Scratchpad example parity` (`docs/engineering/runbook.md`
2092
+ L1949 h3) + `## Scratchpad example upgrade contract (US-0057 / DEC-0039 /
2093
+ DEC-0057)` (L2535 h2).
2094
+
2095
+ #### US-0076 — Codebase map freshness gate
2096
+
2097
+ `US-0076` is an always-on validator gate that checks the codebase map
2098
+ (`docs/engineering/codebase-map.md` + `dependencies.json`) is fresh before
2099
+ sprint-plan and architecture phases. It has no scratchpad key block — the
2100
+ freshness gate is a static check (`scripts/materialize_codebase_map.py
2101
+ --check`). The toggle `CODEBASE_MAP_REFRESH_ON_ROLLOVER` (owned by `US-0082`
2102
+ below — grouped cross-link, not re-documented here) controls whether the
2103
+ map is rolled on `/refresh-context`; default `0` keeps the gate
2104
+ non-refreshing and byte-identical to the pre-`US-0076` baseline.
2105
+
2106
+ Always-on framing: zero runtime cost because the gate is a static check; a
2107
+ stale map emits `CODEBASE_MAP_STALE` and blocks the phase. Operators never
2108
+ toggle the gate itself — only the refresh-on-rollover behavior (via
2109
+ `US-0082`'s key).
2110
+
2111
+ Runbook: § `## Codebase map bootstrap (US-0082 / DEC-0065)`
2112
+ (`docs/engineering/runbook.md` L63 h2 — shared with `US-0082`).
2113
+
2114
+ #### US-0077 — Delegation policy
2115
+
2116
+ `US-0077` is an always-on validator gate that enforces the intake evidence
2117
+ delegation policy: when an operator delegates a story to a subagent, the
2118
+ delegated required-topic path must produce intake evidence
2119
+ (`handoffs/intake_evidence/US-xxxx-intake.json`). It has no scratchpad key
2120
+ block — it is a static validator that runs in intake evidence validation
2121
+ (per `US-0078` / `DEC-0060`). The gate emits
2122
+ `INTAKE_DELEGATION_EVIDENCE_MISSING` when delegation evidence is absent.
2123
+
2124
+ Always-on framing: zero runtime cost because the gate is a static check;
2125
+ the validator fires on the intake artifact surface, not on the runtime
2126
+ workflow. The gate is non-bypassable in intake evidence validation.
2127
+
2128
+ Runbook: § `## Documentation profile validation (US-0077 / DEC-0059)`
2129
+ (`docs/engineering/runbook.md` L98 h2).
2130
+
2131
+ #### US-0078 — Env file bootstrap
2132
+
2133
+ `US-0078` is an install-time bootstrap: on `missing` / `upgrade` / npm
2134
+ `postinstall`, the installer copies the shipped
2135
+ `template/.cursor/.env.example` (if present) to `.cursor/.env` only when the
2136
+ target is absent (copy-when-missing, mirroring `US-0099`). It has no
2137
+ scratchpad key block — the bootstrap is runbook-anchored and fires only at
2138
+ install/upgrade time, so it adds zero runtime cost outside that lifecycle
2139
+ event. The bootstrap is framed as "automatic at install time" rather than
2140
+ "enable to turn on"; operators never toggle a flag to invoke it.
2141
+
2142
+ No `.env` reads happen at runtime unless `US-0085` operator `.env` setup is
2143
+ explicitly enabled (`DEC-0071`); `US-0078` only seeds the file at install
2144
+ time. Compose-with `US-0083`: the bootstrap seeds the env baseline; `US-0083`
2145
+ layers the delivery-routing keys on top.
2146
+
2147
+ Runbook: § `## Interactive intake evidence validation (US-0078 / DEC-0060 /
2148
+ US-0083 / DEC-0067)` (`docs/engineering/runbook.md` L479 h2 — shared with
2149
+ `US-0083`).
2150
+
2151
+ #### US-0079 — Bug queue routing
2152
+
2153
+ `US-0079` routes the orchestrator to drain bug issues alongside stories
2154
+ when the backlog is empty. Four scratchpad keys: `AUTO_BUG_QUEUE`
2155
+ (default `0` — opt-in master enable), `AUTO_BUG_TARGET` (default empty —
2156
+ optional bug-id pin), `AUTO_BUG_MAX_ITEMS` (default `0` — unlimited when
2157
+ enabled), `AUTO_BUG_ON_BLOCK` (default `skip` — also `drain` to continue
2158
+ draining after a bug block). Default `AUTO_BUG_QUEUE=0` is byte-identical
2159
+ to the pre-`US-0079` baseline (no bug queue drain).
2160
+
2161
+ Default-off / zero-overhead-when-off: when `AUTO_BUG_QUEUE=0` (default),
2162
+ the workflow adds zero runtime overhead — no bug scan, no bug routing, no
2163
+ bug drain. Flip `0`→`1` to activate the bug queue drain; the orchestrator
2164
+ then drains OPEN bugs in priority order interleaved with stories.
2165
+
2166
+ Runbook: § `## Bug issues (US-0079 / DEC-0061)`
2167
+ (`docs/engineering/runbook.md` L512 h2).
2168
+
2169
+ #### US-0080 — Auto quiet mode
2170
+
2171
+ `US-0080` is the auto quiet mode + token-cost profile runtime toggle. One
2172
+ scratchpad key: `AUTO_QUIET` (default `0` — verbose; `1` suppresses
2173
+ non-essential narrator prose). The `TOKEN_PROFILE` runtime toggle (per
2174
+ `DEC-0035` / `US-0053`) is grouped here: `lean` (default per main reference
2175
+ list) packs a narrower context, `full` preserves the full context, `cheap`
2176
+ selects the cheapest model tier. `AUTO_QUIET` is orthogonal to
2177
+ `TOKEN_PROFILE` — quiet mode controls narrator prose, not context breadth.
2178
+
2179
+ Default-off / zero-overhead-when-off: when `AUTO_QUIET=0` (default), the
2180
+ narrator prose is unchanged; when `TOKEN_PROFILE` is at its default (per
2181
+ main reference list), the context breadth is unchanged. Both keys compose
2182
+ without interference; flipping either to a non-default value activates the
2183
+ respective behavior.
2184
+
2185
+ Runbook: § `## Context compaction and token profile mode (US-0053 /
2186
+ DEC-0035)` (`docs/engineering/runbook.md` L550 h2 — shared with `US-0072`)
2187
+ + `### Token-cost evidence + comparability (US-0080 / DEC-0062)` (L570 h3).
2188
+
2189
+ #### US-0081 — Caveman mode
2190
+
2191
+ `US-0081` is the caveman voice mode — terse operator UX. Two scratchpad
2192
+ keys: `CAVEMAN_MODE` (default `0` — off; `1` enables caveman voice) and
2193
+ `CAVEMAN_LEVEL` (default `full`; also `terse` / `off`). An unknown
2194
+ `CAVEMAN_LEVEL` value emits `CAVEMAN_LEVEL_UNKNOWN` and falls back to the
2195
+ pre-`US-0089` voice. `US-0081` owns the caveman voice/level narrative; the
2196
+ runbook h2 `## Caveman mode (US-0089)` (L2032) collides with `US-0089` in
2197
+ this 18-feature family — the caveman-mode runbook section is the
2198
+ `US-0081` cross-link target here, and `US-0089` owns auto orchestration
2199
+ (see below). This is the locked US-id collision resolution per
2200
+ `/architecture`.
2201
+
2202
+ Default-off / zero-overhead-when-off: when `CAVEMAN_MODE=0` (default), the
2203
+ operator UX is byte-identical to the pre-`US-0081` baseline. Flip `0`→`1`
2204
+ to activate caveman voice; `CAVEMAN_LEVEL` tunes the terseness. The voice
2205
+ mode is purely a narrator-prose toggle; it does not change workflow phases
2206
+ or role assignments.
2207
+
2208
+ Runbook: § `### Caveman mode (US-0089)`
2209
+ (`docs/engineering/runbook.md` L2032 h3 — runbook US-id collides with
2210
+ `US-0089`; `US-0081` owns the caveman voice/level narrative, `US-0089`
2211
+ owns auto orchestration).
2212
+
2213
+ #### US-0082 — Codebase map
2214
+
2215
+ `US-0082` is the codebase map bootstrap mechanism — the install-time +
2216
+ rollover surface that materializes `docs/engineering/codebase-map.md` and
2217
+ `dependencies.json`. One scratchpad key:
2218
+ `CODEBASE_MAP_REFRESH_ON_ROLLOVER` (default `0` — no rollover; `1` rolls
2219
+ the map on `/refresh-context`). The bootstrap runs on `missing` / `upgrade`
2220
+ / npm `postinstall` regardless of this toggle; the toggle only controls
2221
+ whether `/refresh-context` performs a rollover refresh. Default `0` is
2222
+ byte-identical to the pre-`US-0082` baseline.
2223
+
2224
+ `US-0082` owns the bootstrap-mechanism narrative; `US-0076` (same
2225
+ umbrella, above) owns the freshness-gate narrative — the two are
2226
+ angle-distinct (bootstrap mechanism vs freshness gate). The
2227
+ `CODEBASE_MAP_REFRESH_ON_ROLLOVER` toggle is documented here, not in
2228
+ `US-0076` (grouped cross-link from `US-0076` to here). Labeling
2229
+ correction: `US-0082` = "Codebase map" per runbook L63 + DEC-0065 +
2230
+ architecture `## US-0082 — Codebase map (bootstrap mechanism)` L1612; the
2231
+ spec handoff's "Input compression" is a mislabel — the input-compression
2232
+ surface is owned by `US-0090`.
2233
+
2234
+ Runbook: § `## Codebase map bootstrap (US-0082 / DEC-0065)`
2235
+ (`docs/engineering/runbook.md` L63 h2 — shared with `US-0076`).
2236
+
2237
+ #### US-0083 — Scratchpad delivery keys
2238
+
2239
+ `US-0083` extends the scratchpad delivery keys with one net-new key:
2240
+ `AUTO_DELIVERY_ROUTING` (default `scratchpad_only` — delivery hints written
2241
+ to the scratchpad only; also `backlog_then_scratchpad` to mirror delivery
2242
+ hints to the backlog). The `DELIVERY_MODE` key is owned by `US-0114`'s
2243
+ release & distribution keys block (L2005 in this README) — grouped
2244
+ cross-link, not re-documented here. The reason code
2245
+ `DELIVERY_MODE_SWITCH_MID_STORY` is emitted when the operator switches
2246
+ `DELIVERY_MODE` mid-story (per `DEC-0067`).
2247
+
2248
+ Default-off posture does not apply — `AUTO_DELIVERY_ROUTING` always has a
2249
+ value; the default `scratchpad_only` preserves the pre-`US-0083` delivery
2250
+ posture (delivery hints in the scratchpad only, no backlog mirroring).
2251
+ Flip `scratchpad_only`→`backlog_then_scratchpad` to mirror delivery hints
2252
+ to the backlog; the framework's runtime behavior changes only in where the
2253
+ hints are written, not in workflow phases.
2254
+
2255
+ Runbook: § `## Interactive intake evidence validation (US-0078 / DEC-0060 /
2256
+ US-0083 / DEC-0067)` (`docs/engineering/runbook.md` L479 h2 — shared with
2257
+ `US-0078`) + `### Scratchpad delivery keys` (L591 h3, under the same parent
2258
+ h2).
2259
+
2260
+ #### US-0085 — Context fresh-context markers
2261
+
2262
+ `US-0085` is an always-on validator gate that enforces the per-phase
2263
+ fresh-context isolation contract per `US-0048` / `DEC-0029`: every phase
2264
+ checkpoint must record a `fresh_context_marker`,
2265
+ `phase_id`, `role`, `timestamp`, and `evidence_ref` in
2266
+ `docs/engineering/state.md`. It has no scratchpad key block — it is a
2267
+ static validator that runs in every phase checkpoint. The gate emits
2268
+ `PHASE_CONTEXT_ISOLATION_MISSING` when a phase checkpoint omits the
2269
+ isolation evidence tuple.
2270
+
2271
+ Always-on framing: zero runtime cost because the gate is a static check;
2272
+ the validator fires on the state.md checkpoint surface, not on the runtime
2273
+ workflow. The gate is non-bypassable in CI; a missing isolation evidence
2274
+ tuple fails the validator and blocks phase progression. Operators never
2275
+ toggle it — it is part of the framework's permanent isolation contract.
2276
+
2277
+ Runbook: § `## Per-phase subagent isolation evidence (US-0048 / DEC-0029)`
2278
+ (`docs/engineering/runbook.md` L1628 h2) + `## Operator .env setup
2279
+ (US-0085 / DEC-0071)` (L2643 h2).
2280
+
2281
+ #### US-0087 — Full-autonomy mode
2282
+
2283
+ `US-0087` is the full-autonomy mode cluster — the largest key surface in
2284
+ the family (18 net-new key rows). The master enable is `AUTO_FLOW_MODE`
2285
+ (default `manual` — also `full_autonomy` to enable hands-off drain). When
2286
+ `AUTO_FLOW_MODE=manual` (default), the framework's runtime behavior is
2287
+ byte-identical to the pre-`US-0087` baseline: no implementation loop, no
2288
+ block retry cap, no cross-model critic, no sovereign-memory auto-advance,
2289
+ no goal-mode convergence. The 18 keys span the implementation loop
2290
+ (`AUTO_IMPLEMENTATION_LOOP`, `AUTO_LOOP_MAX_CYCLES`, `AUTO_BLOCK_RETRY_MAX`),
2291
+ release publish (`RELEASE_PUBLISH_MODE`), cross-model critic
2292
+ (`CROSS_MODEL_REVIEW`, `CROSS_MODEL_ANTISLOP_THRESHOLD`,
2293
+ `CROSS_MODEL_REWORK_MAX`), sovereign memory (`SOVEREIGN_MEMORY`,
2294
+ `SOVEREIGN_MEMORY_TOP_N`, `SOVEREIGN_MEMORY_TOP_K`,
2295
+ `SOVEREIGN_MEMORY_MAX_CHARS`, `SOVEREIGN_MEMORY_JSONL_MAX_LINES`), and the
2296
+ auto-sovereign + goal-mode family (`AUTO_SOVEREIGN`,
2297
+ `AUTO_SOVEREIGN_DEFERRAL_MAX`, `AUTO_SOVEREIGN_DRAIN_GENERATE_MAX`,
2298
+ `AUTO_SOVEREIGN_DEFERRAL_POLICY`, `SOVEREIGN_GOAL_MODE`). The reason codes
2299
+ `BLOCK_RETRY_CAP_EXHAUSTED` and `NATIVE_CHAIN_UNAVAILABLE` are emitted by
2300
+ this cluster.
2301
+
2302
+ Default-off / zero-overhead-when-off: when `AUTO_FLOW_MODE=manual` (default),
2303
+ all 18 keys are inert; the workflow adds zero runtime overhead. Flip
2304
+ `manual`→`full_autonomy` to activate the cluster; the orchestrator then
2305
+ runs the implementation loop with bounded retry, cross-model critic, and
2306
+ sovereign-memory auto-advance. The outer driver (`US-0092` in `US-0116`'s
2307
+ family, already released) is the optional fallback for headless/CI or
2308
+ when the native chain is unavailable — cross-link only.
2309
+
2310
+ Runbook: § `## Targeted bug auto drain (US-0087)`
2311
+ (`docs/engineering/runbook.md` L1809 h2) + `### Full-autonomy outer driver
2312
+ (US-0092) — fallback` (L1958 h3 — cross-link to `US-0092` for the
2313
+ outer-driver fallback angle; `US-0087` owns the full-autonomy mode + hard
2314
+ caps, `US-0092` owns the security-posture + outer-driver fallback —
2315
+ `US-0092` in `US-0116`'s family, already released, cross-link only).
2316
+
2317
+ #### US-0088 — Automation modes
2318
+
2319
+ `US-0088` is the automation-modes cluster — backlog drain + bulk execute.
2320
+ Nine scratchpad keys: `AUTO_BACKLOG_DRAIN` (default `0` — opt-in master
2321
+ enable for backlog drain), `AUTO_BACKLOG_MAX_STORIES` (default `10`),
2322
+ `AUTO_BACKLOG_ON_BLOCK` (default `skip` — also `drain`),
2323
+ `AUTO_STORY_SELECTION` (default `priority_then_backlog_order`),
2324
+ `AUTO_EXECUTE_BULK` (default `0` — opt-in master enable for bulk execute),
2325
+ `AUTO_EXECUTE_MAX_ITEMS` (default `1`), `AUTO_EXECUTE_ON_BLOCK` (default
2326
+ `skip`), `AUTO_EXECUTE_SELECTION` (default `planned_then_priority`),
2327
+ `AUTO_TEAM_SCOPE_ENFORCE` (default `1`). When `AUTO_BACKLOG_DRAIN=0` and
2328
+ `AUTO_EXECUTE_BULK=0` (defaults), the framework's runtime behavior is
2329
+ byte-identical to the pre-`US-0088` baseline.
2330
+
2331
+ Default-off / zero-overhead-when-off: when both master enables are `0`
2332
+ (defaults), the workflow adds zero runtime overhead — no backlog scan, no
2333
+ bulk execute, no story selection policy evaluation. Flip
2334
+ `AUTO_BACKLOG_DRAIN` `0`→`1` to activate backlog drain; flip
2335
+ `AUTO_EXECUTE_BULK` `0`→`1` to activate bulk execute. The two clusters
2336
+ compose; the selection policies apply only when the respective master
2337
+ enable is on.
2338
+
2339
+ Runbook: § `## Continuous /auto + backlog drain (US-0088)`
2340
+ (`docs/engineering/runbook.md` L1838 h2).
2341
+
2342
+ #### US-0089 — Auto orchestration
2343
+
2344
+ `US-0089` is the auto-orchestration cluster — pause/resume + remote
2345
+ automation profile. Two scratchpad keys: `AUTO_PAUSE_REQUEST` (default `0`
2346
+ — no pause requested; `1` requests the orchestrator pause after the
2347
+ current phase) and `AUTO_REMOTE_AUTOMATION_PROFILE` (default `off` — no
2348
+ remote profile; a profile name enables remote automation via
2349
+ `/scripts/auto_remote.py --profile <name>`). When both are at defaults
2350
+ (`0` and `off`), the framework's runtime behavior is byte-identical to
2351
+ the pre-`US-0089` baseline. The `AUTO_PAUSE_REQUEST` table is in the
2352
+ runbook at L1873 under `## Continuous /auto + backlog drain (US-0088)`.
2353
+
2354
+ US-id collision resolution (locked in `/architecture`): the runbook h2
2355
+ `## Caveman mode (US-0089)` at L2032 covers caveman voice/level (which is
2356
+ `US-0081` family content, cross-linked above). The 18-feature family
2357
+ `US-0089` = **Auto orchestration** (per scratchpad L21
2358
+ `AUTO_PAUSE_REQUEST` + L135 `AUTO_REMOTE_AUTOMATION_PROFILE` + 18-feature
2359
+ family decomposition in backlog.md US-0117 block). The `#### US-0089`
2360
+ subsection title here is "Auto orchestration" (NOT "Caveman mode"); the
2361
+ caveman-mode narrative is owned by `#### US-0081` above.
2362
+
2363
+ Default-off / zero-overhead-when-off: when `AUTO_PAUSE_REQUEST=0` and
2364
+ `AUTO_REMOTE_AUTOMATION_PROFILE=off` (defaults), the workflow adds zero
2365
+ runtime overhead — no pause check, no remote profile subprocess. Flip
2366
+ either to a non-default value to activate the respective behavior.
2367
+
2368
+ Runbook: § `### Manual vs automation routing (US-0086)`
2369
+ (`docs/engineering/runbook.md` L1398 h3 — parent h2 covering remote
2370
+ execution / automation routing; `US-0089` owns auto-orchestration,
2371
+ `US-0086` owns manual-vs-automation routing — `US-0086` in `US-0115`'s
2372
+ family, already released, cross-link only) + secondary anchor
2373
+ `## Continuous /auto + backlog drain (US-0088)` (L1838 h2 —
2374
+ `AUTO_PAUSE_REQUEST` table at L1873).
2375
+
2376
+ #### US-0090 — Caveman input compression
2377
+
2378
+ `US-0090` is the caveman input compression — optional terse-input UX that
2379
+ compresses operator file scope before the agent reads it. Two scratchpad
2380
+ keys: `CAVEMAN_COMPRESS_INPUT` (default `0` — off; `1` enables input
2381
+ compression) and `CAVEMAN_FILE_SCOPE` (default empty — repo-relative glob
2382
+ or file list to compress; required when `CAVEMAN_COMPRESS_INPUT=1`). An
2383
+ empty `CAVEMAN_FILE_SCOPE` with `CAVEMAN_COMPRESS_INPUT=1` emits
2384
+ `CAVEMAN_COMPRESS_SCOPE_EMPTY` (fail-closed on `--write`). When
2385
+ `CAVEMAN_COMPRESS_INPUT=0` (default), the framework's runtime behavior is
2386
+ byte-identical to the pre-`US-0090` baseline.
2387
+
2388
+ Default-off / zero-overhead-when-off: when `CAVEMAN_COMPRESS_INPUT=0`
2389
+ (default), the workflow adds zero runtime overhead — no input compression,
2390
+ no file-scope scan. Flip `0`→`1` and set `CAVEMAN_FILE_SCOPE` to activate
2391
+ input compression; the agent reads a compressed representation of the
2392
+ scoped files, not the raw files. Labeling correction: `US-0090` = "Caveman
2393
+ input compression" per runbook L2099 + DEC-0073 + architecture `## US-0090
2394
+ — Caveman input compression` L1636; the spec handoff's "Phase governance
2395
+ integration" is a mislabel — "phase governance integration" is the
2396
+ umbrella-level introductory framing (AC-1), not a separate `#### US-0090`
2397
+ subsection.
2398
+
2399
+ Runbook: § `### Caveman input compression (US-0090)`
2400
+ (`docs/engineering/runbook.md` L2099 h3 — parent h2 `## Caveman mode
2401
+ (US-0089)` L2032; `US-0090` owns input compression, `US-0081` owns
2402
+ caveman voice/level).
2403
+
2404
+ ### Work-kind routing (US-0118) umbrella section
2405
+
2406
+ Per-story work-kind classification + tiered delivery routing. The
2407
+ `work_kind` enum `{doc, mini, code}` derives `(delivery_mode,
2408
+ phase_plan)` from the story shape so that small items skip
2409
+ architecture / qa / verify-work overhead. Gated by the default-off
2410
+ `WORK_KIND_ROUTING` scratchpad flag (zero overhead when off —
2411
+ byte-identical to pre-US-0118 baseline; the classifier is not invoked
2412
+ and `/auto` `resolve_delivery_mode` step 0 + `/intake` step 5
2413
+ early-return). When `WORK_KIND_ROUTING=1`, the classifier runs at
2414
+ `/intake` step 5 (after ACs drafted, after US-0051 decomposition
2415
+ evaluator, before persistence) and `/auto` step 0 consumes the
2416
+ recommended delivery mode under the L8 precedence chain.
2417
+
2418
+ | work_kind | recommended_delivery_mode | recommended_phase_plan |
2419
+ |-----------|---------------------------|------------------------|
2420
+ | `doc` | `ultra_lean` | `[intake, execute, release]` |
2421
+ | `mini` | `ultra_lean` or `mega_quick` (US-0096 eligibility) | `[spec, plan, build+verify, ship]` or `[quick]` |
2422
+ | `code` | `standard` | Full canonical lifecycle (DEC-0052 chain) |
2423
+
2424
+ **L8 precedence chain**: `start-from` (always wins) > explicit
2425
+ `DELIVERY_MODE` (US-0114) > explicit `AUTO_PHASE_*` (US-0070) >
2426
+ `WORK_KIND_ROUTING`-derived > current default. Explicit operator flags
2427
+ always win; the classifier fills only the unset case. Conflict (work-kind
2428
+ recommends `X` but explicit `DELIVERY_MODE=Y` set) →
2429
+ `WORK_KIND_DELIVERY_MODE_CONFLICT` (fail-closed; explicit wins).
2430
+
2431
+ **Zero-overhead-when-off contract:** when `WORK_KIND_ROUTING=0` (default),
2432
+ `/auto` `resolve_delivery_mode` step 0 returns the pre-US-0118 result
2433
+ without invoking `classify_work_kind`, and `/intake` step 5 skips the
2434
+ classifier proposal entirely. Existing backlog rows without `work_kind` /
2435
+ `recommended_delivery_mode` route via current `DELIVERY_MODE` /
2436
+ `AUTO_PHASE_*` precedence (no forced reclassification, no schema
2437
+ migration). Mirrors the US-0034 / US-0035 / US-0089 zero-overhead-when-off
2438
+ contract pattern.
2439
+
2440
+ **Runbook pointer:** see `## Work-kind routing (US-0118 / DEC-0118)` in
2441
+ `docs/engineering/runbook.md` for the work-kind enumeration, L8 precedence
2442
+ chain, operator recipe (force full lifecycle on a `doc` story via
2443
+ `DELIVERY_MODE=standard`), `--explain` flag usage, and the four
2444
+ `WORK_KIND_*` reason codes with remediation prose.
2445
+
2446
+ #### US-0118 — Work-kind classification + tiered delivery routing
2447
+
2448
+ Classifier signature (R-0106 Q10 LOCKED):
2449
+ `scripts/work_kind_classify_lib.py:classify_work_kind(story_prose,
2450
+ acceptance_criteria, touched_file_hints, component_scope) ->
2451
+ WorkKindClassification` returning `work_kind ∈ {doc, mini, code}`,
2452
+ `recommended_delivery_mode ∈ {standard, ultra_lean, mega_quick}`,
2453
+ `recommended_phase_plan` (list of canonical phase ids), `rationale`
2454
+ (string), `evidence_refs` (names-only), and optional `rule_trace`
2455
+ (populated by `--explain`). Pure stdlib, no network, no `.env` reads, no
2456
+ LLM calls (Q3 LOCKED). Reuses
2457
+ `scripts/dev_environment_lib.classify_touched_files` (tier A/B/C +
2458
+ `TIER_C_SKIP_PREFIXES`) — import, do not reinvent (Q9 LOCKED).
2459
+
2460
+ | work_kind | recommended_delivery_mode | recommended_phase_plan | Rule |
2461
+ |-----------|---------------------------|------------------------|------|
2462
+ | `doc` | `ultra_lean` | `[intake, execute, release]` | All touched files match `TIER_C_SKIP_PREFIXES` or are `*.md`/`README*` under skip prefixes. |
2463
+ | `mini` | `ultra_lean` or `mega_quick` | `[spec, plan, build+verify, ship]` or `[quick]` | Single component, ACs ≤ 3, no companion DEC required. `mega_quick` only when US-0096 eligibility passes. |
2464
+ | `code` | `standard` | Full canonical lifecycle | Otherwise (tier A or any non-skip-prefix source path). |
2465
+
2466
+ Tie-break (Q1 LOCKED): mixed-tier stories (e.g. both `docs/` and `src/`)
2467
+ resolve by **highest tier wins** (`code` > `mini` > `doc`) per
2468
+ `classify_touched_files` tier_rank A>B>C.
2469
+
2470
+ Precedence chain (L8 LOCKED): `start-from` (always wins) > explicit
2471
+ `DELIVERY_MODE` (US-0114) > explicit `AUTO_PHASE_*` (US-0070) >
2472
+ `WORK_KIND_ROUTING`-derived > current default. Conflict →
2473
+ `WORK_KIND_DELIVERY_MODE_CONFLICT` (fail-closed; explicit wins). Mid-story
2474
+ `DELIVERY_MODE` switch forbidden (`DELIVERY_MODE_SWITCH_MID_STORY`).
2475
+
2476
+ Reason-code family (R-0106 Q2 LOCKED): `WORK_KIND_ROUTING_OFF` (info),
2477
+ `WORK_KIND_DELIVERY_MODE_CONFLICT` (fail-closed),
2478
+ `WORK_KIND_CLASSIFY_FAILED` (fail-closed), `WORK_KIND_UNKNOWN_ROUTE`
2479
+ (fail-closed), `WORK_KIND_PLAN_COVERAGE_MISSING` (fail-closed),
2480
+ `WORK_KIND_TIE_BREAK_APPLIED` (info). Each emits remediation guidance in
2481
+ `sprints/Sxxxx/qa-findings.md` / `release-findings.md`.
2482
+
2483
+ Intake evidence schema extension (AC-9): when `WORK_KIND_ROUTING=1` and
2484
+ the classifier runs at `/intake` step 5, the intake evidence JSON gains
2485
+ three optional fields — `work_kind`, `recommended_delivery_mode`,
2486
+ `work_kind_operator_decision ∈ {accept, override}`. US-0078 evidence gate
2487
+ still runs before any backlog/acceptance write (L10 unchanged).
2488
+
2489
+ Runbook: § `## Work-kind routing (US-0118 / DEC-0118)`
2490
+ (`docs/engineering/runbook.md` h2 — covers `WORK_KIND_ROUTING` flag, L8
2491
+ precedence, operator recipe, `--explain` usage, four reason codes,
2492
+ intake evidence schema extension, compose-do-not-amend verification).
2493
+
2494
+ ### Full scratchpad reference (detailed)
2495
+
2496
+ - `MAGIC_CONTEXT_STRICT=0|1`
2497
+ - `1`: enforces context refresh discipline after code edits.
2498
+ - `DONE=0|1`
2499
+ - `1`: stop hook reminder loops when session is complete.
2500
+ - `MAGIC_BENCH_SESSION=<id>`
2501
+ - enables live benchmark event logging under one session id.
2502
+ - `AUTO_INSTALL_DEPS=0|1`
2503
+ - `1`: agent may install dependencies/runtimes automatically.
2504
+ - `AUTO_RELEASE_NOTES=0|1`
2505
+ - `1`: auto-generate `handoffs/release_notes.md`.
2506
+ - `REMOTE_EXECUTION=0|1`
2507
+ - `1`: allow remote/docker execution if configured.
2508
+ - `REMOTE_CONFIG=.cursor/remote.json`
2509
+ - path to remote execution server config.
2510
+
2511
+ ### Sovereign-loop era keys (US-0103–US-0112)
2512
+
2513
+ The sovereign-loop era keys are default-off: when each master enable flag is
2514
+ `0` (or `phase_driven` for US-0110), the framework is byte-identical to the
2515
+ pre-sovereign-loop baseline. Order mirrors `.cursor/scratchpad.md` sovereign
2516
+ block (US-0103 → US-0110 → US-0104 → US-0105 → US-0107 → US-0108 → US-0109
2517
+ → US-0111 → US-0112).
2518
+
2519
+ #### US-0103 — AI Decision Ledger + Plan Fidelity
2520
+
2521
+ - `AI_DECISION_LEDGER=0|1` (default `0`) — when `0`: no ledger
2522
+ reads/writes/schema checks.
2523
+ - `AUTO_PLAN_FIDELITY=strict|relaxed|extended` (default `strict`) — active
2524
+ only when ledger enabled.
2525
+ - Default-off / zero-overhead-when-off: when `AI_DECISION_LEDGER=0`, no
2526
+ ledger reads/writes/schema checks — zero overhead.
2527
+
2528
+ #### US-0110 — Goal-Based Convergence
2529
+
2530
+ - `SOVEREIGN_GOAL_MODE=phase_driven|goal_convergence` (default
2531
+ `phase_driven`).
2532
+ - `SOVEREIGN_GOAL=explicit goal text` (default empty).
2533
+ - `SOVEREIGN_GOAL_TOP_N=int >=1` (default `3`).
2534
+ - `SOVEREIGN_GOAL_MAX_CHARS=int >=64` (default `512`).
2535
+ - `SOVEREIGN_GOAL_TIMEOUT_MAX=int >=0` (default `0` = disabled).
2536
+ - Default-off / zero-overhead-when-off: when
2537
+ `SOVEREIGN_GOAL_MODE=phase_driven`, zero overhead — no evaluation, no
2538
+ `goal_progress` block, no partial-delivery write.
2539
+
2540
+ #### US-0104 — Cross-Model Adversarial Critic
2541
+
2542
+ - `CROSS_MODEL_REVIEW=0|1` (default `0`).
2543
+ - `CROSS_MODEL_ANTISLOP_THRESHOLD=int 0-10` (default `6`).
2544
+ - `CROSS_MODEL_REWORK_MAX=int >=0` (default `2`).
2545
+ - Default-off / zero-overhead-when-off: when `CROSS_MODEL_REVIEW=0`, zero
2546
+ overhead — no critic spawn, no findings writes, no anti-slop gate.
2547
+
2548
+ #### US-0105 — Sovereign Memory
2549
+
2550
+ - `SOVEREIGN_MEMORY=0|1` (default `0`).
2551
+ - `SOVEREIGN_MEMORY_TOP_N=int >=0` (default `5`).
2552
+ - `SOVEREIGN_MEMORY_TOP_K=int >=0` (default `3`).
2553
+ - `SOVEREIGN_MEMORY_MAX_CHARS=int >=0` (default `2048`).
2554
+ - `SOVEREIGN_MEMORY_JSONL_MAX_LINES=int >=1` (default `500`).
2555
+ - Default-off / zero-overhead-when-off: when `SOVEREIGN_MEMORY=0`, zero
2556
+ overhead — no JSONL writes, no injection reads, no spawn digest assembly.
2557
+
2558
+ #### US-0107 — Sovereign Loop Mode
2559
+
2560
+ - `AUTO_SOVEREIGN=0|1` (default `0`).
2561
+ - `AUTO_SOVEREIGN_DEFERRAL_MAX=int >=1` (default `50`).
2562
+ - `AUTO_SOVEREIGN_DRAIN_GENERATE_MAX=int >=0` (default `3`).
2563
+ - `AUTO_SOVEREIGN_DEFERRAL_POLICY=stop|skip|resolve_first` (default
2564
+ `resolve_first`).
2565
+ - `SOVEREIGN_NOTIFY_TARGET=off|ntfy|email|hook` (default `off`).
2566
+ - `SOVEREIGN_NOTIFY_NTFY_TOPIC`, `SOVEREIGN_NOTIFY_NTFY_BASE`,
2567
+ `SOVEREIGN_NOTIFY_HOOK_URL`, `SOVEREIGN_NOTIFY_EMAIL_TO` (default empty —
2568
+ local-only).
2569
+ - Default-off / zero-overhead-when-off: when `AUTO_SOVEREIGN=0`, zero
2570
+ overhead — no deferral reads/writes, no advance, no notifications.
2571
+
2572
+ #### US-0108 — Parallel Instance Arbitrage
2573
+
2574
+ - `SOVEREIGN_PARALLEL_DEV=0|1` (default `0`).
2575
+ - `AUTO_SOVEREIGN_PARALLEL_N=int >=1` (default `3`).
2576
+ - `AUTO_SOVEREIGN_PARALLEL_MAX_TOTAL=int >=1` (default `6`).
2577
+ - `AUTO_SOVEREIGN_MERGE_RESOLVE=first_pass_wins|last_pass_wins|winner_takes_all|manual`
2578
+ (default `first_pass_wins`).
2579
+ - `AUTO_SOVEREIGN_WORKTREE_KEEP=0|1` (default `0`).
2580
+ - `AUTO_SOVEREIGN_PARALLEL_QA=0|1` (default `0`).
2581
+ - `AUTO_SOVEREIGN_PARALLEL_QA_ARBITER=critic_first_pass|majority_vote`
2582
+ (default `critic_first_pass`).
2583
+ - `AUTO_SOVEREIGN_PARALLEL_ANTI_SLOP_THRESHOLD=int 0-10` (default `6`).
2584
+ - `AUTO_SOVEREIGN_PARALLEL_REWORK_MAX=int >=0` (default `2`).
2585
+ - `AUTO_SOVEREIGN_PARALLEL_MERGE_TIMEOUT_SEC=int >=10` (default `60`).
2586
+ - `AUTO_SOVEREIGN_PARALLEL_MODEL_<idx>`,
2587
+ `AUTO_SOVEREIGN_PARALLEL_LENS_<idx>` (optional, per-instance overrides).
2588
+ - Default-off / zero-overhead-when-off: when `SOVEREIGN_PARALLEL_DEV=0`,
2589
+ zero overhead — no worktrees, no parallel QA, no pick JSON, no resource
2590
+ guard.
2591
+
2592
+ #### US-0109 — Self-Healing Deploy Loop
2593
+
2594
+ - `AUTO_SOVEREIGN_SELF_HEALING_DEPLOY=0|1` (default `0`).
2595
+ - `AUTO_SOVEREIGN_DEPLOY_RETRY_MAX=int >=1` (default `3`).
2596
+ - `AUTO_SOVEREIGN_DEPLOY_SMOKE_TIMEOUT_SEC=int >=1` (default `30`).
2597
+ - `AUTO_SOVEREIGN_DEPLOY_PROBE_KIND=health_endpoint|acceptance_smoke|both`
2598
+ (default `both`).
2599
+ - `SOVEREIGN_DEPLOY_ACCEPTANCE_SMOKE_PATH=repo-relative path` (default
2600
+ `tests/deploy_smoke/`).
2601
+ - `AUTO_SOVEREIGN_DEPLOY_HEALTH_ENDPOINT=names-only env ref` (default empty
2602
+ = unresolvable).
2603
+ - Default-off / zero-overhead-when-off: when
2604
+ `AUTO_SOVEREIGN_SELF_HEALING_DEPLOY=0`, zero overhead, byte-identical
2605
+ publish path — no probe, no retry, no deferral, no execute healing steps.
2606
+
2607
+ #### US-0111 — Release Trigger Adapters
2608
+
2609
+ - `RELEASE_TRIGGER_SOURCE=manual|github|npm|git_tag|auto` (default
2610
+ `manual`).
2611
+ - `RELEASE_TRIGGER_TIMEOUT_SEC=int >=1` (default `10`).
2612
+ - `RELEASE_TRIGGER_FALLBACK_TO_LOCAL=0|1` (default `0`).
2613
+ - Default-off / zero-overhead-when-off: default source is `manual` —
2614
+ byte-identical to pre-US-0111 `/release` path (zero behavior change when
2615
+ not configured).
2616
+
2617
+ #### US-0112 — Model-catalog example presets
2618
+
2619
+ US-0112 has no dedicated sovereign-loop scratchpad block. Operators tune the
2620
+ sovereign loop's behavior via the existing delivery/catalog keys documented in
2621
+ the **Delivery & lifecycle** region of `.cursor/scratchpad.md`:
2622
+
2623
+ - `DELIVERY_MODE=ultra_lean|mega_quick|balanced|highend` (default
2624
+ `balanced`).
2625
+ - `TOKEN_PROFILE=lean|balanced|rich` (default `balanced`).
2626
+ - `ID_NAMESPACE_BOOTSTRAP=0|1` (default `0`).
2627
+ - `MODEL_TIER=...` — per-phase model tier.
2628
+
2629
+ Presets themselves ship as example JSON files under
2630
+ `template/.cursor/model-catalog.local.example.*.json`; opt in by copying an
2631
+ example to `.cursor/model-catalog.local.json`. When no preset is copied to the
2632
+ active catalog path, the sovereign loop reads its existing resolver defaults —
2633
+ zero behavior change.
2634
+
2635
+ ### Release & distribution keys (US-0041 / US-0062 / US-0111 / US-0112)
2636
+
2637
+ The release & distribution keys are default-off or passive: when each master
2638
+ flag is at its default (`RELEASE_TRIGGER_SOURCE=manual`,
2639
+ `RELEASE_PUBLISH_MODE=disabled` for the kit repo / `confirm` for consumer repos,
2640
+ `PROJECT_README_ENFORCE=1` post-bootstrap with `FRAMEWORK_KIT_REPO=0` in
2641
+ consumer repos, and no preset copied to `.cursor/model-catalog.local.json`),
2642
+ the framework's runtime behavior is byte-identical to the pre-release-
2643
+ distribution baseline. Order mirrors `.cursor/scratchpad.md` release &
2644
+ distribution regions (US-0062 → US-0054 publish controls → US-0041/US-0062
2645
+ shared release/install surface → US-0111 → US-0112 cross-link).
2646
+
2647
+ #### US-0062 — Installer-Owned `its_magic/` folder for framework metadata
2648
+
2649
+ - `PROJECT_README_ENFORCE=0|1` (default `1` post-bootstrap) — master enforce
2650
+ flag for `US-0097`'s project-README coverage gate (`/release` step 3g). When
2651
+ `0`: step 3g skips (migration/grandfathering only). When `1`: blocking. Flip
2652
+ `0`→`1` only after `validate_project_readme_coverage.py --report` shows
2653
+ `coverage_missing: []`.
2654
+ - `FRAMEWORK_KIT_REPO=0|1` (default `0`; kit-repo exception) — when `1`
2655
+ (its-magic dev kit repo only): skip execute 23a/23b and the project validator
2656
+ root check. Consumer repos never set `FRAMEWORK_KIT_REPO=1`.
2657
+ - Default-off / zero-overhead-when-off: when `PROJECT_README_ENFORCE=0` and
2658
+ `FRAMEWORK_KIT_REPO=0` (consumer repo defaults), no gate runs at release
2659
+ unless the project README coverage check is invoked. Zero runtime overhead
2660
+ for consumer repos.
2661
+
2662
+ #### US-0111 (release-workflow angle) — Publish controls composition
2663
+
2664
+ `US-0111`'s release-workflow operator surface composes with the existing
2665
+ `US-0054` publish controls. The canonical key rows for
2666
+ `RELEASE_PUBLISH_MODE=disabled|confirm|auto` (default `confirm`; the kit repo
2667
+ runs `disabled`), `RELEASE_TARGETS_FILE=docs/engineering/release-targets.json`,
2668
+ and `RELEASE_TARGETS_DEFAULT=` (comma-separated default target IDs) are
2669
+ documented in `### Configurable multi-target publish + confirmation gate
2670
+ (US-0054)` above. `US-0114` does not duplicate those rows here — see that
2671
+ section for the canonical defaults and flip guidance.
2672
+
2673
+ #### US-0041 / US-0062 — Shared release/install surface
2674
+
2675
+ - `AUTO_INSTALL_DEPS=0|1` (default `1`) — when `0`, the agent will not
2676
+ auto-install dependencies/runtimes. Already documented in the main reference
2677
+ list above; `US-0114` adds the grouped cross-link, no duplicate row.
2678
+ - `AUTO_RELEASE_NOTES=0|1` (default `1`) — when `0`, skip auto-generation of
2679
+ `handoffs/release_notes.md`. Already documented in the main reference list
2680
+ above; `US-0114` adds the grouped cross-link, no duplicate row.
2681
+ - Default-off / zero-overhead-when-off: when both remain at default `1`, the
2682
+ release path runs the standard auto-install + auto-release-notes flow; no
2683
+ extra runtime cost. Flipping either to `0` only suppresses that one
2684
+ automatic step.
2685
+
2686
+ #### US-0041 — Lifecycle QA surface (no dedicated scratchpad block)
2687
+
2688
+ `US-0041` has no dedicated release-distribution scratchpad key block. Its
2689
+ normative surface is the runbook `## Lifecycle QA matrix (US-0041)` anchor +
2690
+ installer completeness reason codes (`INSTALL_COMPLETENESS_FAILED`,
2691
+ `INSTALL_REQUIRED_SCRIPT_MISSING:<path>`, `INSTALL_MANIFEST_ERROR`) + the
2692
+ shared `AUTO_INSTALL_DEPS` / `AUTO_RELEASE_NOTES` keys above. See the runbook
2693
+ anchor and the `US-0041` operator subsection above for the canonical surface;
2694
+ no key rows are added here.
2695
+
2696
+ #### US-0111 / US-0112 — Cross-link to Sovereign-loop era keys
2697
+
2698
+ For `RELEASE_TRIGGER_SOURCE` / `RELEASE_TRIGGER_TIMEOUT_SEC` /
2699
+ `RELEASE_TRIGGER_FALLBACK_TO_LOCAL` (`US-0111`) and `DELIVERY_MODE` /
2700
+ `TOKEN_PROFILE` / `ID_NAMESPACE_BOOTSTRAP` / `MODEL_TIER` (`US-0112`) keys, see
2701
+ `### Sovereign-loop era keys (US-0103–US-0112)` above for the canonical key
2702
+ rows. `US-0114` documents these from the release-workflow operator angle in
2703
+ the narrative subsections above; the canonical key rows remain in the
2704
+ sovereign-loop era block for byte-stability (US-0113 byte-stability preserved;
2705
+ no duplicate key rows).
2706
+
2707
+ ### Integration & observability keys (US-0034 / US-0084 / US-0086 / US-0093 / US-0096 / US-0101 / US-0102)
2708
+
2709
+ The integration & observability keys are default-off for optional features
2710
+ and runbook-anchored for always-on guards. When each optional master flag is
2711
+ at its default (`CROSS_REPO_OBSERVABILITY=0`, `DELIVERY_MODE=standard`,
2712
+ `LEAN_MEMORY_READ=1` / `LEAN_MEMORY_WRITE=1` with no pack/active-context
2713
+ paths present, no `MODEL_TIER_DEFAULT` override, no `MODEL_SLUG_<PHASE_ID>`
2714
+ overrides), the framework's runtime behavior is byte-identical to the
2715
+ pre-integration-observability baseline. Always-on guards (`US-0084` /
2716
+ `US-0086` / `US-0093`) carry no scratchpad key rows — their normative surface
2717
+ is runbook-anchored + reason-coded.
2718
+
2719
+ #### US-0034 — Cross-repo compatibility observability keys
2720
+
2721
+ - `CROSS_REPO_OBSERVABILITY=0|1` (default `0`) — master enable for
2722
+ compatibility visibility. When `0` (default): no source probing, no gate
2723
+ evaluation, no release block. Flip `0`→`1` to activate compatibility
2724
+ signal tracking under `docs/engineering/compatibility-signals.md` and
2725
+ `docs/engineering/compatibility-report.md`.
2726
+ - `COMPATIBILITY_GATE_ON_CRITICAL=0|1` (default `1`) — gate posture when
2727
+ observability is on. When `1` (default): unresolved critical findings
2728
+ trigger a release decision gate (`COMPATIBILITY_CRITICAL_OPEN`). Flip
2729
+ `1`→`0` only for advisory-mode observability without the release block.
2730
+ - `COMPATIBILITY_SOURCES=` (default empty) — semicolon-separated
2731
+ `repo=/module=/contract=/docs=` declarations. Empty default means no
2732
+ sources are probed (effective zero-overhead-when-off even when
2733
+ `CROSS_REPO_OBSERVABILITY=1`).
2734
+ - Default-off / zero-overhead-when-off: when `CROSS_REPO_OBSERVABILITY=0`
2735
+ (default), the workflow adds zero required compatibility overhead — no
2736
+ source probing, no gate evaluation, no release block.
2737
+
2738
+ #### US-0096 — Active context handoff keys
2739
+
2740
+ - `LEAN_MEMORY_READ=0|1` (default `1` when pack/active-context paths exist)
2741
+ — toggle the lean pack / active-context read paths. When `0`: standard
2742
+ cold reads run instead.
2743
+ - `LEAN_MEMORY_WRITE=0|1` (default `1` when pack/active-context paths exist)
2744
+ — toggle the lean pack / active-context write paths. When `0`: standard
2745
+ artifact emission runs instead.
2746
+ - `LEAN_COLD_READ_MAX_SECTIONS` (int `>= 1`; default `4`) — bound cold reads
2747
+ to a section-count cap. Lower values reduce context cost at the risk of
2748
+ missing late sections; raise cautiously.
2749
+ - `LEAN_STATE_INDEX_ROWS` (int `>= 30`; default `80`) — bound the state.md
2750
+ index rows retained on the hot surface. Lower values trigger archival
2751
+ rollover sooner; raise to keep more history hot.
2752
+ - `AUTO_DELIVERY_ROUTING=scratchpad_only|backlog_then_scratchpad` (default
2753
+ `scratchpad_only`) — select scratchpad-only vs
2754
+ backlog-then-scratchpad routing for the active-context handoff.
2755
+ `scratchpad_only` keeps the handoff fully on the scratchpad surface;
2756
+ `backlog_then_scratchpad` routes via the backlog authority first.
2757
+ - Default-off / zero-overhead-when-off: when `LEAN_MEMORY_READ=0` and
2758
+ `LEAN_MEMORY_WRITE=0`, the lean pack / active-context paths are disabled
2759
+ and the workflow falls back to standard cold reads. The canonical
2760
+ `DELIVERY_MODE` row is documented in `### Release & distribution keys
2761
+ (US-0041 / US-0062 / US-0111 / US-0112)` above (owned by `US-0114` per
2762
+ byte-stability); `US-0096` documents the active-context-handoff operator
2763
+ angle in the narrative subsection above, not the release-workflow angle.
2764
+
2765
+ #### US-0101 — Model tier resolution keys
2766
+
2767
+ - `MODEL_TIER_DEFAULT=cheap|balanced|strong` (default `balanced`) — fallback
2768
+ tier when no per-phase override applies. Flip to `cheap` for cost-sensitive
2769
+ runs or `strong` for complex phases.
2770
+ - `MODEL_CATALOG=<path>` (default `.cursor/model-catalog.local.json`) —
2771
+ path to the local slug catalog consulted when `MODEL_RESOLVE` is
2772
+ `local_catalog` or `role_catalog`. Copy one of the shipped
2773
+ `.cursor/model-catalog.local.example*.json` presets to activate.
2774
+ - `MODEL_RESOLVE=alias_only|local_catalog|role_catalog` (default
2775
+ `alias_only`) — resolution strategy. `alias_only` uses Cursor-stable
2776
+ aliases; `local_catalog` looks up vendor slugs from `MODEL_CATALOG`;
2777
+ `role_catalog` opts into the `US-0102` phase→role→catalog lookup.
2778
+ - `MODEL_FALLBACK=<strategy>` (default `inherit`) — fallback when a catalog
2779
+ lookup fails. Common values: `inherit`, `cheap`, `balanced`, `strong`.
2780
+ - `MODEL_PROVIDER_MODE=cursor|api` (default `cursor`) — `cursor` routes
2781
+ subagents through Cursor-managed infrastructure; `api` opts into BYOK via
2782
+ Cursor Settings → Models → API Key (known limitation: subagents do NOT
2783
+ inherit custom API keys / base URLs).
2784
+ - Default-off / zero-overhead-when-off: when no `MODEL_TIER_DEFAULT`
2785
+ override is set and `MODEL_RESOLVE=alias_only` (default), the resolver
2786
+ falls back to the framework default tier with no catalog read. The
2787
+ canonical `MODEL_TIER` row is documented in `### Sovereign-loop era keys
2788
+ (US-0103–US-0112)` above (owned by `US-0113` per byte-stability);
2789
+ `US-0101` documents the resolver-mechanics operator angle in the
2790
+ narrative subsection above, not the sovereign-loop-bootstrap angle.
2791
+
2792
+ #### US-0102 — Role-based model catalog keys
2793
+
2794
+ - `MODEL_SLUG_<PHASE_ID>=<your-vendor-slug>` — direct vendor slug override
2795
+ for a canonical phase id (`ask`, `refresh-context`, `memory-audit`,
2796
+ `status-reconcile`, `pause`, `intake`, `discovery`, `research`, `release`,
2797
+ `plan-verify`, `architecture`, `execute`, `quick`, `qa`, `verify-work`,
2798
+ `security-review`, `auto`). Set in `.cursor/scratchpad.local.md` only —
2799
+ use `<your-vendor-slug>` placeholders in committed files. `MODEL_ASK`
2800
+ participates in step 1 like any other phase (no special-case bypass).
2801
+ - Composition-on-US-0101 note: set `MODEL_CATALOG` (US-0101) first, then
2802
+ layer per-phase slug overrides. Precedence chain (deterministic, per
2803
+ canonical `phase_id`): `MODEL_<PHASE>` (direct slug, highest) →
2804
+ `MODEL_TIER_<PHASE>` (DEC-0086 tier→alias / `local_catalog` chain) →
2805
+ `role_catalog` lookup (only when `MODEL_RESOLVE=role_catalog`; miss falls
2806
+ through) → `MODEL_TIER_DEFAULT` (DEC-0086 tier chain) → Cursor stable
2807
+ alias (DEC-0086 built-in mapping).
2808
+ - Default-off / zero-overhead-when-off: when no `MODEL_SLUG_<PHASE_ID>`
2809
+ overrides are set, the catalog falls back to `MODEL_TIER_DEFAULT`
2810
+ (`US-0101`) with no role-catalog lookup overhead.
2811
+
2812
+ #### US-0086 — Grouped cross-link (REMOTE_EXECUTION family)
2813
+
2814
+ For `REMOTE_EXECUTION` / `REMOTE_CONFIG` / `AUTO_REMOTE_AUTOMATION_PROFILE` /
2815
+ `AUTO_REMOTE_ENVIRONMENT_LABEL`, see the main reference list above
2816
+ (pre-`US-0113` reference surface; mirrors `US-0114`'s
2817
+ `AUTO_INSTALL_DEPS` / `AUTO_RELEASE_NOTES` grouped cross-link pattern).
2818
+ `US-0115` adds the grouped cross-link pointer only — no duplicate key rows
2819
+ (byte-stability preserved).
2820
+
2821
+ #### US-0084 — Reason-code-only entry
2822
+
2823
+ `US-0084` has no dedicated scratchpad key block — its normative surface is
2824
+ runbook-anchored (`### Published npm installer.sh / POSIX dash (US-0084)`
2825
+ L1441 + `### Automated checks (US-0084)` L1459) plus the shared
2826
+ `INSTALL_MANIFEST_ERROR` reason code (also surfaced by `US-0062` / `US-0041`
2827
+ per the release & distribution reference extension). No key rows are added
2828
+ here.
2829
+
2830
+ #### US-0093 — Reason-code-only entry
2831
+
2832
+ `US-0093` has no dedicated scratchpad key block — its normative surface is
2833
+ runbook-anchored (`### Browser UAT self-test (US-0093)` L1999) plus the
2834
+ `SCRATCHPAD_HEADER_DRIFT` and `BACKLOG_STATUS_DRIFT` reason codes. No key
2835
+ rows are added here.
2836
+
2837
+ #### Cross-link to Release & distribution keys (DELIVERY_MODE overlap)
2838
+
2839
+ For the canonical `DELIVERY_MODE` row (US-0096 overlap), see `### Release &
2840
+ distribution keys (US-0041 / US-0062 / US-0111 / US-0112)` above. `US-0096`
2841
+ documents the active-context-handoff operator angle in the narrative
2842
+ subsection above; the canonical key row remains in the release & distribution
2843
+ keys block for byte-stability (US-0114 byte-stability preserved; no
2844
+ duplicate key rows).
2845
+
2846
+ #### Cross-link to Sovereign-loop era keys (MODEL_TIER overlap)
2847
+
2848
+ For the canonical `MODEL_TIER` row (US-0101 / US-0102 overlap), see
2849
+ `### Sovereign-loop era keys (US-0103–US-0112)` above. `US-0101` /
2850
+ `US-0102` document the resolver-mechanics + role-catalog operator angle in
2851
+ the narrative subsections above; the canonical key row remains in the
2852
+ sovereign-loop era keys block for byte-stability (US-0113 byte-stability
2853
+ preserved; no duplicate key rows).
2854
+
2855
+ ### Delivery & lifecycle keys (US-0092 / US-0095 / US-0098 / US-0099)
2856
+
2857
+ The delivery & lifecycle keys are default-off for optional runtime features
2858
+ (`US-0092`, `US-0095`, `US-0098`) and runbook-anchored for the install-time
2859
+ bootstrap (`US-0099`). When each optional master flag is at its default
2860
+ (`AUTO_FLOW_MODE=manual` so `US-0092` / `US-0095` are inert,
2861
+ `DEV_AUTO_LAUNCH_PROFILE=off` so `US-0098` is disabled), the framework's
2862
+ runtime behavior is byte-identical to the pre-delivery-lifecycle baseline.
2863
+ `US-0099` is install-time only and carries no scratchpad key rows — its
2864
+ normative surface is runbook-anchored + reason-coded.
2865
+
2866
+ #### US-0098 — Dev environment auto-launch keys
2867
+
2868
+ - `DEV_AUTO_LAUNCH_PROFILE=off|deterministic_v1` (default `off`) — master
2869
+ enable for execute-phase bounded rebuild/relaunch of dev stacks plus
2870
+ Connect surfacing. When `off` (default): execute step 24 skipped with
2871
+ zero overhead. Flip `off`→`deterministic_v1` to activate the gate; the
2872
+ profile path is selected by `DEV_ENVIRONMENT_CONFIG`.
2873
+ - `DEV_ENVIRONMENT_CONFIG=<repo-relative path>` (default
2874
+ `.cursor/dev-environment.json`) — path to the dev environment profile
2875
+ consulted by the auto-launch gate. Copy the shipped
2876
+ `template/.cursor/dev-environment.json.example` to this path (or rely on
2877
+ the `US-0099` install-time bootstrap below) and customize the compose
2878
+ `service` + `*Env` connect refs.
2879
+ - Default-off / zero-overhead-when-off: when
2880
+ `DEV_AUTO_LAUNCH_PROFILE=off` (default), the workflow adds zero
2881
+ runtime overhead — execute step 24 is skipped, no compose inspection,
2882
+ no relaunch, no Connect surfacing.
2883
+
2884
+ #### US-0099 — Reason-code-only entries
2885
+
2886
+ `US-0099` has no dedicated scratchpad key block — its normative surface is
2887
+ runbook-anchored (`## Dev environment auto-launch (US-0098 / DEC-0084)`
2888
+ L244 § Install-time bootstrap (US-0099) L250 + normative contract anchor
2889
+ L301) plus the `DEV_ENV_BOOTSTRAP_*` reason-code family + the
2890
+ `DEV_ENV_PROFILE_MISSING` remediation code. The 5 reason codes:
2891
+
2892
+ - `DEV_ENV_BOOTSTRAP_COPIED` — bootstrap copied the example profile to the
2893
+ resolved target path (informational; emitted on `missing` / `upgrade` /
2894
+ npm `postinstall` when the target was absent).
2895
+ - `DEV_ENV_BOOTSTRAP_SKIPPED_EXISTS` — bootstrap skipped because the
2896
+ target profile already exists (operator-customized profile preserved).
2897
+ - `DEV_ENV_BOOTSTRAP_PATH_INVALID` — bootstrap target path failed
2898
+ validation (malformed or non-repo-relative).
2899
+ - `DEV_ENV_BOOTSTRAP_SOURCE_MISSING` — bootstrap source
2900
+ (`template/.cursor/dev-environment.json.example`) is missing from the
2901
+ install payload.
2902
+ - `DEV_ENV_PROFILE_MISSING` — runtime profile not found after bootstrap was
2903
+ skipped or the profile was deleted post-install; remediate by re-running
2904
+ install/upgrade or
2905
+ `python scripts/dev_environment_lib.py --bootstrap --target <repo>` then
2906
+ customizing.
2907
+
2908
+ #### US-0092 / US-0095 — Grouped cross-link (auto-chain + drain keys)
2909
+
2910
+ For `AUTO_FLOW_MODE`, `AUTO_IMPLEMENTATION_LOOP`, `AUTO_PAUSE_REQUEST`,
2911
+ `AUTO_PAUSE_POLICY`, `AUTO_LOOP_MAX_CYCLES`, `AUTO_BACKLOG_MAX_STORIES`,
2912
+ `AUTO_BACKLOG_DRAIN`, `AUTO_STORY_SELECTION`, `AUTO_BACKLOG_ON_BLOCK`,
2913
+ `AUTO_BUG_QUEUE`, `AUTO_BUG_TARGET`, `AUTO_BUG_MAX_ITEMS`,
2914
+ `AUTO_BUG_ON_BLOCK`, and `AUTO_QUIET`, see the pre-`US-0116` README
2915
+ surfaces above: `### Automation modes` (L880), `### Sync policy (US-0038)`
2916
+ (L909), `### Optional /auto backlog-drain mode (US-0044)` (L2370), and the
2917
+ main reference list above (pre-`US-0113` reference surface). `US-0116` adds
2918
+ the grouped cross-link pointer only — no duplicate key rows
2919
+ (byte-stability preserved; mirrors `US-0114`'s `AUTO_INSTALL_DEPS` /
2920
+ `AUTO_RELEASE_NOTES` grouped cross-link pattern and `US-0115`'s
2921
+ `REMOTE_EXECUTION` family grouped cross-link pattern). The
2922
+ `ALLOW_AUTO_PUSH` and `AUTO_PUSH_BRANCH_ALLOWLIST` rows (US-0092 security
2923
+ posture) live in `### Sync policy (US-0038)` (L909).
2924
+
2925
+ #### Cross-link to Release & distribution keys (DELIVERY_MODE / AUTO_INSTALL_DEPS / AUTO_RELEASE_NOTES overlap)
2926
+
2927
+ For the canonical `DELIVERY_MODE`, `AUTO_INSTALL_DEPS`, and
2928
+ `AUTO_RELEASE_NOTES` rows (US-0096 / US-0041 / US-0062 overlap), see
2929
+ `### Release & distribution keys (US-0041 / US-0062 / US-0111 / US-0112)`
2930
+ above. `US-0116` documents the auto-chain lifecycle-shape / enablement
2931
+ angle in the narrative subsections above; the canonical key rows remain in
2932
+ the release & distribution keys block for byte-stability (`US-0114`
2933
+ byte-stability preserved; no duplicate key rows).
2934
+
2935
+ #### Cross-link to Integration & observability keys (LEAN_MEMORY_* overlap)
2936
+
2937
+ For the canonical `LEAN_MEMORY_READ`, `LEAN_MEMORY_WRITE`,
2938
+ `LEAN_COLD_READ_MAX_SECTIONS`, `LEAN_STATE_INDEX_ROWS`, and
2939
+ `AUTO_DELIVERY_ROUTING` rows (US-0096 / US-0115 overlap), see
2940
+ `### Integration & observability keys (US-0034 / US-0084 / US-0086 /
2941
+ US-0093 / US-0096 / US-0101 / US-0102)` above. `US-0095` is angle-distinct
2942
+ from `US-0096`'s `LEAN_MEMORY_*` family (process angle vs memory angle per
2943
+ R-0104 open question #2); `US-0116` adds the cross-link pointer only — no
2944
+ duplicate key rows (`US-0115` byte-stability preserved).
2945
+
2946
+ ### Phase & role governance keys (US-0069 / US-0070 / US-0071 / US-0072 / US-0075 / US-0076 / US-0077 / US-0078 / US-0079 / US-0080 / US-0081 / US-0082 / US-0083 / US-0085 / US-0087 / US-0088 / US-0089 / US-0090)
2947
+
2948
+ The phase & role governance keys split across three postures: optional
2949
+ runtime features that are default-off and impose zero overhead when
2950
+ disabled (`US-0069`, `US-0070`, `US-0079`, `US-0080`, `US-0081`,
2951
+ `US-0082`, `US-0083`, `US-0087`, `US-0088`, `US-0089`, `US-0090`), always-on
2952
+ validators that are static gates with zero runtime cost (`US-0071`,
2953
+ `US-0076`, `US-0077`, `US-0085`), and install-time bootstraps that run only
2954
+ at `missing` / `upgrade` / npm `postinstall` (`US-0075`, `US-0078`). When
2955
+ each optional master flag is at its default, the framework's runtime
2956
+ behavior is byte-identical to the pre-phase-role-governance baseline.
2957
+ Order mirrors `.cursor/scratchpad.md` (US-0069 → US-0070 → US-0079 →
2958
+ US-0080 → US-0081 → US-0083 → US-0087 → US-0088 → US-0089 → US-0090;
2959
+ US-0082 owns the codebase-map toggle; the rest are prose-only /
2960
+ runbook-cross-link-only entries). 5th-story cumulative byte-stability
2961
+ surface — US-0113 L1881, US-0114 L2005, US-0115 L2077, US-0116 L2225
2962
+ blocks are byte-stable; US-0117 adds net-new key rows + cross-link
2963
+ pointers + reason-code-only entries + prose-only entries only, never
2964
+ edits prior released blocks.
2965
+
2966
+ #### US-0069 — Phase→role matrix keys
2967
+
2968
+ - `AUTO_ROLE_RESEARCH=<role>` (default empty) — overrides the role catalog
2969
+ default (`US-0102`) for the research phase; empty keeps the catalog default.
2970
+ - `AUTO_ROLE_PLAN_VERIFY=<role>` (default empty) — overrides the role
2971
+ catalog default for the plan-verify phase; empty keeps the catalog
2972
+ default.
2973
+ - `AUTO_ROLE_REFRESH_CONTEXT=<role>` (default empty) — overrides the role
2974
+ catalog default for the refresh-context phase; empty keeps the catalog
2975
+ default.
2976
+ - Default-off posture: empty defaults keep the catalog default; the
2977
+ matrix is always consulted during `/auto` but empty values mean zero
2978
+ behavior change relative to the pre-`US-0069` baseline.
2979
+
2980
+ #### US-0070 — Phase selection policy keys
2981
+
2982
+ - `AUTO_PHASE_PLAN=<macro>` (default empty) — custom macro schedule
2983
+ (e.g., `["spec","plan","build+verify","ship"]`); empty keeps the
2984
+ story-boundary macro recomputed per `US-0044` / `DEC-0022`.
2985
+ - `AUTO_PHASE_INCLUDE=<phase-id-list>` (default empty) — force-include
2986
+ phases; empty keeps the resolved plan.
2987
+ - `AUTO_PHASE_EXCLUDE=<phase-id-list>` (default empty) — force-exclude
2988
+ phases; empty keeps the resolved plan.
2989
+ - `AUTO_PHASE_PROFILE=<profile>` (default empty) — named profile such as
2990
+ `ultra_lean` / `standard` / `minimal`; empty keeps the
2991
+ story-boundary recomputed macro.
2992
+ - Reason codes: `PHASE_POLICY_CONFLICT` (exactly one active mode after
2993
+ merge; conflict emits no plan), `PHASE_PLAN_UNKNOWN_PHASE` (unknown
2994
+ phase name in `AUTO_PHASE_INCLUDE` / `AUTO_PHASE_EXCLUDE`).
2995
+ - Default-off posture: empty values keep the catalog-computed macro; the
2996
+ framework's runtime behavior is byte-identical to the pre-`US-0070`
2997
+ baseline.
2998
+
2999
+ #### US-0079 — Bug queue routing keys
3000
+
3001
+ - `AUTO_BUG_QUEUE=0|1` (default `0`) — opt-in master enable for bug queue
3002
+ drain; `0` is byte-identical to the pre-`US-0079` baseline.
3003
+ - `AUTO_BUG_TARGET=<bug-id>` (default empty) — optional bug-id pin; empty
3004
+ drains all OPEN bugs in priority order.
3005
+ - `AUTO_BUG_MAX_ITEMS=<int>` (default `0` — unlimited when enabled) —
3006
+ max bugs to drain per `/auto` invocation.
3007
+ - `AUTO_BUG_ON_BLOCK=skip|drain` (default `skip`) — `skip` halts the bug
3008
+ drain on a bug block; `drain` continues draining after a bug block.
3009
+ - Default-off / zero-overhead-when-off: when `AUTO_BUG_QUEUE=0` (default),
3010
+ the workflow adds zero runtime overhead — no bug scan, no bug routing.
3011
+
3012
+ #### US-0080 — Auto quiet mode key
3013
+
3014
+ - `AUTO_QUIET=0|1` (default `0`) — `1` suppresses non-essential narrator
3015
+ prose; `0` (default) is byte-identical to the pre-`US-0080` baseline.
3016
+ - `TOKEN_PROFILE=lean|full|cheap` (default per main reference list above
3017
+ L1864) — grouped cross-link: `lean` (default per main reference list)
3018
+ packs a narrower context, `full` preserves the full context, `cheap`
3019
+ selects the cheapest model tier. `AUTO_QUIET` is orthogonal to
3020
+ `TOKEN_PROFILE` (quiet mode controls narrator prose, not context
3021
+ breadth per `DEC-0035` / `US-0053`).
3022
+ - Default-off / zero-overhead-when-off: when `AUTO_QUIET=0` (default) and
3023
+ `TOKEN_PROFILE` is at its default (per main reference list), the
3024
+ framework's runtime behavior is byte-identical to the pre-`US-0080`
3025
+ baseline.
3026
+
3027
+ #### US-0081 — Caveman mode keys
3028
+
3029
+ - `CAVEMAN_MODE=0|1` (default `0`) — `1` enables caveman voice mode;
3030
+ `0` (default) is byte-identical to the pre-`US-0081` baseline.
3031
+ - `CAVEMAN_LEVEL=terse|full|off` (default `full`) — tunes the terseness
3032
+ when `CAVEMAN_MODE=1`; unknown value emits `CAVEMAN_LEVEL_UNKNOWN` and
3033
+ falls back to the pre-`US-0089` voice.
3034
+ - Default-off / zero-overhead-when-off: when `CAVEMAN_MODE=0` (default),
3035
+ the operator UX is byte-identical to the pre-`US-0081` baseline.
3036
+
3037
+ #### US-0082 — Codebase map bootstrap toggle
3038
+
3039
+ - `CODEBASE_MAP_REFRESH_ON_ROLLOVER=0|1` (default `0`) — `1` rolls the
3040
+ codebase map on `/refresh-context`; `0` (default) is byte-identical to
3041
+ the pre-`US-0082` baseline. The bootstrap itself runs on `missing` /
3042
+ `upgrade` / npm `postinstall` regardless of this toggle; the toggle
3043
+ only controls the `/refresh-context` rollover refresh.
3044
+ - Cross-link: `US-0076` (freshness gate, same umbrella, above) — the
3045
+ toggle is documented here, not in `US-0076` (grouped cross-link from
3046
+ `US-0076` to here).
3047
+ - Default-off / zero-overhead-when-off: when
3048
+ `CODEBASE_MAP_REFRESH_ON_ROLLOVER=0` (default), `/refresh-context`
3049
+ does not roll the map; the framework's runtime behavior is
3050
+ byte-identical to the pre-`US-0082` baseline.
3051
+
3052
+ #### US-0083 — Scratchpad delivery routing key
3053
+
3054
+ - `AUTO_DELIVERY_ROUTING=scratchpad_only|backlog_then_scratchpad` (default
3055
+ `scratchpad_only`) — `scratchpad_only` writes delivery hints to the
3056
+ scratchpad only (preserves the pre-`US-0083` delivery posture);
3057
+ `backlog_then_scratchpad` mirrors delivery hints to the backlog.
3058
+ - Cross-link: `DELIVERY_MODE` (US-0083 overlap) → see `### Release &
3059
+ distribution keys (US-0041 / US-0062 / US-0111 / US-0112)` above (L2005)
3060
+ which owns the canonical `DELIVERY_MODE` row (US-0114 byte-stability
3061
+ preserved; `DELIVERY_MODE` is NOT re-documented here).
3062
+ - Reason code: `DELIVERY_MODE_SWITCH_MID_STORY` (emitted when the operator
3063
+ switches `DELIVERY_MODE` mid-story per `DEC-0067`).
3064
+ - Default-off posture does not apply — `AUTO_DELIVERY_ROUTING` always has
3065
+ a value; the default `scratchpad_only` preserves the pre-`US-0083`
3066
+ delivery posture.
3067
+
3068
+ #### US-0087 — Full-autonomy mode keys (18 keys)
3069
+
3070
+ - `AUTO_FLOW_MODE=manual|full_autonomy` (default `manual`) — master enable
3071
+ for full-autonomy mode; `manual` (default) is byte-identical to the
3072
+ pre-`US-0087` baseline.
3073
+ - `AUTO_IMPLEMENTATION_LOOP=0|1` (default `1`) — enables the
3074
+ implementation loop in full-autonomy mode.
3075
+ - `AUTO_LOOP_MAX_CYCLES=<int>` (default `5`) — max cycles per
3076
+ implementation loop.
3077
+ - `AUTO_BLOCK_RETRY_MAX=<int>` (default `5`; per `(story_id, stop_reason)`
3078
+ recoverable retries before `BLOCK_RETRY_CAP_EXHAUSTED`) — max retries
3079
+ per block.
3080
+ - `RELEASE_PUBLISH_MODE=disabled|snapshot|...` (default `disabled`) —
3081
+ release publish mode (cross-link to `US-0114` for the canonical
3082
+ semantics).
3083
+ - `CROSS_MODEL_REVIEW=0|1` (default `1`) — enables the cross-model critic
3084
+ in full-autonomy mode.
3085
+ - `CROSS_MODEL_ANTISLOP_THRESHOLD=<int>` (default `6`) — antislop
3086
+ threshold for the cross-model critic.
3087
+ - `CROSS_MODEL_REWORK_MAX=<int>` (default `2`) — max rework cycles for
3088
+ the cross-model critic.
3089
+ - `SOVEREIGN_MEMORY=0|1` (default `1`) — enables the sovereign-memory
3090
+ auto-advance hook.
3091
+ - `SOVEREIGN_MEMORY_TOP_N=<int>` (default `5`) — top-N digest entries.
3092
+ - `SOVEREIGN_MEMORY_TOP_K=<int>` (default `3`) — top-K digest entries.
3093
+ - `SOVEREIGN_MEMORY_MAX_CHARS=<int>` (default `2048`) — max chars per
3094
+ digest entry.
3095
+ - `SOVEREIGN_MEMORY_JSONL_MAX_LINES=<int>` (default `500`) — max lines
3096
+ per `mistakes.jsonl` rollover.
3097
+ - `AUTO_SOVEREIGN=0|1` (default `1`) — enables the auto-sovereign
3098
+ deferral drain.
3099
+ - `AUTO_SOVEREIGN_DEFERRAL_MAX=<int>` (default `50`) — max deferred
3100
+ candidates.
3101
+ - `AUTO_SOVEREIGN_DRAIN_GENERATE_MAX=<int>` (default `3`) — max
3102
+ drain-generate cycles.
3103
+ - `AUTO_SOVEREIGN_DEFERRAL_POLICY=resolve_first|...` (default
3104
+ `resolve_first`) — deferral policy.
3105
+ - `SOVEREIGN_GOAL_MODE=goal_convergence|...` (default `goal_convergence`)
3106
+ — sovereign goal mode.
3107
+ - Reason codes: `BLOCK_RETRY_CAP_EXHAUSTED` (per `(story_id, stop_reason)`
3108
+ recoverable retries exhausted), `NATIVE_CHAIN_UNAVAILABLE` (native
3109
+ in-chat chain unavailable; outer driver fallback per `US-0092`).
3110
+ - Default-off / zero-overhead-when-off: when `AUTO_FLOW_MODE=manual`
3111
+ (default), all 18 keys are inert; the workflow adds zero runtime
3112
+ overhead.
3113
+
3114
+ #### US-0088 — Automation modes keys (9 keys)
3115
+
3116
+ - `AUTO_BACKLOG_DRAIN=0|1` (default `0`) — opt-in master enable for
3117
+ backlog drain; `0` (default) is byte-identical to the pre-`US-0088`
3118
+ baseline.
3119
+ - `AUTO_BACKLOG_MAX_STORIES=<int>` (default `10`) — max stories to drain
3120
+ per `/auto` invocation.
3121
+ - `AUTO_BACKLOG_ON_BLOCK=skip|drain` (default `skip`) — `skip` halts the
3122
+ backlog drain on a story block; `drain` continues draining.
3123
+ - `AUTO_STORY_SELECTION=<policy>` (default `priority_then_backlog_order`)
3124
+ — story selection policy for backlog drain.
3125
+ - `AUTO_EXECUTE_BULK=0|1` (default `0`) — opt-in master enable for bulk
3126
+ execute; `0` (default) is byte-identical to the pre-`US-0088` baseline.
3127
+ - `AUTO_EXECUTE_MAX_ITEMS=<int>` (default `1`) — max items to execute
3128
+ per bulk execute invocation.
3129
+ - `AUTO_EXECUTE_ON_BLOCK=skip|drain` (default `skip`) — `skip` halts the
3130
+ bulk execute on a block; `drain` continues.
3131
+ - `AUTO_EXECUTE_SELECTION=<policy>` (default `planned_then_priority`) —
3132
+ selection policy for bulk execute.
3133
+ - `AUTO_TEAM_SCOPE_ENFORCE=0|1` (default `1`) — enforces team scope
3134
+ (PO/Tech Lead/Dev/QA/Release/Curator) in bulk execute.
3135
+ - Default-off / zero-overhead-when-off: when `AUTO_BACKLOG_DRAIN=0` and
3136
+ `AUTO_EXECUTE_BULK=0` (defaults), the workflow adds zero runtime
3137
+ overhead — no backlog scan, no bulk execute.
3138
+
3139
+ #### US-0089 — Auto orchestration keys
3140
+
3141
+ - `AUTO_PAUSE_REQUEST=0|1` (default `0`) — `1` requests the orchestrator
3142
+ pause after the current phase; `0` (default) is byte-identical to the
3143
+ pre-`US-0089` baseline.
3144
+ - `AUTO_REMOTE_AUTOMATION_PROFILE=off|<profile>` (default `off`) —
3145
+ enables remote automation via `scripts/auto_remote.py --profile
3146
+ <name>`; `off` (default) is byte-identical to the pre-`US-0089`
3147
+ baseline.
3148
+ - Default-off / zero-overhead-when-off: when `AUTO_PAUSE_REQUEST=0` and
3149
+ `AUTO_REMOTE_AUTOMATION_PROFILE=off` (defaults), the workflow adds zero
3150
+ runtime overhead — no pause check, no remote profile subprocess.
3151
+
3152
+ #### US-0090 — Caveman input compression keys
3153
+
3154
+ - `CAVEMAN_COMPRESS_INPUT=0|1` (default `0`) — `1` enables input
3155
+ compression; `0` (default) is byte-identical to the pre-`US-0090`
3156
+ baseline.
3157
+ - `CAVEMAN_FILE_SCOPE=<glob>` (default empty) — repo-relative glob or
3158
+ file list to compress; required when `CAVEMAN_COMPRESS_INPUT=1`. Empty
3159
+ with `CAVEMAN_COMPRESS_INPUT=1` emits `CAVEMAN_COMPRESS_SCOPE_EMPTY`
3160
+ (fail-closed on `--write`).
3161
+ - Default-off / zero-overhead-when-off: when `CAVEMAN_COMPRESS_INPUT=0`
3162
+ (default), the workflow adds zero runtime overhead — no input
3163
+ compression, no file-scope scan.
3164
+
3165
+ #### Prose-only / runbook-cross-link-only entries (US-0071 / US-0072 / US-0075 / US-0076 / US-0077 / US-0078 / US-0085)
3166
+
3167
+ The following seven features have no scratchpad key block in this
3168
+ sub-block — they are prose-only / runbook-cross-link-only entries
3169
+ (always-on validators or install-time bootstraps or concept-only features).
3170
+ Their operator-facing narrative lives in the per-feature subsections above
3171
+ under `### Phase & role governance (...) umbrella section`:
3172
+
3173
+ - `US-0071` (Metadata sanitization) — always-on validator gate; runbook
3174
+ cross-link `## User-visible internal metadata guard (US-0071 /
3175
+ DEC-0053)` (L303 h2).
3176
+ - `US-0072` (Context slimming) — concept only; runtime toggle
3177
+ `TOKEN_PROFILE` is grouped cross-link to `US-0080` subsection above +
3178
+ main reference list above L1864; `LEAN_MEMORY_*` family mechanics are
3179
+ cross-link to `### Integration & observability keys (US-0034 / US-0084 /
3180
+ US-0086 / US-0093 / US-0096 / US-0101 / US-0102)` above (L2077, default
3181
+ omit — angle-distinct per R-0105: `US-0072` owns the concept, `US-0080`
3182
+ owns the `TOKEN_PROFILE` runtime toggle, `US-0115` owns the
3183
+ memory-layer mechanics).
3184
+ - `US-0075` (Scratchpad example-first refresh) — install-time bootstrap;
3185
+ runbook cross-link `### Scratchpad example parity` (L1949 h3) + `##
3186
+ Scratchpad example upgrade contract (US-0057 / DEC-0039 / DEC-0057)`
3187
+ (L2535 h2).
3188
+ - `US-0076` (Codebase map freshness gate) — always-on validator gate;
3189
+ toggle `CODEBASE_MAP_REFRESH_ON_ROLLOVER` is grouped cross-link to
3190
+ `US-0082` subsection above (US-0082 owns the bootstrap-mechanism
3191
+ narrative); runbook cross-link `## Codebase map bootstrap (US-0082 /
3192
+ DEC-0065)` (L63 h2).
3193
+ - `US-0077` (Delegation policy) — always-on validator gate; runbook
3194
+ cross-link `## Documentation profile validation (US-0077 / DEC-0059)`
3195
+ (L98 h2); reason code `INTAKE_DELEGATION_EVIDENCE_MISSING`.
3196
+ - `US-0078` (Env file bootstrap) — install-time bootstrap; runbook
3197
+ cross-link `## Interactive intake evidence validation (US-0078 /
3198
+ DEC-0060 / US-0083 / DEC-0067)` (L479 h2 — shared with `US-0083`).
3199
+ - `US-0085` (Context fresh-context markers) — always-on validator gate;
3200
+ runbook cross-link `## Per-phase subagent isolation evidence (US-0048 /
3201
+ DEC-0029)` (L1628 h2); reason code `PHASE_CONTEXT_ISOLATION_MISSING`.
3202
+
3203
+ #### Cross-link pointers (no duplicate key rows)
3204
+
3205
+ - `DELIVERY_MODE` (US-0083 overlap) → see `### Release & distribution keys
3206
+ (US-0041 / US-0062 / US-0111 / US-0112)` above (L2005) which owns the
3207
+ canonical `DELIVERY_MODE` row (US-0114 byte-stability preserved; not
3208
+ re-documented here).
3209
+ - `LEAN_MEMORY_*` family (US-0072 / US-0087 angle) → see `### Integration
3210
+ & observability keys (US-0034 / US-0084 / US-0086 / US-0093 / US-0096 /
3211
+ US-0101 / US-0102)` above (L2077) which owns the canonical
3212
+ `LEAN_MEMORY_*` family rows per `US-0096` / `DEC-0082` (US-0115
3213
+ byte-stability preserved; default omit per R-0105 — `US-0087` owns
3214
+ full-autonomy mode, `US-0115` owns memory-layer mechanics).
3215
+ - `TOKEN_PROFILE` (US-0072 / US-0080 overlap) → grouped cross-link to
3216
+ main reference list above L1864 + `US-0080` subsection above (US-0080
3217
+ owns the `TOKEN_PROFILE` runtime toggle narrative; not re-documented as
3218
+ a net-new row here).
3219
+ - `CODEBASE_MAP_REFRESH_ON_ROLLOVER` (US-0076 / US-0082 overlap) → see
3220
+ `US-0082 — Codebase map bootstrap toggle` subsection above (US-0082
3221
+ owns the bootstrap-mechanism narrative; not re-documented as a net-new
3222
+ row here).
3223
+
3224
+ ### Work-kind routing keys (US-0118)
3225
+
3226
+ The work-kind routing keys are default-off: when `WORK_KIND_ROUTING=0`
3227
+ (default), the framework is byte-identical to the pre-US-0118 baseline —
3228
+ `/auto` `resolve_delivery_mode` step 0 + `/intake` step 5 skip the
3229
+ classifier entirely (zero overhead). 6th-story cumulative byte-stability
3230
+ surface — US-0113 L2421, US-0114 L2545, US-0115 L2617, US-0116 L2765,
3231
+ US-0117 L2856 blocks are byte-stable; US-0118 adds net-new-keys-only +
3232
+ cross-link pointers + reason-code-only entries, never edits prior
3233
+ released blocks.
3234
+
3235
+ - `WORK_KIND_ROUTING=0|1` (default `0`) — master enable for per-story
3236
+ work-kind classification. When `0`: no classifier invocation, no
3237
+ `/auto` step-0a hook, no `/intake` step-5 proposal (zero overhead).
3238
+ - `WORK_KIND_TIE_BREAK=highest_tier_wins` (default `highest_tier_wins`;
3239
+ Q1 LOCKED) — tie-break policy when a story touches both `docs/` and
3240
+ `src/` (mixed tier). `highest_tier_wins` resolves to `code` > `mini` >
3241
+ `doc` per `classify_touched_files` tier_rank A>B>C.
3242
+ - Default-off / zero-overhead-when-off: when `WORK_KIND_ROUTING=0`, no
3243
+ classifier reads/writes — zero overhead; byte-identical to pre-US-0118
3244
+ baseline (contract test `test_us0118_default_off_zero_overhead`).
3245
+
3246
+ Reason codes (R-0106 Q2 LOCKED; fail-closed unless marked info):
3247
+
3248
+ - `WORK_KIND_ROUTING_OFF` (info) — `WORK_KIND_ROUTING=0`; current
3249
+ behavior unchanged.
3250
+ - `WORK_KIND_DELIVERY_MODE_CONFLICT` — work-kind recommends `X` but
3251
+ explicit `DELIVERY_MODE=Y` set and they differ; explicit wins per L8.
3252
+ - `WORK_KIND_CLASSIFY_FAILED` — classifier raised an exception or
3253
+ returned malformed `WorkKindClassification`.
3254
+ - `WORK_KIND_UNKNOWN_ROUTE` — `work_kind` value not in `{doc, mini, code}`.
3255
+ - `WORK_KIND_PLAN_COVERAGE_MISSING` — classifier returned an empty/invalid
3256
+ `recommended_phase_plan`.
3257
+ - `WORK_KIND_TIE_BREAK_APPLIED` (info) — mixed-tier story resolved by
3258
+ the highest-tier-wins tie-break.
3259
+
3260
+ #### Cross-link pointers (no duplicate key rows)
3261
+
3262
+ - `DELIVERY_MODE` (US-0096 / US-0114 overlap) → see `### Release &
3263
+ distribution keys (US-0041 / US-0062 / US-0111 / US-0112)` above
3264
+ (L2545) which owns the canonical `DELIVERY_MODE` row (US-0114
3265
+ byte-stability preserved; explicit `DELIVERY_MODE` wins per L8
3266
+ precedence — not re-documented as a net-new row here).
3267
+ - `AUTO_PHASE_*` family (US-0070 overlap) → see `### Phase & role
3268
+ governance keys (US-0069 / ... / US-0090)` above (L2856) which owns
3269
+ the canonical `AUTO_PHASE_PLAN` / `AUTO_PHASE_EXCLUDE` /
3270
+ `AUTO_PHASE_INCLUDE` / `AUTO_PHASE_PROFILE` rows (US-0117
3271
+ byte-stability preserved; explicit `AUTO_PHASE_*` wins over
3272
+ `WORK_KIND_ROUTING`-derived per L8 — not re-documented as net-new
3273
+ rows here).
3274
+ - `LEAN_MEMORY_*` family (US-0115 overlap) → see `### Integration &
3275
+ observability keys` above (L2617) which owns the canonical
3276
+ `LEAN_MEMORY_*` family rows (US-0115 byte-stability preserved; not
3277
+ re-documented here).
3278
+
3279
+ ### Autonomy preset keys (US-0119)
3280
+
3281
+ The autonomy preset keys are default-off: when `AUTONOMY_PRESET=none` (default),
3282
+ the framework is byte-identical to the pre-US-0119 baseline — 7th-story cumulative
3283
+ byte-stability surface. US-0113..US-0118 blocks are byte-stable; US-0119 adds
3284
+ net-new-keys-only + cross-link pointers + reason-code-only entries, never edits
3285
+ prior released blocks.
3286
+
3287
+ **Preset enum** (`AUTONOMY_PRESET` — 3-tier):
3288
+ - `AUTONOMY_PRESET=none` (default) — empty expansion; byte-identical pre-US-0119.
3289
+ - `AUTONOMY_PRESET=balanced` — moderate autonomy: 8 flags expanded per DEC-0119 §7.
3290
+ - `AUTONOMY_PRESET=full` — maximum autonomy: all 12 flags expanded per DEC-0119 §7.
3291
+
3292
+ **Stop-policy enum** (`AUTONOMY_STOP_POLICY` — 3-value):
3293
+ - `AUTONOMY_STOP_POLICY=block` (default) — all fail-closed stops block; byte-identical pre-US-0119.
3294
+ - `AUTONOMY_STOP_POLICY=auto_repair_then_block` — bounded auto-repair for
3295
+ `autonomy_resolvable` codes; cap exhaustion → `AUTONOMY_REPAIR_CAP_EXHAUSTED` terminal.
3296
+ - `AUTONOMY_STOP_POLICY=auto_repair_then_skip` — same as above but skip on cap exhaustion.
3297
+
3298
+ **Per-feature flags** (12 flags; precedence: explicit > preset > default):
3299
+ - `INTAKE_AUTONOMY_MODE=0|1` — auto-derive intake answers on known-stack repeat projects (`balanced`: `—`; `full`: `1`).
3300
+ - `INTAKE_MINIMAL_PACK=0|1` — shrink follow-up intake on established projects (`balanced`: `—`; `full`: `1`).
3301
+ - `INTAKE_ASSUME_STACK_CONTEXT=0|1` — auto-fill stack/runtime from backlog with `assumption_confirmation_ref` contract preserved (BUG-0007 compose) (`balanced`: `—`; `full`: `1`).
3302
+ - `WORK_KIND_AUTO_ACCEPT=0|1` — auto-accept classifier output when `WORK_KIND_ROUTING=1` (`balanced`: `1`; `full`: `1`).
3303
+ - `CROSS_MODEL_REWORK_EXHAUSTED_POLICY=block|downgrade` — critic rework cap exhausted policy (`balanced`: `downgrade`; `full`: `downgrade`).
3304
+ - `CROSS_MODEL_SKIP_PHASES=` (csv) — skip critic for low-risk phases (`balanced`: csv; `full`: csv).
3305
+ - `RESUME_BRIEF_AUTO_REFRESH=0|1` — auto-refresh stale brief (`balanced`: `1`; `full`: `1`).
3306
+ - `RUNTIME_PROOF_KIND=strict|lightweight` — counter+ts attestation instead of SHA-256 (`balanced`: `lightweight`; `full`: `lightweight`).
3307
+ - `GOAL_CONVERGENCE_INTERVAL=3|1` — evaluate every N phases (`balanced`: `3`; `full`: `1`).
3308
+ - `SOVEREIGN_DRAIN_AUTO_ACCEPT=0|1` — auto-accept drain candidates below medium risk (`balanced`: `1`; `full`: `1`).
3309
+ - `RELEASE_PUBLISH_AUTO_CONFIRM=0|1` — auto-confirm publish targets in allowlist (`balanced`: `1`; `full`: `1`).
3310
+ - `AUTONOMY_REPAIR_CAP_OVERRIDE=` (optional int) — operator override per-run cap.
3311
+
3312
+ **Stop-class taxonomy** (DEC-0119 §4; matrix at `docs/engineering/autonomy-stop-matrix.md`):
3313
+ - `security_hard` — never auto-resolved; block immediately; `auto_repair_kind=n/a`; cap=0.
3314
+ - `autonomy_resolvable` — bounded auto-repair permitted when policy != `block`; cap per (run, code) from matrix (default 3).
3315
+
3316
+ **auto_repair_kind values** (9 values): `reorder_anchors`, `fix_timestamp`, `truncate_hot_surface`, `reset_retry_counter`, `disambiguate_state`, `auto_refresh_brief`, `approve_plan_deviation`, `regenerate_isolation_evidence`, `skip_confirmation_gate`.
3317
+
3318
+ **Terminal stop reason**: `AUTONOMY_REPAIR_CAP_EXHAUSTED` — distinct from `BLOCK_RETRY_CAP_EXHAUSTED` (run-level vs story-level).
3319
+
3320
+ #### Cross-link pointers (no duplicate key rows)
3321
+
3322
+ - `AUTONOMY_PRESET` / `AUTONOMY_STOP_POLICY` / 12 per-feature flags → canonical scratchpad schema at `.cursor/scratchpad.md` (T-002); expansion logic at `scripts/autonomy_preset_lib.py` (T-001); stop-matrix manifest at `docs/engineering/autonomy-stop-matrix.md` (T-003); repair ledger at `handoffs/autonomy_repair_ledger/` (T-005).
3323
+ - `WORK_KIND_AUTO_ACCEPT` (US-0118 overlap) → see `### Work-kind routing keys (US-0118)` above (L3224) which owns the canonical `WORK_KIND_ROUTING` rows (US-0118 byte-stability preserved; explicit `WORK_KIND_AUTO_ACCEPT` is an additive US-0119 relaxation layer — not a re-documentation of US-0118).
3324
+ - `CROSS_MODEL_REWORK_EXHAUSTED_POLICY` / `CROSS_MODEL_SKIP_PHASES` (US-0104 overlap) → see `### Integration & observability keys` above (L2617) which owns the canonical `CROSS_MODEL_REVIEW` / `CROSS_MODEL_REWORK_MAX` rows (US-0117 byte-stability preserved; US-0119 only adds `downgrade` expansion values).
3325
+ - `INTAKE_ASSUME_STACK_CONTEXT` (BUG-0007 compose) → see `### Intake & evidence keys (US-0068 / ...)` above which owns the canonical `INTAKE_*` rows; US-0119 preserves `assumption_confirmation_ref` contract unchanged.
3326
+ - `RELEASE_PUBLISH_AUTO_CONFIRM` (US-0054 overlap) → see `### Release & distribution keys (US-0041 / ...)` above which owns the canonical `RELEASE_PUBLISH_MODE` rows; US-0119 only adds auto-confirm relaxation layer.
3327
+
3328
+ ### Remote execution config (`.cursor/remote.json`)
3329
+
3330
+ Remote config is optional and mode-aware:
3331
+
3332
+ - `REMOTE_EXECUTION=0` (default): skip remote config checks entirely.
3333
+ - `REMOTE_EXECUTION=1`: validate `.cursor/remote.json` first and fail fast on
3334
+ missing/malformed/invalid or insecure config.
3335
+
3336
+ Canonical contract (DEC-0016):
3337
+
3338
+ - Required root fields:
3339
+ - `version` (integer)
3340
+ - `defaultTarget` (string)
3341
+ - `targets` (array)
3342
+ - Required target fields:
3343
+ - `id` (string)
3344
+ - `type` (`docker|ssh|vm`)
3345
+ - `enabled` (boolean)
3346
+ - `host` (string)
3347
+ - `port` (integer `1..65535`)
3348
+ - `workspaceRoot` (string)
3349
+ - Optional:
3350
+ - `auth.mode` (`none|env`)
3351
+ - If `auth.mode=env`, use env-var references only (`tokenEnv`,
3352
+ `passwordEnv`, `privateKeyPathEnv`, ...).
3353
+
3354
+ Two safe target examples are shipped in:
3355
+
3356
+ - `.cursor/remote.json` (active repo)
3357
+ - `template/.cursor/remote.json` (template parity copy)
3358
+
3359
+ The examples include:
3360
+
3361
+ - `local-docker`: local network/docker-like endpoint.
3362
+ - `remote-vm-ssh`: remote VM/SSH-like endpoint.
3363
+
3364
+ No secrets policy:
3365
+
3366
+ - Never commit inline tokens/passwords/private keys in `remote.json`.
3367
+ - Commit env-var reference names only.
3368
+
3369
+ Fail-fast error format:
3370
+
3371
+ - `[REMOTE_CONFIG_ERROR] <path>: expected <rule>, got <actual>. Fix: <hint>.`
3372
+
3373
+ Troubleshooting quick guide:
3374
+
3375
+ - Missing file in remote mode:
3376
+ - Create `.cursor/remote.json` from the template copy, or set
3377
+ `REMOTE_EXECUTION=0`.
3378
+ - Invalid enum/type/range:
3379
+ - Update the failing field to match allowed values/ranges.
3380
+ - Malformed JSON:
3381
+ - Fix JSON syntax and retry.
3382
+ - Secret-like inline value detected:
3383
+ - Replace literal secret with an env-var reference field.
3384
+ - **CI still runs its-magic packaging jobs?** Your project received a pre-fix workflow.
3385
+ Run **`its-magic --target <repo> --mode upgrade`** (or **`--mode clean`** then reinstall)
3386
+ to refresh `.github/workflows/ci.yml` from the corrected template. After upgrade, GitHub
3387
+ Actions should show only **`checks`** and **`auto-fix`** jobs — not `npm-test`,
3388
+ `brew-test`, or `choco-test`. Fix applies to new installs/upgrades; stale repos heal on
3389
+ next upgrade (**US-0018**).
3390
+
3391
+ Team/local (recommended in `.cursor/scratchpad.local.md`):
3392
+
3393
+ - `TEAM_MODE=0|1`
3394
+ - `TEAM_MEMBER=<your-id>`
3395
+ - `ACTIVE_TASK_IDS=T-12,T-13`
3396
+
3397
+ ### Automated feature loop (optional)
3398
+
3399
+ Enable:
3400
+
3401
+ - `AUTO_FLOW_MODE=auto_until_decision`
3402
+ - `PHASE_MODE=auto`
3403
+ - `PERMISSION_MODE=auto`
3404
+ - `RUN_TESTS_ON_EDIT=1`
3405
+ - `LOOP_UNTIL_GREEN=1`
3406
+ - `AUTO_IMPLEMENTATION_LOOP=1`
3407
+ - `AUTO_LOOP_MAX_CYCLES=5`
3408
+
3409
+ Then run `/auto`.
3410
+
3411
+ Graceful stop (for shutdown/end of day):
3412
+
3413
+ 1. Set `AUTO_PAUSE_REQUEST=1`
3414
+ 2. Flow stops at next configured boundary (`AUTO_PAUSE_POLICY`)
3415
+ 3. `/pause` artifacts are written
3416
+ 4. Next day run `/resume` or `/auto`
3417
+
3418
+ ### Recommended profiles
3419
+
3420
+ **Max automation (high autonomy):**
3421
+
3422
+ - `AUTO_FLOW_MODE=auto_until_decision`
3423
+ - `PHASE_MODE=auto`
3424
+ - `PERMISSION_MODE=auto`
3425
+ - `RUN_TESTS_ON_EDIT=1`
3426
+ - `LOOP_UNTIL_GREEN=1`
3427
+ - `AUTO_IMPLEMENTATION_LOOP=1`
3428
+ - `AUTO_LOOP_MAX_CYCLES=5`
3429
+ - `AUTO_INSTALL_DEPS=1` (optional, if you trust auto installs)
3430
+ - `AUTO_PAUSE_POLICY=after_phase`
3431
+
3432
+ **Safer automation (recommended for most teams):**
3433
+
3434
+ - same as above, but keep:
3435
+ - `PERMISSION_MODE=interactive`
3436
+ - `AUTO_INSTALL_DEPS=0`
3437
+ - `AUTO_PAUSE_POLICY=after_task`
3438
+
3439
+ ### Quality chain (3-layer auto-fix)
3440
+
3441
+ its-magic provides a complete quality chain that catches issues at three levels.
3442
+ Each layer catches problems the previous layer missed:
3443
+
3444
+ ```text
3445
+ ┌─────────────────────────────────────────────────────────────────┐
3446
+ │ Layer 1: Cursor AI loop (in-editor) OFF by default │
3447
+ │ AUTO_IMPLEMENTATION_LOOP + LOOP_UNTIL_GREEN │
3448
+ │ execute → QA → fix → execute (bounded by AUTO_LOOP_MAX_CYCLES)│
3449
+ └──────────────────────────┬──────────────────────────────────────┘
3450
+ │ code ready to push
3451
+ ┌──────────────────────────▼──────────────────────────────────────┐
3452
+ │ Layer 2: validate-and-push (local pre-push) MANUAL (run it)│
3453
+ │ scripts/validate-and-push.sh / .ps1 │
3454
+ │ test → format → lint-fix → test → commit + push │
3455
+ └──────────────────────────┬──────────────────────────────────────┘
3456
+ │ pushed to GitHub
3457
+ ┌──────────────────────────▼──────────────────────────────────────┐
3458
+ │ Layer 3: CI auto-fix (GitHub Actions) OFF by default │
3459
+ │ .github/workflows/ci.yml │
3460
+ │ test/lint → auto-fix → commit → re-run (up to 3 retries) │
3461
+ └─────────────────────────────────────────────────────────────────┘
3462
+ ```
3463
+
3464
+ | Layer | Default | Enable |
3465
+ |-------|---------|--------|
3466
+ | 1 - Cursor AI loop | off | Set `AUTO_IMPLEMENTATION_LOOP=1` + `LOOP_UNTIL_GREEN=1` in scratchpad |
3467
+ | 2 - validate-and-push | manual | Run `scripts/validate-and-push.sh` or `.ps1` before pushing |
3468
+ | 3 - CI auto-fix | off | Set `CI_AUTO_FIX: true` in `docs/engineering/runbook.md` |
3469
+
3470
+ CI itself (tests, lint, typecheck) always runs on push/PR. Only the **auto-fix
3471
+ retry loop** is gated behind `CI_AUTO_FIX`. When disabled, CI still reports
3472
+ failures -- it just won't try to fix and commit automatically.
3473
+
3474
+ All commands are read from `docs/engineering/runbook.md`. Fill in your
3475
+ project-specific commands once and every layer uses them:
3476
+
3477
+ ```text
3478
+ TEST_COMMAND: npm test
3479
+ LINT_COMMAND: npx eslint .
3480
+ LINT_FIX_COMMAND: npx eslint --fix .
3481
+ FORMAT_COMMAND: npx prettier --write .
3482
+ CI_AUTO_FIX: true
3483
+ ```
3484
+
3485
+ #### Layer 1: Cursor AI loop
3486
+
3487
+ Enabled via scratchpad flags (see [Automation modes](#automation-modes)).
3488
+ The AI runs execute → QA → fix cycles inside Cursor until tests pass or
3489
+ the safety cap (`AUTO_LOOP_MAX_CYCLES`) is reached.
3490
+
3491
+ #### Layer 2: Local validate-and-push
3492
+
3493
+ Run before pushing to catch anything the AI loop missed. **Merged scratchpad** (see
3494
+ `docs/engineering/runbook.md`, **Executable validate-and-push wiring (DEC-0058)**) gates
3495
+ **`git push`**: default **`SYNC_POLICY_MODE=manual`** and **`ALLOW_AUTO_PUSH=0`** exit early
3496
+ with a **reason code** (no push). Opt-in push requires an eligible mode, **`ALLOW_AUTO_PUSH=1`**,
3497
+ a non-empty **branch allowlist** match, passing **runbook** checks, and bounded **QA** rules.
3498
+
3499
+ ```bash
3500
+ # Bash (Linux / macOS; bash required for this script)
3501
+ bash scripts/validate-and-push.sh
3502
+
3503
+ # PowerShell (Windows)
3504
+ powershell scripts/validate-and-push.ps1
3505
+ powershell scripts/validate-and-push.ps1 -MaxAttempts 3
3506
+ powershell scripts/validate-and-push.ps1 -DryRun
3507
+ ```
3508
+
3509
+ The script:
3510
+ 1. Evaluates merged scratchpad policy via **`python scripts/sync_push_gates.py`** (Python 3 on PATH)
3511
+ 2. Runs `FORMAT_COMMAND` and `LINT_FIX_COMMAND` to auto-fix what it can
3512
+ 3. Runs `LINT_COMMAND`, optional `TYPECHECK_COMMAND`, and `TEST_COMMAND` to verify (with `TEST_TIMEOUT_SECONDS` when `timeout`/`gtimeout` is available on Unix)
3513
+ 4. If checks fail, pauses and waits for you to fix
3514
+ 5. Re-runs (up to 5 attempts, configurable)
3515
+ 6. When green, re-checks allowlist + QA scan, then commits and pushes automatically (unless dry-run / no-commit)
3516
+
3517
+ Use `-NoCommit` (PowerShell), **`--dry-run`** first arg (Bash), or `false` as third arg (Bash) to skip **push**.
3518
+ **Policy-only** interpretation of scratchpad sync flags is **deprecated** for these scripts; see **`decisions/DEC-0058.md`** (policy semantics remain **`DEC-0018`** / **`US-0038`**).
3519
+
3520
+ #### Layer 3: CI auto-fix (GitHub Actions)
3521
+
3522
+ **Disabled by default.** Set `CI_AUTO_FIX: true` in `docs/engineering/runbook.md`
3523
+ to enable. When enabled and CI fails after a push, the auto-fix job kicks in:
3524
+
3525
+ ```text
3526
+ push / PR ──> checks ──> PASS ──> done
3527
+
3528
+ FAIL
3529
+
3530
+ auto-fix job
3531
+
3532
+ run LINT_FIX_COMMAND
3533
+ run FORMAT_COMMAND
3534
+
3535
+ changes found?
3536
+ ╱ ╲
3537
+ yes no
3538
+ │ │
3539
+ commit + push report failure
3540
+ │ (manual fix needed)
3541
+ CI re-runs
3542
+ (up to 3x)
3543
+ ```
3544
+
3545
+ Auto-fix commits appear as `ci: auto-fix attempt N/3`. After 3 retries the
3546
+ workflow stops and points you to `scripts/validate-and-push` for local fixing.
3547
+
3548
+ <!-- readme-feature-coverage-catalog -->
3549
+
3550
+ ### Feature coverage catalog (US-0091)
3551
+
3552
+ - `/acceptance` — Mandatory Intake Question Packs for First and Small Intakes (`US-0068`).
3553
+ - `/ask` — /ask Command: Context-Aware Questions Without Workflow (`US-0020`).
3554
+ - `/ask` — Context Compaction and Tiered Token-Cost Optimization Mode (`US-0053`).
3555
+ - `/auto` — Architecture triad archiver ignores `## US-xxxx` headings, blocking `/auto` with `STATE_ARCHIVE_BOUNDARY_AMBIGUOUS` (`BUG-0010`).
3556
+ - `/auto` — Configurable Auto Phase Selection Policy (`US-0070`).
3557
+ - `/auto` — Continuous `/auto` Backlog-Drain Mode with Fine-Tune Switches (`US-0044`).
3558
+ - `/auto` — Fresh Subagent Context Per Phase and /auto Orchestration (`US-0023`).
3559
+ - `/auto` — Mid-Process `/auto` Continuation with Deterministic Resume Point (`US-0037`).
3560
+ - `/auto` — Strict Phase Role Enforcement in /auto Orchestration (`US-0069`).
3561
+ - `/auto` — Strict Runtime Proof for Per-Phase Subagent Isolation (`US-0056`).
3562
+ - `/auto` — Token-Cost Hardening for Orchestrated Runs (`US-0080`).
3563
+ - `/auto` — `/auto` continuous multi-phase loop + quiet drain (close one-phase-stop gap) (`US-0088`).
3564
+ - `/auto` — `/auto` executes phases without spawning required subagents (`BUG-0006`).
3565
+ - `/auto` — `/auto` explicit bug targeting (fix all OPEN bugs / fix `BUG-####`) (`US-0087`).
3566
+ - `/auto` — `/auto` fails with stale resume target after bug intake (`BUG-0005`).
3567
+ - `/check` — Optional Documentation Pack (Design Concept, CRS, Technical Spec) (`US-0031`).
3568
+ - `/confirmation` — Enforced Interactive Intake Question Evidence (`US-0078`).
3569
+ - `/connectivity` — Release Operator Run/Connect/Verify Hints Contract (`US-0067`).
3570
+ - `/decision` — Optional Fresh-Project ID Namespace Bootstrap (`US-0052`).
3571
+ - `/derived` — Deterministic Status Reconciliation Command (`US-0055`).
3572
+ - `/developer-dense` — Documentation Audience Profiles and Dual README Strategy (`US-0077`).
3573
+ - `/docs` — Installer-Owned `its_magic/` Folder for Framework Metadata (`US-0062`).
3574
+ - `/engineering` — Deterministic Context Slimming and Archive Enforcement Across Core Artifacts (`US-0072`).
3575
+ - `/engineering` — Deterministic State Hot-Surface Rollover and Archive Enforcement (`US-0060`).
3576
+ - `/engineering` — OS-Aware Runbook Command Auto-Bootstrap with Verified Quality Gates (`US-0063`).
3577
+ - `/flag` — Release Gate for Command/Flag Documentation Delta (`US-0030`).
3578
+ - `/intake` — Critical Evaluation in Intake and Architecture (`US-0021`).
3579
+ - `/intake` — Deterministic Intake Runtime Capability Guard and Single-Writer Drift Safety (`US-0059`).
3580
+ - `/intake` — Multi-Repo and Contract Compatibility Observability (`US-0034`).
3581
+ - `/intake` — intake evidence records asked questions that were never asked (`BUG-0007`).
3582
+ - `/integration` — Generated Test Scaffolding and Auto-Run Contract (`US-0066`).
3583
+ - `/managed` — Runtime QA Autopilot for Generated Projects (`US-0065`).
3584
+ - `/new` — First-Intake Full-Plan Coverage and Story-Map Gate (`US-0081`).
3585
+ - `/order` — Deterministic Artifact Ordering and Write Discipline (`US-0058`).
3586
+ - `/phases` — Cross-Phase Artifact Ownership Guard and Deterministic Archive Control (`US-0061`).
3587
+ - `/planning` — User-Visible Internal Metadata Sanitization Guard (`US-0071`).
3588
+ - `/product` — Backlog Reconciliation Gate for Released Sprints (`US-0043`).
3589
+ - `/push` — Phase-Triggered Sync Policy with Guarded Auto-Push (`US-0038`).
3590
+ - `/release` — Enforced Per-Phase Subagent Isolation with Audit Gate (`US-0048`).
3591
+ - `/release` — Legacy DONE-Story Acceptance/Traceability Backfill Guard (`US-0049`).
3592
+ - `/release` — Per-Sprint Release Notes and Release Queue Tracker (`US-0040`).
3593
+ - `/release` — Release Findings Artifact and Post-QA Issue Workflow (`US-0042`).
3594
+ - `/release` — Release Gate Tightening for Check-In Tests and QA/UAT Completion (`US-0039`).
3595
+ - `/remote` — Automation-driven remote execution selection (Docker / SSH / NL container intent) (`US-0086`).
3596
+ - `/remote` — Gitignored `.env` for remote and release connectivity (no AI read) (`US-0085`).
3597
+ - `/repetitive` — Delegable Intake Clarification Without Hard Blocks (`US-0083`).
3598
+ - `/research` — Knowledge Curation & Early Research (`US-0029`).
3599
+ - `/risk` — Intelligent Intake Decomposition and Risk-Aware PO Questioning (`US-0051`).
3600
+ - `/scratchpad` — Caveman mode missing voice compression rules (US-0089 incomplete delivery) (`BUG-0011`).
3601
+ - `/scratchpad` — Executable Scratchpad-Driven Sync and Auto-Push Wiring (`US-0076`).
3602
+ - `/scratchpad` — Scratchpad Delivery Simplification (Example-Only Install Policy) (`US-0073`).
3603
+ - `/scratchpad` — Upgrade Scratchpad Example–First Refresh (Fix Example Drift vs Materialized Baseline) (`US-0075`).
3604
+ - `/scratchpad` — Upgrade-Safe Scratchpad Example Refresh and Parity (`US-0057`).
3605
+ - `/scratchpad` — Scratchpad example stale: template example missing features written to canonical scratchpad (`BUG-0013`).
3606
+ - `/auto` — AI Decision Ledger + Plan Fidelity policy (`US-0103`).
3607
+ - `/sovereign-critic` — Cross-Model Adversarial Critic (`US-0104`).
3608
+ - `/refresh-context` — Sovereign Memory (`US-0105`).
3609
+ - `/auto` — Sovereign Role-Behavior Manifest (`US-0106`).
3610
+ - `/auto` — Sovereign Loop Mode (AUTO_SOVEREIGN) (`US-0107`).
3611
+ - `/execute` — Parallel Instance Arbitrage for dev phase (`US-0108`).
3612
+ - `/auto` — Goal-Based Convergence Loops (`US-0110`).
3613
+ - `/release` — Release-trigger-driven version changelog derivation (`US-0111`).
3614
+ - `/upgrade` — Ship model-catalog example presets on install/upgrade (`US-0112`).
3615
+ - `/sprint-plan` — Explicit `/sprint-plan --bulk` Mode (`US-0046`).
3616
+ - `/sprint-plan` — Sprint Sizing Rules and Configurable Sprint Planning (`US-0022`).
3617
+ - `/story` — Optional Feature User Guide Generation (`US-0032`).
3618
+ - `/uat` — Cursor browser-integrated UAT self-test (browser_smoke + automatable manual UI) (`US-0093`).
3619
+ - `/uat` — UAT Artifact Lifecycle and Ownership (`US-0027`).
3620
+ - `SKILL` scratchpad flag — Skill and Templates (`US-0004`).
3621
+ - `US-0001` scratchpad flag — Core Workflow Commands (`US-0001`).
3622
+
3623
+ ## Walkthrough examples
3624
+
3625
+ ### Example 1: New feature from idea
3626
+
3627
+ 1. `/intake`
3628
+ 2. `/research`
3629
+ 3. `/architecture`
3630
+ 4. `/sprint-plan`
3631
+ 5. `/plan-verify`
3632
+ 6. `/execute`
3633
+ 7. `/qa`
3634
+ 8. `/verify-work`
3635
+ 9. `/release`
3636
+ 10. `/refresh-context`
3637
+
3638
+ ### Example 2: Mid-flight idea change
3639
+
3640
+ 1. Set `AUTO_PAUSE_REQUEST=1`
3641
+ 2. Run `/intake` to update story/acceptance
3642
+ 3. Re-run `/sprint-plan` + `/plan-verify`
3643
+ 4. Resume via `/auto`
3644
+
3645
+ ### Example 3: Pause/resume
3646
+
3647
+ 1. `/pause`
3648
+ 2. Close work
3649
+ 3. `/resume` next session
3650
+
3651
+ ### Deterministic `/auto` continuation
3652
+
3653
+ When resuming mid-process, `/auto` resolves start phase deterministically:
3654
+
3655
+ 1. explicit `/auto start-from=<phase>`
3656
+ 2. `handoffs/resume_brief.md`
3657
+ 3. conservative `docs/engineering/state.md` fallback
3658
+ 4. fail-fast (no guessing)
3659
+
3660
+ Canonical phases:
3661
+ `intake`, `discovery`, `research`, `architecture`, `sprint-plan`,
3662
+ `plan-verify`, `execute`, `qa`, `verify-work`, `release`, `refresh-context`.
3663
+
3664
+ Fail-fast message format:
3665
+ `[AUTO_RESUME_ERROR] <code>: <summary>. Source=<source>. Fix: <action>.`
3666
+
3667
+ Compatibility and safety:
3668
+ - Manual/interactive workflow stays unchanged unless `/auto` continuation is used.
3669
+ - Existing stop conditions remain enforced (decision gate, missing input,
3670
+ pause request, loop max).
3671
+
3672
+ ### Optional `/auto` backlog-drain mode (US-0044)
3673
+
3674
+ If you want `/auto` to continue across multiple planned stories in one run,
3675
+ enable backlog-drain switches in `.cursor/scratchpad.md`:
3676
+
3677
+ - `AUTO_BACKLOG_DRAIN=1`
3678
+ - `AUTO_BACKLOG_MAX_STORIES=<n>`
3679
+ - `AUTO_BACKLOG_ON_BLOCK=stop|skip`
3680
+ - `AUTO_STORY_SELECTION=priority_then_backlog_order`
3681
+
3682
+ Default-safe behavior remains unchanged with `AUTO_BACKLOG_DRAIN=0`.
3683
+
3684
+ ### Explicit `/sprint-plan --bulk` mode (US-0046)
3685
+
3686
+ By default, `/sprint-plan` plans one scope at a time. For multi-story planning,
3687
+ run explicit bulk mode:
3688
+
3689
+ - `/sprint-plan --bulk`
3690
+
3691
+ Bulk planning remains bounded and deterministic via `.cursor/scratchpad.md`:
3692
+
3693
+ - `SPRINT_BULK_MAX_STORIES=<n>`
3694
+ - `SPRINT_BULK_MAX_SPRINTS=<n>`
3695
+ - `SPRINT_BULK_SELECTION=priority_then_backlog_order`
3696
+
3697
+ Bounded stop reason codes:
3698
+ `SPRINT_BULK_MAX_STORIES_REACHED`, `SPRINT_BULK_MAX_SPRINTS_REACHED`,
3699
+ `SPRINT_BULK_NO_ELIGIBLE_STORIES`, `SPRINT_BULK_MISSING_ACCEPTANCE`.
3700
+
3701
+ ### Explicit `/auto --execute-bulk` mode (US-0047)
3702
+
3703
+ Bulk execution is explicit-mode only. Default `/auto` behavior remains unchanged.
3704
+
3705
+ Enable either way:
3706
+
3707
+ - one-run explicit argument: `/auto --execute-bulk`
3708
+ - scratchpad switch: `AUTO_EXECUTE_BULK=1`
3709
+
3710
+ Deterministic controls in `.cursor/scratchpad.md`:
3711
+
3712
+ - `AUTO_EXECUTE_MAX_ITEMS=<n>`
3713
+ - `AUTO_EXECUTE_ON_BLOCK=stop|skip`
3714
+ - `AUTO_EXECUTE_SELECTION=planned_then_priority`
3715
+ - `AUTO_TEAM_SCOPE_ENFORCE=0|1`
3716
+
3717
+ Deterministic reason codes:
3718
+ `EXEC_BULK_MAX_ITEMS_REACHED`, `EXEC_BULK_NO_ELIGIBLE_ITEMS`,
3719
+ `EXEC_BULK_ITEM_BLOCKED_STOP`, `EXEC_BULK_ITEM_BLOCKED_SKIPPED`,
3720
+ `EXEC_TEAM_SCOPE_BLOCKED`, `EXEC_TEAM_SCOPE_SKIPPED`.
3721
+
3722
+ Team-mode safety:
3723
+ - In `TEAM_MODE=1`, bulk execute records `TEAM_MODE`, `TEAM_MEMBER`,
3724
+ `ACTIVE_TASK_IDS` in state breadcrumbs.
3725
+ - With `AUTO_TEAM_SCOPE_ENFORCE=1`, out-of-scope tasks are blocked/skipped
3726
+ deterministically and never mutated.
3727
+
3728
+ ### Example 4: Existing project onboarding
3729
+
3730
+ 1. `/map-codebase`
3731
+ 2. Review generated mapping artifacts
3732
+ 3. Continue with `/intake` or `/architecture`
3733
+
3734
+ ## Other useful capabilities
3735
+
3736
+ ### Voice input (multilingual)
3737
+
3738
+ Voice is an input layer only; it feeds normal slash commands.
3739
+
3740
+ - OS dictation
3741
+ - Cursor voice (if available)
3742
+ - Local STT tooling
3743
+
3744
+ Reliable pattern:
3745
+
3746
+ - bind `/intake ` insertion shortcut
3747
+ - dictate only the content after the command
3748
+
3749
+ ### Repository layout (quick orientation)
3750
+
3751
+ - `.cursor/`: commands, rules, agents, hooks, skills, scratchpad.
3752
+ - `docs/`: product + engineering docs.
3753
+ - `sprints/`: sprint planning/tracking.
3754
+ - `handoffs/`: role-to-role transfers.
3755
+ - `decisions/`: decision records.
3756
+ - `.github/workflows/`: CI/CD templates.
3757
+
3758
+ <!-- readme-feature-coverage-catalog -->
3759
+
3760
+ ### Feature coverage catalog (US-0091)
3761
+
3762
+ - `/evidence` — Backlog-to-Sprint Traceability Contract (`US-0025`).
3763
+ - `/exit` — Milestone Lifecycle Definition and Exit Criteria (`US-0026`).
3764
+ - `/field` — Official Remote Config Template, Docs, and Fail-Fast Validation (`US-0036`).
3765
+ - `/installer` — Runbook Completion (`US-0015`).
3766
+ - `/intake` — Component-Scoped Execution Mode with Protection Guards (`US-0035`).
3767
+ - `/intake` — Configurable Guided Intake Behavior (`US-0033`).
3768
+ - `/map-codebase` — map-codebase does not write codebase-map in fresh repos (`BUG-0002`).
3769
+ - `/memory-audit` — Memory Drift Audit Command (`US-0024`).
3770
+ - `/product` — Canonical Story Status Source + Global Drift Guard (`US-0045`).
3771
+ - `/product` — Clean Install Hygiene and Complete Clean-Repo Coverage (`US-0050`).
3772
+ - `/security-review` — Security & Compliance Review Agent (`US-0028`).
3773
+ - `/skip` — Explicit Bulk Execute Orchestration Mode (`US-0047`).
3774
+ - `/strings` — Clean Placeholder Content from Templates and Active Files (`US-0019`).
3775
+ - `/write` — Artifact Templates and Starter Docs (`US-0006`).
3776
+ - `AUTO_FLOW_MODE` scratchpad flag — Automation Modes (`US-0011`).
3777
+ - `README` scratchpad flag — Voice Input Documentation (`US-0010`).
3778
+ - `TEAM_MODE` scratchpad flag — Team Mode (`US-0013`).
3779
+ - `US-0002` scratchpad flag — AI Behavior Rules (`US-0002`).
3780
+ - `US-0003` scratchpad flag — Subagent Definitions (`US-0003`).
3781
+ - `US-0005` scratchpad flag — Hook System (`US-0005`).
3782
+ - `US-0008` scratchpad flag — CLI Installer (`US-0008`).
3783
+ - `US-0012` scratchpad flag — Benchmark Suite (`US-0012`).
3784
+ - `US-0014` scratchpad flag — Quality Chain (3-Layer) (`US-0014`).
3785
+ - `US-0017` scratchpad flag — Template Drift Guard (`US-0017`).
3786
+
3787
+ ## Developer and release deep-dive
3788
+
3789
+ ### CI/CD via runbook
3790
+
3791
+ Workflows read keys from `docs/engineering/runbook.md`:
3792
+
3793
+ - `TEST_COMMAND`
3794
+ - `LINT_COMMAND`
3795
+ - `TYPECHECK_COMMAND`
3796
+ - `DEPLOY_STAGING_COMMAND`
3797
+ - `DEPLOY_PROD_COMMAND`
3798
+
3799
+ Unset keys are skipped. The template ships with empty values for `LINT_COMMAND`,
3800
+ `FORMAT_COMMAND`, and `TYPECHECK_COMMAND` -- this is intentional. its-magic is a
3801
+ template/installer project; fill in your project-specific commands after setup.
3802
+
3803
+ US-0015 intent contract:
3804
+ - Empty optional runbook keys are valid defaults for this repository type.
3805
+ - They must not be treated as missing required configuration.
3806
+
3807
+ ### Installer internals
3808
+
3809
+ - `installer.ps1` (Windows)
3810
+ - `installer.sh` (macOS/Linux)
3811
+ - `installer.py` (fallback)
3812
+
3813
+ Modes: `missing`, `overwrite`, `interactive`, `upgrade` (+ optional backup).
3814
+
3815
+ ### Release automation
3816
+
3817
+ Unified release scripts:
3818
+
3819
+ - Windows: `scripts/release-all.ps1`
3820
+ - macOS/Linux: `scripts/release-all.sh`
3821
+
3822
+ NPM helpers:
3823
+
3824
+ - `npm run release:all`
3825
+ - `npm run release:all:patch|minor|major|beta|dry`
3826
+ - `npm run release:npm-only|choco-only|brew-only`
3827
+
3828
+ Release script flow:
3829
+
3830
+ 1. bump `package.json` version
3831
+ 2. publish npm
3832
+ 3. create GitHub release
3833
+ 4. update/publish Chocolatey package
3834
+ 5. update/push Homebrew formula (stable or beta)
3835
+
3836
+ ```mermaid
3837
+ flowchart LR
3838
+ ReleaseAll[scripts/release-all.*] --> VerCheck{version has -?}
3839
+ VerCheck -->|stable| NPM["npm publish --tag latest"]
3840
+ VerCheck -->|prerelease| NPMBeta["npm publish --tag beta"]
3841
+ ReleaseAll --> GH["gh release create"]
3842
+ VerCheck -->|prerelease| GHPre["--prerelease flag"]
3843
+ GH --> Choco[choco pack + push]
3844
+ GH --> BrewCheck{prerelease?}
3845
+ BrewCheck -->|no| BrewStable[its-magic.rb]
3846
+ BrewCheck -->|yes| BrewBeta[its-magic-beta.rb]
3847
+ NPM --> U1["npx its-magic"]
3848
+ NPMBeta --> U1b["npx its-magic@beta"]
3849
+ Choco --> U2["choco install its-magic"]
3850
+ Choco --> U2b["choco install its-magic --pre"]
3851
+ BrewStable --> U3["brew install its-magic"]
3852
+ BrewBeta --> U3b["brew install its-magic-beta"]
3853
+ ```
3854
+
3855
+ Prereqs:
3856
+
3857
+ - `npm login`
3858
+ - `gh auth login`
3859
+ - Chocolatey API key (if choco publish)
3860
+ - Homebrew tap repo for formula distribution
3861
+
3862
+ ### Package manager installation matrix
3863
+
3864
+ | Manager | Stable | Beta / Pre-release |
3865
+ |------------|-------------------------------------------|---------------------------------------------|
3866
+ | npm/npx | `npx its-magic --target . --mode missing` | `npx its-magic@beta --target . --mode missing` |
3867
+ | Chocolatey | `choco install its-magic` | `choco install its-magic --pre` |
3868
+ | Homebrew | `brew install USER/tap/its-magic` | `brew install USER/tap/its-magic-beta` |
3869
+
3870
+ ### Release package contents
3871
+
3872
+ Published npm package includes runtime content only (commands/rules/agents/docs/installers).
3873
+
3874
+ Excluded from npm package:
3875
+
3876
+ - `benchmarks/`
3877
+ - `tests/`
3878
+ - `packaging/`
3879
+ - `Plan.md`
3880
+
3881
+ ### Benchmarks
3882
+
3883
+ - Main benchmark: `benchmarks/run-bench.ps1` or `benchmarks/run-bench.sh`
3884
+ - Live benchmark: `benchmarks/live/run-live-bench.*`
3885
+ - Prompted benchmark: `benchmarks/prompts/run-prompts.*`
3886
+ - Headless benchmark: `benchmarks/headless/run-headless.*`
3887
+
3888
+ Reports:
3889
+
3890
+ - `benchmarks/bench-report.md`
3891
+ - `benchmarks/live/live-bench-report.md`
3892
+ - `benchmarks/headless/headless-report.md`
3893
+ - `benchmarks/headless/protocol.md`
3894
+
3895
+ ```mermaid
3896
+ flowchart TD
3897
+ StartBench[Start benchmark] --> SelectScenario[Load scenarios]
3898
+ SelectScenario --> InstallKit[Install its-magic into temp workspace]
3899
+ InstallKit --> RunChecks[Validate required files/sections]
3900
+ RunChecks --> BenchReport[Write benchmarks/bench-report.md]
3901
+ ```
3902
+
3903
+ ```mermaid
3904
+ flowchart TD
3905
+ StartLive[Start live benchmark] --> SetSession[Set MAGIC_BENCH_SESSION]
3906
+ SetSession --> RunCommands[Run /* commands in Cursor]
3907
+ RunCommands --> LogHooks[Hook telemetry to bench-log.jsonl]
3908
+ LogHooks --> LiveReport[Write live-bench-report.md]
3909
+ ```
3910
+
3911
+ ```mermaid
3912
+ flowchart TD
3913
+ StartHeadless[Start headless run] --> LoadPrompt[Load prompt blocks]
3914
+ LoadPrompt --> TempWorkspace[Create temp workspace]
3915
+ TempWorkspace --> InstallHeadless[Install its-magic]
3916
+ InstallHeadless --> RunAgent[agent -p --force for each step]
3917
+ RunAgent --> ValidateOutputs[Validate files/sections/smoke checks]
3918
+ ValidateOutputs --> WriteProtocol[Write protocol.md]
3919
+ WriteProtocol --> WriteHeadlessReport[Write headless-report.md]
3920
+ ```
3921
+
3922
+ ### Rules
3923
+
3924
+ - `core.mdc`: phase flow, context pack, pause/resume, remote usage.
3925
+ - `quality.mdc`: small steps, tests/quality, optional auto-install.
3926
+ - `coding-standards.mdc`: strict language best practices and code quality rules.
3927
+ - `handoffs.mdc`: handoffs + state updates required.
3928
+ - `escalation.mdc`: decision gate and stop conditions.
3929
+
3930
+ ### Hooks
3931
+
3932
+ - `beforeShellExecution`: blocks dangerous commands.
3933
+ - `beforeReadFile`: warns on secret-like files.
3934
+ - `afterFileEdit`: tracks code edits vs context refresh.
3935
+ - `stop`: reminds context refresh when needed.
3936
+
3937
+ ### Artifacts (single source of truth)
3938
+
3939
+ - `docs/product/*`: vision, backlog, acceptance.
3940
+ - `docs/engineering/*`: architecture, decisions, state, runbook.
3941
+ - `sprints/Sxxxx/*`: sprint scope, tasks, progress, QA findings, summary.
3942
+ - `decisions/*`: decision records.
3943
+ - `handoffs/*`: role-to-role transfer notes.
3944
+
3945
+ ## Purpose
3946
+
3947
+ This repository publishes the **its-magic** workflow kit: commands, rules, skills, and
3948
+ documentation templates that teams install into their own repositories. The goal is a
3949
+ repeatable, file-backed lifecycle from intake through release.
3950
+
3951
+ ## Quickstart
3952
+
3953
+ Use [Setup](#setup) for install commands. First-time install:
3954
+
3955
+ ```bash
3956
+ npx its-magic --target . --mode missing --create
3957
+ ```
3958
+
3959
+ ## Examples
3960
+
3961
+ - Upgrade an existing repo: `its-magic --target . --mode upgrade`
3962
+ - Run check-in tests: use `TEST_COMMAND` from `docs/engineering/runbook.md` (often `sh tests/run-tests.sh`).
3963
+
3964
+ ## Related documentation
3965
+
3966
+ - Operator commands and gates: `docs/engineering/runbook.md`
3967
+ - Architecture and story contracts: `docs/engineering/architecture.md`
3968
+ - Product backlog and acceptance: `docs/product/backlog.md`, `docs/product/acceptance.md`
3969
+ - Optional spec-pack mode (`SPEC_PACK_MODE=1`): engineering design artifacts under `docs/engineering/` when your team enables it
3970
+ - Optional user guides (`USER_GUIDE_MODE=1`): `docs/user-guides/` when enabled
3971
+
3972
+ ## Limitations
3973
+
3974
+ - its-magic is a **process and documentation** framework; it does not replace your
3975
+ application runtime, hosting, or product-specific compliance work.
3976
+ - Mixed files such as `README.md` are preserved on upgrade; review notices may appear when
3977
+ the template adds new sections.
3978
+ - Documentation profile validation (`scripts/validate_doc_profile.py`) enforces audience and
3979
+ depth choices from the merged scratchpad (`DOC_AUDIENCE_PROFILE`, `DOC_DETAIL_LEVEL`).
3980
+
3981
+ ## Contributing
3982
+
3983
+ Contributor-focused workflow and guardrails live in
3984
+ [`docs/developer/README.md`](docs/developer/README.md).