its-magic 0.1.2-9 → 0.1.3-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1602 -755
- package/bin/its-magic.js +121 -11
- package/bin/postinstall.js +93 -0
- package/installer.ps1 +759 -0
- package/installer.py +1036 -0
- package/installer.sh +649 -0
- package/package.json +18 -14
- package/scripts/check_intake_template_parity.py +312 -0
- package/scripts/doc_profile_lib.py +415 -0
- package/scripts/guard_installer_publish.py +88 -0
- package/scripts/intake_bug_routing_guard.py +67 -0
- package/scripts/intake_evidence_lib.py +802 -0
- package/scripts/intake_evidence_validate.py +73 -0
- package/scripts/materialize_codebase_map.py +184 -0
- package/scripts/remote_config_summary.py +243 -0
- package/template/.cursor/agents/curator.mdc +35 -0
- package/template/.cursor/agents/dev.mdc +29 -0
- package/template/.cursor/agents/po.mdc +141 -0
- package/template/.cursor/agents/qa.mdc +28 -0
- package/template/.cursor/agents/release.mdc +28 -0
- package/template/.cursor/agents/security.mdc +98 -0
- package/template/.cursor/agents/tech-lead.mdc +57 -0
- package/template/.cursor/commands/architecture.md +127 -0
- package/template/.cursor/commands/ask.md +55 -0
- package/template/.cursor/commands/auto.md +533 -0
- package/template/.cursor/commands/discovery.md +47 -0
- package/template/.cursor/commands/execute.md +343 -0
- package/template/.cursor/commands/intake.md +323 -0
- package/template/.cursor/commands/map-codebase.md +46 -0
- package/template/.cursor/commands/memory-audit.md +175 -0
- package/template/.cursor/commands/milestone-complete.md +51 -0
- package/template/.cursor/commands/milestone-start.md +59 -0
- package/template/.cursor/commands/pause.md +64 -0
- package/{.cursor/commands/gsd-phase-context.md → template/.cursor/commands/phase-context.md} +6 -2
- package/template/.cursor/commands/plan-verify.md +34 -0
- package/template/.cursor/commands/qa.md +226 -0
- package/template/.cursor/commands/quick.md +41 -0
- package/template/.cursor/commands/refresh-context.md +82 -0
- package/template/.cursor/commands/release.md +523 -0
- package/template/.cursor/commands/research.md +49 -0
- package/template/.cursor/commands/resume.md +67 -0
- package/template/.cursor/commands/security-review.md +81 -0
- package/template/.cursor/commands/sprint-plan.md +103 -0
- package/template/.cursor/commands/status-reconcile.md +95 -0
- package/template/.cursor/commands/verify-work.md +152 -0
- package/template/.cursor/dev-environment.json.example +22 -0
- package/{.cursor → template/.cursor}/hooks/README.md +3 -2
- package/{.cursor/hooks/gsd-hook.py → template/.cursor/hooks/hook.py} +15 -6
- package/template/.cursor/hooks.json +26 -0
- package/template/.cursor/remote.json +31 -0
- package/template/.cursor/rules/caveman.mdc +184 -0
- package/template/.cursor/rules/coding-standards.mdc +39 -0
- package/template/.cursor/rules/core.mdc +111 -0
- package/template/.cursor/rules/handoffs.mdc +27 -0
- package/template/.cursor/rules/quality.mdc +49 -0
- package/template/.cursor/scratchpad.local.example.md +323 -0
- package/template/.cursor/scratchpad.md +324 -0
- package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/SKILL.md +2 -2
- package/template/.cursorignore +6 -0
- package/template/.env.example +28 -0
- package/template/.github/workflows/ci.yml +194 -0
- package/{.github → template/.github}/workflows/deploy.yml +5 -2
- package/template/.its-magic-version +1 -0
- package/template/CHANGELOG.md +11 -0
- package/template/README.md +1602 -0
- package/template/decisions/DEC-0001.md +11 -0
- package/template/decisions/DEC-0002.md +11 -0
- package/template/docs/developer/README.md +44 -0
- package/template/docs/engineering/architecture.md +9 -0
- package/template/docs/engineering/artifact-ordering-policy.md +48 -0
- package/template/docs/engineering/artifact-ownership-policy.md +57 -0
- package/template/docs/engineering/auto-orchestration-reference.md +1211 -0
- package/{docs → template/docs}/engineering/codebase-map.md +0 -5
- package/template/docs/engineering/compatibility-report.md +20 -0
- package/template/docs/engineering/compatibility-signals.md +7 -0
- package/template/docs/engineering/component-scope-report.md +16 -0
- package/template/docs/engineering/component-scope.md +19 -0
- package/template/docs/engineering/context/installer-owned-paths.manifest +96 -0
- package/template/docs/engineering/context/readme-section-affinity.json +30 -0
- package/template/docs/engineering/decisions.md +16 -0
- package/template/docs/engineering/legacy-drift-audit.md +21 -0
- package/template/docs/engineering/manifests/components/api-gateway.manifest.yaml +12 -0
- package/template/docs/engineering/manifests/registry.manifest.yaml +20 -0
- package/template/docs/engineering/manifests/repo.manifest.yaml +11 -0
- package/template/docs/engineering/phase-context.md +16 -0
- package/template/docs/engineering/release-targets.json +123 -0
- package/template/docs/engineering/research.md +29 -0
- package/template/docs/engineering/runbook.md +2391 -0
- package/template/docs/engineering/runtime-connectivity.md +81 -0
- package/template/docs/engineering/security-review.md +33 -0
- package/template/docs/engineering/spec-pack/README.md +20 -0
- package/template/docs/engineering/state-archive/README.md +15 -0
- package/template/docs/engineering/state.md +20 -0
- package/template/docs/engineering/status-normalization-report.md +19 -0
- package/template/docs/engineering/token-cost-parity-manifest.md +16 -0
- package/template/docs/engineering/us-0084-remote-e2e.md +44 -0
- package/template/docs/product/acceptance.md +1 -0
- package/template/docs/product/backlog.md +5 -0
- package/template/docs/product/vision.md +11 -0
- package/template/docs/user-guides/README.md +40 -0
- package/{handoffs → template/handoffs}/dev_to_qa.md +0 -3
- package/{handoffs → template/handoffs}/po_to_tl.md +0 -3
- package/{handoffs → template/handoffs}/qa_to_dev.md +1 -2
- package/template/handoffs/release_notes.md +51 -0
- package/template/handoffs/release_queue.md +47 -0
- package/template/handoffs/release_to_dev.md +31 -0
- package/template/handoffs/releases/Sxxxx-release-notes.md +62 -0
- package/template/handoffs/releases/vX.Y.Z-release-notes.md.example +21 -0
- package/template/handoffs/resume_brief.md +14 -0
- package/{handoffs → template/handoffs}/tl_to_dev.md +0 -2
- package/template/handoffs/token_cost_runs/README.md +26 -0
- package/template/its_magic/.its-magic-version +1 -0
- package/template/its_magic/README.md +9 -0
- package/template/scripts/auto_outer_driver.py +521 -0
- package/template/scripts/caveman_compress_input.py +903 -0
- package/template/scripts/check_downstream_ci_guard.py +67 -0
- package/template/scripts/check_intake_template_parity.py +312 -0
- package/template/scripts/check_token_cost_parity.py +69 -0
- package/template/scripts/dev_environment_lib.py +601 -0
- package/template/scripts/doc_profile_lib.py +415 -0
- package/template/scripts/downstream_ci_guard_lib.py +222 -0
- package/template/scripts/enforce-triad-hot-surface.py +753 -0
- package/template/scripts/guard_installer_publish.py +88 -0
- package/template/scripts/intake_bug_resume_brief_refresh.py +303 -0
- package/template/scripts/intake_bug_routing_guard.py +67 -0
- package/template/scripts/intake_evidence_lib.py +802 -0
- package/template/scripts/intake_evidence_validate.py +73 -0
- package/template/scripts/materialize_codebase_map.py +184 -0
- package/template/scripts/pack_json_validate.py +130 -0
- package/template/scripts/project_readme_coverage_lib.py +417 -0
- package/template/scripts/readme_feature_coverage_lib.py +608 -0
- package/{scripts → template/scripts}/release-all.sh +27 -4
- package/template/scripts/release_changelog_backfill.py +153 -0
- package/template/scripts/release_changelog_lib.py +544 -0
- package/template/scripts/release_changelog_validate.py +134 -0
- package/template/scripts/remote_config_summary.py +243 -0
- package/template/scripts/sync_push_gates.py +198 -0
- package/template/scripts/token_cost_compare.py +40 -0
- package/template/scripts/token_cost_lib.py +108 -0
- package/template/scripts/uat_probe_lib.py +868 -0
- package/template/scripts/validate-and-push.ps1 +280 -0
- package/template/scripts/validate-and-push.sh +243 -0
- package/template/scripts/validate_doc_profile.py +103 -0
- package/template/scripts/validate_project_readme_coverage.py +151 -0
- package/template/scripts/validate_readme_feature_coverage.py +140 -0
- package/template/sprints/S0001/progress.md +1 -0
- package/template/sprints/S0001/qa-findings.md +9 -0
- package/template/sprints/S0001/release-findings.md +24 -0
- package/template/sprints/S0001/sprint.md +9 -0
- package/template/sprints/S0001/summary.md +7 -0
- package/template/sprints/S0001/tasks.md +1 -0
- package/template/sprints/S0001/uat.json +6 -0
- package/template/sprints/S0001/uat.md +5 -0
- package/template/sprints/quick/Q0001/summary.md +1 -0
- package/{sprints → template/sprints}/quick/Q0001/task.json +0 -1
- package/.cursor/agents/curator.mdc +0 -21
- package/.cursor/agents/dev.mdc +0 -20
- package/.cursor/agents/po.mdc +0 -19
- package/.cursor/agents/qa.mdc +0 -19
- package/.cursor/agents/release.mdc +0 -19
- package/.cursor/agents/tech-lead.mdc +0 -21
- package/.cursor/commands/gsd-architecture.md +0 -29
- package/.cursor/commands/gsd-auto.md +0 -27
- package/.cursor/commands/gsd-discovery.md +0 -27
- package/.cursor/commands/gsd-execute.md +0 -32
- package/.cursor/commands/gsd-intake.md +0 -28
- package/.cursor/commands/gsd-map-codebase.md +0 -25
- package/.cursor/commands/gsd-milestone-complete.md +0 -24
- package/.cursor/commands/gsd-milestone-start.md +0 -26
- package/.cursor/commands/gsd-pause.md +0 -25
- package/.cursor/commands/gsd-plan-verify.md +0 -26
- package/.cursor/commands/gsd-qa.md +0 -28
- package/.cursor/commands/gsd-quick.md +0 -24
- package/.cursor/commands/gsd-refresh-context.md +0 -26
- package/.cursor/commands/gsd-release.md +0 -29
- package/.cursor/commands/gsd-research.md +0 -28
- package/.cursor/commands/gsd-resume.md +0 -26
- package/.cursor/commands/gsd-sprint-plan.md +0 -30
- package/.cursor/commands/gsd-verify-work.md +0 -25
- package/.cursor/hooks.json +0 -26
- package/.cursor/plans/cursor-gsd-team-kit_8cfee9b8.plan.md +0 -57
- package/.cursor/remote.json +0 -18
- package/.cursor/rules/gsd-core.mdc +0 -18
- package/.cursor/rules/gsd-handoffs.mdc +0 -10
- package/.cursor/rules/gsd-quality.mdc +0 -15
- package/.cursor/scratchpad.md +0 -34
- package/.github/workflows/ci.yml +0 -47
- package/decisions/DEC-0001.md +0 -21
- package/decisions/DEC-0002.md +0 -21
- package/docs/engineering/architecture.md +0 -354
- package/docs/engineering/decisions.md +0 -6
- package/docs/engineering/research.md +0 -11
- package/docs/engineering/runbook.md +0 -32
- package/docs/engineering/state.md +0 -33
- package/docs/product/acceptance.md +0 -6
- package/docs/product/backlog.md +0 -7
- package/docs/product/vision.md +0 -46
- package/gsd-installer.ps1 +0 -189
- package/gsd-installer.py +0 -195
- package/gsd-installer.sh +0 -201
- package/handoffs/release_notes.md +0 -14
- package/handoffs/resume_brief.md +0 -8
- package/milestones/M0001/milestone.json +0 -7
- package/milestones/M0001/phases.json +0 -9
- package/milestones/M0001/progress.md +0 -3
- package/milestones/M0001/summary.md +0 -3
- package/scripts/generate-release-notes.ps1 +0 -74
- package/scripts/generate-release-notes.sh +0 -63
- package/scripts/release-all.ps1 +0 -423
- package/sprints/S0001/progress.md +0 -4
- package/sprints/S0001/qa-findings.md +0 -113
- package/sprints/S0001/sprint.md +0 -70
- package/sprints/S0001/summary.md +0 -46
- package/sprints/S0001/tasks.md +0 -35
- package/sprints/S0001/uat.json +0 -8
- package/sprints/S0001/uat.md +0 -8
- package/sprints/quick/Q0001/summary.md +0 -3
- /package/{.cursor/rules/gsd-escalation.mdc → template/.cursor/rules/escalation.mdc} +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/acceptance.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/acceptance.md +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/architecture.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/architecture.md +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/decision.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/decision.md +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/handoff.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/handoff.md +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/milestone.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/phase-context.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/plan-verify.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/sprint.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/sprint.md +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/story.json +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/story.md +0 -0
- /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/uat.json +0 -0
- /package/{docs → template/docs}/engineering/context/phase-template.json +0 -0
- /package/{docs → template/docs}/engineering/dependencies.json +0 -0
- /package/{sprints → template/sprints}/S0001/plan-verify.json +0 -0
|
@@ -0,0 +1,1211 @@
|
|
|
1
|
+
# /auto — full orchestration specification (reference)
|
|
2
|
+
|
|
3
|
+
> **US-0080 / DEC-0062**: Expanded contract for `/auto`. The slim `.cursor/commands/auto.md` is the default injected surface; load this file when full prose, tables, and step detail are required.
|
|
4
|
+
|
|
5
|
+
## Subagents
|
|
6
|
+
- curator
|
|
7
|
+
- tech-lead
|
|
8
|
+
|
|
9
|
+
## Execution model
|
|
10
|
+
- `/auto` is a **spawn-only orchestrator**: it schedules materialization, spawns
|
|
11
|
+
fresh **phase-role** subagents, and verifies phase boundaries—it **must not**
|
|
12
|
+
execute lifecycle phase work, perform phase-role duties, or author **phase
|
|
13
|
+
deliverables** in the orchestrator context.
|
|
14
|
+
- For each phase, **spawn a fresh subagent** for that phase’s canonical role;
|
|
15
|
+
phase output must arrive only via artifacts and handoff files (no in-turn
|
|
16
|
+
orchestrator execution of that phase).
|
|
17
|
+
- Phase context transfer happens only through artifacts and handoff files.
|
|
18
|
+
- Scope is process/workflow orchestration only. Do not claim runtime product
|
|
19
|
+
orchestration changes.
|
|
20
|
+
- **Bug-queue mode** (**`US-0087`**) uses the same **spawn-only** model: schedule
|
|
21
|
+
materialization and spawn phase-role subagents per bug segment — **never** in-turn
|
|
22
|
+
**`execute`**, **`qa`**, or other lifecycle work in the orchestrator context.
|
|
23
|
+
Missing spawn → **`AUTO_ORCHESTRATOR_PHASE_EXECUTION`** (**`BUG-0006`**,
|
|
24
|
+
**`US-0069`**, **`DEC-0051`**).
|
|
25
|
+
|
|
26
|
+
## Spawn-boundary integrity (BUG-0006 / US-0080)
|
|
27
|
+
|
|
28
|
+
This gate is **orthogonal** to per-phase isolation (**DEC-0029**, see
|
|
29
|
+
`decisions/DEC-0029.md`) and strict runtime proof (**DEC-0038**, see
|
|
30
|
+
`decisions/DEC-0038.md`): satisfying one does not excuse skipping the others.
|
|
31
|
+
|
|
32
|
+
- **Forbidden**: using the orchestrator context to **perform** a lifecycle phase
|
|
33
|
+
instead of **spawning** the required role subagent (for example in-turn
|
|
34
|
+
**`architecture`**, **`execute`**, or **`qa`** work attributed to the
|
|
35
|
+
orchestrator).
|
|
36
|
+
- **Fail fast** with **`AUTO_ORCHESTRATOR_PHASE_EXECUTION`**. **Remediation**:
|
|
37
|
+
stop; spawn a **fresh** subagent for the canonical **`phase_id`** and **`role`**
|
|
38
|
+
per the phase→role matrix (**DEC-0051**); continue only through artifacts and
|
|
39
|
+
handoffs. **Do not** overload **`PHASE_CONTEXT_ISOLATION_VIOLATION`** or
|
|
40
|
+
**`RUNTIME_PROOF_*`** for a spawn-boundary violation—those address wrong-writer
|
|
41
|
+
isolation breaks and attestation failures, not missing spawn.
|
|
42
|
+
|
|
43
|
+
## Per-phase isolation enforcement (US-0048 / DEC-0029)
|
|
44
|
+
|
|
45
|
+
`/auto` must enforce fresh-context isolation as a fail-closed contract:
|
|
46
|
+
|
|
47
|
+
- `/auto` must not write phase deliverables itself. If phase work is performed in
|
|
48
|
+
the orchestrator context, stop immediately with reason code
|
|
49
|
+
`PHASE_CONTEXT_ISOLATION_VIOLATION`.
|
|
50
|
+
- Each spawned phase must write isolation evidence with required fields
|
|
51
|
+
(`phase_id`, `role`, `fresh_context_marker`, `timestamp`, `evidence_ref`) to
|
|
52
|
+
the canonical evidence store (`docs/engineering/state.md`) before `/auto`
|
|
53
|
+
proceeds to the next phase.
|
|
54
|
+
- `/auto` must fail closed when evidence is missing/invalid/stale (see reason
|
|
55
|
+
codes below). No silent continuation.
|
|
56
|
+
|
|
57
|
+
Reason codes (deterministic):
|
|
58
|
+
- `PHASE_CONTEXT_ISOLATION_MISSING`
|
|
59
|
+
- `PHASE_CONTEXT_ISOLATION_VIOLATION`
|
|
60
|
+
- `ISOLATION_EVIDENCE_STALE`
|
|
61
|
+
- `ISOLATION_EVIDENCE_INVALID`
|
|
62
|
+
|
|
63
|
+
## Strict runtime proof enforcement (US-0056 / DEC-0038)
|
|
64
|
+
|
|
65
|
+
`/auto` must enforce strict runtime attestation in addition to artifact-level
|
|
66
|
+
isolation evidence:
|
|
67
|
+
|
|
68
|
+
- Each completed phase must provide a runtime attestation tuple linked to the
|
|
69
|
+
phase checkpoint evidence:
|
|
70
|
+
- `orchestrator_run_id`
|
|
71
|
+
- `runtime_proof_id`
|
|
72
|
+
- `phase_id`
|
|
73
|
+
- `role`
|
|
74
|
+
- `proof_issued_at` (ISO UTC / RFC3339)
|
|
75
|
+
- `proof_ttl_seconds`
|
|
76
|
+
- `proof_hash`
|
|
77
|
+
- `runtime_proof_id` must be unique per phase run; reused proof IDs are invalid.
|
|
78
|
+
- Proof freshness must be validated against `proof_issued_at` + TTL policy.
|
|
79
|
+
- Proof linkage must be deterministic and auditable to checkpoint evidence refs.
|
|
80
|
+
- Fail closed on any strict-proof violation; no silent continuation.
|
|
81
|
+
|
|
82
|
+
Strict-proof reason codes:
|
|
83
|
+
- `RUNTIME_PROOF_MISSING`
|
|
84
|
+
- `RUNTIME_PROOF_INVALID`
|
|
85
|
+
- `RUNTIME_PROOF_REUSED`
|
|
86
|
+
- `RUNTIME_PROOF_STALE`
|
|
87
|
+
- `RUNTIME_PROOF_AMBIGUOUS_LINK`
|
|
88
|
+
|
|
89
|
+
## Strict phase role enforcement (US-0069 / DEC-0051)
|
|
90
|
+
|
|
91
|
+
`/auto` must enforce a deterministic **phase→role contract** with **preflight
|
|
92
|
+
admission** before each phase spawn, **fail-closed checkpoint validation** after
|
|
93
|
+
each phase completes, and **aligned strict-proof `role`** values. Post-hoc
|
|
94
|
+
isolation markers alone are insufficient.
|
|
95
|
+
|
|
96
|
+
### Canonical phase→role matrix (fixed defaults)
|
|
97
|
+
|
|
98
|
+
| phase_id | Allowed roles | Default when no valid alternate policy |
|
|
99
|
+
|----------|-----------------|----------------------------------------|
|
|
100
|
+
| `intake` | `po` | `po` |
|
|
101
|
+
| `discovery` | `po` | `po` |
|
|
102
|
+
| `research` | `po`, `tech-lead` | `tech-lead` |
|
|
103
|
+
| `architecture` | `tech-lead` | `tech-lead` |
|
|
104
|
+
| `sprint-plan` | `tech-lead` | `tech-lead` |
|
|
105
|
+
| `plan-verify` | `qa`, `tech-lead` | `qa` |
|
|
106
|
+
| `execute` | `dev` (override path only) | `dev` |
|
|
107
|
+
| `qa` | `qa` | `qa` |
|
|
108
|
+
| `verify-work` | `qa` | `qa` |
|
|
109
|
+
| `release` | `release` | `release` |
|
|
110
|
+
| `refresh-context` | `curator`, `po` | `curator` |
|
|
111
|
+
|
|
112
|
+
### Alternate-role scratchpad policy (single-valued resolution)
|
|
113
|
+
|
|
114
|
+
Resolve **exactly one** expected role for phases with alternates using merged
|
|
115
|
+
scratchpad (active + `.cursor/scratchpad.local.md`; template parity on install):
|
|
116
|
+
|
|
117
|
+
- `AUTO_ROLE_RESEARCH`: `po` \| `tech-lead` — when **unset or empty**, default
|
|
118
|
+
`tech-lead`; when set to any other value, fail closed with diagnostics (no
|
|
119
|
+
unrelated-role fallback).
|
|
120
|
+
- `AUTO_ROLE_PLAN_VERIFY`: `qa` \| `tech-lead` — when **unset or empty**,
|
|
121
|
+
default `qa`; otherwise only `qa` or `tech-lead` allowed (else fail closed).
|
|
122
|
+
- `AUTO_ROLE_REFRESH_CONTEXT`: `curator` \| `po` — when **unset or empty**,
|
|
123
|
+
default `curator`; otherwise only `curator` or `po` allowed (else fail closed).
|
|
124
|
+
|
|
125
|
+
### Preflight capability gate (before spawn)
|
|
126
|
+
|
|
127
|
+
Before spawning phase work, `/auto` must:
|
|
128
|
+
|
|
129
|
+
1. Resolve `phase_id` → expected canonical `role` (matrix + policy keys above).
|
|
130
|
+
2. For `execute`, apply **default deny**: expected role is `dev` unless **both**
|
|
131
|
+
`AUTO_EXECUTE_ROLE_OVERRIDE=allowed_non_dev_execute` **and**
|
|
132
|
+
`EXECUTE_OVERRIDE_GOVERNANCE_REF` point to a **parseable** approved exception
|
|
133
|
+
record (for example `DEC-xxxx` or a documented anchor in
|
|
134
|
+
`docs/engineering/state.md`).
|
|
135
|
+
3. Evaluate **role capability availability** for that boundary (subagent/tooling
|
|
136
|
+
can satisfy the resolved role).
|
|
137
|
+
4. On missing capability: stop with `PHASE_ROLE_CAPABILITY_MISSING` including
|
|
138
|
+
`phase_id`, expected role, observed capability result, and remediation. **Do
|
|
139
|
+
not** spawn under a substitute unrelated role.
|
|
140
|
+
|
|
141
|
+
### Post-completion boundary validation
|
|
142
|
+
|
|
143
|
+
When a phase completes, before advancing:
|
|
144
|
+
|
|
145
|
+
- Isolation evidence `role` must equal the **same** preflight-resolved expected
|
|
146
|
+
role for that `phase_id`. Else stop with `PHASE_ROLE_MISMATCH`.
|
|
147
|
+
- Strict-proof tuple `role` must equal isolation `role` and the expected role.
|
|
148
|
+
- `proof_hash` must be SHA-256 over canonical sorted-key JSON of
|
|
149
|
+
`orchestrator_run_id`, `runtime_proof_id`, `phase_id`, `role`,
|
|
150
|
+
`proof_issued_at`, `proof_ttl_seconds` (`DEC-0038` / architecture US-0069).
|
|
151
|
+
|
|
152
|
+
### Resume / `start-from` parity
|
|
153
|
+
|
|
154
|
+
Every `/auto` invocation (explicit `start-from`, `resume_brief`, or conservative
|
|
155
|
+
`state.md` fallback) must **recompute** policy resolution and preflight from
|
|
156
|
+
scratch; stale continuation artifacts must not bypass the gate.
|
|
157
|
+
|
|
158
|
+
### Role-enforcement reason codes (deterministic)
|
|
159
|
+
|
|
160
|
+
- `PHASE_ROLE_CAPABILITY_MISSING`
|
|
161
|
+
- `PHASE_ROLE_MISMATCH`
|
|
162
|
+
|
|
163
|
+
## Configurable phase selection policy (US-0070 / DEC-0052)
|
|
164
|
+
|
|
165
|
+
`/auto` must treat the **resolved phase plan** as a first-class, fail-closed
|
|
166
|
+
schedule: a single ordered subset of canonical phases computed from merged
|
|
167
|
+
scratchpad (active + `.cursor/scratchpad.local.md`; template parity on install),
|
|
168
|
+
**before** resume/`start-from` intersection and **before** any phase spawn.
|
|
169
|
+
|
|
170
|
+
### Canonical lifecycle order (baseline `full` plan)
|
|
171
|
+
|
|
172
|
+
Unless narrowed by policy, the canonical ordered phase list is:
|
|
173
|
+
|
|
174
|
+
`intake` → `discovery` → `research` → `architecture` → `sprint-plan` →
|
|
175
|
+
`plan-verify` → `execute` → `qa` → `verify-work` → `release` →
|
|
176
|
+
`refresh-context`
|
|
177
|
+
|
|
178
|
+
When `SECURITY_REVIEW=1`, insert `/security-review` in **design** mode
|
|
179
|
+
immediately after `architecture` and before `sprint-plan`, and in **code** mode
|
|
180
|
+
immediately after `execute` and before `qa`, as documented in **Steps** below.
|
|
181
|
+
Record these inserts in `resolved_phase_plan` breadcrumbs using the same
|
|
182
|
+
deterministic labels the orchestrator already uses for security boundaries.
|
|
183
|
+
|
|
184
|
+
### Scratchpad selectors (exactly one active policy mode)
|
|
185
|
+
|
|
186
|
+
At most one of the following may be materially active after merge. If two or
|
|
187
|
+
more non-default selectors conflict, fail closed with `PHASE_POLICY_CONFLICT`
|
|
188
|
+
and **do not** materialize a plan:
|
|
189
|
+
|
|
190
|
+
- `AUTO_PHASE_PLAN=full` — full canonical lifecycle (including security-review
|
|
191
|
+
inserts when enabled). Default when unset and no other selector is set.
|
|
192
|
+
- `AUTO_PHASE_EXCLUDE=<csv>` — start from `full`, remove listed phase IDs
|
|
193
|
+
(validate each token; unknown id → `PHASE_PLAN_UNKNOWN_PHASE`).
|
|
194
|
+
- `AUTO_PHASE_INCLUDE=<csv>` — schedule **only** listed ids, then **re-sort**
|
|
195
|
+
into canonical lifecycle order. Unknown id → `PHASE_PLAN_UNKNOWN_PHASE`.
|
|
196
|
+
Empty result after parsing → `PHASE_PLAN_EMPTY_INCLUDE`.
|
|
197
|
+
- `AUTO_PHASE_PROFILE=<name>` — expand a **named profile** from the registry
|
|
198
|
+
below. Unknown profile → `PHASE_PLAN_UNKNOWN_PROFILE`.
|
|
199
|
+
|
|
200
|
+
**Conflict rule**: `AUTO_PHASE_PLAN` is default-only when it is unset, empty, or
|
|
201
|
+
exactly `full`. Any explicit non-`full` `AUTO_PHASE_PLAN` value is invalid
|
|
202
|
+
(fail closed with `PHASE_PLAN_INVALID_AUTO_PHASE_PLAN`) — use `INCLUDE` /
|
|
203
|
+
`EXCLUDE` / `PROFILE` instead.
|
|
204
|
+
|
|
205
|
+
### Profile registry (baseline)
|
|
206
|
+
|
|
207
|
+
- `default` — equivalent to `full` (optional explicit alias; same behavior as
|
|
208
|
+
unset policy).
|
|
209
|
+
|
|
210
|
+
**High-risk profile sketch** (illustrative; `R-0049`): `profile_high_risk_dev_fast`
|
|
211
|
+
may only be selected when **both** hold: `AUTO_PHASE_PROFILE=profile_high_risk_dev_fast`
|
|
212
|
+
and `AUTO_PHASE_HIGH_RISK_ACK=<operator_token>` matches the profile spec
|
|
213
|
+
version documented in `decisions/DEC-0052.md` / research `R-0049`. Missing ack →
|
|
214
|
+
`PHASE_PLAN_HIGH_RISK_ACK_REQUIRED`. High-risk profiles may define **narrower**
|
|
215
|
+
reinstatement rules **only** as documented for that profile; default profile
|
|
216
|
+
behavior applies otherwise.
|
|
217
|
+
|
|
218
|
+
### Plan materialization pipeline (evaluation order)
|
|
219
|
+
|
|
220
|
+
On every `/auto` entry (including resume, backlog-drain, bug-queue, bulk execute, and
|
|
221
|
+
team-mode runs), **recompute** from merged scratchpad:
|
|
222
|
+
|
|
223
|
+
1. Parse merged scratchpad policy inputs for phase selection + `SECURITY_REVIEW`.
|
|
224
|
+
2. Detect active policy mode; on conflict → `PHASE_POLICY_CONFLICT` (no plan).
|
|
225
|
+
3. Expand mode to a **candidate** ordered phase list in canonical order.
|
|
226
|
+
4. Apply **non-skippable reinstatement** for the **default profile** (and for
|
|
227
|
+
any profile that does not explicitly document a narrower exception with ack):
|
|
228
|
+
- **Safety gates**: always reinstate if removed: `qa`, `verify-work`,
|
|
229
|
+
`release`.
|
|
230
|
+
- **Evidence-chain closure**: if the candidate retains any phase from
|
|
231
|
+
`execute` onward (`execute`, optional `security-review-code`, `qa`,
|
|
232
|
+
`verify-work`, `release`, `refresh-context`), reinstate (if removed) the
|
|
233
|
+
contiguous canonical prefix from `intake` through `plan-verify` so later
|
|
234
|
+
gates retain valid upstream isolation + strict-proof chain semantics.
|
|
235
|
+
- When `SECURITY_REVIEW=1`, reinstate the corresponding `security-review-*`
|
|
236
|
+
insert when the adjacent retained phases would otherwise violate the
|
|
237
|
+
documented security boundary contract.
|
|
238
|
+
Record each reinstatement in breadcrumbs with reason `non_skippable_gate`
|
|
239
|
+
(or a more specific documented code).
|
|
240
|
+
5. Record **operator-visible plan breadcrumbs** to `docs/engineering/state.md`
|
|
241
|
+
**before** first spawn (append-bottom per `DEC-0040`):
|
|
242
|
+
- `phase_policy_mode` (`full|exclude|include|profile`)
|
|
243
|
+
- `resolved_phase_plan` (ordered `phase_id` list)
|
|
244
|
+
- `skipped_phases` (id + reason: `policy_exclude`, `non_skippable_gate`,
|
|
245
|
+
`default_full_plan`, etc.)
|
|
246
|
+
- `orchestrator_run_id` (when known for this run)
|
|
247
|
+
6. **Do not** silently revive phases omitted by policy on continuation: every
|
|
248
|
+
entry re-reads scratchpad bytes and recomputes the plan class.
|
|
249
|
+
|
|
250
|
+
### `start-from` and resume intersection with the resolved plan
|
|
251
|
+
|
|
252
|
+
After computing the **resolved phase plan**, resolve the **nominal** start
|
|
253
|
+
phase using **Deterministic resume-source precedence** (explicit `start-from`
|
|
254
|
+
→ **`bug-target=`** argv (when present) → merged scratchpad → `resume_brief` →
|
|
255
|
+
`state` fallback → fail-fast).
|
|
256
|
+
|
|
257
|
+
Then **intersect**:
|
|
258
|
+
|
|
259
|
+
- Keep phases that appear in the resolved plan **in plan order**, starting at
|
|
260
|
+
the first plan phase whose canonical position is **at or after** the nominal
|
|
261
|
+
anchor phase (canonical order matches the baseline list above, including
|
|
262
|
+
security inserts when enabled).
|
|
263
|
+
- If the intersection is empty, fail closed with
|
|
264
|
+
`START_FROM_PHASE_PLAN_EMPTY_INTERSECTION` and diagnostics listing
|
|
265
|
+
`resolved_phase_plan` vs `requested_start_phase` / resume inference.
|
|
266
|
+
|
|
267
|
+
### Compatibility with `US-0069` / `DEC-0051`
|
|
268
|
+
|
|
269
|
+
- Role resolution and preflight apply **only** to phases present in the
|
|
270
|
+
intersected schedule. Skipping `research` does **not** change the expected
|
|
271
|
+
role for `architecture` or any other retained phase.
|
|
272
|
+
- Skipped phases produce **no** spawn and **no** alternate-role substitution
|
|
273
|
+
for a different phase.
|
|
274
|
+
|
|
275
|
+
### Phase-plan reason codes (deterministic)
|
|
276
|
+
|
|
277
|
+
Add to operator diagnostics and breadcrumb records:
|
|
278
|
+
|
|
279
|
+
- `PHASE_POLICY_CONFLICT`
|
|
280
|
+
- `PHASE_PLAN_UNKNOWN_PHASE`
|
|
281
|
+
- `PHASE_PLAN_EMPTY_INCLUDE`
|
|
282
|
+
- `PHASE_PLAN_UNKNOWN_PROFILE`
|
|
283
|
+
- `PHASE_PLAN_INVALID_AUTO_PHASE_PLAN`
|
|
284
|
+
- `PHASE_PLAN_HIGH_RISK_ACK_REQUIRED`
|
|
285
|
+
- `START_FROM_PHASE_PLAN_EMPTY_INTERSECTION`
|
|
286
|
+
|
|
287
|
+
### Phase boundary operator visibility (AC-10)
|
|
288
|
+
|
|
289
|
+
At each phase boundary (after completing a scheduled phase), record a compact
|
|
290
|
+
**phase boundary status** entry (for example in `docs/engineering/state.md`
|
|
291
|
+
continuation breadcrumbs) including:
|
|
292
|
+
|
|
293
|
+
- `resolved_phase_plan` snapshot (or stable hash pointer to the run’s plan record)
|
|
294
|
+
- `skipped_phases` summary (id + reason code)
|
|
295
|
+
- `phase_boundary` (completed `phase_id`)
|
|
296
|
+
- `next_scheduled_phase` (or `none` when complete/stopped)
|
|
297
|
+
|
|
298
|
+
**`US-0087` bug-queue extensions** (when bug scheduler is active or segment is
|
|
299
|
+
bug-scoped; see **`architecture.md`** **`# US-0087`**):
|
|
300
|
+
|
|
301
|
+
- `segment_work_item_kind` (`story|bug`)
|
|
302
|
+
- `active_bug_id` (`BUG-####` or `(none)`)
|
|
303
|
+
- `bug_queue_position` (1-based into **OPEN** ordering for `all-open`, or `(none)`)
|
|
304
|
+
- `bug_queue_remaining` (integer or `(none)`)
|
|
305
|
+
- `backlog_drain_active` (boolean — story **`AUTO_BACKLOG_DRAIN`** drives **this** run)
|
|
306
|
+
- `bug_queue_active` (boolean — bug scheduler drives **this** run)
|
|
307
|
+
|
|
308
|
+
**Invariant**: `backlog_drain_active` and `bug_queue_active` must **not** both be
|
|
309
|
+
true for the same materialized run (scheduler mutex).
|
|
310
|
+
|
|
311
|
+
## Inputs
|
|
312
|
+
- Merged scratchpad policy (`US-0073` / `DEC-0055`): resolve flags from **local >
|
|
313
|
+
materialized `.cursor/scratchpad.md` > `.cursor/scratchpad.local.example.md`**
|
|
314
|
+
(installers materialize baseline when missing; missing required keys after merge
|
|
315
|
+
must fail closed with `[SCRATCHPAD_MERGE_ERROR]` diagnostics, not silent defaults).
|
|
316
|
+
- `AUTO_FLOW_MODE` and `PHASE_MODE` from merged scratchpad
|
|
317
|
+
- `AUTO_IMPLEMENTATION_LOOP`, `AUTO_LOOP_MAX_CYCLES` from merged scratchpad
|
|
318
|
+
- `AUTO_PAUSE_REQUEST`, `AUTO_PAUSE_POLICY` from merged scratchpad
|
|
319
|
+
- `SECURITY_REVIEW`, `COMPLIANCE_PROFILES` from merged scratchpad
|
|
320
|
+
- `AUTO_EXECUTE_BULK`, `AUTO_EXECUTE_MAX_ITEMS`, `AUTO_EXECUTE_ON_BLOCK`,
|
|
321
|
+
`AUTO_EXECUTE_SELECTION`, `AUTO_TEAM_SCOPE_ENFORCE` from merged scratchpad
|
|
322
|
+
- `AUTO_ROLE_RESEARCH`, `AUTO_ROLE_PLAN_VERIFY`, `AUTO_ROLE_REFRESH_CONTEXT`,
|
|
323
|
+
`AUTO_EXECUTE_ROLE_OVERRIDE`, `EXECUTE_OVERRIDE_GOVERNANCE_REF` from merged
|
|
324
|
+
scratchpad (US-0069 / DEC-0051)
|
|
325
|
+
- `AUTO_PHASE_PLAN`, `AUTO_PHASE_EXCLUDE`, `AUTO_PHASE_INCLUDE`,
|
|
326
|
+
`AUTO_PHASE_PROFILE`, `AUTO_PHASE_HIGH_RISK_ACK` from merged scratchpad
|
|
327
|
+
(US-0070 / DEC-0052)
|
|
328
|
+
- `TEAM_MODE`, `TEAM_MEMBER`, `ACTIVE_TASK_IDS` from merged scratchpad context
|
|
329
|
+
- Current product and engineering docs
|
|
330
|
+
- Optional explicit argument: `start-from=<phase>`
|
|
331
|
+
- Optional explicit argument: **`bug-target=BUG-####`** or **`bug-target=all-open`**
|
|
332
|
+
(**`US-0087`**; parsed before merged scratchpad scheduler keys)
|
|
333
|
+
- Optional explicit argument: `--execute-bulk` (one-run explicit override)
|
|
334
|
+
- `AUTO_BUG_QUEUE`, `AUTO_BUG_TARGET`, `AUTO_BUG_MAX_ITEMS`, `AUTO_BUG_ON_BLOCK`
|
|
335
|
+
from merged scratchpad (**`US-0087`**)
|
|
336
|
+
- Resume-source artifacts:
|
|
337
|
+
- `handoffs/resume_brief.md`
|
|
338
|
+
- `docs/engineering/state.md`
|
|
339
|
+
|
|
340
|
+
## Automation remote routing contract (US-0086)
|
|
341
|
+
|
|
342
|
+
This contract is deterministic and default-off. It composes with `US-0064`,
|
|
343
|
+
`DEC-0070`, `US-0085`, and `DEC-0071`.
|
|
344
|
+
|
|
345
|
+
Automation profile controls (merged scratchpad):
|
|
346
|
+
|
|
347
|
+
- `AUTO_REMOTE_AUTOMATION_PROFILE`: `off|deterministic_v1`
|
|
348
|
+
- `AUTO_REMOTE_ENVIRONMENT_LABEL`: `local|docker|ssh` (names-only evidence)
|
|
349
|
+
- `REMOTE_EXECUTION`: `0|1` (remote config validation gate from `US-0084`)
|
|
350
|
+
- `REMOTE_CONFIG`: canonical remote config path
|
|
351
|
+
|
|
352
|
+
Mode split:
|
|
353
|
+
|
|
354
|
+
- `AUTO_REMOTE_AUTOMATION_PROFILE=off` -> preserve manual/local behavior; no
|
|
355
|
+
silent remote reroute.
|
|
356
|
+
- `AUTO_REMOTE_AUTOMATION_PROFILE=deterministic_v1` -> routing policy may resolve
|
|
357
|
+
Docker/SSH/local targets for automation workflows.
|
|
358
|
+
|
|
359
|
+
NL intent resolution (v1 literal):
|
|
360
|
+
|
|
361
|
+
- Parse only the exact phrase `start container <target_id>`.
|
|
362
|
+
- Resolve `<target_id>` against canonical enabled `targets[].id`.
|
|
363
|
+
- Unknown id -> fail closed `REMOTE_TARGET_UNKNOWN`.
|
|
364
|
+
- Known but disabled id -> fail closed `REMOTE_TARGET_DISABLED`.
|
|
365
|
+
|
|
366
|
+
Routing precedence when profile is enabled:
|
|
367
|
+
|
|
368
|
+
1. Explicit NL intent target (`start container <target_id>`).
|
|
369
|
+
2. Canonical target validation (`targets[].id`, enabled state).
|
|
370
|
+
3. Heuristic fallback (documented file-class matrix).
|
|
371
|
+
4. Local default when no remote target is selected.
|
|
372
|
+
|
|
373
|
+
Fail-closed reason codes (locked by `architecture.md` `# US-0086`):
|
|
374
|
+
|
|
375
|
+
- `REMOTE_AUTOMATION_MODE_OFF`
|
|
376
|
+
- `REMOTE_TARGET_UNKNOWN`
|
|
377
|
+
- `REMOTE_TARGET_DISABLED`
|
|
378
|
+
- `REMOTE_TARGET_UNROUTABLE`
|
|
379
|
+
|
|
380
|
+
Evidence tuple contract for execute/qa/release handoffs and `state.md`:
|
|
381
|
+
|
|
382
|
+
- `target_id`
|
|
383
|
+
- `environment_label`
|
|
384
|
+
- `automation_profile`
|
|
385
|
+
- `routing_source` (`explicit_intent|heuristic_fallback|local_default`)
|
|
386
|
+
- `secret_surface=names_only`
|
|
387
|
+
|
|
388
|
+
Security continuity:
|
|
389
|
+
|
|
390
|
+
- Automation must not read `.env` directly.
|
|
391
|
+
- Output remains names-only; do not print secret values in logs, handoffs, or
|
|
392
|
+
state artifacts.
|
|
393
|
+
|
|
394
|
+
## Canonical status contract (US-0045)
|
|
395
|
+
|
|
396
|
+
- Story status authority is `docs/product/backlog.md` only.
|
|
397
|
+
- `docs/product/acceptance.md` and `docs/engineering/state.md` are derived views.
|
|
398
|
+
- `/auto` must not infer implementation readiness from non-canonical status
|
|
399
|
+
artifacts when they conflict with backlog status.
|
|
400
|
+
|
|
401
|
+
## Outputs (artifacts)
|
|
402
|
+
- Updated phase artifacts for each step
|
|
403
|
+
- `docs/engineering/state.md`
|
|
404
|
+
- `handoffs/resume_brief.md` if stopped
|
|
405
|
+
- `sprints/S0001/qa-findings.md` and `handoffs/qa_to_dev.md` when loop finds issues
|
|
406
|
+
- Deterministic continuation breadcrumbs in relevant artifacts
|
|
407
|
+
|
|
408
|
+
## Stop conditions
|
|
409
|
+
|
|
410
|
+
Deterministic stop reasons for continuous and looping runs (aligned with
|
|
411
|
+
**Deterministic stop matrix (US-0088)** above):
|
|
412
|
+
|
|
413
|
+
- `completed` — all intersected phases finished; segment done.
|
|
414
|
+
- `decision_gate` — decision gate triggered; non-suppressible.
|
|
415
|
+
- `missing_input` — missing critical input; non-suppressible.
|
|
416
|
+
- `pause_request` — `AUTO_PAUSE_REQUEST=1` reached at a safe boundary; non-suppressible.
|
|
417
|
+
- `loop_max` — `AUTO_LOOP_MAX_CYCLES` reached with unresolved defects; non-suppressible.
|
|
418
|
+
- `error` — runtime or configuration error; non-suppressible.
|
|
419
|
+
- `blocked` — sync/scope gate or external blocker; non-suppressible.
|
|
420
|
+
|
|
421
|
+
## Optional backlog-drain mode (US-0044 / DEC-0022)
|
|
422
|
+
|
|
423
|
+
`/auto` supports an optional multi-story backlog-drain mode. Default behavior
|
|
424
|
+
remains unchanged unless explicitly enabled.
|
|
425
|
+
|
|
426
|
+
Canonical controls from `.cursor/scratchpad.md`:
|
|
427
|
+
- `AUTO_BACKLOG_DRAIN`: `0|1` (default `0`)
|
|
428
|
+
- `AUTO_BACKLOG_MAX_STORIES`: integer `>=1` (default `1`)
|
|
429
|
+
- `AUTO_BACKLOG_ON_BLOCK`: `stop|skip` (default `stop`)
|
|
430
|
+
- `AUTO_STORY_SELECTION`: `priority_then_backlog_order` (default)
|
|
431
|
+
|
|
432
|
+
Deterministic behavior when enabled (`AUTO_BACKLOG_DRAIN=1`):
|
|
433
|
+
- Select next eligible OPEN story via `AUTO_STORY_SELECTION`.
|
|
434
|
+
- **Advance through multiple phases** of the resolved lifecycle per story
|
|
435
|
+
(**reference Step 5**) — the orchestrator does not stop after one phase
|
|
436
|
+
unless a deterministic stop condition fires (see **Deterministic stop matrix
|
|
437
|
+
(US-0088)**).
|
|
438
|
+
- After each story's terminal boundary (`refresh-context` completion or policy
|
|
439
|
+
stop), **recompute the materialized phase plan** by reloading merged
|
|
440
|
+
scratchpad phase-selection inputs at the story boundary (**US-0044** /
|
|
441
|
+
**US-0088**). The next eligible OPEN story starts with a fresh plan class —
|
|
442
|
+
no silent revival of omitted phases from the prior story's plan.
|
|
443
|
+
- Continue to next eligible OPEN story until:
|
|
444
|
+
- `AUTO_BACKLOG_MAX_STORIES` limit reached (`BACKLOG_MAX_STORIES_REACHED`), or
|
|
445
|
+
- no eligible stories remain, or
|
|
446
|
+
- stop condition / decision gate occurs.
|
|
447
|
+
- On blocked story:
|
|
448
|
+
- `AUTO_BACKLOG_ON_BLOCK=stop` → stop immediately.
|
|
449
|
+
- `AUTO_BACKLOG_ON_BLOCK=skip` → record skip reason and continue to next story.
|
|
450
|
+
- Track `backlog_drain_stories_remaining_budget` across boundaries; notify
|
|
451
|
+
operator on segment handoff / drain advance (non-routine, non-suppressible
|
|
452
|
+
even when `AUTO_QUIET=1`).
|
|
453
|
+
|
|
454
|
+
Default-safe behavior:
|
|
455
|
+
- With `AUTO_BACKLOG_DRAIN=0`, preserve existing single-segment continuation.
|
|
456
|
+
|
|
457
|
+
## Optional bug-queue mode (US-0087)
|
|
458
|
+
|
|
459
|
+
`/auto` supports an optional, **default-off** bug-queue scheduler for **OPEN**
|
|
460
|
+
defects in **`docs/product/backlog.md`** **`## Bug issues (canonical)`**,
|
|
461
|
+
orthogonal to story-only **`AUTO_BACKLOG_DRAIN`** (**`US-0044`** / **`DEC-0022`**).
|
|
462
|
+
Bug-queue mode is **spawn-only** — same **`AUTO_ORCHESTRATOR_PHASE_EXECUTION`**
|
|
463
|
+
contract as other phases (**`BUG-0006`**, **`US-0069`** / **`DEC-0051`**).
|
|
464
|
+
|
|
465
|
+
### Canonical argv literals (AC-1)
|
|
466
|
+
|
|
467
|
+
Exact tokens (**no aliases** in v1; contract-tested):
|
|
468
|
+
|
|
469
|
+
- **`bug-target=BUG-####`** — single **OPEN** bug (example: **`bug-target=BUG-0007`**).
|
|
470
|
+
- **`bug-target=all-open`** — deterministic **OPEN**-only queue.
|
|
471
|
+
|
|
472
|
+
### Scratchpad keys (merged; `template/` parity)
|
|
473
|
+
|
|
474
|
+
Default-off when unset (see **`architecture.md`** **`# US-0087`**):
|
|
475
|
+
|
|
476
|
+
- **`AUTO_BUG_QUEUE`**: `0|1`
|
|
477
|
+
- **`AUTO_BUG_TARGET`**: `all-open` | **`BUG-####`** — required when **`AUTO_BUG_QUEUE=1`**
|
|
478
|
+
unless **`bug-target=`** argv supplies the target for this invocation.
|
|
479
|
+
- **`AUTO_BUG_MAX_ITEMS`**: non-negative integer — optional cap on bugs consumed per
|
|
480
|
+
orchestrator run for **`all-open`**; **`0`** or unset = no cap beyond queue length.
|
|
481
|
+
- **`AUTO_BUG_ON_BLOCK`**: `stop|skip` — queue behavior when a bug segment stops at a
|
|
482
|
+
pause/stop boundary.
|
|
483
|
+
|
|
484
|
+
### Scheduler mutex and argv precedence (AC-3)
|
|
485
|
+
|
|
486
|
+
**One active scheduler** per materialized run:
|
|
487
|
+
|
|
488
|
+
- If merged scratchpad has **`AUTO_BACKLOG_DRAIN=1`** **and** **`AUTO_BUG_QUEUE=1`**
|
|
489
|
+
**and** this invocation has **no** explicit **`bug-target=`** argv token → fail
|
|
490
|
+
closed with **`[AUTO_RESUME_ERROR] AUTO_SCHEDULER_CONFLICT: ...`**.
|
|
491
|
+
- When **`bug-target=`** argv is present, it **selects** the bug scheduler for this
|
|
492
|
+
run; **`AUTO_BACKLOG_DRAIN`** must **not** drive story selection for the same
|
|
493
|
+
materialized run (story drain keys ignored for scheduler selection; record
|
|
494
|
+
**`backlog_drain_active=false`**, **`bug_queue_active=true`** in **AC-10** for
|
|
495
|
+
that run).
|
|
496
|
+
|
|
497
|
+
**Parsing order** before nominal resume resolution: **`start-from`** → **`bug-target=`**
|
|
498
|
+
argv → merged scratchpad (**`AUTO_BACKLOG_DRAIN`**, **`AUTO_BUG_*`**) →
|
|
499
|
+
**`resume_brief.md`** → **`state.md`** fallback (**`architecture.md`** **`# US-0087`**).
|
|
500
|
+
|
|
501
|
+
### OPEN queue semantics (AC-4)
|
|
502
|
+
|
|
503
|
+
- **OPEN** rows only in the canonical bug section — exclude **DONE** and non-matching ids.
|
|
504
|
+
- **Ordering**: ascending **numeric** sort on **`BUG-####`** (stable document-order
|
|
505
|
+
tie-break if needed).
|
|
506
|
+
- **`AUTO_BUG_MAX_ITEMS`**: when set to positive integer *N*, consume at most *N*
|
|
507
|
+
bugs from the head of the ordered queue this run; record **`bug_queue_remaining`**
|
|
508
|
+
for operator visibility.
|
|
509
|
+
- **Empty queue** when **`bug-target=all-open`** (or equivalent) and zero **OPEN**
|
|
510
|
+
bugs → **`[AUTO_RESUME_ERROR] AUTO_BUG_QUEUE_EMPTY: ...`** (or equivalent
|
|
511
|
+
deterministic envelope).
|
|
512
|
+
|
|
513
|
+
### Fail-closed reason codes (AC-1, AC-4, AC-8)
|
|
514
|
+
|
|
515
|
+
| Code | When |
|
|
516
|
+
|------|------|
|
|
517
|
+
| **`AUTO_BUG_QUEUE_EMPTY`** | **`all-open`** and zero **OPEN** bugs. |
|
|
518
|
+
| **`AUTO_BUG_TARGET_UNKNOWN`** | Malformed id / pattern, or id missing from canonical bug section. |
|
|
519
|
+
| **`AUTO_BUG_TARGET_NOT_OPEN`** | Known id, status not **OPEN**. |
|
|
520
|
+
| **`AUTO_SCHEDULER_CONFLICT`** | **`AUTO_BACKLOG_DRAIN=1`** ∧ **`AUTO_BUG_QUEUE=1`** without **`bug-target=`** argv. |
|
|
521
|
+
|
|
522
|
+
Do **not** overload **`PHASE_POLICY_CONFLICT`** or backlog-drain codes for these.
|
|
523
|
+
|
|
524
|
+
### Bug segment fields: `resume_brief.md` + `state.md` (`DEC-0069` / AC-5)
|
|
525
|
+
|
|
526
|
+
Default: **paired** refresh at segment boundaries — update **`handoffs/resume_brief.md`**
|
|
527
|
+
**and** append **`docs/engineering/state.md`** breadcrumbs together so continuation
|
|
528
|
+
without **`start-from`** avoids false **`RESUME_BRIEF_STALE`**.
|
|
529
|
+
|
|
530
|
+
| Field | Purpose |
|
|
531
|
+
|-------|---------|
|
|
532
|
+
| **`bug_id`** | Active **`BUG-####`** for this segment (**OPEN**), or **`(none)`**. |
|
|
533
|
+
| **`bug_queue_position`** | 1-based index into **OPEN** ordering for **`all-open`**; else **`(none)`**. |
|
|
534
|
+
| **`bug_queue_remaining`** | Count of **OPEN** bugs after current position; **`(none)`** when not queue-scoped. |
|
|
535
|
+
| **`intended_resume_phase`** | Next phase for this segment (align with **`next_scheduled_phase`** on `state.md`). |
|
|
536
|
+
|
|
537
|
+
Mirror the **AC-10** tuple (`segment_work_item_kind`, `active_bug_id`,
|
|
538
|
+
`backlog_drain_active`, `bug_queue_active`, etc.) in both surfaces per
|
|
539
|
+
**`architecture.md`** **`# US-0087`**.
|
|
540
|
+
|
|
541
|
+
## Optional bulk execute mode (US-0047 / DEC-0024)
|
|
542
|
+
|
|
543
|
+
`/auto` supports an explicit bulk execute orchestration mode for continuous
|
|
544
|
+
planned-item delivery. Default behavior remains unchanged unless explicitly
|
|
545
|
+
enabled.
|
|
546
|
+
|
|
547
|
+
Canonical controls from `.cursor/scratchpad.md`:
|
|
548
|
+
- `AUTO_EXECUTE_BULK`: `0|1` (default `0`)
|
|
549
|
+
- `AUTO_EXECUTE_MAX_ITEMS`: integer `>=1` (default `1`)
|
|
550
|
+
- `AUTO_EXECUTE_ON_BLOCK`: `stop|skip` (default `stop`)
|
|
551
|
+
- `AUTO_EXECUTE_SELECTION`: `planned_then_priority` (default)
|
|
552
|
+
- `AUTO_TEAM_SCOPE_ENFORCE`: `0|1` (default `1`)
|
|
553
|
+
|
|
554
|
+
Explicit activation contract:
|
|
555
|
+
- Bulk execute mode is activated when either:
|
|
556
|
+
- explicit argument `--execute-bulk` is present for this run, or
|
|
557
|
+
- `AUTO_EXECUTE_BULK=1` in scratchpad.
|
|
558
|
+
- Without explicit activation, preserve current non-bulk continuation behavior.
|
|
559
|
+
|
|
560
|
+
Deterministic behavior when enabled:
|
|
561
|
+
- Select next eligible planned work item via `AUTO_EXECUTE_SELECTION`.
|
|
562
|
+
- Process each item with strict isolation:
|
|
563
|
+
- fresh subagent per phase boundary
|
|
564
|
+
- fresh subagent per execute<->QA loop cycle
|
|
565
|
+
- Apply bounded stop criteria:
|
|
566
|
+
- stop at `AUTO_EXECUTE_MAX_ITEMS`, or
|
|
567
|
+
- stop/skip on blocked item per policy, or
|
|
568
|
+
- stop when no eligible items remain.
|
|
569
|
+
|
|
570
|
+
Team mode guardrails (`TEAM_MODE=1`):
|
|
571
|
+
- Snapshot and record team context inputs:
|
|
572
|
+
- `TEAM_MODE`, `TEAM_MEMBER`, `ACTIVE_TASK_IDS`
|
|
573
|
+
- If `AUTO_TEAM_SCOPE_ENFORCE=1`, only tasks in current member scope are
|
|
574
|
+
executable.
|
|
575
|
+
- Out-of-scope tasks must be deterministically handled with no writes:
|
|
576
|
+
- `stop` policy -> `EXEC_TEAM_SCOPE_BLOCKED`
|
|
577
|
+
- `skip` policy -> `EXEC_TEAM_SCOPE_SKIPPED`
|
|
578
|
+
|
|
579
|
+
## Sync policy contract (US-0038 / DEC-0018)
|
|
580
|
+
|
|
581
|
+
`/auto` may evaluate sync eligibility only at phase-completion boundaries.
|
|
582
|
+
It remains process-level guidance (no runtime git orchestrator changes).
|
|
583
|
+
|
|
584
|
+
Canonical policy controls from `.cursor/scratchpad.md`:
|
|
585
|
+
- `SYNC_POLICY_MODE`:
|
|
586
|
+
`disabled|manual|by_phase|by_milestone|custom_phase_list`
|
|
587
|
+
- `SYNC_CUSTOM_PHASES`: comma-separated canonical phase IDs for
|
|
588
|
+
`custom_phase_list` mode
|
|
589
|
+
- `ALLOW_AUTO_PUSH`: `0|1`
|
|
590
|
+
- `AUTO_PUSH_BRANCH_ALLOWLIST`: comma-separated branches/patterns
|
|
591
|
+
|
|
592
|
+
Deterministic policy semantics:
|
|
593
|
+
- `disabled`: skip sync evaluation entirely (`SYNC_DISABLED`).
|
|
594
|
+
- `manual`: no auto-sync attempts (`MANUAL_MODE_NO_AUTO`).
|
|
595
|
+
- `by_phase`: evaluate at every phase completion boundary.
|
|
596
|
+
- `by_milestone`: evaluate only at milestone completion boundary.
|
|
597
|
+
- `custom_phase_list`: evaluate only when completed phase is listed.
|
|
598
|
+
- Unset/invalid mode fails closed to `manual`.
|
|
599
|
+
|
|
600
|
+
Guarded auto-push eligibility chain (all required):
|
|
601
|
+
1. Boundary is eligible for configured mode.
|
|
602
|
+
2. `ALLOW_AUTO_PUSH=1`.
|
|
603
|
+
3. QA-first safety passes (feature work cannot auto-push before QA pass;
|
|
604
|
+
manual user-invoked sync remains allowed).
|
|
605
|
+
4. No unresolved blocking QA findings / critical unresolved issues.
|
|
606
|
+
5. Branch safety passes: protected/default branches are denied by default unless
|
|
607
|
+
explicitly allowlisted.
|
|
608
|
+
6. Mandatory pre-push checks pass:
|
|
609
|
+
- `TEST_COMMAND` is required
|
|
610
|
+
- optional `LINT_COMMAND` / `TYPECHECK_COMMAND` run only when configured
|
|
611
|
+
- failures or timeout result in `no_push`
|
|
612
|
+
|
|
613
|
+
If any condition fails, verdict is deterministic `no_push` with reason code.
|
|
614
|
+
|
|
615
|
+
Reason-code baseline:
|
|
616
|
+
- `SYNC_DISABLED`
|
|
617
|
+
- `MANUAL_MODE_NO_AUTO`
|
|
618
|
+
- `SYNC_TRIGGER_NOT_ELIGIBLE`
|
|
619
|
+
- `AUTO_PUSH_NOT_ENABLED`
|
|
620
|
+
- `PRE_QA_AUTOPUSH_FORBIDDEN`
|
|
621
|
+
- `BLOCKING_QA_FINDINGS`
|
|
622
|
+
- `BRANCH_NOT_ALLOWLISTED`
|
|
623
|
+
- `TEST_COMMAND_MISSING`
|
|
624
|
+
- `TEST_FAILED`
|
|
625
|
+
- `TEST_TIMEOUT`
|
|
626
|
+
- `OPTIONAL_CHECK_FAILED`
|
|
627
|
+
- `SYNC_PUSHED`
|
|
628
|
+
- `BACKLOG_DRAIN_DISABLED`
|
|
629
|
+
- `BACKLOG_STORY_BLOCKED_STOP`
|
|
630
|
+
- `BACKLOG_STORY_BLOCKED_SKIPPED`
|
|
631
|
+
- `BACKLOG_MAX_STORIES_REACHED`
|
|
632
|
+
- `BACKLOG_NO_ELIGIBLE_STORIES`
|
|
633
|
+
- `EXEC_BULK_DISABLED`
|
|
634
|
+
- `EXEC_BULK_ITEM_BLOCKED_STOP`
|
|
635
|
+
- `EXEC_BULK_ITEM_BLOCKED_SKIPPED`
|
|
636
|
+
- `EXEC_BULK_MAX_ITEMS_REACHED`
|
|
637
|
+
- `EXEC_BULK_NO_ELIGIBLE_ITEMS`
|
|
638
|
+
- `EXEC_TEAM_SCOPE_BLOCKED`
|
|
639
|
+
- `EXEC_TEAM_SCOPE_SKIPPED`
|
|
640
|
+
- `RUNTIME_PROOF_MISSING`
|
|
641
|
+
- `RUNTIME_PROOF_INVALID`
|
|
642
|
+
- `RUNTIME_PROOF_REUSED`
|
|
643
|
+
- `RUNTIME_PROOF_STALE`
|
|
644
|
+
- `RUNTIME_PROOF_AMBIGUOUS_LINK`
|
|
645
|
+
- `PHASE_ROLE_CAPABILITY_MISSING`
|
|
646
|
+
- `PHASE_ROLE_MISMATCH`
|
|
647
|
+
- `PHASE_POLICY_CONFLICT`
|
|
648
|
+
- `PHASE_PLAN_UNKNOWN_PHASE`
|
|
649
|
+
- `PHASE_PLAN_EMPTY_INCLUDE`
|
|
650
|
+
- `PHASE_PLAN_UNKNOWN_PROFILE`
|
|
651
|
+
- `PHASE_PLAN_INVALID_AUTO_PHASE_PLAN`
|
|
652
|
+
- `PHASE_PLAN_HIGH_RISK_ACK_REQUIRED`
|
|
653
|
+
- `START_FROM_PHASE_PLAN_EMPTY_INTERSECTION`
|
|
654
|
+
|
|
655
|
+
## Canonical `start-from` contract
|
|
656
|
+
|
|
657
|
+
- Accepted canonical phase IDs:
|
|
658
|
+
- `intake`
|
|
659
|
+
- `discovery`
|
|
660
|
+
- `research`
|
|
661
|
+
- `architecture`
|
|
662
|
+
- `sprint-plan`
|
|
663
|
+
- `plan-verify`
|
|
664
|
+
- `execute`
|
|
665
|
+
- `qa`
|
|
666
|
+
- `verify-work`
|
|
667
|
+
- `release`
|
|
668
|
+
- `refresh-context`
|
|
669
|
+
- Only canonical IDs are accepted. Alias values (for example `sprint_plan`,
|
|
670
|
+
`verifywork`) are invalid and must fail fast.
|
|
671
|
+
|
|
672
|
+
## Deterministic resume-source precedence
|
|
673
|
+
|
|
674
|
+
Resolve nominal start phase and scheduler inputs in strict order (**`US-0087`**
|
|
675
|
+
extends ordering vs legacy two-step resume):
|
|
676
|
+
|
|
677
|
+
1. Explicit `/auto start-from=<phase>`
|
|
678
|
+
2. Explicit **`bug-target=`** argv token when present (`bug-target=BUG-####` or
|
|
679
|
+
`bug-target=all-open`) — parsed **before** merged scratchpad scheduler keys;
|
|
680
|
+
selects bug scheduler for this run when applicable.
|
|
681
|
+
3. Merged scratchpad (**`US-0073`** / **`DEC-0055`**) — `AUTO_BACKLOG_DRAIN`,
|
|
682
|
+
**`AUTO_BUG_QUEUE`**, **`AUTO_BUG_TARGET`**, related flags.
|
|
683
|
+
4. `handoffs/resume_brief.md`
|
|
684
|
+
5. Conservative `docs/engineering/state.md` fallback
|
|
685
|
+
6. Fail fast on ambiguity/conflict/unrecoverable inputs (including
|
|
686
|
+
**`AUTO_SCHEDULER_CONFLICT`** when **`AUTO_BACKLOG_DRAIN=1`** ∧
|
|
687
|
+
**`AUTO_BUG_QUEUE=1`** without **`bug-target=`** argv).
|
|
688
|
+
|
|
689
|
+
Deterministic precedence behavior:
|
|
690
|
+
- If explicit `start-from` is valid, it wins for the **nominal start phase** anchor;
|
|
691
|
+
scheduler mutex (**`AUTO_SCHEDULER_CONFLICT`**) is still evaluated when scratchpad
|
|
692
|
+
enables both drains without **`bug-target=`** argv resolution.
|
|
693
|
+
- **`bug-target=`** argv when present overrides conflicting scratchpad scheduler
|
|
694
|
+
selection for **this** run (bug queue active; story drain inactive for scheduling).
|
|
695
|
+
- `state.md` fallback applies only per the ordered chain above when higher-priority
|
|
696
|
+
sources do not supply a trustworthy anchor.
|
|
697
|
+
- If `resume_brief.md` is present but stale or unparseable, fail fast instead
|
|
698
|
+
of silently falling back.
|
|
699
|
+
|
|
700
|
+
## Conflict and stale/unparseable policy
|
|
701
|
+
|
|
702
|
+
- Explicit valid override always wins and is logged as override.
|
|
703
|
+
- **`AUTO_BACKLOG_DRAIN=1`** and **`AUTO_BUG_QUEUE=1`** together without explicit
|
|
704
|
+
**`bug-target=`** argv → **`AUTO_SCHEDULER_CONFLICT`** (fail fast; do not pick a
|
|
705
|
+
silent default scheduler).
|
|
706
|
+
- No override + `resume_brief` conflicts with `state` inference: fail fast.
|
|
707
|
+
- `resume_brief` exists but stale: fail fast.
|
|
708
|
+
- `resume_brief` exists but unparseable: fail fast.
|
|
709
|
+
- `state` fallback yields multiple candidate phases: fail fast.
|
|
710
|
+
- `state` fallback yields no trustworthy boundary: fail fast.
|
|
711
|
+
|
|
712
|
+
## Fail-fast error code contract
|
|
713
|
+
|
|
714
|
+
All resume-resolution failures must use:
|
|
715
|
+
|
|
716
|
+
`[AUTO_RESUME_ERROR] <code>: <summary>. Source=<source>. Fix: <action>.`
|
|
717
|
+
|
|
718
|
+
Required codes:
|
|
719
|
+
- `INVALID_START_FROM`
|
|
720
|
+
- `RESUME_BRIEF_MISSING`
|
|
721
|
+
- `RESUME_BRIEF_STALE`
|
|
722
|
+
- `RESUME_BRIEF_UNPARSEABLE`
|
|
723
|
+
- `RESUME_STATE_CONFLICT`
|
|
724
|
+
- `STATE_PHASE_AMBIGUOUS`
|
|
725
|
+
- `STATE_PHASE_UNRECOVERABLE`
|
|
726
|
+
|
|
727
|
+
Bug-queue extensions (**`US-0087`**; use the same **`[AUTO_RESUME_ERROR]`** envelope
|
|
728
|
+
for resolver/materialization failures):
|
|
729
|
+
|
|
730
|
+
- `AUTO_SCHEDULER_CONFLICT`
|
|
731
|
+
- `AUTO_BUG_QUEUE_EMPTY`
|
|
732
|
+
- `AUTO_BUG_TARGET_UNKNOWN`
|
|
733
|
+
- `AUTO_BUG_TARGET_NOT_OPEN`
|
|
734
|
+
|
|
735
|
+
## Continuous multi-phase execution (US-0088)
|
|
736
|
+
|
|
737
|
+
A single `/auto` orchestrated run (or a **documented equivalent outer driver** —
|
|
738
|
+
see **AC-1 equivalence** below) advances through **all phases** in the
|
|
739
|
+
**intersected resolved schedule** (**Step 5** below — cross-anchor:
|
|
740
|
+
**"reference Step 5"**) until a **deterministic stop condition** fires. The
|
|
741
|
+
orchestrator does **not** stop after spawning one phase unless the stop matrix
|
|
742
|
+
requires it.
|
|
743
|
+
|
|
744
|
+
### Outer-driver equivalence (AC-1, Option B)
|
|
745
|
+
|
|
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:
|
|
753
|
+
|
|
754
|
+
- Same intersected phase order as a single-invocation run.
|
|
755
|
+
- Same per-phase isolation evidence (**DEC-0029**) + strict-proof attestation
|
|
756
|
+
(**DEC-0038**).
|
|
757
|
+
- Same deterministic stop reasons and stop matrix evaluation.
|
|
758
|
+
- Same `resume_brief` + `state.md` refresh at every materialized phase boundary.
|
|
759
|
+
- Operators must follow the runbook recipe
|
|
760
|
+
(**`docs/engineering/runbook.md`** § Continuous `/auto` + backlog drain).
|
|
761
|
+
|
|
762
|
+
### Deterministic stop matrix (US-0088)
|
|
763
|
+
|
|
764
|
+
| Condition | Behavior | Operator notify (AC-2) |
|
|
765
|
+
|-----------|----------|------------------------|
|
|
766
|
+
| Next phase exists, no hard stop | **Continue** — preflight US-0069, spawn next phase | Quiet OK when `AUTO_QUIET=1` |
|
|
767
|
+
| `decision_gate` | **Stop** until resolved | **Always** (non-suppressible) |
|
|
768
|
+
| `error` / missing critical input | **Stop** | **Always** (non-suppressible) |
|
|
769
|
+
| `AUTO_PAUSE_REQUEST` / `pause` | **Stop** at safe boundary | **Always** (non-suppressible) |
|
|
770
|
+
| `AUTO_LOOP_MAX_CYCLES` / `loop_max` | **Stop** | **Always** (non-suppressible) |
|
|
771
|
+
| `blocked` (sync/scope gate) | **Stop** | **Always** (non-suppressible) |
|
|
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) |
|
|
773
|
+
| `BACKLOG_MAX_STORIES_REACHED` | **Stop** | **Always** (non-suppressible) |
|
|
774
|
+
|
|
775
|
+
`stop_reason` vocabulary: `completed`, `decision_gate`, `missing_input`,
|
|
776
|
+
`pause_request`, `loop_max`, `error`, `blocked`.
|
|
777
|
+
|
|
778
|
+
### Full-autonomy stop matrix (US-0092)
|
|
779
|
+
|
|
780
|
+
**`AUTO_FLOW_MODE=full_autonomy`** enables **`scripts/auto_outer_driver.py`**
|
|
781
|
+
(spawn-only outer driver). **TOKEN_PROFILE controls context breadth / token cost only**
|
|
782
|
+
— never automation level, drain, or outer-driver invocation.
|
|
783
|
+
|
|
784
|
+
| Condition | US-0088 | `full_autonomy` delta | Operator notify |
|
|
785
|
+
|-----------|---------|------------------------|-----------------|
|
|
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` |
|
|
787
|
+
| `decision_gate` | Hard stop | **No change — hard** | Always |
|
|
788
|
+
| Unrecoverable `error` | Hard stop | **No change — hard** | Always |
|
|
789
|
+
| Critical `missing_input` | Hard stop | **No change — hard** | Always |
|
|
790
|
+
| Transient `missing_input` (recoverable) | Hard stop | **Relaxable** — bounded block-retry | Notify on cap |
|
|
791
|
+
| `pause_request` | Hard stop | **No change — hard** | Always |
|
|
792
|
+
| `loop_max` | Hard stop | **No change — hard** | Always |
|
|
793
|
+
| `blocked` — transient/sync | Hard stop | **Relaxable** when recoverable | Notify on cap |
|
|
794
|
+
| `blocked` — isolation/strict-proof/ownership | Hard stop | **No change — hard** | Always |
|
|
795
|
+
| UAT/QA fail | Hard stop (operator) | **Relaxable** when `AUTO_IMPLEMENTATION_LOOP=1` | Notify on cap |
|
|
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 |
|
|
797
|
+
| `BACKLOG_MAX_STORIES_REACHED` | Hard stop | **No change — hard** | Always |
|
|
798
|
+
| `AUTO_SCHEDULER_CONFLICT` | Hard stop | **No change — hard** | Always |
|
|
799
|
+
| `RELEASE_PUBLISH_MODE=auto` | Explicit opt-in | **No change — hard default-off** | Always on publish |
|
|
800
|
+
| Security deny (`.env`, intake mutation) | Hard deny | **No change — hard** | Always |
|
|
801
|
+
|
|
802
|
+
**Drain-advance-without-pause**: with **`full_autonomy`** in IDE, native in-chat chain
|
|
803
|
+
schedules next OPEN story/bug **immediately** **without operator re-`/auto`**; outer
|
|
804
|
+
driver is **optional** / **fallback** for headless/CI. Paired **`resume_brief`** +
|
|
805
|
+
**`state.md`** refresh per **DEC-0069** at every boundary.
|
|
806
|
+
|
|
807
|
+
### Native in-chat auto-chain (US-0095 / DEC-0080)
|
|
808
|
+
|
|
809
|
+
**IDE primary path** when **`AUTO_FLOW_MODE=full_autonomy`** + Cursor IDE + Task tool:
|
|
810
|
+
orchestrator runs a **foreground sequential** spawn loop in the **same /auto orchestrator
|
|
811
|
+
session** (**Native in-chat auto-chain**). Continuation loop: preflight → spawn → await →
|
|
812
|
+
verify → caps → branch. **`NATIVE_CHAIN_UNAVAILABLE`** when Task tool denied or spawn
|
|
813
|
+
depth limit hit — hard stop for native path; suggest outer driver as **optional** fallback.
|
|
814
|
+
|
|
815
|
+
**Activation gate**: `full_autonomy` + IDE context + Task tool → set **`native_chain_active=true`**
|
|
816
|
+
in `state.md` boundary. Set **`native_chain_continuing=true`** when orchestrator scheduled
|
|
817
|
+
next spawn/advance **this** boundary.
|
|
818
|
+
|
|
819
|
+
**Spawn-only invariants** (**BUG-0006**): orchestrator schedules phase-role subagents only;
|
|
820
|
+
each phase completes via fresh spawn + artifacts; no in-band phase work.
|
|
821
|
+
|
|
822
|
+
**Forbidden turn-boundary semantics**: **`stop_reason=completed (segment exhausted)`** is
|
|
823
|
+
**invalid** when next phase, drain target, or relaxable retry is schedulable.
|
|
824
|
+
|
|
825
|
+
### IDE drain-advance-without-pause algorithm (US-0095)
|
|
826
|
+
|
|
827
|
+
**Trigger** (all required): `stop_phase=refresh-context`; `stop_reason=completed`; drain
|
|
828
|
+
enabled (**`AUTO_BACKLOG_DRAIN=1`** or bug-queue per **US-0087** mutex); budget remaining.
|
|
829
|
+
|
|
830
|
+
| Step | Action |
|
|
831
|
+
|------|--------|
|
|
832
|
+
| **1** | **READ** latest phase-boundary block in `docs/engineering/state.md` (`stop_phase`, `stop_reason`, `story_id`, `sprint_id`, `orchestrator_run_id`, `backlog_drain_stories_remaining_budget`, `bug_queue_remaining`) |
|
|
833
|
+
| **2** | **ASSERT** **DEC-0069** pairing — completed phase refreshed **`resume_brief`** + **`state.md`**; stale → **`RESUME_BRIEF_STALE`** (fail-closed, no advance) |
|
|
834
|
+
| **3** | **SELECT** next work item — story: decrement budget, select OPEN story per `AUTO_STORY_SELECTION`; bug: ascending **`BUG-####`** per **US-0087** |
|
|
835
|
+
| **4** | **RELOAD** scratchpad; **MATERIALIZE** `resolved_phase_plan` (**US-0070**); intersect with segment entry phase |
|
|
836
|
+
| **5** | **PREPEND** `handoffs/resume_brief.md` — `story_id`/`bug_id`, `intended_resume_phase`, unchanged `orchestrator_run_id`, drain counters |
|
|
837
|
+
| **6** | **APPEND** `state.md` materialization breadcrumb for new segment |
|
|
838
|
+
| **7** | **IMMEDIATELY** spawn first phase subagent — **without operator re-`/auto`**, **no** mandatory outer-driver instruction |
|
|
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
|
+
|
|
846
|
+
**DEC-0069 pairing mandate**: every phase boundary and drain advance **must** refresh
|
|
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.
|
|
850
|
+
|
|
851
|
+
### Native-chain stop matrix (US-0095)
|
|
852
|
+
|
|
853
|
+
Native chain **does not weaken** **DEC-0078** hard gates:
|
|
854
|
+
|
|
855
|
+
| Condition | Native chain behavior |
|
|
856
|
+
|-----------|----------------------|
|
|
857
|
+
| Next intersected phase, no hard stop | **Continue in-chat** — schedule spawn |
|
|
858
|
+
| **`decision_gate`**, isolation/strict-proof, security deny | **Hard stop** — unchanged |
|
|
859
|
+
| **`BACKLOG_MAX_STORIES_REACHED`**, **`loop_max`**, unrecoverable **`error`**, **`pause_request`** | **Hard stop** — unchanged |
|
|
860
|
+
| Relaxable transient stops (**DEC-0078**) | Bounded ledger retry → `phase_respawn` / `native_chain_continue` |
|
|
861
|
+
| Segment complete + drain enabled | **Drain-advance** — immediate in-chat continuation |
|
|
862
|
+
| Task spawn denied | **`NATIVE_CHAIN_UNAVAILABLE`** — hard for native path |
|
|
863
|
+
|
|
864
|
+
### `AUTO_QUIET` under native chain (US-0095)
|
|
865
|
+
|
|
866
|
+
| Event | `AUTO_QUIET=0` | `AUTO_QUIET=1` |
|
|
867
|
+
|-------|----------------|----------------|
|
|
868
|
+
| Routine phase PASS | May notify | **Suppress** |
|
|
869
|
+
| Native chain continuing to next phase | Compact breadcrumb OK | **Suppress** |
|
|
870
|
+
| Drain advance to next story/bug | Segment handoff notify OK | **Suppress** routine prose; **no** outer-driver instruction |
|
|
871
|
+
| `decision_gate`, errors, caps, **`NATIVE_CHAIN_UNAVAILABLE`** | **Always** | **Always** |
|
|
872
|
+
| `BACKLOG_MAX_STORIES_REACHED`, `BLOCK_RETRY_CAP_EXHAUSTED` | **Always** | **Always** |
|
|
873
|
+
|
|
874
|
+
**Forbidden grep patterns** (IDE-primary `full_autonomy` sections): mandatory `run the outer driver`;
|
|
875
|
+
`re-run /auto` between drain segments; `segment exhausted` as terminal when continuation pending;
|
|
876
|
+
unqualified `python scripts/auto_outer_driver.py`.
|
|
877
|
+
|
|
878
|
+
### Block-retry ledger + unified cap interaction (US-0092 / US-0095)
|
|
879
|
+
|
|
880
|
+
Append-only **`handoffs/auto_block_retry/<orchestrator_run_id>.jsonl`** — names-only;
|
|
881
|
+
no secrets. IDE native chain and outer driver **share one accounting model**:
|
|
882
|
+
|
|
883
|
+
| Cap | Scope |
|
|
884
|
+
|-----|-------|
|
|
885
|
+
| `AUTO_LOOP_MAX_CYCLES` | Each phase spawn + each drain advance = **1** `outer_cycle_index` increment |
|
|
886
|
+
| `AUTO_IMPLEMENTATION_LOOP` | Inner `execute`↔`qa`↔`verify-work` → `implementation_loop_index` |
|
|
887
|
+
| `AUTO_BLOCK_RETRY_MAX` | Per `(story_id, stop_reason)` recoverable retries |
|
|
888
|
+
| `AUTO_BACKLOG_MAX_STORIES` | `backlog_drain_stories_remaining_budget` decremented at segment advance |
|
|
889
|
+
|
|
890
|
+
**`remediation_action` values**: `phase_respawn`, `native_chain_continue`, `drain_advance`
|
|
891
|
+
(alongside existing `outer_reinvoke`).
|
|
892
|
+
|
|
893
|
+
**State breadcrumb fields** (each `full_autonomy` phase boundary):
|
|
894
|
+
|
|
895
|
+
| Field | Semantics |
|
|
896
|
+
|-------|-----------|
|
|
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 |
|
|
900
|
+
| **`outer_cycle_index`** | Continuation cycles this run (int ≥ 0) |
|
|
901
|
+
| **`implementation_loop_index`** | Inner remediation cycles for current story segment (int ≥ 0) |
|
|
902
|
+
|
|
903
|
+
Cap exhaustion → exit **6** `BLOCK_RETRY_CAP_EXHAUSTED`. **Ordering**: check
|
|
904
|
+
**`AUTO_LOOP_MAX_CYCLES`** first; then **`AUTO_IMPLEMENTATION_LOOP`** +
|
|
905
|
+
**`AUTO_BLOCK_RETRY_MAX`** before recoverable retry; unrecoverable classes bypass ledger.
|
|
906
|
+
|
|
907
|
+
**Security deny-list** (unchanged from **DEC-0078**): no auto-read **`.env`**, no intake
|
|
908
|
+
evidence mutation, no publish without **`RELEASE_PUBLISH_MODE=auto`**.
|
|
909
|
+
|
|
910
|
+
### Browser UAT self-test (US-0093)
|
|
911
|
+
|
|
912
|
+
Two-tier browser UAT: **`scripts/uat_probe_lib.py`** classifies and completes subprocess probes;
|
|
913
|
+
phase subagents (**`/verify-work`**, **`/qa`**, **`/execute`**) own Cursor browser MCP when
|
|
914
|
+
**`UAT_BROWSER_PROBE_MODE=cursor`** (default). Lib **never** invokes browser MCP (**BUG-0006**).
|
|
915
|
+
|
|
916
|
+
| Key | Role |
|
|
917
|
+
|-----|------|
|
|
918
|
+
| `UAT_BROWSER_PROBE_MODE` | `cursor` \| `http_fallback` \| `playwright_fallback` |
|
|
919
|
+
| `UAT_BROWSER_FALLBACK_CHAIN` | HTTP → Playwright after **`UAT_BROWSER_UNAVAILABLE`** |
|
|
920
|
+
| `UAT_PROCESS_HEALTH_POLL_SECONDS` / `UAT_PROCESS_HEALTH_POLL_INTERVAL_SECONDS` | `process_health` readiness |
|
|
921
|
+
| `DEV_SERVER_PORT` / `DEV_SERVER_COMMAND` | Dev-server inference overrides |
|
|
922
|
+
|
|
923
|
+
CI: set **`UAT_BROWSER_PROBE_MODE=http_fallback`**. Evidence:
|
|
924
|
+
**`sprints/Sxxxx/evidence/browser/`** + **`browser_evidence_refs`** in **`uat.json`**.
|
|
925
|
+
Validate: **`python scripts/uat_probe_lib.py --merge-result <fragment.json>`**.
|
|
926
|
+
Manual override: **`@browser`** in Agent panel. Orthogonal to **`PERMISSION_MODE`** and browser
|
|
927
|
+
approval modes.
|
|
928
|
+
### `AUTO_QUIET` vs `TOKEN_PROFILE` (US-0088 / AC-2)
|
|
929
|
+
|
|
930
|
+
| Key | Values | Role |
|
|
931
|
+
|-----|--------|------|
|
|
932
|
+
| `AUTO_QUIET` | `0` \| `1` (default `0`) | `1` = suppress routine per-phase success chatter; must **not** suppress `decision_gate`, errors, pause, `loop_max`, `blocked`, or missing inputs. |
|
|
933
|
+
| `TOKEN_PROFILE` | `lean` \| `balanced` \| `full` | **TOKEN_PROFILE controls context breadth / token cost only** — **DEC-0035** / **US-0080** / **US-0092**; **orthogonal** to `AUTO_QUIET`, drain, and outer-driver invocation. |
|
|
934
|
+
|
|
935
|
+
### `TOKEN_PROFILE` × `CAVEMAN_MODE` non-substitution (US-0089 / DEC-0072 §1)
|
|
936
|
+
|
|
937
|
+
`TOKEN_PROFILE` controls context breadth. `CAVEMAN_MODE` controls reply voice. Neither substitutes for the other; setting one does not change the other. Combine freely.
|
|
938
|
+
|
|
939
|
+
`CAVEMAN_MODE` and `CAVEMAN_LEVEL` live in `.cursor/scratchpad.md` (default
|
|
940
|
+
`CAVEMAN_MODE=0`, `CAVEMAN_LEVEL=` empty). `CAVEMAN_COMPRESS_INPUT` and
|
|
941
|
+
`CAVEMAN_FILE_SCOPE` are reserved for **US-0090** and remain **documented
|
|
942
|
+
no-ops** in US-0089. The literal-region invariant, the five canonical
|
|
943
|
+
operator toggle phrases (`caveman on`, `caveman off`, `stop caveman`,
|
|
944
|
+
`normal mode`, `caveman: lite|full|ultra`), and the `CAVEMAN_LEVEL_UNKNOWN`
|
|
945
|
+
fail-closed contract live in `.cursor/rules/caveman.mdc`. Default-off is
|
|
946
|
+
enforced by the `test_caveman_default_off_*` subtests in
|
|
947
|
+
`tests/auto_command_contract_test.py` (**DEC-0072** §6).
|
|
948
|
+
|
|
949
|
+
### `TOKEN_PROFILE` × `CAVEMAN_MODE` × `CAVEMAN_COMPRESS_INPUT` non-substitution (US-0090 / DEC-0073 §1)
|
|
950
|
+
|
|
951
|
+
`TOKEN_PROFILE` controls context breadth. `CAVEMAN_MODE` controls reply voice. `CAVEMAN_COMPRESS_INPUT` controls input-side file compression. All three axes are orthogonal: setting one does not change the others, and none substitutes for another.
|
|
952
|
+
|
|
953
|
+
`CAVEMAN_COMPRESS_INPUT` and `CAVEMAN_FILE_SCOPE` live in
|
|
954
|
+
`.cursor/scratchpad.md` (defaults: `CAVEMAN_COMPRESS_INPUT=0`,
|
|
955
|
+
`CAVEMAN_FILE_SCOPE=` empty). Activation also requires the operator to
|
|
956
|
+
invoke `scripts/caveman_compress_input.py --write`; absent any of the three
|
|
957
|
+
conditions the script is a no-op and the fail-closed reason codes from
|
|
958
|
+
**DEC-0073** §7 apply. Default-off is enforced by the
|
|
959
|
+
`test_caveman_compress_input_*` subtests in
|
|
960
|
+
`tests/auto_command_contract_test.py` (**DEC-0073** §11).
|
|
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
|
+
|
|
1053
|
+
## Steps
|
|
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`:
|
|
1057
|
+
detect exactly-one policy mode, expand, apply non-skippable reinstatement,
|
|
1058
|
+
validate tokens/profile/ack requirements, and append plan breadcrumbs
|
|
1059
|
+
(`phase_policy_mode`, `resolved_phase_plan`, `skipped_phases` + reasons) to
|
|
1060
|
+
`docs/engineering/state.md` **before** any phase spawn. On failure, emit
|
|
1061
|
+
deterministic phase-plan reason codes and stop (no partial schedule).
|
|
1062
|
+
2. Parse optional `start-from=<phase>` and validate canonical phase ID rules.
|
|
1063
|
+
Parse optional **`bug-target=`** argv literals (**`US-0087`**) and evaluate
|
|
1064
|
+
**scheduler mutex** (`AUTO_SCHEDULER_CONFLICT` when **`AUTO_BACKLOG_DRAIN=1`**
|
|
1065
|
+
∧ **`AUTO_BUG_QUEUE=1`** without **`bug-target=`** argv).
|
|
1066
|
+
Parse optional `--execute-bulk` and treat it as explicit one-run override.
|
|
1067
|
+
3. Resolve **nominal** start phase using deterministic precedence:
|
|
1068
|
+
- explicit `start-from` → **`bug-target=`** argv (when present) → merged scratchpad
|
|
1069
|
+
→ resume brief → state fallback → fail-fast.
|
|
1070
|
+
- Emit `[AUTO_RESUME_ERROR] ...` message on resolver failure.
|
|
1071
|
+
3a. **Intersect** the nominal start anchor with the resolved phase plan (plan
|
|
1072
|
+
order preserved; drop scheduled phases strictly before the anchor in canonical
|
|
1073
|
+
order). **Empty intersection** → fail fast with
|
|
1074
|
+
`START_FROM_PHASE_PLAN_EMPTY_INTERSECTION` and diagnostics listing
|
|
1075
|
+
`resolved_phase_plan` vs `requested_start_phase` / inferred resume anchor.
|
|
1076
|
+
Set the executable schedule to this intersection.
|
|
1077
|
+
4. Record continuation breadcrumb metadata in `docs/engineering/state.md`:
|
|
1078
|
+
- `invocation_mode=auto`
|
|
1079
|
+
- `requested_start_from`
|
|
1080
|
+
- `resolved_start_phase` (first phase of the intersected schedule)
|
|
1081
|
+
- `resolution_source` (`argument|resume_brief|state_fallback`)
|
|
1082
|
+
- `resolution_status` (`resolved|fail-fast`)
|
|
1083
|
+
- `timestamp`
|
|
1084
|
+
5. **(reference Step 5 — continuous multi-phase spawn)** **IDE primary path
|
|
1085
|
+
(US-0095)**: when **`AUTO_FLOW_MODE=full_autonomy`** + Cursor IDE + Task tool,
|
|
1086
|
+
orchestrator runs **Native in-chat auto-chain** — **foreground sequential**
|
|
1087
|
+
spawn loop in the **same /auto orchestrator session** until stop matrix fires
|
|
1088
|
+
(see **Native in-chat auto-chain (US-0095)** above). Otherwise spawn a fresh
|
|
1089
|
+
subagent for each remaining phase in **the intersected resolved schedule order**
|
|
1090
|
+
(not the full canonical list when phases are omitted), starting at
|
|
1091
|
+
`resolved_start_phase`, and **advance through all subsequent phases** until a
|
|
1092
|
+
**deterministic stop condition** fires (see **Deterministic stop matrix
|
|
1093
|
+
(US-0088)** above). The orchestrator does **not** stop after a single phase
|
|
1094
|
+
spawn unless the stop matrix requires it; outer-driver equivalence applies
|
|
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`**):
|
|
1098
|
+
default full path:
|
|
1099
|
+
intake -> discovery -> research -> architecture -> sprint plan ->
|
|
1100
|
+
plan verify -> execute -> QA -> verify work -> release -> refresh context.
|
|
1101
|
+
If `SECURITY_REVIEW=1`, run `/security-review` in a fresh security subagent:
|
|
1102
|
+
- in `design` mode immediately after architecture and before sprint plan,
|
|
1103
|
+
- in `code` mode immediately after execute and before QA.
|
|
1104
|
+
If `SECURITY_REVIEW=0` (default), skip both checks with zero overhead.
|
|
1105
|
+
- If `AUTO_BACKLOG_DRAIN=1`, repeat story lifecycle for next eligible OPEN
|
|
1106
|
+
story using deterministic selection policy until bounded stop criteria.
|
|
1107
|
+
**Reload merged scratchpad phase-selection inputs and recompute the phase
|
|
1108
|
+
plan at each story boundary** (same policy class as single-segment runs).
|
|
1109
|
+
- If bug-queue mode is active (**`bug-target=`** argv or **`AUTO_BUG_QUEUE=1`**
|
|
1110
|
+
with resolved target), iterate **OPEN** bugs per **Optional bug-queue mode
|
|
1111
|
+
(US-0087)** — ascending numeric **`BUG-####`** order, **`AUTO_BUG_MAX_ITEMS`**
|
|
1112
|
+
cap, **`AUTO_BUG_ON_BLOCK`** stop/skip — running the same **resolved phase plan**
|
|
1113
|
+
per bug segment with fresh spawns only. **Reload scratchpad and revalidate
|
|
1114
|
+
mutex at each bug boundary.** Empty **OPEN** queue → **`AUTO_BUG_QUEUE_EMPTY`**.
|
|
1115
|
+
- If bulk execute mode is active (`--execute-bulk` or
|
|
1116
|
+
`AUTO_EXECUTE_BULK=1`), iterate eligible planned items using
|
|
1117
|
+
`AUTO_EXECUTE_SELECTION` with bounded item count
|
|
1118
|
+
(`AUTO_EXECUTE_MAX_ITEMS`) and deterministic block/skip semantics.
|
|
1119
|
+
**Reload merged scratchpad phase-selection inputs and recompute the phase
|
|
1120
|
+
plan at each item boundary** (no silent revival of omitted phases).
|
|
1121
|
+
- In team mode with enforcement enabled, run pre-mutation scope checks against
|
|
1122
|
+
`TEAM_MEMBER` and `ACTIVE_TASK_IDS`; out-of-scope tasks produce deterministic
|
|
1123
|
+
reason codes and no writes.
|
|
1124
|
+
- **US-0069 / DEC-0051**: Before each phase spawn, resolve the single-valued
|
|
1125
|
+
expected role (matrix + `AUTO_ROLE_RESEARCH`, `AUTO_ROLE_PLAN_VERIFY`,
|
|
1126
|
+
`AUTO_ROLE_REFRESH_CONTEXT`), enforce execute default deny / override
|
|
1127
|
+
contract, and run the preflight capability gate; on failure stop with
|
|
1128
|
+
`PHASE_ROLE_CAPABILITY_MISSING` (no unrelated-role spawn).
|
|
1129
|
+
- **US-0069 / DEC-0051**: After each phase completes, validate isolation
|
|
1130
|
+
`role` and strict-proof `role` against the preflight-resolved expected
|
|
1131
|
+
role; on conflict stop with `PHASE_ROLE_MISMATCH`.
|
|
1132
|
+
6. Pass only the phase input files and current objective to each spawned
|
|
1133
|
+
subagent. Do not pass prior conversational reasoning as phase context.
|
|
1134
|
+
7. If `AUTO_IMPLEMENTATION_LOOP=1`, alternate fresh subagents for execute and QA
|
|
1135
|
+
(`dev`, then `qa`, then new `dev`, then new `qa`) until no blocking findings
|
|
1136
|
+
or `AUTO_LOOP_MAX_CYCLES` is reached.
|
|
1137
|
+
- After each cycle, verify that both phases wrote new isolation evidence
|
|
1138
|
+
entries (distinct `fresh_context_marker` per phase per cycle).
|
|
1139
|
+
8. If `AUTO_PAUSE_REQUEST=1`, stop at the next safe boundary
|
|
1140
|
+
(`AUTO_PAUSE_POLICY`) and spawn `/pause` in a fresh curator subagent.
|
|
1141
|
+
9. Preserve existing stop conditions and gates without bypass:
|
|
1142
|
+
- decision gate
|
|
1143
|
+
- missing critical input
|
|
1144
|
+
- pause request at safe boundary
|
|
1145
|
+
- loop max cycles reached
|
|
1146
|
+
10. On stop (or completion), write breadcrumbs:
|
|
1147
|
+
- `stop_reason` (`completed|decision_gate|missing_input|pause_request|loop_max`)
|
|
1148
|
+
- `stop_phase`
|
|
1149
|
+
- `timestamp`
|
|
1150
|
+
11. If stopped before completion, update `handoffs/resume_brief.md` with the
|
|
1151
|
+
intended next phase and stop metadata.
|
|
1152
|
+
11a. At each phase boundary, verify isolation evidence exists for the completed
|
|
1153
|
+
phase in `docs/engineering/state.md` and includes all required fields. If
|
|
1154
|
+
missing/invalid/stale, stop with the appropriate reason code and remediation
|
|
1155
|
+
guidance (run the phase again in a fresh subagent context and write new
|
|
1156
|
+
evidence). Append **phase boundary status** per **Configurable phase
|
|
1157
|
+
selection policy (US-0070 / DEC-0052)** (selected/skipped summary + next
|
|
1158
|
+
scheduled phase).
|
|
1159
|
+
11b. At each phase boundary, verify strict runtime attestation tuple exists and
|
|
1160
|
+
is valid for the completed phase (`orchestrator_run_id`,
|
|
1161
|
+
`runtime_proof_id`, `phase_id`, `role`, `proof_issued_at`,
|
|
1162
|
+
`proof_ttl_seconds`, `proof_hash`).
|
|
1163
|
+
- Missing tuple: `RUNTIME_PROOF_MISSING`
|
|
1164
|
+
- Invalid schema/hash/linkage: `RUNTIME_PROOF_INVALID`
|
|
1165
|
+
- Reused `runtime_proof_id`: `RUNTIME_PROOF_REUSED`
|
|
1166
|
+
- Expired proof TTL / stale proof: `RUNTIME_PROOF_STALE`
|
|
1167
|
+
- Ambiguous proof-to-checkpoint linkage: `RUNTIME_PROOF_AMBIGUOUS_LINK`
|
|
1168
|
+
- Remediation: rerun affected phase in fresh subagent context, write new
|
|
1169
|
+
strict-proof tuple + checkpoint evidence, then continue.
|
|
1170
|
+
12. At each phase boundary, evaluate sync policy only when mode requires it and
|
|
1171
|
+
record a deterministic sync verdict entry with:
|
|
1172
|
+
- `phase_boundary`
|
|
1173
|
+
- `policy_mode`
|
|
1174
|
+
- `trigger_source` (`manual|auto`)
|
|
1175
|
+
- `branch`
|
|
1176
|
+
- `checks` (`test|lint|typecheck`: `pass|fail|skipped`)
|
|
1177
|
+
- `qa_status_snapshot`
|
|
1178
|
+
- `push_decision` (`pushed|blocked|not_eligible`)
|
|
1179
|
+
- `reason_code`
|
|
1180
|
+
- `evidence_refs`
|
|
1181
|
+
13. When backlog-drain mode, bug-queue mode, or bulk execute mode is enabled,
|
|
1182
|
+
append per-item run summary entries:
|
|
1183
|
+
- `item_id`
|
|
1184
|
+
- `item_kind` (`story|sprint|bug`)
|
|
1185
|
+
- `story_id`
|
|
1186
|
+
- `bug_id` (when `item_kind=bug`)
|
|
1187
|
+
- `sprint_id`
|
|
1188
|
+
- `story_start_phase`
|
|
1189
|
+
- `story_stop_phase`
|
|
1190
|
+
- `story_outcome` (`released|blocked|skipped`)
|
|
1191
|
+
- `story_reason_code`
|
|
1192
|
+
- `team_context_snapshot` (`TEAM_MODE`, `TEAM_MEMBER`, `ACTIVE_TASK_IDS`)
|
|
1193
|
+
- `timestamp`
|
|
1194
|
+
|
|
1195
|
+
## Backward compatibility
|
|
1196
|
+
|
|
1197
|
+
- Manual and interactive workflows remain unchanged by default.
|
|
1198
|
+
- `/resume` remains valid for context loading and guided continuation.
|
|
1199
|
+
- Deterministic precedence and fail-fast behavior apply when `/auto` continuation
|
|
1200
|
+
is invoked.
|
|
1201
|
+
|
|
1202
|
+
## Deterministic artifact ordering guard (US-0058 / DEC-0040)
|
|
1203
|
+
|
|
1204
|
+
- When `/auto` coordinates phases that write mutable artifacts, each phase must
|
|
1205
|
+
follow `docs/engineering/artifact-ordering-policy.md`.
|
|
1206
|
+
- Ordering policies are mandatory:
|
|
1207
|
+
- `state.md`: append-bottom
|
|
1208
|
+
- `backlog.md` / `acceptance.md`: sorted-canonical
|
|
1209
|
+
- release/handoff surfaces: policy-specific (prepend/append) as documented.
|
|
1210
|
+
- If a required placement anchor is missing or ambiguous, fail closed with
|
|
1211
|
+
`ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and do not continue.
|