pi-spine 1.7.0 → 1.8.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.
Files changed (125) hide show
  1. package/package.json +2 -2
  2. package/skills/spine-autonomous-operator/SKILL.md +264 -0
  3. package/skills/spine-autonomous-operator/references/issue-template.md +45 -0
  4. package/skills/spine-orchestrate-waves/SKILL.md +1 -0
  5. package/skills/spine-release-operator/SKILL.md +44 -8
  6. package/skills/spine-release-operator/references/pi-async-orchestration.md +88 -0
  7. package/skills/spine-release-operator/scripts/collect-release-intake.sh +71 -0
  8. package/src/batch/abort.mjs +1 -0
  9. package/src/batch/agent-session-worker.mjs +1 -0
  10. package/src/batch/attached-engine-handoff.mjs +1 -0
  11. package/src/batch/attached-runner.mjs +1 -0
  12. package/src/batch/contract-prelanded.mjs +1 -0
  13. package/src/batch/contract-task-start.mjs +1 -0
  14. package/src/batch/contract-verify.mjs +1 -0
  15. package/src/batch/detached-start.mjs +1 -0
  16. package/src/batch/diagnosis-launch-failure.mjs +1 -0
  17. package/src/batch/diagnosis-merge-failure.mjs +1 -0
  18. package/src/batch/diagnosis-retry-limbo.mjs +1 -0
  19. package/src/batch/diagnosis-tail-state.mjs +1 -0
  20. package/src/batch/diagnosis-task-done.mjs +1 -0
  21. package/src/batch/diagnosis-worker-done-missing.mjs +1 -0
  22. package/src/batch/diagnosis.mjs +1 -0
  23. package/src/batch/engine-lanes/commit.mjs +1 -0
  24. package/src/batch/engine-lanes/merge.mjs +1 -0
  25. package/src/batch/engine-lanes/queue.mjs +1 -0
  26. package/src/batch/engine-lanes/review.mjs +1 -0
  27. package/src/batch/engine-lanes.mjs +1 -0
  28. package/src/batch/engine-scope.mjs +1 -0
  29. package/src/batch/engine.mjs +19 -9
  30. package/src/batch/evidence.mjs +1 -0
  31. package/src/batch/gate-evidence-collect.mjs +1 -0
  32. package/src/batch/gate-evidence-read.mjs +1 -0
  33. package/src/batch/gate.mjs +1 -0
  34. package/src/batch/git-helpers.mjs +1 -1
  35. package/src/batch/heartbeat-git-debounce.mjs +83 -0
  36. package/src/batch/heartbeat.mjs +17 -20
  37. package/src/batch/integrate-worktree.mjs +1 -0
  38. package/src/batch/integrate.mjs +1 -0
  39. package/src/batch/journal-rebuild.mjs +1 -0
  40. package/src/batch/journal.mjs +2 -1
  41. package/src/batch/lane-commit.mjs +1 -0
  42. package/src/batch/lane-dirty-check.mjs +1 -0
  43. package/src/batch/lifecycle.mjs +1 -0
  44. package/src/batch/limbo-detect.mjs +1 -0
  45. package/src/batch/macro-phase.mjs +1 -0
  46. package/src/batch/merge/adoption-doc-merge.mjs +1 -0
  47. package/src/batch/merge/wave-merge-state.mjs +1 -0
  48. package/src/batch/metrics.mjs +1 -0
  49. package/src/batch/orphan-detect.mjs +1 -0
  50. package/src/batch/pause.mjs +1 -0
  51. package/src/batch/post-merge-limbo.mjs +1 -0
  52. package/src/batch/postmortem.mjs +1 -0
  53. package/src/batch/readers/spine-state.mjs +1 -0
  54. package/src/batch/readers/taskplane-state.mjs +1 -0
  55. package/src/batch/reconcile.mjs +84 -8
  56. package/src/batch/resume-common.mjs +1 -0
  57. package/src/batch/resume-engine.mjs +1 -0
  58. package/src/batch/resume-multi-lanes.mjs +1 -0
  59. package/src/batch/resume-multi-validate.mjs +1 -0
  60. package/src/batch/resume-multi.mjs +1 -0
  61. package/src/batch/resume-validation.mjs +1 -0
  62. package/src/batch/resume.mjs +1 -0
  63. package/src/batch/retry.mjs +1 -0
  64. package/src/batch/review-shared.mjs +1 -0
  65. package/src/batch/review-spawn.mjs +1 -0
  66. package/src/batch/review.mjs +1 -0
  67. package/src/batch/rules-manifest-drift.mjs +1 -0
  68. package/src/batch/salvage.mjs +1 -0
  69. package/src/batch/sequence.mjs +5 -2
  70. package/src/batch/state.mjs +1 -0
  71. package/src/batch/supervisor-spawn.mjs +1 -0
  72. package/src/batch/task-stall-budget.mjs +3 -4
  73. package/src/batch/worker-host.mjs +31 -25
  74. package/src/batch/worker-output.mjs +1 -0
  75. package/src/batch/worker-prompt.mjs +1 -0
  76. package/src/cli/journal-follow.mjs +1 -1
  77. package/src/config/agent-model-resolve.mjs +1 -0
  78. package/src/config/contract.mjs +1 -0
  79. package/src/config/cursor-rules/discover.mjs +1 -0
  80. package/src/config/cursor-rules/match-globs.mjs +1 -0
  81. package/src/config/cursor-rules/parse-frontmatter.mjs +1 -0
  82. package/src/config/cursor-rules/profile.mjs +1 -0
  83. package/src/config/cursor-rules/select.mjs +1 -0
  84. package/src/config/env-overrides.mjs +1 -0
  85. package/src/config/pi-spine-root.mjs +1 -0
  86. package/src/config/preflight/discovery.mjs +333 -0
  87. package/src/config/preflight/git-batch.mjs +320 -0
  88. package/src/config/preflight/integrate-plan.mjs +460 -0
  89. package/src/config/reviewer-context.mjs +1 -0
  90. package/src/config/settings-fields.mjs +1 -0
  91. package/src/config/spine-config-schema.mjs +1 -0
  92. package/src/config/spine-init-constants.mjs +1 -0
  93. package/src/config/spine-preflight-lib.mjs +54 -1013
  94. package/src/config/worker-backend.mjs +1 -0
  95. package/src/config/worker-context.mjs +1 -0
  96. package/src/config/worker-launch-script.mjs +1 -0
  97. package/src/config/worktree-setup-hook.mjs +1 -0
  98. package/src/dashboard/public/dashboard.js +6 -1
  99. package/src/dashboard/running-tail-state.mjs +1 -0
  100. package/src/dashboard/server.mjs +136 -16
  101. package/src/dashboard/snapshot-lanes.mjs +479 -0
  102. package/src/dashboard/snapshot-waves.mjs +272 -0
  103. package/src/dashboard/snapshot.mjs +41 -862
  104. package/src/doctor/agent-model-inherit.mjs +1 -0
  105. package/src/doctor/agent-models.mjs +1 -0
  106. package/src/doctor/coexistence.mjs +1 -0
  107. package/src/doctor/run-doctor-checks.mjs +1 -0
  108. package/src/doctor/stale-path.mjs +1 -0
  109. package/src/doctor/stall-config.mjs +1 -0
  110. package/src/doctor/suggest-max-parallel.mjs +1 -0
  111. package/src/doctor/task-packet-size.mjs +3 -10
  112. package/src/doctor/worktree-health.mjs +1 -0
  113. package/src/planner/cycles.mjs +1 -0
  114. package/src/planner/file-scope.mjs +1 -0
  115. package/src/planner/format-plan.mjs +1 -0
  116. package/src/planner/graph.mjs +1 -0
  117. package/src/planner/scope.mjs +1 -0
  118. package/src/planner/wave-scope.mjs +1 -0
  119. package/src/planner/waves.mjs +1 -0
  120. package/src/tasks/packet/merge-deps.mjs +1 -0
  121. package/src/tasks/packet/parse-prompt.mjs +4 -3
  122. package/src/tasks/packet/parse-status.mjs +1 -0
  123. package/src/tasks/packet/size-line.mjs +12 -0
  124. package/src/tasks/packet/validate-contract.mjs +1 -0
  125. package/src/tasks/packet/validate-prompt.mjs +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-spine",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Orchestration spine for long-running pi development",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -69,7 +69,7 @@
69
69
  }
70
70
  },
71
71
  "devDependencies": {
72
- "@earendil-works/pi-coding-agent": "^0.78.0",
72
+ "@earendil-works/pi-coding-agent": "^0.80.3",
73
73
  "@types/node": "^22.19.18",
74
74
  "eslint": "^9.28.0",
75
75
  "globals": "^16.2.0",
@@ -0,0 +1,264 @@
1
+ ---
2
+ name: spine-autonomous-operator
3
+ description: Autonomous pi-spine batch operator for pending tasks. Audits task sizing and decomposition, maximizes safe parallelization, runs preflight, executes wave-by-wave batch start with gate/integrate/complete land loop, recovers from failures, and files upstream bugs at beettlle/pi-spine. Use when asked to run all pending spine tasks, execute a full spine batch, operate spine waves, or finish SP-* tasks with clean preflight.
4
+ disable-model-invocation: true
5
+ compatibility: Requires spine CLI, gh CLI (for issue filing), git, Node >= 22. Run from pi-spine repo root on main.
6
+ ---
7
+
8
+ # Spine Autonomous Operator
9
+
10
+ You are the **pi-spine batch operator** for this repository. Drive all **pending** spine tasks to completion with maximum **safe** parallelization. You operate batches; you do **not** implement product code unless recovery requires fixing task packets or repo hygiene.
11
+
12
+ For **curated semver releases** (subset scope, publish gates), use [`skills/spine-release-operator/SKILL.md`](../spine-release-operator/SKILL.md) instead.
13
+
14
+ Invoke explicitly: `/skill:spine-autonomous-operator`
15
+
16
+ ## Success criteria
17
+
18
+ 1. `spine plan pending` shows **0 pending tasks**
19
+ 2. `spine preflight` passes with a **clean** git tree
20
+ 3. All work is **integrated on `main`** (not stuck in worktrees)
21
+ 4. Repeatable pi-spine **engine** faults have GitHub issues filed
22
+ 5. Final report: waves completed, tasks done, issues filed, verification output
23
+
24
+ ## Hard rules
25
+
26
+ - **Never** hand-edit `.spine/batch-state.json` or journal files under `.spine/runtime/`
27
+ - **Never** implement product code in task folders while a batch owns that scope
28
+ - **Never** claim batch/test success without CLI output
29
+ - **Always** use `spine status --diagnose` for recovery; follow `suggestedCommand`
30
+ - **Always** run `spine gate approve` before `spine integrate`
31
+ - **Always** run `npm install` on `main` after successful integrate
32
+ - **Do not** use unattended `spine run sequence --auto-approve-gate --force` without monitoring
33
+ - **Do not** start a second batch while another batch is **running** on the same repo
34
+ - **Never** background `spine batch resume --attached` or `resume --attached --force` ([#163](https://github.com/beettlle/pi-spine/issues/163))
35
+
36
+ ## Phase 0 — Baseline
37
+
38
+ ```bash
39
+ cd <repo-root>
40
+ spine --version
41
+ spine doctor
42
+ git status
43
+ git branch --show-current # must be main
44
+ spine status --diagnose # readonly — do not collide with active batch
45
+ ```
46
+
47
+ If not on `main`, stop and ask the operator. If another operator's batch is **running**, stop unless explicitly asked to take over recovery.
48
+
49
+ ## Phase 1 — Audit pending tasks
50
+
51
+ ### 1.1 Inventory
52
+
53
+ ```bash
54
+ spine plan pending
55
+ spine tasks validate pending
56
+ spine tasks analyze pending
57
+ spine deps pending
58
+ ```
59
+
60
+ Read `spine-tasks/CONTEXT.md` for `Next Task ID` and phase notes.
61
+
62
+ ### 1.2 Size audit
63
+
64
+ For each pending `spine-tasks/{SP-###-slug}/PROMPT.md`:
65
+
66
+ | Size | Target | Action if exceeded |
67
+ |------|--------|-------------------|
68
+ | **S** | <2h, ≤4 impl steps | Keep |
69
+ | **M** | 2–4h | OK if file scope disjoint from parallel neighbors |
70
+ | **L** | 4–8h | **Split** into multiple S/M tasks |
71
+ | **XL** | >8h or >4 steps | **Must split** |
72
+
73
+ **Decompose** when:
74
+ - More than 4 implementation steps (excluding Testing + Completion Criteria)
75
+ - Multiple unrelated file areas in one task
76
+ - Same hot file in parallel tasks (serialize via `dependencies.json`)
77
+ - M/L tasks share overlapping `fileScopeMustChange` in the same wave
78
+
79
+ ### 1.3 Parallelization audit
80
+
81
+ - [ ] `dependencies.json` matches PROMPT `## Dependencies`
82
+ - [ ] Same-wave tasks have **disjoint** `fileScopeMustChange`
83
+ - [ ] Hot shared files are serial (e.g. `src/batch/heartbeat.mjs`, `bin/spine.mjs`)
84
+ - [ ] No directory paths with trailing `/` in contracts — use explicit files
85
+ - [ ] No parenthetical comments in contract paths (e.g. `file.ts (Step 2 only)`)
86
+ - [ ] Pre-landed code on `main` → point `fileScopeMustChange` at `spine-tasks/{task}/STATUS.md` + `## Amendments`
87
+
88
+ After changes:
89
+
90
+ ```bash
91
+ spine tasks validate pending
92
+ spine tasks analyze pending
93
+ spine plan pending
94
+ ```
95
+
96
+ ### 1.4 Commit packet changes
97
+
98
+ ```bash
99
+ git add spine-tasks/ .spine/spine-config.json # only if changed
100
+ git commit -m "chore(spine): refine pending task packets for safe parallel execution"
101
+ ```
102
+
103
+ Repo hygiene that breaks preflight:
104
+ - Add `coverage/`, `node_modules/`, `.pi/` to `.gitignore` if missing
105
+ - `git worktree prune` after abort
106
+
107
+ ## Phase 2 — Preflight gate
108
+
109
+ ```bash
110
+ spine preflight
111
+ ```
112
+
113
+ All checks must pass (`git-clean`, `no-active-batch`, `tasks-validate`, `prelanded-file-scope`, `plan`). Fix, commit, re-run until green. **Do not start a batch on failed preflight** or while another batch is running.
114
+
115
+ ## Phase 3 — Wave execution loop
116
+
117
+ Preview the plan:
118
+
119
+ ```bash
120
+ spine run sequence pending --dry-run
121
+ ```
122
+
123
+ For each wave `N` until `spine plan pending` shows 0 tasks:
124
+
125
+ ### 3.1 Start
126
+
127
+ **pi async (preferred in pi sessions)** — see [pi-async-orchestration.md](../spine-release-operator/references/pi-async-orchestration.md):
128
+
129
+ ```text
130
+ MonitorCreate:
131
+ command: spine batch start pending --wave N --attached
132
+ description: Pending wave N
133
+ timeout: 0
134
+ onDone: spine status --diagnose → land loop (§3.3) or recovery (§4)
135
+ ```
136
+
137
+ **Foreground fallback** (non-pi or after #163 orphan on MonitorCreate):
138
+
139
+ ```bash
140
+ spine batch start pending --wave N --attached
141
+ ```
142
+
143
+ ### 3.2 Monitor
144
+
145
+ ```bash
146
+ spine status --diagnose
147
+ # or block:
148
+ spine wait --until completed,failed,needs_integrate,needs_retry,aborted --timeout 2h
149
+ ```
150
+
151
+ Optional: `spine watch --once`, `spine dashboard`
152
+
153
+ ### 3.2a Pi async watchdog (optional)
154
+
155
+ If MonitorCreate `onDone` did not fire but batch may still be running:
156
+
157
+ ```text
158
+ LoopCreate: trigger "2m", readOnly true, maxFires 50
159
+ prompt: check spine status --diagnose; LoopDelete self on terminal diagnosis
160
+ ```
161
+
162
+ **Do not** start the next wave until the current wave is fully landed on `main`.
163
+
164
+ ### 3.3 Land loop
165
+
166
+ When diagnosis is `needs_integrate` or gate is open:
167
+
168
+ ```bash
169
+ spine gate status
170
+ spine gate approve
171
+ spine integrate
172
+ npm install
173
+ spine batch complete
174
+ git add spine-tasks/*/.DONE 2>/dev/null; git commit -m "chore: track .DONE for wave N" || true
175
+ ```
176
+
177
+ Verify: `git status` clean, `.DONE` count increased.
178
+
179
+ ### 3.4 Advance
180
+
181
+ Increment `N` and repeat.
182
+
183
+ ## Phase 4 — Recovery
184
+
185
+ Always: `spine status --diagnose`
186
+
187
+ | Diagnosis | Action |
188
+ |-----------|--------|
189
+ | `running` | Wait; `spine watch` or async watchdog |
190
+ | `paused` | `spine batch resume` (foreground if `--attached`) |
191
+ | `needs_retry` | Fix packet if needed; `spine batch retry <taskId>` |
192
+ | `worker_orphaned` | `abort` → `dismiss` → prune worktree → retry wave |
193
+ | `needs_integrate` | Land loop (gate → integrate → npm install → complete) |
194
+ | `state_drift` | `spine batch retry <taskId>`; then **`spine batch resume --attached --force` in foreground** |
195
+ | `failed` / `aborted` | Inspect journal; fix packet; dismiss; retry |
196
+ | Contract fail | Fix PROMPT on **main**, commit, abort, dismiss, prune, retry |
197
+ | Integrate hang | Manual `spine integrate` + `spine batch complete`; file upstream issue |
198
+
199
+ **After abort:**
200
+
201
+ ```bash
202
+ spine batch abort --reason recovery
203
+ spine batch dismiss --reason recovery
204
+ rm -rf .worktrees/spine-* # if stale
205
+ git worktree prune
206
+ spine preflight
207
+ ```
208
+
209
+ ## Phase 5 — File upstream pi-spine issues
210
+
211
+ File at https://github.com/beettlle/pi-spine/issues when:
212
+ - Same diagnosis repeats after `suggestedCommand`
213
+ - Engine crash, orphan, gate bug, integrate hang, verifier false positive
214
+
215
+ **Not** for: misconfig, dirty git, bad packets, consumer code bugs.
216
+
217
+ ```bash
218
+ spine issue draft --type bug --json
219
+ spine issue draft --type bug --create
220
+ # or:
221
+ gh issue create --repo beettlle/pi-spine --title "..." --body-file .spine/issue-draft.md
222
+ ```
223
+
224
+ Search existing issues first. Include version, commands, diagnosis, journal excerpt, expected vs actual.
225
+
226
+ See [references/issue-template.md](references/issue-template.md) for a full template.
227
+
228
+ ## Phase 6 — Final verification
229
+
230
+ ```bash
231
+ spine plan pending
232
+ spine preflight
233
+ git status
234
+ npm run release:check
235
+ find spine-tasks -name '.DONE' | wc -l
236
+ ```
237
+
238
+ In pi sessions, `MonitorCreate` for `npm run release:check` is allowed (see pi-async-orchestration).
239
+
240
+ ## Final report (required)
241
+
242
+ 1. **Tasks completed** — SP-IDs and wave numbers
243
+ 2. **Decomposition changes** — splits/fixes in Phase 1
244
+ 3. **Issues filed** — pi-spine GitHub links or "none"
245
+ 4. **Recovery actions** — aborts, retries, contract fixes
246
+ 5. **Verification** — paste `spine preflight` tail and `spine plan pending`
247
+ 6. **Remaining blockers** — if any
248
+
249
+ ## Repo-specific notes (pi-spine)
250
+
251
+ - **Tasks root:** `spine-tasks/`
252
+ - **Config:** `.spine/spine-config.json`
253
+ - **Test gate:** `npm run release:check` (typecheck → lint → tests → coverage)
254
+ - **Known upstream issues:** #114 (integrate hang, fixed), #118 (trailing-slash contracts), #130 (`coverage/` restore), #163 (`engine_orphaned`)
255
+
256
+ ## Short prompt (resume mid-batch)
257
+
258
+ ```text
259
+ Run pending spine tasks: validate/analyze/plan → fix packets → preflight →
260
+ for each wave: MonitorCreate batch start (or foreground) → diagnose →
261
+ gate approve → integrate → npm install → batch complete.
262
+ Resume --attached --force stays foreground. File pi-spine bugs on engine faults.
263
+ Done when 0 pending, preflight green, release:check passes. Post final report.
264
+ ```
@@ -0,0 +1,45 @@
1
+ # pi-spine upstream issue template
2
+
3
+ Use when filing engine/orchestrator bugs at https://github.com/beettlle/pi-spine/issues
4
+
5
+ ## Environment
6
+
7
+ - pi-spine: `spine --version`
8
+ - pi: `pi --version`
9
+ - Node: `node --version`
10
+ - Repo: `pi-spine` @ `git rev-parse --short HEAD`
11
+
12
+ ## Commands run
13
+
14
+ ```text
15
+ (paste exact spine commands)
16
+ ```
17
+
18
+ ## Diagnosis
19
+
20
+ ```text
21
+ (paste output of: spine status --diagnose)
22
+ ```
23
+
24
+ ## Journal excerpt
25
+
26
+ ```bash
27
+ spine journal replay --batch <batchId>
28
+ ```
29
+
30
+ ```text
31
+ (paste last 20–40 lines relevant to failure)
32
+ ```
33
+
34
+ ## Expected vs actual
35
+
36
+ - **Expected:** ...
37
+ - **Actual:** ...
38
+
39
+ ## Minimal reproduction
40
+
41
+ Steps another operator can follow on pi-spine or a consumer repo.
42
+
43
+ ## Related issues
44
+
45
+ Search first: #114 integrate hang, #118 contract trailing-slash, #130 coverage restore, #163 engine_orphaned
@@ -21,6 +21,7 @@ Invoke explicitly: `/skill:spine-orchestrate-waves`, `/spine-orchestrate pending
21
21
  |---------|-------------|
22
22
  | Task packet authoring | `create-spine-tasks` skill |
23
23
  | Curated release subset | `spine-release-operator` skill |
24
+ | Pi async batch/verify (MonitorCreate) | [spine-release-operator/references/pi-async-orchestration.md](../spine-release-operator/references/pi-async-orchestration.md) |
24
25
  | Canonical how-to prose | [references/outer-loop.md](references/outer-loop.md) (synced from `docs/adoption/agent-orchestrated-waves.md`) |
25
26
  | Slash entry (`/spine-orchestrate`) | pi-spine extension — wave plan + outer loop checklist |
26
27
  | Single-task suggested command | `/spine-next` inside land loop |
@@ -17,7 +17,8 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
17
17
  | Concern | Delegate to |
18
18
  |---------|-------------|
19
19
  | PROMPT/STATUS/Contract authoring | `create-spine-tasks` skill + templates |
20
- | Batch land loop / recovery | Phases below (adapted from `spine-autonomous-operator`) |
20
+ | Batch land loop / recovery | [`spine-autonomous-operator`](../spine-autonomous-operator/SKILL.md) Phase 3–4 + [pi-async-orchestration.md](references/pi-async-orchestration.md) |
21
+ | Wave evidence / diagnosis tree | [`spine-orchestrate-waves`](../spine-orchestrate-waves/SKILL.md) |
21
22
  | Semver scope budgets | [references/release-profiles.md](references/release-profiles.md) |
22
23
  | Issue intake queries | [references/issue-intake-checklist.md](references/issue-intake-checklist.md) |
23
24
  | Manifest format | [references/release-manifest-template.md](references/release-manifest-template.md) |
@@ -44,6 +45,8 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
44
45
  - **Always** run `spine gate approve` before `spine integrate`
45
46
  - **Always** run `npm install` on `main` after successful integrate
46
47
  - **Do not** execute tasks outside the approved manifest scope
48
+ - **Do not** start a second batch while another batch is **running** on this repo
49
+ - **Never** background `spine batch resume --attached` or `resume --attached --force` ([#163](https://github.com/beettlle/pi-spine/issues/163))
47
50
  - **Always** run `/gitnexus analyze` (Pre-work) before Phase 0 — do not start intake, authoring, or batches on a stale index
48
51
 
49
52
  ---
@@ -106,6 +109,13 @@ If not on `main`, stop. If git is dirty, commit or stash hygiene fixes before re
106
109
 
107
110
  Follow [references/issue-intake-checklist.md](references/issue-intake-checklist.md).
108
111
 
112
+ Optional snapshot (readonly):
113
+
114
+ ```bash
115
+ skills/spine-release-operator/scripts/collect-release-intake.sh {TARGET}
116
+ # optional: tee spine-tasks/_authoring/release-v{TARGET}/intake-snapshot-$(date -u +%Y%m%d).md
117
+ ```
118
+
109
119
  **GitHub issues:**
110
120
 
111
121
  ```bash
@@ -235,7 +245,21 @@ spine run sequence <release-scope> --dry-run
235
245
 
236
246
  For each wave `N` until all release-scoped tasks are `.DONE`:
237
247
 
238
- ### 4.1 Start
248
+ Check `spine status --diagnose` first — if a batch is already **running** for this release, do not start another; follow recovery or wait.
249
+
250
+ ### 4.1 Start (pi async — preferred in pi sessions)
251
+
252
+ See [references/pi-async-orchestration.md](references/pi-async-orchestration.md):
253
+
254
+ ```text
255
+ MonitorCreate:
256
+ command: spine batch start <release-scope> --wave N --attached
257
+ description: Release wave N
258
+ timeout: 0
259
+ onDone: spine status --diagnose → §4.3 land loop or §4.4 recovery
260
+ ```
261
+
262
+ **Foreground fallback** (non-pi, or after #163 orphan on MonitorCreate):
239
263
 
240
264
  ```bash
241
265
  spine batch start <release-scope> --wave N --attached
@@ -249,6 +273,8 @@ spine status --diagnose
249
273
  spine wait --until completed,failed,needs_integrate,needs_retry,aborted --timeout 2h
250
274
  ```
251
275
 
276
+ Optional pi watchdog: `LoopCreate` every 2m, `readOnly: true`, `maxFires: 50` — see pi-async-orchestration.
277
+
252
278
  **Do not** start wave N+1 until wave N is integrated on `main`.
253
279
 
254
280
  Wave sizing: prefer ≤4 M-sized tasks per wave; serialize hot shared files.
@@ -278,7 +304,7 @@ Always: `spine status --diagnose`
278
304
  | `needs_retry` | Fix packet; `spine batch retry <taskId>` |
279
305
  | `worker_orphaned` | abort → dismiss → prune worktree → retry |
280
306
  | `needs_integrate` | Land loop |
281
- | `state_drift` | `spine batch retry <taskId>` (pause first if task still `running`); then `spine batch resume --attached --force` |
307
+ | `state_drift` | `spine batch retry <taskId>` (pause first if task still `running`); then **`spine batch resume --attached --force` in foreground** (never MonitorCreate) |
282
308
  | `failed` / `aborted` | Inspect journal; fix packet; dismiss; retry |
283
309
  | Contract fail | Fix PROMPT on main, commit, abort, dismiss, retry |
284
310
 
@@ -291,10 +317,17 @@ Always: `spine status --diagnose`
291
317
  ```bash
292
318
  spine plan <release-scope> # should show 0 pending for scope
293
319
  spine preflight
294
- npm run release:check # typecheck → lint → tests → coverage (CI parity)
295
320
  git status
296
321
  ```
297
322
 
323
+ **pi async (preferred):** `MonitorCreate` with `npm run release:check 2>&1 | tee /tmp/pi-spine-release-check.log`, `timeout: 900000`, `onDone` to read log tail and present checklist.
324
+
325
+ **Foreground fallback:**
326
+
327
+ ```bash
328
+ npm run release:check # typecheck → lint → tests → coverage (CI parity)
329
+ ```
330
+
298
331
  Present checklist from `docs/release/npm-publish.md`:
299
332
 
300
333
  - [ ] All release-scoped tasks done
@@ -322,6 +355,8 @@ Monitor CI:
322
355
  gh run list --workflow release.yml --limit 3
323
356
  ```
324
357
 
358
+ **pi async:** `MonitorCreate` with `gh run watch --exit-status <run-id>`, `timeout: 1800000`, `onDone` to report conclusion and run smoke tests if green.
359
+
325
360
  Post-publish smoke per `docs/release/npm-publish.md`:
326
361
 
327
362
  ```bash
@@ -362,10 +397,11 @@ Close GitHub issues where tasks had `Closes: #NNN` and work shipped.
362
397
  ## Short prompt (resume mid-release)
363
398
 
364
399
  ```text
365
- Resume spine release v{TARGET}: /gitnexus analyze (or gitnexus analyze) → gitnexus status →
400
+ Resume spine release v{TARGET}: /gitnexus analyze → gitnexus status →
366
401
  check manifest at spine-tasks/_authoring/release-v{TARGET}/manifest.md →
367
- verify remaining scope → preflight → for each wave: batch start --attached → diagnose →
402
+ spine status --diagnose (do not collide with running batch) →
403
+ preflight → for each wave: MonitorCreate batch start (or foreground) → onDone diagnose →
368
404
  gate approve → integrate → npm install → batch complete →
369
- when scope done: tests + preflight → STOP for publish approval.
370
- Post final report with composition table.
405
+ MonitorCreate release:check → STOP for publish approval.
406
+ resume --attached --force stays foreground. Post final report with composition table.
371
407
  ```
@@ -0,0 +1,88 @@
1
+ # Pi async orchestration (MonitorCreate / LoopCreate)
2
+
3
+ Use in **pi sessions** when long-running shell work would waste the agent context window. The operator session stays free for intake, manifest edits, issue filing, and recovery planning while batches and verification run in the background.
4
+
5
+ **Fallback:** When pi bridge tools are unavailable (Cursor-only, no MonitorCreate), use blocking `spine wait` and foreground shell — see each skill's non-pi sections.
6
+
7
+ ---
8
+
9
+ ## When to use MonitorCreate (preferred)
10
+
11
+ `MonitorCreate` runs a shell command in the background and fires an `onDone` prompt when it exits. No polling loop required.
12
+
13
+ | Command | timeout | Notes |
14
+ |---------|---------|-------|
15
+ | `spine batch start <scope> --wave N --attached` | `0` (none) | Wave batch; see safety rules below |
16
+ | `npm run release:check 2>&1 \| tee /tmp/pi-spine-release-check.log` | `900000` (15m) | Default 5m is too short for full pi-spine suite |
17
+ | `gh run watch --exit-status <run-id>` | `1800000` (30m) | After tag push; resolve run-id from `gh run list` |
18
+
19
+ ### onDone prompt template (batch)
20
+
21
+ ```text
22
+ Monitor for wave N completed. Run spine status --diagnose.
23
+ - needs_integrate: inspect .spine/runtime/<batchId>/evidence/ → gate approve → integrate → npm install → batch complete.
24
+ - needs_retry / failed / aborted: follow recovery table; do not start next wave.
25
+ - running: optional LoopCreate watchdog (below) or spine watch.
26
+ Paste diagnosis headline and exit evidence. Do not claim success without CLI output.
27
+ ```
28
+
29
+ ### onDone prompt template (release:check)
30
+
31
+ ```text
32
+ release:check monitor completed. Read tail of /tmp/pi-spine-release-check.log.
33
+ If exit 0: present pre-publish checklist from docs/release/npm-publish.md.
34
+ If non-zero: STOP; summarize first failing step; do not bump version.
35
+ ```
36
+
37
+ ---
38
+
39
+ ## When to use LoopCreate (watchdog only)
40
+
41
+ Use when MonitorCreate's completion wake is insufficient or you need lightweight status polling without blocking the session.
42
+
43
+ ```text
44
+ LoopCreate:
45
+ trigger: "2m"
46
+ readOnly: true
47
+ maxFires: 50
48
+ prompt: |
49
+ Check spine status --diagnose for batch <batchId>.
50
+ If diagnosis is terminal (needs_integrate, failed, aborted, needs_retry): LoopDelete this loop and run onDone actions.
51
+ If still running: do nothing.
52
+ ```
53
+
54
+ Prefer Monitor's built-in completion wake over LoopCreate when MonitorCreate was used for the same command.
55
+
56
+ ---
57
+
58
+ ## When NOT to async
59
+
60
+ | Action | Rule | Why |
61
+ |--------|------|-----|
62
+ | `spine batch resume --attached` | **Foreground shell only** | [#163](https://github.com/beettlle/pi-spine/issues/163) engine_orphaned |
63
+ | `spine batch resume --attached --force` | **Foreground shell only** | Same; release recovery discipline |
64
+ | `spine gate approve` | Agent must read evidence first | FR-SHIP-13; no auto-approve |
65
+ | Land loop during active recovery | Stay on current wave | Avoid parallel engines |
66
+
67
+ If `engine_orphaned` recurs after MonitorCreate on `batch start`, fall back to blocking `spine wait` for that wave and comment on #163.
68
+
69
+ ---
70
+
71
+ ## Cleanup
72
+
73
+ Before starting the next wave or ending the release session:
74
+
75
+ ```text
76
+ LoopList → LoopDelete any release watchdog loops
77
+ MonitorList → note completed monitors; MonitorStop any stale runners
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Do not interfere with active batches
83
+
84
+ Before authoring skill-driven commands:
85
+
86
+ 1. Run `spine status --diagnose` (readonly).
87
+ 2. If a batch is **running** for the current release, do not start a second batch or edit `.spine/runtime/**`.
88
+ 3. Skill/doc updates on `main` are safe; batch execution is owned by the active operator session.
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env bash
2
+ # Collect GitHub issues and spine backlog for release intake.
3
+ # Usage: from repo root: skills/spine-release-operator/scripts/collect-release-intake.sh [TARGET_VERSION]
4
+
5
+ set -euo pipefail
6
+
7
+ REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
8
+ cd "$REPO_ROOT"
9
+
10
+ TARGET="${1:-unknown}"
11
+
12
+ echo "=== pi-spine release intake snapshot ==="
13
+ echo "Target: v${TARGET}"
14
+ echo "Date: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
15
+ echo "Repo: $REPO_ROOT"
16
+ echo "Branch: $(git branch --show-current 2>/dev/null || echo unknown)"
17
+ echo "Package version: $(node -p "require('./package.json').version" 2>/dev/null || echo unknown)"
18
+ echo ""
19
+
20
+ echo "=== GitNexus status ==="
21
+ if command -v gitnexus >/dev/null 2>&1; then
22
+ gitnexus status 2>/dev/null || echo "(gitnexus status failed)"
23
+ else
24
+ echo "(gitnexus not installed)"
25
+ fi
26
+ echo ""
27
+
28
+ echo "=== GitHub open issues (beettlle/pi-spine) ==="
29
+ if command -v gh >/dev/null 2>&1; then
30
+ gh issue list --repo beettlle/pi-spine --state open --limit 100 \
31
+ --json number,title,labels,url,createdAt \
32
+ 2>/dev/null || echo "(gh failed — check auth)"
33
+ else
34
+ echo "(gh not installed)"
35
+ fi
36
+ echo ""
37
+
38
+ echo "=== Documentation issues ==="
39
+ if command -v gh >/dev/null 2>&1; then
40
+ gh issue list --repo beettlle/pi-spine --state open --label documentation \
41
+ --json number,title,labels \
42
+ 2>/dev/null || true
43
+ fi
44
+ echo ""
45
+
46
+ echo "=== Bug issues ==="
47
+ if command -v gh >/dev/null 2>&1; then
48
+ gh issue list --repo beettlle/pi-spine --state open --label bug \
49
+ --json number,title,labels \
50
+ 2>/dev/null || true
51
+ fi
52
+ echo ""
53
+
54
+ echo "=== Spine plan pending ==="
55
+ if command -v spine >/dev/null 2>&1; then
56
+ spine plan pending 2>/dev/null || true
57
+ else
58
+ echo "(spine not installed)"
59
+ fi
60
+ echo ""
61
+
62
+ echo "=== Issue → task mapping (Closes:/Partial:) ==="
63
+ if command -v rg >/dev/null 2>&1; then
64
+ rg 'Closes:|Partial:' spine-tasks/*/PROMPT.md 2>/dev/null || echo "(no mappings found)"
65
+ else
66
+ grep -r 'Closes:\|Partial:' spine-tasks/*/PROMPT.md 2>/dev/null || echo "(no mappings found)"
67
+ fi
68
+ echo ""
69
+
70
+ echo "=== Next Task ID (from CONTEXT.md) ==="
71
+ grep -E '^\*\*Next Task ID:\*\*' spine-tasks/CONTEXT.md 2>/dev/null || echo "(CONTEXT.md not found)"
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Archive-first batch abort (FR-BATCH-06, §18.6).
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * In-process lane worker via pi-coding-agent createAgentSession (TP-050 spike).
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Attached engine post-merge SIGTERM survival (SP-316, GitHub #21).
3
4
  *
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Attached batch foreground runner — milestones, integrate handoff, CLI exit (SP-343, GitHub #34).
3
4
  * Post-merge limbo resume fast path (SP-348, GitHub #39).
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Pre-landed fileScopeMustChange satisfaction (issue #56, SP-373).
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Resolve lane branch HEAD at task.started for scoped contract verify (issue #62, SP-415).
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Machine contract verification in lane worktree (handoff §4.5, SP-154/SP-155).
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Detached batch engine spawn — default for `spine batch start` and `spine batch resume`.
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Worker launch failure inference for diagnosis headlines (SP-105, SP-421).
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Wave merge failure diagnosis helpers (SP-338 / GitHub #29).
3
4
  */
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Failed-phase limbo after retry clears failed tasks but phase stays failed (GitHub #25).
3
4
  */