its-magic 0.1.2-55 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/scripts/check_intake_template_parity.py +96 -0
  3. package/template/.cursor/commands/architecture.md +4 -0
  4. package/template/.cursor/commands/auto.md +110 -15
  5. package/template/.cursor/commands/discovery.md +4 -0
  6. package/template/.cursor/commands/execute.md +343 -291
  7. package/template/.cursor/commands/intake.md +4 -0
  8. package/template/.cursor/commands/map-codebase.md +4 -0
  9. package/template/.cursor/commands/memory-audit.md +4 -0
  10. package/template/.cursor/commands/milestone-complete.md +4 -0
  11. package/template/.cursor/commands/milestone-start.md +4 -0
  12. package/template/.cursor/commands/pause.md +4 -0
  13. package/template/.cursor/commands/phase-context.md +4 -0
  14. package/template/.cursor/commands/plan-verify.md +4 -0
  15. package/template/.cursor/commands/qa.md +226 -222
  16. package/template/.cursor/commands/quick.md +13 -0
  17. package/template/.cursor/commands/refresh-context.md +4 -0
  18. package/template/.cursor/commands/release.md +505 -487
  19. package/template/.cursor/commands/research.md +4 -0
  20. package/template/.cursor/commands/resume.md +4 -0
  21. package/template/.cursor/commands/security-review.md +4 -0
  22. package/template/.cursor/commands/sprint-plan.md +4 -0
  23. package/template/.cursor/commands/status-reconcile.md +4 -0
  24. package/template/.cursor/commands/verify-work.md +4 -0
  25. package/template/.cursor/dev-environment.json.example +22 -0
  26. package/template/.cursor/scratchpad.local.example.md +40 -3
  27. package/template/.cursor/scratchpad.md +324 -262
  28. package/template/.cursorignore +1 -0
  29. package/template/docs/engineering/auto-orchestration-reference.md +121 -14
  30. package/template/docs/engineering/context/installer-owned-paths.manifest +4 -1
  31. package/template/docs/engineering/runbook.md +207 -4
  32. package/template/scripts/check_intake_template_parity.py +96 -0
  33. package/template/scripts/dev_environment_lib.py +463 -0
  34. package/template/scripts/pack_json_validate.py +130 -0
  35. package/template/scripts/project_readme_coverage_lib.py +417 -0
  36. package/template/scripts/readme_feature_coverage_lib.py +2 -2
  37. package/template/scripts/validate_project_readme_coverage.py +151 -0
@@ -743,10 +743,13 @@ requires it.
743
743
 
744
744
  ### Outer-driver equivalence (AC-1, Option B)
745
745
 
746
- When a single Cursor `/auto` invocation cannot schedule multiple fresh subagent
747
- turns (product/runtime constraint), a **documented outer driver** (operator
748
- script or manual re-invocation with `start-from` / refreshed `resume_brief`) is
749
- **deterministically equivalent** provided all of the following hold:
746
+ **native chain supersedes Option B** under **`AUTO_FLOW_MODE=full_autonomy`** + IDE + Task
747
+ available native in-chat chain is **primary**. When a single Cursor `/auto` invocation
748
+ cannot schedule multiple fresh subagent turns (product/runtime constraint), a **documented
749
+ outer driver** (operator script or manual re-invocation with `start-from` / refreshed
750
+ `resume_brief`) is **deterministically equivalent** (**fallback only** — applies when
751
+ **`NATIVE_CHAIN_UNAVAILABLE`** or headless/CI/`--invoke-cmd` context) provided all of the
752
+ following hold:
750
753
 
751
754
  - Same intersected phase order as a single-invocation run.
752
755
  - Same per-phase isolation evidence (**DEC-0029**) + strict-proof attestation
@@ -766,7 +769,7 @@ script or manual re-invocation with `start-from` / refreshed `resume_brief`) is
766
769
  | `AUTO_PAUSE_REQUEST` / `pause` | **Stop** at safe boundary | **Always** (non-suppressible) |
767
770
  | `AUTO_LOOP_MAX_CYCLES` / `loop_max` | **Stop** | **Always** (non-suppressible) |
768
771
  | `blocked` (sync/scope gate) | **Stop** | **Always** (non-suppressible) |
769
- | US lifecycle DONE / sprint segment complete | **Stop** segment; `AUTO_BACKLOG_DRAIN=1` may advance to next OPEN story (recompute phase plan — **Step 5**) | Notify on segment handoff (non-routine) |
772
+ | US lifecycle DONE / sprint segment complete | **IDE `full_autonomy`**: orchestrator **must** drain-advance in-chat (no operator re-`/auto`). **Other modes / fallback**: stop segment; `AUTO_BACKLOG_DRAIN=1` may advance (recompute phase plan — **Step 5**) | Notify on segment handoff (non-routine) |
770
773
  | `BACKLOG_MAX_STORIES_REACHED` | **Stop** | **Always** (non-suppressible) |
771
774
 
772
775
  `stop_reason` vocabulary: `completed`, `decision_gate`, `missing_input`,
@@ -780,7 +783,7 @@ script or manual re-invocation with `start-from` / refreshed `resume_brief`) is
780
783
 
781
784
  | Condition | US-0088 | `full_autonomy` delta | Operator notify |
782
785
  |-----------|---------|------------------------|-----------------|
783
- | Next phase, no hard stop | Continue inner `/auto` | Outer driver **re-invokes** when Cursor ends turn early | Quiet OK when `AUTO_QUIET=1` |
786
+ | Next phase, no hard stop | Continue inner `/auto` | Native chain continues in-chat; outer driver **re-invokes** only on **`NATIVE_CHAIN_UNAVAILABLE`** / headless **fallback** | Quiet OK when `AUTO_QUIET=1` |
784
787
  | `decision_gate` | Hard stop | **No change — hard** | Always |
785
788
  | Unrecoverable `error` | Hard stop | **No change — hard** | Always |
786
789
  | Critical `missing_input` | Hard stop | **No change — hard** | Always |
@@ -790,7 +793,7 @@ script or manual re-invocation with `start-from` / refreshed `resume_brief`) is
790
793
  | `blocked` — transient/sync | Hard stop | **Relaxable** when recoverable | Notify on cap |
791
794
  | `blocked` — isolation/strict-proof/ownership | Hard stop | **No change — hard** | Always |
792
795
  | UAT/QA fail | Hard stop (operator) | **Relaxable** when `AUTO_IMPLEMENTATION_LOOP=1` | Notify on cap |
793
- | Segment complete + `AUTO_BACKLOG_DRAIN=1` | Advance (may need manual re-`/auto`) | **Drain-advance-without-pause** — immediate next item | Segment handoff notify |
796
+ | Segment complete + `AUTO_BACKLOG_DRAIN=1` | Advance (may need manual re-`/auto` in non-native modes) | **Drain-advance-without-pause** — immediate in-chat continuation; **no** operator re-`/auto` | Segment handoff notify |
794
797
  | `BACKLOG_MAX_STORIES_REACHED` | Hard stop | **No change — hard** | Always |
795
798
  | `AUTO_SCHEDULER_CONFLICT` | Hard stop | **No change — hard** | Always |
796
799
  | `RELEASE_PUBLISH_MODE=auto` | Explicit opt-in | **No change — hard default-off** | Always on publish |
@@ -810,7 +813,8 @@ verify → caps → branch. **`NATIVE_CHAIN_UNAVAILABLE`** when Task tool denied
810
813
  depth limit hit — hard stop for native path; suggest outer driver as **optional** fallback.
811
814
 
812
815
  **Activation gate**: `full_autonomy` + IDE context + Task tool → set **`native_chain_active=true`**
813
- in `state.md` boundary.
816
+ in `state.md` boundary. Set **`native_chain_continuing=true`** when orchestrator scheduled
817
+ next spawn/advance **this** boundary.
814
818
 
815
819
  **Spawn-only invariants** (**BUG-0006**): orchestrator schedules phase-role subagents only;
816
820
  each phase completes via fresh spawn + artifacts; no in-band phase work.
@@ -833,8 +837,16 @@ enabled (**`AUTO_BACKLOG_DRAIN=1`** or bug-queue per **US-0087** mutex); budget
833
837
  | **6** | **APPEND** `state.md` materialization breadcrumb for new segment |
834
838
  | **7** | **IMMEDIATELY** spawn first phase subagent — **without operator re-`/auto`**, **no** mandatory outer-driver instruction |
835
839
 
840
+ **Between steps 6 and 7** (no operator stop): orchestrator **must not** emit operator wait
841
+ instructions, set **`stop_reason=completed (segment exhausted)`** when drain budget > 0 and
842
+ eligible OPEN item exists, or skip Task-spawn for step **7**. Attest
843
+ **`drain_advance_action=spawned|skipped|not_applicable`** on `state.md` phase boundary;
844
+ **`skipped`** when budget > 0 + OPEN item exists is **invalid** (regression).
845
+
836
846
  **DEC-0069 pairing mandate**: every phase boundary and drain advance **must** refresh
837
- **`resume_brief`** + **`state.md`** before scheduling in-chat continuation.
847
+ **`resume_brief`** + **`state.md`** before scheduling in-chat continuation. Orchestrator
848
+ **MUST Task-spawn** next phase — **`/auto`** is orchestrator context label, not operator
849
+ re-invocation instruction.
838
850
 
839
851
  ### Native-chain stop matrix (US-0095)
840
852
 
@@ -882,7 +894,9 @@ no secrets. IDE native chain and outer driver **share one accounting model**:
882
894
 
883
895
  | Field | Semantics |
884
896
  |-------|-----------|
885
- | **`native_chain_active`** | `true` when IDE native chain is driving continuation |
897
+ | **`native_chain_active`** | `true` when IDE native chain is driving continuation (gate eligibility) |
898
+ | **`native_chain_continuing`** | `true` when orchestrator scheduled next spawn/advance **this** boundary |
899
+ | **`drain_advance_action`** | `spawned` \| `skipped` \| `not_applicable` — step 7 outcome at segment boundary |
886
900
  | **`outer_cycle_index`** | Continuation cycles this run (int ≥ 0) |
887
901
  | **`implementation_loop_index`** | Inner remediation cycles for current story segment (int ≥ 0) |
888
902
 
@@ -945,9 +959,101 @@ conditions the script is a no-op and the fail-closed reason codes from
945
959
  `test_caveman_compress_input_*` subtests in
946
960
  `tests/auto_command_contract_test.py` (**DEC-0073** §11).
947
961
 
962
+ ### `DELIVERY_MODE` × `TOKEN_PROFILE` × `CAVEMAN_MODE` non-substitution (US-0096 / DEC-0082 §1)
963
+
964
+ > **`DELIVERY_MODE`** controls lifecycle shape and artifact surfaces only. **`TOKEN_PROFILE`** controls context breadth / token cost only (**DEC-0062**). **`CAVEMAN_MODE`** controls reply voice only (**DEC-0072**). None substitutes for another.
965
+
966
+ Scratchpad keys: **`DELIVERY_MODE`** (`standard` | `ultra_lean` | `mega_quick`, default **`standard`**);
967
+ **`LEAN_MEMORY_READ`**, **`LEAN_MEMORY_WRITE`**, **`LEAN_COLD_READ_MAX_SECTIONS`** (default **4**),
968
+ **`LEAN_STATE_INDEX_ROWS`** (default **80**), **`AUTO_DELIVERY_ROUTING`**
969
+ (`scratchpad_only` | `backlog_then_scratchpad`, default **`scratchpad_only`**).
970
+
971
+ ### Mode-scoped delivery resolver — step 0 (US-0096 / DEC-0082)
972
+
973
+ **Before** **DEC-0052** pipeline, **resolve_delivery_mode**: argv `delivery-mode=` → backlog row
974
+ `delivery_mode` (when **`AUTO_DELIVERY_ROUTING=backlog_then_scratchpad`**) → scratchpad
975
+ **`DELIVERY_MODE`** → **`standard`**.
976
+
977
+ | `delivery_mode` | `resolved_phase_plan` | `reinstatement_mode` | `memory_layer` |
978
+ |-----------------|----------------------|---------------------|----------------|
979
+ | `standard` | Full **DEC-0052** chain | `dec0052_default` | `standard` |
980
+ | `ultra_lean` | `[spec, plan, build+verify, ship]` | `none` | `pack` |
981
+ | `mega_quick` | `[quick]` when eligible | `none` | `quick` |
982
+
983
+ **reinstatement applies only when delivery_mode=standard**. **`AUTO_PHASE_*`** applies **only**
984
+ when `delivery_mode=standard`; non-standard + non-default **`AUTO_PHASE_*`** →
985
+ **`PHASE_POLICY_CONFLICT`**. **`DELIVERY_MODE_SWITCH_MID_STORY`**: fail closed.
986
+
987
+ Breadcrumbs: **`delivery_mode`**, **`resolved_phase_plan`**, **`reinstatement_mode`**, **`memory_layer`**.
988
+
989
+ #### `ultra_lean` macro-phases
990
+
991
+ | Macro | Merged phases | Role |
992
+ |-------|---------------|------|
993
+ | **`spec`** | intake + discovery | **po** |
994
+ | **`plan`** | research + architecture + sprint-plan | **tech-lead** |
995
+ | **`build+verify`** | execute + qa + verify-work | **dev** / **qa** |
996
+ | **`ship`** | release + refresh-context | **release** / **curator** |
997
+
998
+ **`AUTO_IMPLEMENTATION_LOOP`** preserved inside **`build+verify`**. No eleven-phase reinstatement.
999
+
1000
+ #### `mega_quick` eligibility
1001
+
1002
+ Fail-closed codes: **`MEGA_QUICK_BUG_SEGMENT`**, **`MEGA_QUICK_AC_TOO_BROAD`**,
1003
+ **`MEGA_QUICK_ARCHITECTURE_REQUIRED`**, **`MEGA_QUICK_SPRINT_EXISTS`**,
1004
+ **`MEGA_QUICK_STORY_OVERRIDE`**, **`MEGA_QUICK_MULTI_COMPONENT`**, **`MEGA_QUICK_GATE_ESCALATION`**.
1005
+ Ineligible → **`DELIVERY_MODE_INELIGIBLE`** + specific code.
1006
+
1007
+ ### Layered memory tiers (US-0096 / DEC-0082 §5)
1008
+
1009
+ | Tier | Path | Triad? | Cap |
1010
+ |------|------|--------|-----|
1011
+ | Hot | **`handoffs/active-context.md`** | **No** | **`LEAN_STATE_INDEX_ROWS`** (default **80**) |
1012
+ | Warm | **`work/<story_id>/pack.json`** | n/a | **16 KiB** soft |
1013
+ | Cold | vision / architecture / decisions sections | n/a | **`LEAN_COLD_READ_MAX_SECTIONS`** (default **4**) |
1014
+
1015
+ **`active-context.md` is NOT a triad member** — **`enforce-triad-hot-surface.py`** does not scan it.
1016
+ Oversize with **`LEAN_MEMORY_WRITE=1`** → **`ACTIVE_CONTEXT_OVERSIZE`**.
1017
+
1018
+ **`pack.json` schema v1** — validator **`scripts/pack_json_validate.py`**; reason codes **`PACK_*`**.
1019
+ Required: **`schema_version`** (`"1"`), **`story_id`**, **`delivery_mode`**, **`status`**, **`ac[]`**,
1020
+ **`tasks[]`**, **`refs[]`**, **`deltas[]`**, **`memory_layer`** (`"pack"`).
1021
+
1022
+ | Mode | Authoritative tasks surface |
1023
+ |------|----------------------------|
1024
+ | `standard` | **`sprints/Sxxxx/tasks.md`** |
1025
+ | `ultra_lean` | **`work/US-xxxx/pack.json`** `tasks[]` |
1026
+ | `mega_quick` | **`sprints/quick/Qxxxx/task.json`** |
1027
+
1028
+ ### Quality floor + lean memory gates (US-0096 / DEC-0082 §8–§9)
1029
+
1030
+ All lean modes: tests before stop; AC traceability in pack/task.json; new patterns →
1031
+ architecture/decision delta; **`active-context.md`** updated on material learnings; no secrets/publish
1032
+ bypass. **`LEAN_MEMORY_READ=0`** or **`LEAN_MEMORY_WRITE=0`** on **`ultra_lean`** spawn →
1033
+ **`LEAN_MEMORY_DISABLED`** (fail closed).
1034
+
1035
+ ### Run-class extension (US-0096 / DEC-0082 §9 — amends DEC-0062)
1036
+
1037
+ Sorted JSON run-class object **must** include **`delivery_mode`**. Evidence rows in
1038
+ **`handoffs/token_cost_runs/<orchestrator_run_id>.md`** **must** include **`delivery_mode`** column.
1039
+ **`ultra_lean`** vs **`standard`** same story → **`TOKEN_COST_RUN_CLASS_MISMATCH`**.
1040
+
1041
+ ### Dev environment auto-launch profile (US-0098 / DEC-0084)
1042
+
1043
+ **`DEV_AUTO_LAUNCH_PROFILE`** (`off` | `deterministic_v1`, default **`off`**) gates execute step **24**
1044
+ — zero overhead when **`off`**. Orthogonal to **`AUTO_REMOTE_AUTOMATION_PROFILE`** (**US-0086**):
1045
+ when both **`deterministic_v1`**, **US-0086** remote target resolution (**`docker`** / **`ssh`**) wins
1046
+ over **`docker-host-local`**. Persisted profile at **`.cursor/dev-environment.json`** (names-only
1047
+ **`*Env`** refs in **`connect`**); **no** **`release-targets.json`** schema change (**US-0064**
1048
+ unchanged). **US-0085** inheritance: helper and step **24** never read **`.env`**. **`DEV_SERVER_*`**
1049
+ scratchpad keys compose with **`local`** detection. Fail closed → **`DEV_ENV_DETECT_AMBIGUOUS`**
1050
+ when stack cannot be resolved. Connect block fields align with
1051
+ **`docs/engineering/runtime-connectivity.md`** operator summary template.
1052
+
948
1053
  ## Steps
949
- 1. Read automation flags from merged scratchpad and **materialize the resolved
950
- phase plan** per **Configurable phase selection policy (US-0070 / DEC-0052)**:
1054
+ 1. **resolve_delivery_mode** (step 0 **US-0096 / DEC-0082**) then read automation flags from
1055
+ merged scratchpad and **materialize the resolved phase plan** per mode + **Configurable phase
1056
+ selection policy (US-0070 / DEC-0052)** when `delivery_mode=standard`:
951
1057
  detect exactly-one policy mode, expand, apply non-skippable reinstatement,
952
1058
  validate tokens/profile/ack requirements, and append plan breadcrumbs
953
1059
  (`phase_policy_mode`, `resolved_phase_plan`, `skipped_phases` + reasons) to
@@ -986,8 +1092,9 @@ conditions the script is a no-op and the fail-closed reason codes from
986
1092
  **deterministic stop condition** fires (see **Deterministic stop matrix
987
1093
  (US-0088)** above). The orchestrator does **not** stop after a single phase
988
1094
  spawn unless the stop matrix requires it; outer-driver equivalence applies
989
- when native chain is unavailable or a single invocation cannot schedule
990
- multiple subagent turns (see **Outer-driver equivalence (AC-1, Option B)** above):
1095
+ when **`NATIVE_CHAIN_UNAVAILABLE`**, headless/CI, or `--invoke-cmd` prevents in-chat
1096
+ scheduling (see **Outer-driver equivalence (AC-1, Option B)** above — **fallback only**;
1097
+ **native chain supersedes Option B** in IDE **`full_autonomy`**):
991
1098
  default full path:
992
1099
  intake -> discovery -> research -> architecture -> sprint plan ->
993
1100
  plan verify -> execute -> QA -> verify work -> release -> refresh context.
@@ -38,8 +38,9 @@ scripts/check_downstream_ci_guard.py
38
38
  scripts/downstream_ci_guard_lib.py
39
39
  scripts/auto_outer_driver.py
40
40
  scripts/uat_probe_lib.py
41
+ scripts/project_readme_coverage_lib.py
42
+ scripts/validate_project_readme_coverage.py
41
43
  .github/workflows
42
- README.md
43
44
  its_magic
44
45
 
45
46
  [clean_paths]
@@ -71,6 +72,8 @@ scripts/check_downstream_ci_guard.py
71
72
  scripts/downstream_ci_guard_lib.py
72
73
  scripts/auto_outer_driver.py
73
74
  scripts/uat_probe_lib.py
75
+ scripts/project_readme_coverage_lib.py
76
+ scripts/validate_project_readme_coverage.py
74
77
  .github/workflows/ci.yml
75
78
  .github/workflows/deploy.yml
76
79
  its_magic
@@ -128,16 +128,17 @@ Normative H2 titles and matrix: `docs/engineering/architecture.md` (`# US-0077`)
128
128
  ## README feature coverage validation (US-0091 / DEC-0074)
129
129
 
130
130
  **Goal:** ensure every DONE user-visible backlog item (`US-xxxx` / `BUG-xxxx` with
131
- `user_visible: true`) has operator blurbs in root `README.md` and traceability rows in
132
- `docs/developer/README.md`, without inventing new `USER_*` / `DEV_*` H2 literals
133
- (**DEC-0059** composes; **US-0030** delta gate unchanged).
131
+ `user_visible: true`) has operator blurbs in **`its_magic/README.md`** (framework catalog)
132
+ and traceability rows in `docs/developer/README.md`, without inventing new `USER_*` / `DEV_*`
133
+ H2 literals (**DEC-0059** composes; **US-0030** delta gate unchanged). Consumer root
134
+ `README.md` is **out of scope** for this gate — see **US-0097** / **DEC-0083**.
134
135
 
135
136
  ### Delta vs static doc gates
136
137
 
137
138
  | Gate | Question | Remediation |
138
139
  |------|----------|-------------|
139
140
  | **US-0030** (delta) | Did this sprint change commands/flags without README/runbook updates? | Update command docs for changed surfaces; agent checklist in `/release` step 3 family. |
140
- | **US-0091** (static) | Is every DONE user-visible item documented in the README family? | Backfill root + DEV shard; set `user_visible:` marker; run validator `--report`. |
141
+ | **US-0091** (static) | Is every DONE user-visible item documented in the framework README family? | Backfill **`its_magic/README.md`** + DEV shard; set `user_visible:` marker; run validator `--report`. |
141
142
 
142
143
  ### Scratchpad key
143
144
 
@@ -167,6 +168,120 @@ Reason codes: `README_FEATURE_COVERAGE_BLOCKED`, `README_FEATURE_COVERAGE_GAP:<i
167
168
  Normative predicate + affinity manifest: `decisions/DEC-0074.md`,
168
169
  `docs/engineering/context/readme-section-affinity.json`.
169
170
 
171
+ ## Project README coverage validation (US-0097 / DEC-0083)
172
+
173
+ **Goal:** ensure project-owned root `README.md` has a bootstrap scaffold and growing
174
+ feature catalog under `<!-- project-readme-feature-catalog -->` for every DONE
175
+ `user_visible: true` backlog item. Framework catalog remains in **`its_magic/README.md`**
176
+ (**US-0091** gate **3f** — independent from project gate **3g**).
177
+
178
+ ### Placeholder sentinels S1–S5
179
+
180
+ | Signal | Detection rule | Verdict |
181
+ |--------|----------------|---------|
182
+ | **S1** | H1 `# its-magic — AI dev team` | placeholder |
183
+ | **S2** | `<!-- readme-feature-coverage-catalog -->` | placeholder |
184
+ | **S3** | Heading `Feature coverage catalog (US-0091)` | placeholder |
185
+ | **S4** | Byte-identical to `template/README.md` | placeholder |
186
+ | **S5** | None of S1–S4 + custom title/purpose | **operator-authored** — preserve |
187
+
188
+ **Detection order**: `FRAMEWORK_KIT_REPO=1` → S1–S4 → S5. Hybrid roots fail closed with
189
+ `PROJECT_README_MIGRATION_AMBIGUOUS` or `PROJECT_README_SENTINEL_CONFLICT`.
190
+
191
+ ### Migration algorithm M1–M5
192
+
193
+ | Step | Condition | Action |
194
+ |------|-----------|--------|
195
+ | **M1** | `FRAMEWORK_KIT_REPO=1` | Skip consumer migration |
196
+ | **M2** | Root **S5** | Preserve root; copy to **`its_magic/README.md`** if missing |
197
+ | **M3** | Root **S1–S4**, **`its_magic/`** missing | Lift root → **`its_magic/README.md`** |
198
+ | **M4** | Root **S1–S4** after **M3** | Replace root with project scaffold |
199
+ | **M5** | Hybrid / ambiguous | Fail closed |
200
+
201
+ ### Scratchpad keys
202
+
203
+ - `PROJECT_README_ENFORCE`: `0` \| `1` (default `1` post-bootstrap).
204
+ - `FRAMEWORK_KIT_REPO`: `0` \| `1` (default `0`; consumer repos never `1`).
205
+
206
+ **Grandfathering:** set `PROJECT_README_ENFORCE=0` during migration; flip to `1` when
207
+ `validate_project_readme_coverage.py --report` shows `coverage_missing: []`.
208
+
209
+ ### Commands
210
+
211
+ ```bash
212
+ python scripts/validate_project_readme_coverage.py --self-test
213
+ python scripts/validate_project_readme_coverage.py --repo . --report
214
+ python scripts/validate_project_readme_coverage.py --repo . --audit-out docs/engineering/context/project-readme-coverage-audit.json
215
+ python scripts/validate_project_readme_coverage.py --repo . --enforce
216
+ python scripts/check_intake_template_parity.py --scope=project-readme
217
+ ```
218
+
219
+ Reason codes: `PROJECT_README_COVERAGE_BLOCKED`, `PROJECT_README_COVERAGE_GAP:<id>`,
220
+ `PROJECT_README_DELTA_SKIPPED`, `PROJECT_README_BOOTSTRAP_SKIPPED`,
221
+ `PROJECT_README_MIGRATION_AMBIGUOUS`, `PROJECT_README_SENTINEL_CONFLICT`,
222
+ `PROJECT_README_PLACEHOLDER_UNRESOLVED`, `PROJECT_README_ENFORCE_SKIPPED`,
223
+ `PROJECT_README_INPUT_INVALID`.
224
+
225
+ ### Operator recipes (US-0097)
226
+
227
+ | Scenario | Operator action |
228
+ |----------|-----------------|
229
+ | Fresh consumer repo | First **`/execute`** bootstraps project README; framework catalog in **`its_magic/`** |
230
+ | Legacy framework root README | Run **`upgrade`** — migration **M3**/**M4** lifts to **`its_magic/`** + project scaffold |
231
+ | Operator-authored root (S5) | Migration preserves root; adds **`its_magic/README.md`** if missing |
232
+ | Hybrid / ambiguous root | Fix manually per **`PROJECT_README_MIGRATION_AMBIGUOUS`** — remove mixed sentinel + custom prose |
233
+ | Migration window | Set **`PROJECT_README_ENFORCE=0`**; backfill catalog bullets; flip to **`1`** when **`--report`** clean |
234
+ | Kit repo dogfooding | Set **`FRAMEWORK_KIT_REPO=1`** — skip consumer bootstrap (**23a**/**23b**) and project validator root check |
235
+
236
+ **Troubleshooting:** `PROJECT_README_COVERAGE_BLOCKED` at release **3g** → run `--report`,
237
+ backfill missing `US-xxxx` bullets under `<!-- project-readme-feature-catalog -->`.
238
+ `PROJECT_README_MIGRATION_AMBIGUOUS` → split framework content to **`its_magic/README.md`**
239
+ manually, then re-run migration. Implementation tranche order: A (installer + migration) →
240
+ B (bootstrap) → C (execute **23** + release **3g** + scratchpad) → D (validators + tests).
241
+
242
+ Normative contract: `decisions/DEC-0083.md`, `docs/engineering/architecture.md` `# US-0097`.
243
+
244
+ ## Dev environment auto-launch (US-0098 / DEC-0084)
245
+
246
+ **Goal:** execute-phase bounded rebuild/restart of dev stacks plus **Connect** surfacing after
247
+ implementation changes — distinct from **US-0065** phase QA, **US-0086** test routing, and
248
+ **US-0067** release hints. Default-off scratchpad gate; **no** `.env` reads (**US-0085**).
249
+
250
+ ### Operator recipes
251
+
252
+ | Scenario | Operator action |
253
+ |----------|-----------------|
254
+ | Enable dev auto-launch | Set **`DEV_AUTO_LAUNCH_PROFILE=deterministic_v1`** in scratchpad |
255
+ | Seed profile | Copy **`template/.cursor/dev-environment.json.example`** → **`.cursor/dev-environment.json`**; set compose **`service`** + **`*Env`** connect refs |
256
+ | Force relaunch | Send exact phrase **`refresh dev environment`** (case-sensitive whole phrase) |
257
+ | Profile off / manual mode | Leave **`DEV_AUTO_LAUNCH_PROFILE=off`** (default) — execute step **24** zero overhead |
258
+ | Ambiguous stack | Fix compose path or seed profile; remediate **`DEV_ENV_DETECT_AMBIGUOUS`** |
259
+ | Remote + local both on | **US-0086** remote wins over **docker-host-local** — see precedence in **`DEC-0084`** §3 |
260
+ | Bind-mount hot reload | Default skip on source-only docker changes; use refresh or **`restart_on_source_change=true`** |
261
+
262
+ ### Troubleshooting (`DEV_ENV_*` reason codes)
263
+
264
+ **Profile family:** **`DEV_ENV_PROFILE_DISABLED`**, **`DEV_ENV_PROFILE_INVALID`**,
265
+ **`DEV_ENV_PROFILE_MISSING`**, **`DEV_ENV_DETECT_AMBIGUOUS`**, **`DEV_ENV_COMPOSE_UNRESOLVED`**,
266
+ **`DEV_ENV_TARGET_DISABLED`**, **`DEV_ENV_SECRET_SURFACE_VIOLATION`**.
267
+
268
+ **Relaunch family:** **`DEV_ENV_RELAUNCH_SKIPPED_NO_SURFACE`**, **`DEV_ENV_RELAUNCH_SKIPPED_PROFILE_OFF`**,
269
+ **`DEV_ENV_RELAUNCH_FAILED`**, **`DEV_ENV_RELAUNCH_RETRY_EXHAUSTED`**, **`DEV_ENV_RELAUNCH_TIMEOUT`**,
270
+ **`DEV_ENV_CONNECT_UNAVAILABLE`**.
271
+
272
+ ### Commands
273
+
274
+ ```bash
275
+ python scripts/dev_environment_lib.py --self-test
276
+ python scripts/dev_environment_lib.py --load .cursor/dev-environment.json
277
+ python scripts/check_intake_template_parity.py --scope=dev-environment
278
+ pytest -k us0098 tests/auto_command_contract_test.py
279
+ ```
280
+
281
+ Implementation tranche order: **A** (schema + scratchpad) → **B** (stdlib helper) → **C** (execute step **24** + docs) → **D** (contract tests + parity + harness).
282
+
283
+ Normative contract: `decisions/DEC-0084.md`, `docs/engineering/architecture.md` `# US-0098`.
284
+
170
285
  ## User-visible internal metadata guard (US-0071 / DEC-0053)
171
286
 
172
287
  **Goal:** keep planning-shaped identifiers out of **operator-visible software
@@ -447,9 +562,76 @@ Manual override precedence:
447
562
  **`.jsonl`**); copy path into **`token_cost_evidence_ref`** on **`state.md`** checkpoints.
448
563
  - **AC-2**: compare **`cache_read_tokens`** only when **`run_class_hash`** matches; else
449
564
  **`TOKEN_COST_RUN_CLASS_MISMATCH`**.
565
+ - **`delivery_mode`** (US-0096 / DEC-0082): required key in sorted JSON run-class object
566
+ (amends **DEC-0062**). Evidence rows in **`handoffs/token_cost_runs/<orchestrator_run_id>.md`**
567
+ **must** include **`delivery_mode`** column. **`ultra_lean`** vs **`standard`** on same story →
568
+ **`TOKEN_COST_RUN_CLASS_MISMATCH`**. Tranche A target: **≥10%** **`cache_read_tokens`** reduction
569
+ on matched **`standard`** runs vs pre-US-0096 baseline.
450
570
  - **CI/repo checks**: `python scripts/check_token_cost_parity.py --repo .` (manifest-listed
451
571
  active/`template/` pairs); **`tests/run-tests.ps1`** / **`tests/run-tests.sh`** §26M.
452
572
 
573
+ ### Delivery modes (US-0096 / DEC-0082)
574
+
575
+ > **`DELIVERY_MODE`** controls lifecycle shape and artifact surfaces only. **`TOKEN_PROFILE`** controls context breadth / token cost only (**DEC-0062**). **`CAVEMAN_MODE`** controls reply voice only (**DEC-0072**). None substitutes for another.
576
+
577
+ | Key | Values | Default |
578
+ |-----|--------|---------|
579
+ | **`DELIVERY_MODE`** | `standard` \| `ultra_lean` \| `mega_quick` | `standard` |
580
+ | **`LEAN_MEMORY_READ`** | `0` \| `1` | `1` |
581
+ | **`LEAN_MEMORY_WRITE`** | `0` \| `1` | `1` |
582
+ | **`LEAN_COLD_READ_MAX_SECTIONS`** | int ≥ 1 | `4` |
583
+ | **`LEAN_STATE_INDEX_ROWS`** | int ≥ 30 | `80` |
584
+ | **`AUTO_DELIVERY_ROUTING`** | `scratchpad_only` \| `backlog_then_scratchpad` | `scratchpad_only` |
585
+
586
+ **Tranche A default hot caps** (example scratchpad; explicit operator values override):
587
+ **`STATE_HOT_MAX_LINES=1000`**, **`PO_TO_TL_HOT_MAX_LINES=650`**, **`ARCH_HOT_MAX_LINES=3000`**.
588
+
589
+ #### Operator recipes
590
+
591
+ | Mode | When to use | Avoid when |
592
+ |------|-------------|------------|
593
+ | **`standard`** | Full lifecycle, cross-cutting stories, companion DEC, release gates | N/A (default) |
594
+ | **`ultra_lean`** | P1 stories with clear AC, token budget pressure, institutional memory needed | Mid-story mode switch; no validator/index |
595
+ | **`mega_quick`** | ≤3 AC, single component, docs-only or tiny fix | Architecture-first; existing **`Sxxxx`**; bug segments |
596
+
597
+ #### Tranche A universal wins (always-on)
598
+
599
+ 1. **Narrow-read** in all phase command **`Inputs`** — cite **`phase-context.md`** + story section
600
+ anchor; forbid full-file reads when heading exists.
601
+ 2. **Delta handoffs** — append delta paragraphs to handoff bodies; no full rewrites of prior content.
602
+ 3. **Touch-graph reads** — before **`/execute`**, read **`docs/engineering/codebase-map.md`**
603
+ component slice + touched paths from sprint/tasks or pack.
604
+
605
+ #### `ultra_lean` E2E operator recipe (`build+verify`)
606
+
607
+ 1. Set **`DELIVERY_MODE=ultra_lean`**, **`LEAN_MEMORY_READ=1`**, **`LEAN_MEMORY_WRITE=1`**.
608
+ 2. Run **`/auto`** — expect four macro-phases: **`spec`**, **`plan`**, **`build+verify`**, **`ship`**.
609
+ 3. **`build+verify`** merges execute + qa + verify-work in one spawn; **`AUTO_IMPLEMENTATION_LOOP`**
610
+ loops inside macro-phase until green or cap.
611
+ 4. Warm memory: **`work/<story_id>/pack.json`** (validate with **`scripts/pack_json_validate.py`**).
612
+ 5. Hot index: **`handoffs/active-context.md`** (30–80 lines; **not** triad).
613
+
614
+ #### Layered memory + gates
615
+
616
+ - active-context.md is NOT a triad member — triad enforcement unchanged (**DEC-0054**).
617
+ - Rollover → **`handoffs/archive/active-context-<story_id>-<utc>.md`** on oversize or segment close.
618
+ - **`LEAN_MEMORY_READ=0`** or **`LEAN_MEMORY_WRITE=0`** on **`ultra_lean`** → **`LEAN_MEMORY_DISABLED`**.
619
+
620
+ #### Quality floor (all lean modes)
621
+
622
+ - Tests run before stop.
623
+ - AC traceability in **`pack.json`** or **`task.json`**.
624
+ - New patterns → architecture/decision delta.
625
+ - **`active-context.md`** updated on material learnings.
626
+ - No secrets / publish bypass (**`RELEASE_PUBLISH_MODE`** unchanged).
627
+
628
+ #### Backlog routing (optional)
629
+
630
+ When **`AUTO_DELIVERY_ROUTING=backlog_then_scratchpad`**, story row may declare optional
631
+ **`delivery_mode:`** field. Precedence: argv **`delivery-mode=`** → story row → scratchpad → **`standard`**.
632
+
633
+ **Release status (S0086 / US-0096)**: **`released`** (`2026-06-13T16:00:00Z`); **`US-0096`** **DONE** in canonical backlog. Operator verify: **`handoffs/releases/S0086-release-notes.md`** **## Verify**; publish skipped while **`RELEASE_PUBLISH_MODE=confirm`**.
634
+
453
635
  Context compaction policy:
454
636
 
455
637
  - `docs/engineering/state.md` is a compact hot surface for current execution
@@ -1398,6 +1580,27 @@ and **`docs/engineering/auto-orchestration-reference.md`** § **Native in-chat a
1398
1580
  | **`--invoke-cmd`** | N/A | **Required** bridge | Document in runbook |
1399
1581
  | **`NATIVE_CHAIN_UNAVAILABLE`** | Stops | Suggested (**optional** tone) | Non-suppressible |
1400
1582
 
1583
+ ### BUG-0012 regression verify
1584
+
1585
+ Multi-segment operator E2E recipe — validates native-chain orchestrator compliance
1586
+ (**DEC-0081**) after **US-0095** contract delivery.
1587
+
1588
+ 1. **Scratchpad**: set **`AUTO_FLOW_MODE=full_autonomy`**, **`AUTO_BACKLOG_DRAIN=1`**,
1589
+ **`AUTO_BACKLOG_MAX_STORIES≥2`**, **`AUTO_QUIET=1`** in merged `.cursor/scratchpad.md`.
1590
+ 2. **Backlog**: ensure **≥2 OPEN stories** in `docs/product/backlog.md`.
1591
+ 3. **Invoke**: run **`/auto`** once in Cursor IDE Agent panel (no `--invoke-cmd`).
1592
+ 4. **Complete segment A**: let orchestration finish **story A** through **`refresh-context`**.
1593
+ 5. **Pass criteria**: orchestrator drain-advances to **story B** first phase **without**
1594
+ operator re-**`/auto`** and **without** forbidden terminal prose (no mandatory
1595
+ `re-run /auto`, no mandatory outer driver, no `segment exhausted` terminal when
1596
+ continuation pending).
1597
+ 6. **Evidence**: `docs/engineering/state.md` segment boundary shows
1598
+ **`drain_advance_action=spawned`**, **`native_chain_continuing=true`**;
1599
+ `handoffs/resume_brief.md` top pointer advances **`story_id`** to story B.
1600
+
1601
+ Normative detail: **`.cursor/commands/auto.md`** § **Orchestrator post-subagent continuation
1602
+ mandate (BUG-0012)** and architecture **`# BUG-0012`**.
1603
+
1401
1604
  ### Full-autonomy outer driver (US-0092) — fallback
1402
1605
 
1403
1606
  Opt-in **`AUTO_FLOW_MODE=full_autonomy`** (exact literal, default-off) also enables
@@ -9,6 +9,10 @@ Scoped modes (DEC-0073 §10 / US-0090):
9
9
  --scope=us-0092 DEC-0078 full-autonomy outer driver + probe surfaces.
10
10
  --scope=us-0093 DEC-0079 browser UAT probe surfaces.
11
11
  --scope=us-0095 DEC-0080 native in-chat auto-chain surfaces.
12
+ --scope=bug-0012 DEC-0081 native-chain compliance surfaces (BUG-0012).
13
+ --scope=us-0096 DEC-0082 delivery modes surfaces (US-0096).
14
+ --scope=project-readme DEC-0083 project README bootstrap surfaces (US-0097).
15
+ --scope=dev-environment DEC-0084 dev auto-launch profile surfaces (US-0098).
12
16
  --scope=all union of all tables.
13
17
  """
14
18
 
@@ -114,6 +118,90 @@ US0095_PAIRS: tuple[tuple[str, str], ...] = (
114
118
  ),
115
119
  )
116
120
 
121
+ BUG0012_PAIRS: tuple[tuple[str, str], ...] = (
122
+ (".cursor/commands/auto.md", "template/.cursor/commands/auto.md"),
123
+ (
124
+ "docs/engineering/auto-orchestration-reference.md",
125
+ "template/docs/engineering/auto-orchestration-reference.md",
126
+ ),
127
+ ("docs/engineering/runbook.md", "template/docs/engineering/runbook.md"),
128
+ (
129
+ "scripts/check_intake_template_parity.py",
130
+ "template/scripts/check_intake_template_parity.py",
131
+ ),
132
+ )
133
+
134
+ US0096_PAIRS: tuple[tuple[str, str], ...] = (
135
+ (
136
+ ".cursor/scratchpad.local.example.md",
137
+ "template/.cursor/scratchpad.local.example.md",
138
+ ),
139
+ (".cursor/commands/auto.md", "template/.cursor/commands/auto.md"),
140
+ (
141
+ "docs/engineering/auto-orchestration-reference.md",
142
+ "template/docs/engineering/auto-orchestration-reference.md",
143
+ ),
144
+ ("docs/engineering/runbook.md", "template/docs/engineering/runbook.md"),
145
+ (".cursor/commands/quick.md", "template/.cursor/commands/quick.md"),
146
+ (
147
+ "scripts/check_intake_template_parity.py",
148
+ "template/scripts/check_intake_template_parity.py",
149
+ ),
150
+ ("scripts/pack_json_validate.py", "template/scripts/pack_json_validate.py"),
151
+ )
152
+
153
+ PROJECT_README_PAIRS: tuple[tuple[str, str], ...] = (
154
+ (
155
+ "scripts/validate_project_readme_coverage.py",
156
+ "template/scripts/validate_project_readme_coverage.py",
157
+ ),
158
+ (
159
+ "scripts/project_readme_coverage_lib.py",
160
+ "template/scripts/project_readme_coverage_lib.py",
161
+ ),
162
+ (".cursor/commands/execute.md", "template/.cursor/commands/execute.md"),
163
+ (".cursor/commands/release.md", "template/.cursor/commands/release.md"),
164
+ ("docs/engineering/runbook.md", "template/docs/engineering/runbook.md"),
165
+ (
166
+ "docs/engineering/context/installer-owned-paths.manifest",
167
+ "template/docs/engineering/context/installer-owned-paths.manifest",
168
+ ),
169
+ (
170
+ ".cursor/scratchpad.local.example.md",
171
+ "template/.cursor/scratchpad.local.example.md",
172
+ ),
173
+ (
174
+ "scripts/check_intake_template_parity.py",
175
+ "template/scripts/check_intake_template_parity.py",
176
+ ),
177
+ )
178
+
179
+ DEV_ENVIRONMENT_PAIRS: tuple[tuple[str, str], ...] = (
180
+ (".cursor/commands/execute.md", "template/.cursor/commands/execute.md"),
181
+ (".cursor/scratchpad.md", "template/.cursor/scratchpad.md"),
182
+ (
183
+ ".cursor/scratchpad.local.example.md",
184
+ "template/.cursor/scratchpad.local.example.md",
185
+ ),
186
+ (
187
+ "template/.cursor/dev-environment.json.example",
188
+ "template/.cursor/dev-environment.json.example",
189
+ ),
190
+ (
191
+ "scripts/dev_environment_lib.py",
192
+ "template/scripts/dev_environment_lib.py",
193
+ ),
194
+ ("docs/engineering/runbook.md", "template/docs/engineering/runbook.md"),
195
+ (
196
+ "docs/engineering/auto-orchestration-reference.md",
197
+ "template/docs/engineering/auto-orchestration-reference.md",
198
+ ),
199
+ (
200
+ "scripts/check_intake_template_parity.py",
201
+ "template/scripts/check_intake_template_parity.py",
202
+ ),
203
+ )
204
+
117
205
  DOWNSTREAM_CI_GUARD_PAIRS: tuple[tuple[str, str], ...] = (
118
206
  (
119
207
  "scripts/check_downstream_ci_guard.py",
@@ -133,6 +221,10 @@ SCOPES: dict[str, tuple[tuple[str, str], ...]] = {
133
221
  "us-0092": US0092_PAIRS,
134
222
  "us-0093": US0093_PAIRS,
135
223
  "us-0095": US0095_PAIRS,
224
+ "bug-0012": BUG0012_PAIRS,
225
+ "us-0096": US0096_PAIRS,
226
+ "project-readme": PROJECT_README_PAIRS,
227
+ "dev-environment": DEV_ENVIRONMENT_PAIRS,
136
228
  "all": (
137
229
  INTAKE_TEMPLATE_PAIRS
138
230
  + CAVEMAN_COMPRESS_PAIRS
@@ -141,6 +233,10 @@ SCOPES: dict[str, tuple[tuple[str, str], ...]] = {
141
233
  + US0092_PAIRS
142
234
  + US0093_PAIRS
143
235
  + US0095_PAIRS
236
+ + BUG0012_PAIRS
237
+ + US0096_PAIRS
238
+ + PROJECT_README_PAIRS
239
+ + DEV_ENVIRONMENT_PAIRS
144
240
  ),
145
241
  }
146
242