its-magic 0.1.2-39 → 0.1.2-42
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 +4 -0
- package/installer.ps1 +1 -1
- package/installer.sh +649 -643
- package/package.json +5 -1
- package/scripts/guard_installer_publish.py +88 -0
- package/scripts/remote_config_summary.py +243 -0
- package/template/.cursor/commands/auto.md +132 -17
- package/template/.cursor/commands/execute.md +6 -0
- package/template/.cursor/commands/qa.md +5 -0
- package/template/.cursor/rules/coding-standards.mdc +7 -0
- package/template/.cursor/scratchpad.local.example.md +20 -1
- package/template/.cursor/scratchpad.md +35 -10
- package/template/.cursorignore +5 -0
- package/template/.env.example +28 -0
- package/template/README.md +4 -0
- package/template/docs/engineering/auto-orchestration-reference.md +315 -27
- package/template/docs/engineering/context/installer-owned-paths.manifest +78 -72
- package/template/docs/engineering/runbook.md +1772 -1525
- package/template/docs/engineering/runtime-connectivity.md +47 -0
- package/template/docs/engineering/us-0084-remote-e2e.md +44 -0
- package/template/scripts/guard_installer_publish.py +88 -0
- package/template/scripts/remote_config_summary.py +243 -0
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# - DONE: 0|1 (stop hook loops)
|
|
16
16
|
MAGIC_CONTEXT_STRICT=1
|
|
17
17
|
LOOP_UNTIL_GREEN=1
|
|
18
|
-
RUN_TESTS_ON_EDIT=
|
|
18
|
+
RUN_TESTS_ON_EDIT=1
|
|
19
19
|
AUTO_IMPLEMENTATION_LOOP=1
|
|
20
20
|
AUTO_LOOP_MAX_CYCLES=5
|
|
21
21
|
AUTO_PAUSE_REQUEST=0
|
|
@@ -41,13 +41,24 @@ MAGIC_BENCH_SESSION=
|
|
|
41
41
|
# - AUTO_EXECUTE_ON_BLOCK: stop|skip (behavior when a planned item blocks)
|
|
42
42
|
# - AUTO_EXECUTE_SELECTION: planned_then_priority
|
|
43
43
|
# - AUTO_TEAM_SCOPE_ENFORCE: 0|1 (when TEAM_MODE=1, enforce TEAM_MEMBER + ACTIVE_TASK_IDS)
|
|
44
|
+
# Optional bug-queue mode (US-0087) — default-off when absent/unset after merge
|
|
45
|
+
# - AUTO_BUG_QUEUE: 0|1 (1 = enable bug-targeted /auto; mutex vs AUTO_BACKLOG_DRAIN without bug-target argv)
|
|
46
|
+
# - AUTO_BUG_TARGET: all-open|BUG-#### (required when AUTO_BUG_QUEUE=1 unless bug-target= argv supplies target)
|
|
47
|
+
# - AUTO_BUG_MAX_ITEMS: non-negative integer (0 or unset = no cap for all-open queue per run)
|
|
48
|
+
# - AUTO_BUG_ON_BLOCK: stop|skip (bug segment pause/stop boundary)
|
|
49
|
+
# Quiet mode (US-0088) — suppress routine per-phase success chatter only
|
|
50
|
+
# - AUTO_QUIET: 0|1 (default 0; 1 = quiet routine notifications)
|
|
51
|
+
# Non-suppressible: decision_gate, errors, pause, loop_max, blocked, missing inputs.
|
|
52
|
+
# Orthogonal to TOKEN_PROFILE (DEC-0035 / US-0080) — TOKEN_PROFILE controls
|
|
53
|
+
# context breadth / token cost, not notification policy.
|
|
54
|
+
AUTO_QUIET=0
|
|
44
55
|
AUTO_FLOW_MODE=auto_until_decision
|
|
45
56
|
PHASE_MODE=auto
|
|
46
57
|
PERMISSION_MODE=auto
|
|
47
58
|
AUTO_INSTALL_DEPS=1
|
|
48
59
|
AUTO_RELEASE_NOTES=1
|
|
49
|
-
AUTO_BACKLOG_DRAIN=
|
|
50
|
-
AUTO_BACKLOG_MAX_STORIES=
|
|
60
|
+
AUTO_BACKLOG_DRAIN=1
|
|
61
|
+
AUTO_BACKLOG_MAX_STORIES=10
|
|
51
62
|
AUTO_BACKLOG_ON_BLOCK=stop
|
|
52
63
|
AUTO_STORY_SELECTION=priority_then_backlog_order
|
|
53
64
|
AUTO_EXECUTE_BULK=0
|
|
@@ -55,6 +66,10 @@ AUTO_EXECUTE_MAX_ITEMS=1
|
|
|
55
66
|
AUTO_EXECUTE_ON_BLOCK=stop
|
|
56
67
|
AUTO_EXECUTE_SELECTION=planned_then_priority
|
|
57
68
|
AUTO_TEAM_SCOPE_ENFORCE=1
|
|
69
|
+
AUTO_BUG_QUEUE=0
|
|
70
|
+
AUTO_BUG_TARGET=
|
|
71
|
+
AUTO_BUG_MAX_ITEMS=0
|
|
72
|
+
AUTO_BUG_ON_BLOCK=stop
|
|
58
73
|
#
|
|
59
74
|
# `/auto` phase role policy (US-0069 / DEC-0051)
|
|
60
75
|
# - AUTO_ROLE_RESEARCH: po|tech-lead (empty -> default tech-lead)
|
|
@@ -101,11 +116,21 @@ SPRINT_BULK_MAX_STORIES=5
|
|
|
101
116
|
SPRINT_BULK_MAX_SPRINTS=3
|
|
102
117
|
SPRINT_BULK_SELECTION=priority_then_backlog_order
|
|
103
118
|
#
|
|
104
|
-
# Remote execution
|
|
105
|
-
# - REMOTE_EXECUTION: 0|1
|
|
106
|
-
# - REMOTE_CONFIG: path to remote
|
|
107
|
-
|
|
119
|
+
# Remote execution (US-0086 / US-0084 / US-0064)
|
|
120
|
+
# - REMOTE_EXECUTION: 0|1 — 0 skips remote.json validation (zero overhead; DEC-0070).
|
|
121
|
+
# - REMOTE_CONFIG: path to dev/Cursor remote JSON (default .cursor/remote.json).
|
|
122
|
+
# - AUTO_REMOTE_AUTOMATION_PROFILE: off|deterministic_v1 (default off; manual
|
|
123
|
+
# mode remains unchanged unless explicitly enabled for automation workflows).
|
|
124
|
+
# - AUTO_REMOTE_ENVIRONMENT_LABEL: local|docker|ssh (names-only evidence label
|
|
125
|
+
# for execute/qa/release handoffs when automation routing is used).
|
|
126
|
+
# Release/QA SSH/Docker connectivity fields live in docs/engineering/release-targets.json
|
|
127
|
+
# (ssh-server, dockerOverSsh); map WSL vs SSH vs Docker-over-SSH in
|
|
128
|
+
# docs/engineering/runtime-connectivity.md and docs/engineering/us-0084-remote-e2e.md.
|
|
129
|
+
# - Summary helper (names-only stdout): python scripts/remote_config_summary.py
|
|
130
|
+
REMOTE_EXECUTION=1
|
|
108
131
|
REMOTE_CONFIG=.cursor/remote.json
|
|
132
|
+
AUTO_REMOTE_AUTOMATION_PROFILE=off
|
|
133
|
+
AUTO_REMOTE_ENVIRONMENT_LABEL=local
|
|
109
134
|
#
|
|
110
135
|
# Sync policy
|
|
111
136
|
# - SYNC_POLICY_MODE: disabled|manual|by_phase|by_milestone|custom_phase_list
|
|
@@ -114,10 +139,10 @@ REMOTE_CONFIG=.cursor/remote.json
|
|
|
114
139
|
# - ALLOW_AUTO_PUSH: 0|1 (default off; explicit opt-in required)
|
|
115
140
|
# - AUTO_PUSH_BRANCH_ALLOWLIST: comma-separated branches/patterns eligible for
|
|
116
141
|
# auto-push. Protected/default branches are denied unless allowlisted.
|
|
117
|
-
SYNC_POLICY_MODE=
|
|
142
|
+
SYNC_POLICY_MODE=by_phase
|
|
118
143
|
SYNC_CUSTOM_PHASES=
|
|
119
|
-
ALLOW_AUTO_PUSH=
|
|
120
|
-
AUTO_PUSH_BRANCH_ALLOWLIST=
|
|
144
|
+
ALLOW_AUTO_PUSH=1
|
|
145
|
+
AUTO_PUSH_BRANCH_ALLOWLIST=main
|
|
121
146
|
#
|
|
122
147
|
# Knowledge curation
|
|
123
148
|
# - EARLY_RESEARCH: 0|1 (PO/TL search web during intake/architecture)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# .env.example — operator-local secret values (US-0085 / DEC-0071)
|
|
2
|
+
# Copy to .env, fill in values, source before remote/SSH/release ops.
|
|
3
|
+
# .env is gitignored and must NEVER be committed.
|
|
4
|
+
# This file lists names only — no secret values.
|
|
5
|
+
|
|
6
|
+
# ── From template/.cursor/remote.json (Cursor dev/remote targets) ──
|
|
7
|
+
REMOTE_DOCKER_TOKEN=
|
|
8
|
+
REMOTE_SSH_USER=
|
|
9
|
+
REMOTE_SSH_KEY_PATH=
|
|
10
|
+
|
|
11
|
+
# ── From docs/engineering/release-targets.json (release/QA targets) ──
|
|
12
|
+
PUBLIC_DOMAIN=
|
|
13
|
+
CHOCO_API_KEY=
|
|
14
|
+
GITHUB_TOKEN=
|
|
15
|
+
DOCKER_TOKEN=
|
|
16
|
+
DOCKER_RUNTIME_HOST=
|
|
17
|
+
AWS_PROFILE=
|
|
18
|
+
APP_DOMAIN=
|
|
19
|
+
APP_IP=
|
|
20
|
+
CUSTOM_DOMAIN=
|
|
21
|
+
CUSTOM_IP=
|
|
22
|
+
SSH_HOST=
|
|
23
|
+
SSH_USER=
|
|
24
|
+
SSH_PRIVATE_KEY=
|
|
25
|
+
RUNTIME_DOMAIN=
|
|
26
|
+
RUNTIME_IP=
|
|
27
|
+
DOCKER_HOST=
|
|
28
|
+
DOCKER_CONTEXT=
|
package/template/README.md
CHANGED
|
@@ -44,6 +44,10 @@ Pick one method:
|
|
|
44
44
|
| Chocolatey | `choco install its-magic` (Admin shell) |
|
|
45
45
|
| Homebrew | `brew tap USER/tap && brew install its-magic` |
|
|
46
46
|
|
|
47
|
+
### Global Linux install: empty `install_include_paths` (CRLF manifest)
|
|
48
|
+
|
|
49
|
+
If **`its-magic --target <repo> --mode missing`** fails with **`[INSTALL_MANIFEST_ERROR] install_include_paths section is empty`** on Debian/Linux while the packaged manifest still lists paths, the global install likely has **CRLF** line endings in **`installer-owned-paths.manifest`** (visible as **`^M$`** with **`cat -A`**). **Fix in-tree** from **`0.1.2-41`**: **`installer.sh`** strips trailing carriage returns before section matching; **`.gitattributes`** keeps **`*.manifest`** LF; **`prepublishOnly`** runs **`guard_installer_publish`**. **Upgrade**: install a build **≥ `0.1.2-41`** (or reinstall from a fresh **`npm pack`** tarball after pull). Older tarballs such as **`its-magic@0.1.2-40`** may remain broken until republished — see **`docs/engineering/architecture.md`** **`# BUG-0008`**.
|
|
50
|
+
|
|
47
51
|
### 2) Apply to a repo
|
|
48
52
|
|
|
49
53
|
New repo:
|
|
@@ -7,11 +7,38 @@
|
|
|
7
7
|
- tech-lead
|
|
8
8
|
|
|
9
9
|
## Execution model
|
|
10
|
-
- `/auto` is
|
|
11
|
-
-
|
|
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).
|
|
12
17
|
- Phase context transfer happens only through artifacts and handoff files.
|
|
13
18
|
- Scope is process/workflow orchestration only. Do not claim runtime product
|
|
14
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.
|
|
15
42
|
|
|
16
43
|
## Per-phase isolation enforcement (US-0048 / DEC-0029)
|
|
17
44
|
|
|
@@ -190,7 +217,7 @@ behavior applies otherwise.
|
|
|
190
217
|
|
|
191
218
|
### Plan materialization pipeline (evaluation order)
|
|
192
219
|
|
|
193
|
-
On every `/auto` entry (including resume, backlog-drain, bulk execute, and
|
|
220
|
+
On every `/auto` entry (including resume, backlog-drain, bug-queue, bulk execute, and
|
|
194
221
|
team-mode runs), **recompute** from merged scratchpad:
|
|
195
222
|
|
|
196
223
|
1. Parse merged scratchpad policy inputs for phase selection + `SECURITY_REVIEW`.
|
|
@@ -224,7 +251,8 @@ team-mode runs), **recompute** from merged scratchpad:
|
|
|
224
251
|
|
|
225
252
|
After computing the **resolved phase plan**, resolve the **nominal** start
|
|
226
253
|
phase using **Deterministic resume-source precedence** (explicit `start-from`
|
|
227
|
-
→
|
|
254
|
+
→ **`bug-target=`** argv (when present) → merged scratchpad → `resume_brief` →
|
|
255
|
+
`state` fallback → fail-fast).
|
|
228
256
|
|
|
229
257
|
Then **intersect**:
|
|
230
258
|
|
|
@@ -267,6 +295,19 @@ continuation breadcrumbs) including:
|
|
|
267
295
|
- `phase_boundary` (completed `phase_id`)
|
|
268
296
|
- `next_scheduled_phase` (or `none` when complete/stopped)
|
|
269
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
|
+
|
|
270
311
|
## Inputs
|
|
271
312
|
- Merged scratchpad policy (`US-0073` / `DEC-0055`): resolve flags from **local >
|
|
272
313
|
materialized `.cursor/scratchpad.md` > `.cursor/scratchpad.local.example.md`**
|
|
@@ -287,11 +328,69 @@ continuation breadcrumbs) including:
|
|
|
287
328
|
- `TEAM_MODE`, `TEAM_MEMBER`, `ACTIVE_TASK_IDS` from merged scratchpad context
|
|
288
329
|
- Current product and engineering docs
|
|
289
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)
|
|
290
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`**)
|
|
291
336
|
- Resume-source artifacts:
|
|
292
337
|
- `handoffs/resume_brief.md`
|
|
293
338
|
- `docs/engineering/state.md`
|
|
294
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
|
+
|
|
295
394
|
## Canonical status contract (US-0045)
|
|
296
395
|
|
|
297
396
|
- Story status authority is `docs/product/backlog.md` only.
|
|
@@ -307,10 +406,17 @@ continuation breadcrumbs) including:
|
|
|
307
406
|
- Deterministic continuation breadcrumbs in relevant artifacts
|
|
308
407
|
|
|
309
408
|
## Stop conditions
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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.
|
|
314
420
|
|
|
315
421
|
## Optional backlog-drain mode (US-0044 / DEC-0022)
|
|
316
422
|
|
|
@@ -325,18 +431,113 @@ Canonical controls from `.cursor/scratchpad.md`:
|
|
|
325
431
|
|
|
326
432
|
Deterministic behavior when enabled (`AUTO_BACKLOG_DRAIN=1`):
|
|
327
433
|
- Select next eligible OPEN story via `AUTO_STORY_SELECTION`.
|
|
328
|
-
-
|
|
329
|
-
|
|
330
|
-
|
|
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
|
|
331
445
|
- no eligible stories remain, or
|
|
332
446
|
- stop condition / decision gate occurs.
|
|
333
447
|
- On blocked story:
|
|
334
|
-
- `AUTO_BACKLOG_ON_BLOCK=stop`
|
|
335
|
-
- `AUTO_BACKLOG_ON_BLOCK=skip`
|
|
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`).
|
|
336
453
|
|
|
337
454
|
Default-safe behavior:
|
|
338
455
|
- With `AUTO_BACKLOG_DRAIN=0`, preserve existing single-segment continuation.
|
|
339
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
|
+
|
|
340
541
|
## Optional bulk execute mode (US-0047 / DEC-0024)
|
|
341
542
|
|
|
342
543
|
`/auto` supports an explicit bulk execute orchestration mode for continuous
|
|
@@ -470,23 +671,38 @@ Reason-code baseline:
|
|
|
470
671
|
|
|
471
672
|
## Deterministic resume-source precedence
|
|
472
673
|
|
|
473
|
-
Resolve start phase in strict order
|
|
674
|
+
Resolve nominal start phase and scheduler inputs in strict order (**`US-0087`**
|
|
675
|
+
extends ordering vs legacy two-step resume):
|
|
474
676
|
|
|
475
677
|
1. Explicit `/auto start-from=<phase>`
|
|
476
|
-
2. `
|
|
477
|
-
|
|
478
|
-
|
|
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).
|
|
479
688
|
|
|
480
689
|
Deterministic precedence behavior:
|
|
481
|
-
- If explicit `start-from` is valid, it wins
|
|
482
|
-
|
|
483
|
-
|
|
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.
|
|
484
697
|
- If `resume_brief.md` is present but stale or unparseable, fail fast instead
|
|
485
698
|
of silently falling back.
|
|
486
699
|
|
|
487
700
|
## Conflict and stale/unparseable policy
|
|
488
701
|
|
|
489
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).
|
|
490
706
|
- No override + `resume_brief` conflicts with `state` inference: fail fast.
|
|
491
707
|
- `resume_brief` exists but stale: fail fast.
|
|
492
708
|
- `resume_brief` exists but unparseable: fail fast.
|
|
@@ -508,6 +724,61 @@ Required codes:
|
|
|
508
724
|
- `STATE_PHASE_AMBIGUOUS`
|
|
509
725
|
- `STATE_PHASE_UNRECOVERABLE`
|
|
510
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
|
+
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:
|
|
750
|
+
|
|
751
|
+
- Same intersected phase order as a single-invocation run.
|
|
752
|
+
- Same per-phase isolation evidence (**DEC-0029**) + strict-proof attestation
|
|
753
|
+
(**DEC-0038**).
|
|
754
|
+
- Same deterministic stop reasons and stop matrix evaluation.
|
|
755
|
+
- Same `resume_brief` + `state.md` refresh at every materialized phase boundary.
|
|
756
|
+
- Operators must follow the runbook recipe
|
|
757
|
+
(**`docs/engineering/runbook.md`** § Continuous `/auto` + backlog drain).
|
|
758
|
+
|
|
759
|
+
### Deterministic stop matrix (US-0088)
|
|
760
|
+
|
|
761
|
+
| Condition | Behavior | Operator notify (AC-2) |
|
|
762
|
+
|-----------|----------|------------------------|
|
|
763
|
+
| Next phase exists, no hard stop | **Continue** — preflight US-0069, spawn next phase | Quiet OK when `AUTO_QUIET=1` |
|
|
764
|
+
| `decision_gate` | **Stop** until resolved | **Always** (non-suppressible) |
|
|
765
|
+
| `error` / missing critical input | **Stop** | **Always** (non-suppressible) |
|
|
766
|
+
| `AUTO_PAUSE_REQUEST` / `pause` | **Stop** at safe boundary | **Always** (non-suppressible) |
|
|
767
|
+
| `AUTO_LOOP_MAX_CYCLES` / `loop_max` | **Stop** | **Always** (non-suppressible) |
|
|
768
|
+
| `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) |
|
|
770
|
+
| `BACKLOG_MAX_STORIES_REACHED` | **Stop** | **Always** (non-suppressible) |
|
|
771
|
+
|
|
772
|
+
`stop_reason` vocabulary: `completed`, `decision_gate`, `missing_input`,
|
|
773
|
+
`pause_request`, `loop_max`, `error`, `blocked`.
|
|
774
|
+
|
|
775
|
+
### `AUTO_QUIET` vs `TOKEN_PROFILE` (US-0088 / AC-2)
|
|
776
|
+
|
|
777
|
+
| Key | Values | Role |
|
|
778
|
+
|-----|--------|------|
|
|
779
|
+
| `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. |
|
|
780
|
+
| `TOKEN_PROFILE` | `lean` \| `balanced` \| `full` | Unchanged — **DEC-0035** / **US-0080**; **orthogonal** to `AUTO_QUIET`. |
|
|
781
|
+
|
|
511
782
|
## Steps
|
|
512
783
|
1. Read automation flags from merged scratchpad and **materialize the resolved
|
|
513
784
|
phase plan** per **Configurable phase selection policy (US-0070 / DEC-0052)**:
|
|
@@ -517,9 +788,13 @@ Required codes:
|
|
|
517
788
|
`docs/engineering/state.md` **before** any phase spawn. On failure, emit
|
|
518
789
|
deterministic phase-plan reason codes and stop (no partial schedule).
|
|
519
790
|
2. Parse optional `start-from=<phase>` and validate canonical phase ID rules.
|
|
791
|
+
Parse optional **`bug-target=`** argv literals (**`US-0087`**) and evaluate
|
|
792
|
+
**scheduler mutex** (`AUTO_SCHEDULER_CONFLICT` when **`AUTO_BACKLOG_DRAIN=1`**
|
|
793
|
+
∧ **`AUTO_BUG_QUEUE=1`** without **`bug-target=`** argv).
|
|
520
794
|
Parse optional `--execute-bulk` and treat it as explicit one-run override.
|
|
521
795
|
3. Resolve **nominal** start phase using deterministic precedence:
|
|
522
|
-
- explicit
|
|
796
|
+
- explicit `start-from` → **`bug-target=`** argv (when present) → merged scratchpad
|
|
797
|
+
→ resume brief → state fallback → fail-fast.
|
|
523
798
|
- Emit `[AUTO_RESUME_ERROR] ...` message on resolver failure.
|
|
524
799
|
3a. **Intersect** the nominal start anchor with the resolved phase plan (plan
|
|
525
800
|
order preserved; drop scheduled phases strictly before the anchor in canonical
|
|
@@ -534,9 +809,15 @@ Required codes:
|
|
|
534
809
|
- `resolution_source` (`argument|resume_brief|state_fallback`)
|
|
535
810
|
- `resolution_status` (`resolved|fail-fast`)
|
|
536
811
|
- `timestamp`
|
|
537
|
-
5.
|
|
538
|
-
|
|
539
|
-
omitted), starting at
|
|
812
|
+
5. **(reference Step 5 — continuous multi-phase spawn)** Spawn a fresh subagent
|
|
813
|
+
for each remaining phase in **the intersected resolved schedule order** (not
|
|
814
|
+
the full canonical list when phases are omitted), starting at
|
|
815
|
+
`resolved_start_phase`, and **advance through all subsequent phases** until a
|
|
816
|
+
**deterministic stop condition** fires (see **Deterministic stop matrix
|
|
817
|
+
(US-0088)** above). The orchestrator does **not** stop after a single phase
|
|
818
|
+
spawn unless the stop matrix requires it; outer-driver equivalence applies
|
|
819
|
+
when a single invocation cannot schedule multiple subagent turns (see
|
|
820
|
+
**Outer-driver equivalence (AC-1, Option B)** above):
|
|
540
821
|
default full path:
|
|
541
822
|
intake -> discovery -> research -> architecture -> sprint plan ->
|
|
542
823
|
plan verify -> execute -> QA -> verify work -> release -> refresh context.
|
|
@@ -548,6 +829,12 @@ Required codes:
|
|
|
548
829
|
story using deterministic selection policy until bounded stop criteria.
|
|
549
830
|
**Reload merged scratchpad phase-selection inputs and recompute the phase
|
|
550
831
|
plan at each story boundary** (same policy class as single-segment runs).
|
|
832
|
+
- If bug-queue mode is active (**`bug-target=`** argv or **`AUTO_BUG_QUEUE=1`**
|
|
833
|
+
with resolved target), iterate **OPEN** bugs per **Optional bug-queue mode
|
|
834
|
+
(US-0087)** — ascending numeric **`BUG-####`** order, **`AUTO_BUG_MAX_ITEMS`**
|
|
835
|
+
cap, **`AUTO_BUG_ON_BLOCK`** stop/skip — running the same **resolved phase plan**
|
|
836
|
+
per bug segment with fresh spawns only. **Reload scratchpad and revalidate
|
|
837
|
+
mutex at each bug boundary.** Empty **OPEN** queue → **`AUTO_BUG_QUEUE_EMPTY`**.
|
|
551
838
|
- If bulk execute mode is active (`--execute-bulk` or
|
|
552
839
|
`AUTO_EXECUTE_BULK=1`), iterate eligible planned items using
|
|
553
840
|
`AUTO_EXECUTE_SELECTION` with bounded item count
|
|
@@ -614,11 +901,12 @@ Required codes:
|
|
|
614
901
|
- `push_decision` (`pushed|blocked|not_eligible`)
|
|
615
902
|
- `reason_code`
|
|
616
903
|
- `evidence_refs`
|
|
617
|
-
13. When backlog-drain mode or bulk execute mode is enabled,
|
|
618
|
-
summary entries:
|
|
904
|
+
13. When backlog-drain mode, bug-queue mode, or bulk execute mode is enabled,
|
|
905
|
+
append per-item run summary entries:
|
|
619
906
|
- `item_id`
|
|
620
|
-
- `item_kind` (`story|sprint`)
|
|
907
|
+
- `item_kind` (`story|sprint|bug`)
|
|
621
908
|
- `story_id`
|
|
909
|
+
- `bug_id` (when `item_kind=bug`)
|
|
622
910
|
- `sprint_id`
|
|
623
911
|
- `story_start_phase`
|
|
624
912
|
- `story_stop_phase`
|