pi-spine 1.0.2 → 1.2.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 +61 -489
- package/bin/get-version.mjs +1 -13
- package/bin/spine-batch.mjs +162 -51
- package/bin/spine-cli/batch.mjs +3 -3
- package/bin/spine-cli/lane-logs.mjs +24 -0
- package/bin/spine-cli/scenarios.mjs +298 -0
- package/bin/spine-cli/wait.mjs +30 -0
- package/bin/spine-cli/watch.mjs +27 -0
- package/bin/spine-config.mjs +1 -212
- package/bin/spine-doctor.mjs +2 -418
- package/bin/spine-init.mjs +1 -398
- package/bin/spine-issue.mjs +196 -0
- package/bin/spine-journal.mjs +1 -0
- package/bin/spine-preflight.mjs +1 -700
- package/bin/spine-review-step.mjs +6 -4
- package/bin/spine-run.mjs +30 -0
- package/bin/spine-status.mjs +19 -1
- package/bin/spine-tasks.mjs +112 -13
- package/bin/spine-worker-runner.mjs +24 -14
- package/bin/spine.mjs +52 -2
- package/extensions/spine/worker-tools.ts +14 -12
- package/package.json +5 -2
- package/skills/create-spine-tasks/SKILL.md +135 -6
- package/skills/create-spine-tasks/references/clarify-template.md +73 -0
- package/skills/create-spine-tasks/references/contract-template.md +19 -0
- package/skills/create-spine-tasks/references/prompt-template.md +2 -0
- package/skills/create-spine-tasks/references/requirements-checklist-template.md +94 -0
- package/src/batch/abort.mjs +3 -12
- package/src/batch/agent-session-worker.mjs +45 -5
- package/src/batch/attached-engine-handoff.mjs +188 -0
- package/src/batch/attached-runner.mjs +312 -0
- package/src/batch/contract-prelanded.mjs +180 -0
- package/src/batch/contract-verify.mjs +140 -2
- package/src/batch/detached-start.mjs +105 -7
- package/src/batch/diagnosis-alternatives.mjs +46 -0
- package/src/batch/diagnosis-merge-failure.mjs +79 -0
- package/src/batch/diagnosis-retry-limbo.mjs +34 -0
- package/src/batch/diagnosis-stub.mjs +109 -0
- package/src/batch/diagnosis-task-done.mjs +110 -0
- package/src/batch/diagnosis-worker-done-missing.mjs +96 -0
- package/src/batch/diagnosis.mjs +174 -62
- package/src/batch/engine-lanes/merge.mjs +168 -77
- package/src/batch/engine-lanes/queue.mjs +4 -1
- package/src/batch/engine-lanes/review.mjs +32 -74
- package/src/batch/engine-lanes/watch.mjs +29 -0
- package/src/batch/engine-lanes.mjs +1 -0
- package/src/batch/engine-scope.mjs +42 -5
- package/src/batch/engine.mjs +115 -68
- package/src/batch/evidence.mjs +81 -17
- package/src/batch/gate.mjs +46 -17
- package/src/batch/git-helpers.mjs +96 -0
- package/src/batch/heartbeat.mjs +73 -7
- package/src/batch/integrate.mjs +3 -5
- package/src/batch/journal.mjs +25 -0
- package/src/batch/lane-commit.mjs +90 -5
- package/src/batch/lifecycle.mjs +131 -4
- package/src/batch/macro-phase.mjs +226 -0
- package/src/batch/merge/adoption-doc-merge.mjs +243 -0
- package/src/batch/merge/wave-merge-state.mjs +108 -0
- package/src/batch/metrics.mjs +74 -5
- package/src/batch/orphan-detect.mjs +74 -0
- package/src/batch/pause.mjs +223 -0
- package/src/batch/post-merge-limbo.mjs +345 -17
- package/src/batch/reconcile.mjs +473 -50
- package/src/batch/resume-common.mjs +6 -2
- package/src/batch/resume-engine.mjs +58 -1
- package/src/batch/resume-lane-reviews.mjs +16 -0
- package/src/batch/resume-multi-lanes.mjs +56 -1
- package/src/batch/resume-multi-validate.mjs +148 -8
- package/src/batch/resume-multi.mjs +45 -44
- package/src/batch/resume.mjs +64 -47
- package/src/batch/retry.mjs +56 -5
- package/src/batch/review-shared.mjs +196 -0
- package/src/batch/review-spawn.mjs +326 -0
- package/src/batch/review.mjs +178 -212
- package/src/batch/rules-manifest-drift.mjs +157 -0
- package/src/batch/salvage.mjs +2 -1
- package/src/batch/sequence.mjs +454 -0
- package/src/batch/state.mjs +18 -3
- package/src/batch/status-json.mjs +67 -0
- package/src/batch/task-stall-budget.mjs +94 -10
- package/src/batch/worker-host.mjs +185 -37
- package/src/batch/worker-output.mjs +196 -3
- package/src/batch/worktree.mjs +10 -0
- package/src/cli/handoff.mjs +1 -1
- package/src/cli/issue-draft.mjs +180 -0
- package/src/cli/journal-follow.mjs +239 -0
- package/src/cli/lane-logs.mjs +291 -0
- package/src/cli/rules.mjs +1 -1
- package/src/cli/sequence.mjs +108 -0
- package/src/cli/settings-set.mjs +3 -22
- package/src/cli/settings-slash.mjs +27 -5
- package/src/cli/wait.mjs +187 -0
- package/src/cli/watch.mjs +160 -0
- package/src/config/agent-model-resolve.mjs +48 -0
- package/src/config/cursor-rules/discover.mjs +3 -21
- package/src/config/defaults.mjs +7 -1
- package/src/config/settings-fields.mjs +48 -0
- package/src/config/spine-config-load.mjs +221 -0
- package/src/config/spine-init-constants.mjs +424 -0
- package/src/config/spine-preflight-lib.mjs +1180 -0
- package/src/dashboard/lane-throughput.mjs +351 -0
- package/src/dashboard/public/dashboard.css +25 -1
- package/src/dashboard/public/dashboard.js +224 -40
- package/src/dashboard/public/index.html +15 -9
- package/src/dashboard/server.mjs +4 -0
- package/src/dashboard/snapshot.mjs +387 -6
- package/src/dashboard/view.mjs +170 -15
- package/src/doctor/agent-model-inherit.mjs +61 -6
- package/src/doctor/run-doctor-checks.mjs +483 -0
- package/src/doctor/sequence-safety.mjs +57 -0
- package/src/doctor/stale-path.mjs +22 -0
- package/src/doctor/stale-worktrees.mjs +102 -0
- package/src/fixtures/scenario-registry.mjs +194 -0
- package/src/fs/atomic-write.mjs +49 -0
- package/src/migrate/taskplane-config.mjs +1 -1
- package/src/planner/file-scope.mjs +246 -0
- package/src/planner/format-plan.mjs +9 -7
- package/src/planner/index.mjs +6 -2
- package/src/planner/pending.mjs +92 -1
- package/src/planner/wave-scope.mjs +136 -0
- package/src/planner/waves.mjs +133 -0
- package/src/tasks/analyze/index.mjs +453 -0
- package/src/tasks/packet/index.mjs +1 -0
- package/src/tasks/packet/parse-prompt.mjs +42 -1
- package/src/tasks/packet/validate-prompt.mjs +124 -0
- package/src/util/command-exists.mjs +19 -0
- package/templates/docs/constitution.md +61 -0
- package/templates/spine-config.json +9 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-spine-tasks
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.1.0
|
|
4
4
|
description: Decomposes PRDs and feature briefs into spine task packets (PROMPT.md, STATUS.md) under spine-tasks/ for autonomous execution via spine batch. Use when asked to "create a spine task", "decompose a PRD", "stage tasks for spine", "write PROMPT.md for spine", "create SP-* tasks", or queue work for spine workers.
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -13,15 +13,24 @@ Works from a local pi-spine checkout (`pi install /path/to/pi-spine -l`) or afte
|
|
|
13
13
|
## Architecture
|
|
14
14
|
|
|
15
15
|
```
|
|
16
|
-
|
|
16
|
+
PRD / brief
|
|
17
|
+
│
|
|
18
|
+
├─ Lean authoring ─────────────────────────────────────────────┐
|
|
19
|
+
│ Step 0? → Step A → Step B → Step C │
|
|
20
|
+
│ │
|
|
21
|
+
└─ Full authoring ───────────────────────────────────────────┤
|
|
22
|
+
Step 0? → A.5 clarify → A.6 checklist → B slice → C.5 analyze? → C
|
|
23
|
+
│
|
|
24
|
+
create-spine-tasks skill → PROMPT.md + STATUS.md (+ dependencies.json edits)
|
|
25
|
+
→ optional _explore/ and _authoring/ artifacts
|
|
17
26
|
spine-orchestrator extension → Slash commands, batch guidance
|
|
18
|
-
spine CLI →
|
|
27
|
+
spine CLI → tasks validate, tasks analyze, plan, batch start, gates
|
|
19
28
|
├─ .spine/agents/worker.md → Worker standing orders (checkpoint discipline)
|
|
20
29
|
├─ .spine/agents/reviewer.md → Reviewer rubric
|
|
21
30
|
└─ .spine/spine-config.json → tasks root, testing commands, lanes, gates
|
|
22
31
|
```
|
|
23
32
|
|
|
24
|
-
The skill only creates and updates task files. Execution behavior lives in pi-spine and the worker/reviewer agent prompts.
|
|
33
|
+
The skill only creates and updates task files. Execution behavior lives in pi-spine and the worker/reviewer agent prompts. Authoring artifacts under `{tasksRoot}/_explore/` and `{tasksRoot}/_authoring/` inform decomposition — they are not batch engine input.
|
|
25
34
|
|
|
26
35
|
## Prerequisites
|
|
27
36
|
|
|
@@ -49,6 +58,19 @@ Override tasks root at runtime with `SPINE_TASKS_ROOT` (env > file).
|
|
|
49
58
|
|
|
50
59
|
Use this workflow when the user supplies a PRD, epic brief, or feature spec instead of a single task description.
|
|
51
60
|
|
|
61
|
+
### Authoring modes
|
|
62
|
+
|
|
63
|
+
Pick **lean** or **full** before decomposition. Terminology aligns with [spec-kit presets](https://github.com/github/spec-kit): lean skips pre-slice quality gates; full runs clarify, checklist, and optional LLM analyze before slicing.
|
|
64
|
+
|
|
65
|
+
| Mode | Pipeline | When to use |
|
|
66
|
+
|------|----------|-------------|
|
|
67
|
+
| **Lean** | Optional Step 0 explore → Step A read → Step B slice → Step C track | Greenfield or brownfield with clear PRD paths; single S/M task; quick experiments; operator already validated requirements |
|
|
68
|
+
| **Full** | Step 0 (if brownfield) → Step A.5 clarify → Step A.6 checklist → Step B slice → optional Step C.5 analyze → Step C track | L/XL epics; ambiguous or conflicting requirements; security/compliance surface; parallel wave planning; production-grade decomposition |
|
|
69
|
+
|
|
70
|
+
**Lean** mirrors spec-kit's lean preset (Specify → Plan → Tasks): move from sources to packets with minimal upstream gates. **Full** mirrors the standard spec-kit path (adds Clarify, Checklist, and Analyze before implementation) — use skill Steps A.5/A.6/C.5 or external [Path 4 spec-kit](../../docs/adoption/upstream-execution-workflow.md#path-4--spec-kit-optional-upstream) upstream, then convert artifacts into spine packets.
|
|
71
|
+
|
|
72
|
+
Default to **lean** when the operator does not specify a mode and signals are weak. Switch to **full** when any row in the full-mode table applies.
|
|
73
|
+
|
|
52
74
|
### Step 0: Explore (optional — brownfield / large epics)
|
|
53
75
|
|
|
54
76
|
Run **before** Step A when decomposition needs codebase discovery. Authoring-only — `spine tasks validate` does **not** require explore artifacts.
|
|
@@ -90,6 +112,76 @@ See [docs/adoption/upstream-execution-workflow.md](../../docs/adoption/upstream-
|
|
|
90
112
|
2. `{tasksRoot}/CONTEXT.md` — current phase, **Next Task ID**, execution policy
|
|
91
113
|
3. Existing `{tasksRoot}/dependencies.json` and open task folders (avoid duplicate work)
|
|
92
114
|
|
|
115
|
+
### Step A.5: Clarify (optional — ambiguity pass before slice)
|
|
116
|
+
|
|
117
|
+
Run **after** Step A when using **full** authoring mode or when the PRD/brief needs ambiguity resolution before decomposition. Authoring-only — `spine tasks validate` does **not** require clarify artifacts.
|
|
118
|
+
|
|
119
|
+
External equivalent: [spec-kit `/speckit.clarify`](https://github.com/github/spec-kit) — see [Path 4](../../docs/adoption/upstream-execution-workflow.md#path-4--spec-kit-optional-upstream).
|
|
120
|
+
|
|
121
|
+
**When to run:**
|
|
122
|
+
|
|
123
|
+
| Signal | Why clarify helps |
|
|
124
|
+
|--------|-------------------|
|
|
125
|
+
| Ambiguous PRD / brief | Scope, acceptance criteria, or deps unclear before slicing |
|
|
126
|
+
| L/XL epic | Must split anyway; resolved decisions drive wave boundaries |
|
|
127
|
+
| Conflicting requirements | Multiple sources or stakeholders need reconciliation |
|
|
128
|
+
| Post-explore open questions | Step 0 findings left decomposition blockers |
|
|
129
|
+
| Full authoring pipeline | Operator wants clarify → checklist → slice before packets |
|
|
130
|
+
|
|
131
|
+
**When to skip:**
|
|
132
|
+
|
|
133
|
+
- **Lean** mode with unambiguous PRD and concrete paths
|
|
134
|
+
- Single S/M task with no open requirements questions
|
|
135
|
+
- Migrating existing Taskplane packets unchanged
|
|
136
|
+
- Prior `{tasksRoot}/_authoring/{slug}/clarify.md` still `Status: complete`
|
|
137
|
+
|
|
138
|
+
**Constraints (read-only on sources):**
|
|
139
|
+
|
|
140
|
+
- No commits; no file edits outside read targets and the clarify artifact
|
|
141
|
+
- Output path: `{tasksRoot}/_authoring/{slug}/clarify.md` (git-tracked by default)
|
|
142
|
+
- Clarify informs Step B slicing — not batch engine input
|
|
143
|
+
|
|
144
|
+
**Workflow:**
|
|
145
|
+
|
|
146
|
+
1. Read-only review — PRD/brief, explore findings (if any), CONTEXT.md.
|
|
147
|
+
2. Write `{tasksRoot}/_authoring/{slug}/clarify.md` using [references/clarify-template.md](references/clarify-template.md) (Summary, Open questions, Assumptions, Resolved decisions, Blockers for decomposition).
|
|
148
|
+
3. Link the slug in `{tasksRoot}/CONTEXT.md` — clarify table row or `Clarify complete: {slug}` with date and path.
|
|
149
|
+
4. Use **Resolved decisions** and resolved **Open questions** when slicing tasks in Step B.
|
|
150
|
+
|
|
151
|
+
### Step A.6 — Requirements checklist (optional)
|
|
152
|
+
|
|
153
|
+
Run **after Step A.5 — Clarify** and **before Step B — Slice**. Authoring-only — `spine tasks validate` does **not** require checklist artifacts.
|
|
154
|
+
|
|
155
|
+
**Purpose:** Validate requirement quality ("unit tests for requirements") before decomposition — inspired by spec-kit `/speckit.checklist`. Checks whether the PRD/brief is complete, measurable, and slice-ready; does **not** verify implementation.
|
|
156
|
+
|
|
157
|
+
**Output path:** `{tasksRoot}/_authoring/{slug}/checklist.md` using [references/requirements-checklist-template.md](references/requirements-checklist-template.md).
|
|
158
|
+
|
|
159
|
+
**When to run:**
|
|
160
|
+
|
|
161
|
+
| Signal | Why checklist helps |
|
|
162
|
+
|--------|---------------------|
|
|
163
|
+
| After clarify with open assumptions | Surfaces requirement gaps before slicing |
|
|
164
|
+
| L/XL epic or multi-task decomposition | Catches missing NFRs and edge cases early |
|
|
165
|
+
| Security- or compliance-touching work | Forces explicit auth/data handling in requirements |
|
|
166
|
+
| Vague acceptance language | Converts ambiguity into measurable criteria |
|
|
167
|
+
| Parallel wave planning | Ensures disjoint scopes are justified by clear requirements |
|
|
168
|
+
|
|
169
|
+
**When to skip:**
|
|
170
|
+
|
|
171
|
+
- Single S/M task with concrete File Scope and measurable acceptance criteria
|
|
172
|
+
- Greenfield with a short, unambiguous brief and no security surface
|
|
173
|
+
- Migrating existing spine packets unchanged
|
|
174
|
+
- Requirements already validated; no open items in `clarify.md`
|
|
175
|
+
|
|
176
|
+
**Workflow:**
|
|
177
|
+
|
|
178
|
+
1. Read PRD/brief, `clarify.md` (if present), and project standards referenced in the brief.
|
|
179
|
+
2. Write `{tasksRoot}/_authoring/{slug}/checklist.md` — cover acceptance criteria quality, security, edge cases, testability, and non-functional requirements (see template).
|
|
180
|
+
3. Resolve or explicitly defer `[Gap]` items before Step B; do **not** duplicate Step 0 explore `findings.md` (explore maps codebase; checklist validates requirements).
|
|
181
|
+
4. Link the slug in `{tasksRoot}/CONTEXT.md` when checklist informs decomposition.
|
|
182
|
+
|
|
183
|
+
**Authoring order:** clarify → checklist → slice (Step A.5 → A.6 → B).
|
|
184
|
+
|
|
93
185
|
### Step B: Slice into spine tasks
|
|
94
186
|
|
|
95
187
|
| Rule | Guidance |
|
|
@@ -102,13 +194,45 @@ See [docs/adoption/upstream-execution-workflow.md](../../docs/adoption/upstream-
|
|
|
102
194
|
| **Waves** | Order via `## Dependencies` and `{tasksRoot}/dependencies.json`. |
|
|
103
195
|
| **Review** | Score complexity (below). Do not default to Level 0 for implementation work. |
|
|
104
196
|
|
|
197
|
+
### Step C.5: Analyze (optional — LLM structural review after slice)
|
|
198
|
+
|
|
199
|
+
Run **after** Step B and **before** Step C when using **full** authoring mode and the operator wants an LLM-authored structural review of drafted packets. Authoring-only — `spine tasks validate` does **not** require analyze artifacts.
|
|
200
|
+
|
|
201
|
+
External equivalent: [spec-kit `/speckit.analyze`](https://github.com/github/spec-kit) — cross-artifact consistency check before implementation.
|
|
202
|
+
|
|
203
|
+
**Purpose:** Read-only review of drafted PROMPT/STATUS packets and dependency graph — wave sizing, scope overlap, missing deps, explore/authoring refs. Complements deterministic **`spine tasks analyze`** (CLI structural checks after decomposition).
|
|
204
|
+
|
|
205
|
+
**Output path:** `{tasksRoot}/_authoring/{slug}/analyze.md` — LLM-authored, read-only report (not batch engine input).
|
|
206
|
+
|
|
207
|
+
**When to run:**
|
|
208
|
+
|
|
209
|
+
| Signal | Why LLM analyze helps |
|
|
210
|
+
|--------|----------------------|
|
|
211
|
+
| Multi-task wave with ≥4 M-sized tasks | Catch scope overlap and wave stall risk before batch |
|
|
212
|
+
| First decomposition on a new epic slug | Sanity-check packet quality before operator approval |
|
|
213
|
+
| Full authoring pipeline | Close the loop after clarify → checklist → slice |
|
|
214
|
+
| Operator requests pre-batch review | Human gate before `spine batch start` |
|
|
215
|
+
|
|
216
|
+
**When to skip:**
|
|
217
|
+
|
|
218
|
+
- **Lean** mode or single S/M packet
|
|
219
|
+
- Operator will run only `spine tasks analyze pending` (deterministic CLI suffices)
|
|
220
|
+
- Packets already reviewed in a prior batch iteration
|
|
221
|
+
|
|
222
|
+
**Workflow:**
|
|
223
|
+
|
|
224
|
+
1. Read drafted task folders, `dependencies.json`, and any `_authoring/{slug}/clarify.md` or `checklist.md`.
|
|
225
|
+
2. Write `{tasksRoot}/_authoring/{slug}/analyze.md` — structural findings, wave recommendations, blocking issues for operator (resolve before batch).
|
|
226
|
+
3. Fix packet issues identified in analyze.md before Step C tracking updates.
|
|
227
|
+
4. After Step C, run **`spine tasks analyze pending`** for deterministic structural checks (wave M-count, explore refs, PROMPT/JSON deps drift).
|
|
228
|
+
|
|
105
229
|
### Step C: Update tracking
|
|
106
230
|
|
|
107
231
|
After creating packets:
|
|
108
232
|
|
|
109
233
|
1. **`{tasksRoot}/CONTEXT.md`** — increment `Next Task ID`; add rows to the phase table for new tasks
|
|
110
234
|
2. **`{tasksRoot}/dependencies.json`** — add edges for every dependency (machine-parseable)
|
|
111
|
-
3. Report launch commands: `spine tasks validate pending` (fix contract/PROMPT errors first), `spine plan pending`, then `spine batch start <id>`
|
|
235
|
+
3. Report launch commands: `spine tasks validate pending` (fix contract/PROMPT errors first), `spine tasks analyze pending` (structural checks — wave sizing, deps drift, explore refs), `spine plan pending`, then `spine batch start <id>`
|
|
112
236
|
|
|
113
237
|
**Example decomposition** (feature brief → three tasks):
|
|
114
238
|
|
|
@@ -179,6 +303,7 @@ If the task depends on others, update **both**:
|
|
|
179
303
|
|
|
180
304
|
```bash
|
|
181
305
|
spine tasks validate pending
|
|
306
|
+
spine tasks analyze pending
|
|
182
307
|
spine plan pending
|
|
183
308
|
spine preflight
|
|
184
309
|
SPINE_WORKER_STUB=1 spine batch start SP-042 # stub / CI
|
|
@@ -329,6 +454,7 @@ Do **not** generate Taskplane polyrepo **`#### Segment: <repoId>`** markers —
|
|
|
329
454
|
|
|
330
455
|
Before reporting launch commands:
|
|
331
456
|
|
|
457
|
+
- [ ] Authoring mode chosen (lean default; full when ambiguity, L/XL epic, or security surface)
|
|
332
458
|
- [ ] `Next Task ID` read from CONTEXT.md and incremented
|
|
333
459
|
- [ ] Folder at `{tasksRoot}/{PREFIX-###-slug}/`
|
|
334
460
|
- [ ] Complexity scored; review level assigned (0–3)
|
|
@@ -338,7 +464,8 @@ Before reporting launch commands:
|
|
|
338
464
|
- [ ] STATUS.md with matching steps (hydration markers where needed)
|
|
339
465
|
- [ ] `dependencies.json` updated when task has deps
|
|
340
466
|
- [ ] CONTEXT.md phase table updated for PRD decompositions
|
|
341
|
-
- [ ]
|
|
467
|
+
- [ ] Full mode: clarify/checklist/analyze artifacts complete or explicitly skipped with rationale
|
|
468
|
+
- [ ] Launch: `spine tasks validate pending` → `spine tasks analyze pending` → `spine plan pending` → `spine preflight` → `spine batch start <id>`
|
|
342
469
|
|
|
343
470
|
---
|
|
344
471
|
|
|
@@ -369,6 +496,8 @@ Hydration commits (STATUS.md expansions) may happen mid-step for crash recovery.
|
|
|
369
496
|
- [references/prompt-template.md](references/prompt-template.md) — PROMPT.md and STATUS.md templates
|
|
370
497
|
- [references/contract-template.md](references/contract-template.md) — `## Contract` field guidance and examples (v2.0 §4)
|
|
371
498
|
- [references/explore-template.md](references/explore-template.md) — Step 0 `findings.md` schema (v1.3 §6.3)
|
|
499
|
+
- [references/clarify-template.md](references/clarify-template.md) — Step A.5 `clarify.md` schema (spec-kit `/speckit.clarify` equivalent)
|
|
500
|
+
- [references/requirements-checklist-template.md](references/requirements-checklist-template.md) — Step A.6 `checklist.md` schema (spec-kit `/speckit.checklist` equivalent)
|
|
372
501
|
- [references/context-template.md](references/context-template.md) — `{tasksRoot}/CONTEXT.md` scaffold
|
|
373
502
|
- [docs/PRD.md](../../docs/PRD.md) — task format spec (§13)
|
|
374
503
|
- [docs/adoption/bootstrap-checklist.md](../../docs/adoption/bootstrap-checklist.md) — greenfield setup
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Clarify template
|
|
2
|
+
|
|
3
|
+
Use for **Step A.5 — Clarify (optional)** in the create-spine-tasks skill.
|
|
4
|
+
Output path: `{tasksRoot}/_authoring/{slug}/clarify.md`
|
|
5
|
+
|
|
6
|
+
**Constraints:** read-only pass on PRD/brief sources; no commits; no file edits outside read targets and the clarify artifact. Clarify informs task slicing in Step B. `spine tasks validate` does **not** require clarify artifacts.
|
|
7
|
+
|
|
8
|
+
External equivalent: [spec-kit `/speckit.clarify`](https://github.com/github/spec-kit) (see [Path 4](../../docs/adoption/upstream-execution-workflow.md#path-4--spec-kit-optional-upstream) in upstream-execution-workflow).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
# Clarify: {slug}
|
|
14
|
+
|
|
15
|
+
**Date:** YYYY-MM-DD
|
|
16
|
+
**Status:** complete | superseded
|
|
17
|
+
**Sources:** (PRD/brief paths reviewed)
|
|
18
|
+
|
|
19
|
+
## Summary
|
|
20
|
+
|
|
21
|
+
(1–3 sentences: what was clarified and readiness for decomposition.)
|
|
22
|
+
|
|
23
|
+
## Open questions
|
|
24
|
+
|
|
25
|
+
- (unresolved ambiguities needing operator or stakeholder input; None if clear)
|
|
26
|
+
|
|
27
|
+
## Assumptions
|
|
28
|
+
|
|
29
|
+
- (working assumptions for slicing until confirmed)
|
|
30
|
+
|
|
31
|
+
## Resolved decisions
|
|
32
|
+
|
|
33
|
+
- (decisions made during clarify; include rationale when non-obvious)
|
|
34
|
+
|
|
35
|
+
## Blockers for decomposition
|
|
36
|
+
|
|
37
|
+
- (must-resolve items before Step B slice; None if ready)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## When to skip clarify
|
|
43
|
+
|
|
44
|
+
- Greenfield with unambiguous PRD and concrete File Scope paths
|
|
45
|
+
- Single S/M task with no open requirements questions
|
|
46
|
+
- Migrating existing Taskplane packets unchanged
|
|
47
|
+
- Prior clarify artifact for the same slug is still `Status: complete`
|
|
48
|
+
|
|
49
|
+
## When clarify is recommended
|
|
50
|
+
|
|
51
|
+
- PRD or brief has ambiguous scope, acceptance criteria, or dependencies
|
|
52
|
+
- L/XL epics before splitting into waves
|
|
53
|
+
- Multiple stakeholders or conflicting requirements in source docs
|
|
54
|
+
- Brownfield work where explore findings raised open questions
|
|
55
|
+
- Full authoring mode (see SP-291 lean vs full) before checklist and slice
|
|
56
|
+
|
|
57
|
+
## Linking in CONTEXT.md
|
|
58
|
+
|
|
59
|
+
Add a row or note:
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
| Clarify: feature-x | 2026-06-18 | complete | spine-tasks/_authoring/feature-x/clarify.md |
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or: `Clarify complete: feature-x (2026-06-18) — spine-tasks/_authoring/feature-x/clarify.md`
|
|
66
|
+
|
|
67
|
+
## Ordering with explore and slice
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
Step 0 Explore (optional) → Step A Read sources → Step A.5 Clarify (optional) → Step B Slice
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use **Resolved decisions** and **Blockers for decomposition** when writing `## File Scope` and `## Dependencies` in downstream packets.
|
|
@@ -33,6 +33,8 @@ Normative schema: [PRD v2.0 implementation handoff §4](../../docs/PRD-v2.0-impl
|
|
|
33
33
|
| `fileScopeMustNotChange` | When parallel tasks must not collide | Comma-separated paths/globs |
|
|
34
34
|
| `minLineCoverage` | When task changes application code | Integer 0–100 (pi-spine policy: **77**) |
|
|
35
35
|
| `artifactsMustExist` | When deliverables must exist on disk | Comma-separated file paths |
|
|
36
|
+
| `stallTimeoutMinutes` | Long external jobs (operator matrix, CI arms) exceeding global/size stall budget | Positive integer minutes; engine uses `max(global, size floor, contract)` |
|
|
37
|
+
| `extendGraceOnFileScope` | STATUS-only progress during long external work | `true` or `false`; when `true`, file-scope mtime extends stall grace for this task |
|
|
36
38
|
|
|
37
39
|
Unknown field names produce **warnings** at validate time (not errors). Duplicate rows are errors.
|
|
38
40
|
|
|
@@ -85,6 +87,23 @@ Unknown field names produce **warnings** at validate time (not errors). Duplicat
|
|
|
85
87
|
| artifactsMustExist | `tests/batch/final-verdict.test.mjs` |
|
|
86
88
|
```
|
|
87
89
|
|
|
90
|
+
### Operator matrix / long external job (SP-314)
|
|
91
|
+
|
|
92
|
+
Use when a task runs a multi-hour external matrix or CI arm with little in-repo checkpoint progress (only `STATUS.md` edits). Per-task override avoids raising global `lanes.stallTimeoutMinutes` for the whole batch.
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
## Contract
|
|
96
|
+
|
|
97
|
+
| Field | Value |
|
|
98
|
+
|-------|-------|
|
|
99
|
+
| testCommand | `npm run typecheck && SPINE_WORKER_STUB=1 npm test` |
|
|
100
|
+
| stallTimeoutMinutes | 240 |
|
|
101
|
+
| extendGraceOnFileScope | true |
|
|
102
|
+
| fileScopeMustChange | `spine-tasks/SP-029-*/STATUS.md` |
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Recommended: **240** minutes for jobs expected to run 2+ hours. Size S floor (90m) and global default (120m) are additive floors; contract value wins when higher.
|
|
106
|
+
|
|
88
107
|
---
|
|
89
108
|
|
|
90
109
|
## Validate before plan
|
|
@@ -18,6 +18,8 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
|
|
|
18
18
|
**Assessment:** [1-2 sentences explaining the score]
|
|
19
19
|
**Score:** [N]/8 — Blast radius: [N], Pattern novelty: [N], Security: [N], Reversibility: [N]
|
|
20
20
|
|
|
21
|
+
> **Real-pi batches (SP-195/SP-278):** Do **not** add per-step "Call `spine_review_step`" checkboxes for Review Level ≥ 1. The batch engine runs plan, code, and final reviews after worker `.DONE`. Stub batches (`SPINE_WORKER_STUB=1`) may still use in-worker stub plan review via the tool when a checkpoint marker requires it.
|
|
22
|
+
|
|
21
23
|
## Canonical Task Folder
|
|
22
24
|
|
|
23
25
|
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Requirements checklist template
|
|
2
|
+
|
|
3
|
+
Use for **Step A.6 — Requirements checklist (optional)** in the create-spine-tasks skill.
|
|
4
|
+
Output path: `{tasksRoot}/_authoring/{slug}/checklist.md`
|
|
5
|
+
|
|
6
|
+
**Purpose:** "Unit tests for requirements" — validate PRD/brief quality before task slicing. Inspired by spec-kit `/speckit.checklist`. This is **not** implementation verification; it checks whether requirements are complete, clear, measurable, and ready for decomposition.
|
|
7
|
+
|
|
8
|
+
**Ordering:** Run after **Step A.5 — Clarify** (`clarify.md` in the same `_authoring/{slug}/` folder) and before **Step B — Slice into spine tasks**.
|
|
9
|
+
|
|
10
|
+
**Constraints:** read-only on source docs; no commits; no file edits outside authoring output. `spine tasks validate` does **not** require checklist artifacts.
|
|
11
|
+
|
|
12
|
+
**Do not duplicate** Step 0 explore `findings.md` content — explore maps codebase touch points; checklist validates requirement quality.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
# Requirements checklist: {slug}
|
|
18
|
+
|
|
19
|
+
**Date:** YYYY-MM-DD
|
|
20
|
+
**Status:** complete | superseded
|
|
21
|
+
**Sources:** (PRD/brief paths reviewed)
|
|
22
|
+
|
|
23
|
+
## Summary
|
|
24
|
+
|
|
25
|
+
(1–3 sentences: overall readiness for decomposition and top gaps found.)
|
|
26
|
+
|
|
27
|
+
## Acceptance criteria quality
|
|
28
|
+
|
|
29
|
+
- [ ] CHK001 — Are success criteria measurable for each deliverable? [Measurability]
|
|
30
|
+
- [ ] CHK002 — Can completion be verified without subjective judgment? [Clarity]
|
|
31
|
+
- [ ] CHK003 — Are acceptance criteria traceable to user-facing outcomes? [Traceability]
|
|
32
|
+
|
|
33
|
+
## Security
|
|
34
|
+
|
|
35
|
+
- [ ] CHK010 — Are authn/authz requirements specified for protected operations? [Coverage, Gap]
|
|
36
|
+
- [ ] CHK011 — Are secrets, credentials, and sensitive data handling defined? [Completeness]
|
|
37
|
+
- [ ] CHK012 — Are input validation and fail-secure defaults documented? [Security]
|
|
38
|
+
|
|
39
|
+
## Edge cases
|
|
40
|
+
|
|
41
|
+
- [ ] CHK020 — Are empty, null, and zero-state scenarios addressed? [Edge Case]
|
|
42
|
+
- [ ] CHK021 — Are error and partial-failure paths specified? [Exception Flow]
|
|
43
|
+
- [ ] CHK022 — Are rollback or recovery requirements defined when state mutates? [Recovery, Gap]
|
|
44
|
+
|
|
45
|
+
## Testability
|
|
46
|
+
|
|
47
|
+
- [ ] CHK030 — Is the project's test command identifiable for downstream tasks? [Testability]
|
|
48
|
+
- [ ] CHK031 — Are verifiable behaviors separated from implementation details? [Clarity]
|
|
49
|
+
- [ ] CHK032 — Can workers derive a Testing step from the requirements? [Completeness]
|
|
50
|
+
|
|
51
|
+
## Non-functional requirements
|
|
52
|
+
|
|
53
|
+
- [ ] CHK040 — Are performance or latency targets quantified (not "fast")? [NFR, Clarity]
|
|
54
|
+
- [ ] CHK041 — Are observability, logging, or operability needs specified? [NFR, Gap]
|
|
55
|
+
- [ ] CHK042 — Are compatibility, migration, or reversibility constraints documented? [NFR]
|
|
56
|
+
|
|
57
|
+
## Gaps and blockers
|
|
58
|
+
|
|
59
|
+
- (items marked `[Gap]` or unresolved from clarify.md — None if ready to slice)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## When to run
|
|
65
|
+
|
|
66
|
+
| Signal | Why checklist helps |
|
|
67
|
+
|--------|---------------------|
|
|
68
|
+
| After clarify with open assumptions | Surfaces requirement gaps before slicing |
|
|
69
|
+
| L/XL epic or multi-task decomposition | Catches missing NFRs and edge cases early |
|
|
70
|
+
| Security- or compliance-touching work | Forces explicit auth/data handling in requirements |
|
|
71
|
+
| Vague acceptance language ("robust", "fast") | Converts ambiguity into measurable criteria |
|
|
72
|
+
| Parallel wave planning | Ensures disjoint scopes are justified by clear requirements |
|
|
73
|
+
|
|
74
|
+
## When to skip
|
|
75
|
+
|
|
76
|
+
- Single S/M task with concrete File Scope and measurable acceptance criteria already
|
|
77
|
+
- Greenfield with a short, unambiguous brief and no security surface
|
|
78
|
+
- Migrating existing spine packets unchanged
|
|
79
|
+
- Step 0 explore not run and requirements are already validated elsewhere
|
|
80
|
+
|
|
81
|
+
## Authoring pipeline order
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
Step A (Read sources)
|
|
85
|
+
→ Step A.5 Clarify → {tasksRoot}/_authoring/{slug}/clarify.md
|
|
86
|
+
→ Step A.6 Checklist → {tasksRoot}/_authoring/{slug}/checklist.md
|
|
87
|
+
→ Step B (Slice into spine tasks)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Resolve or explicitly defer checklist gaps before Step B. Link the slug in `{tasksRoot}/CONTEXT.md` when checklist informs decomposition (same pattern as explore findings).
|
|
91
|
+
|
|
92
|
+
## External equivalent
|
|
93
|
+
|
|
94
|
+
- spec-kit: `/speckit.checklist` — [github/spec-kit](https://github.com/github/spec-kit) (`templates/commands/checklist.md`)
|
package/src/batch/abort.mjs
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import { loadSpineConfig } from "
|
|
7
|
+
import { loadSpineConfig } from "../config/spine-config-load.mjs";
|
|
8
8
|
import { archiveBatchStatePath } from "./lifecycle.mjs";
|
|
9
9
|
import { appendJournalEvent, journalPath, readJournalEvents, readJournalTail } from "./journal.mjs";
|
|
10
10
|
import { loadBatchStateFile } from "./reconcile.mjs";
|
|
11
11
|
import { appendBatchHistoryEntry } from "./state.mjs";
|
|
12
12
|
import { removeLaneWorktree } from "./worktree.mjs";
|
|
13
|
+
import { terminateLaneWorkers } from "./worker-host.mjs";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {string} projectRoot
|
|
@@ -79,17 +80,7 @@ function clearActiveBatchState(batchStatePath) {
|
|
|
79
80
|
* @param {boolean} hard
|
|
80
81
|
*/
|
|
81
82
|
function killLaneWorkers(lanes, hard) {
|
|
82
|
-
|
|
83
|
-
for (const lane of lanes ?? []) {
|
|
84
|
-
if (!lane || typeof lane !== "object") continue;
|
|
85
|
-
const pid = Number(/** @type {{ workerPid?: number }} */ (lane).workerPid);
|
|
86
|
-
if (!Number.isFinite(pid) || pid <= 0) continue;
|
|
87
|
-
try {
|
|
88
|
-
process.kill(pid, signal);
|
|
89
|
-
} catch {
|
|
90
|
-
// process may already be gone
|
|
91
|
-
}
|
|
92
|
-
}
|
|
83
|
+
terminateLaneWorkers(lanes, { hard });
|
|
93
84
|
}
|
|
94
85
|
|
|
95
86
|
/**
|
|
@@ -7,8 +7,22 @@ import path from "node:path";
|
|
|
7
7
|
import { appendJournalEvent } from "./journal.mjs";
|
|
8
8
|
import { resolvePiSpineRoot } from "../config/pi-spine-root.mjs";
|
|
9
9
|
import { readReviewLevel } from "./review.mjs";
|
|
10
|
+
import { writeWorkerDoneMarker, createWorkerLiveLogWriter } from "./worker-output.mjs";
|
|
10
11
|
import { buildWorkerTailPrompt } from "./worker-prompt.mjs";
|
|
11
12
|
|
|
13
|
+
const LIVE_LOG_FLUSH_INTERVAL_MS = 2_000;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} taskFolder
|
|
17
|
+
*/
|
|
18
|
+
function resolveTaskIdFromFolder(taskFolder) {
|
|
19
|
+
return (
|
|
20
|
+
process.env.SPINE_TASK_ID ||
|
|
21
|
+
path.basename(taskFolder).match(/^([A-Z]+-\d+)/)?.[1] ||
|
|
22
|
+
"unknown"
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
12
26
|
/**
|
|
13
27
|
* @param {object} params
|
|
14
28
|
* @param {string} params.worktreePath
|
|
@@ -74,11 +88,7 @@ export function createStubAgentSession({ worktreePath, taskFolder, fail = false
|
|
|
74
88
|
"utf-8",
|
|
75
89
|
);
|
|
76
90
|
}
|
|
77
|
-
|
|
78
|
-
donePath,
|
|
79
|
-
`Completed: ${new Date().toISOString()}\nTask: agent-session-stub\n`,
|
|
80
|
-
"utf-8",
|
|
81
|
-
);
|
|
91
|
+
writeWorkerDoneMarker(donePath, { taskId: resolveTaskIdFromFolder(taskFolder) });
|
|
82
92
|
streaming = false;
|
|
83
93
|
},
|
|
84
94
|
subscribe: () => () => {},
|
|
@@ -184,6 +194,31 @@ export function startAgentSessionWorker(
|
|
|
184
194
|
const piSpineRoot = resolvePiSpineRoot(config, projectRoot ?? process.cwd());
|
|
185
195
|
process.env.PI_SPINE_ROOT = piSpineRoot;
|
|
186
196
|
|
|
197
|
+
const liveLogWriter = createWorkerLiveLogWriter({
|
|
198
|
+
projectRoot: journal?.projectRoot ?? projectRoot,
|
|
199
|
+
batchId: journal?.batchId ?? process.env.SPINE_BATCH_ID,
|
|
200
|
+
laneNumber:
|
|
201
|
+
journal?.laneNumber ??
|
|
202
|
+
(process.env.SPINE_LANE_NUMBER ? Number(process.env.SPINE_LANE_NUMBER) : undefined),
|
|
203
|
+
taskId: journal?.taskId ?? process.env.SPINE_TASK_ID ?? resolveTaskIdFromFolder(taskFolder),
|
|
204
|
+
config,
|
|
205
|
+
});
|
|
206
|
+
let lastFlushedTranscriptLength = 0;
|
|
207
|
+
/** @type {ReturnType<typeof setInterval> | null} */
|
|
208
|
+
let liveLogFlushTimer = null;
|
|
209
|
+
|
|
210
|
+
const flushTranscriptToLiveLog = () => {
|
|
211
|
+
if (!liveLogWriter) return;
|
|
212
|
+
const delta = state.transcript.slice(lastFlushedTranscriptLength);
|
|
213
|
+
if (!delta) return;
|
|
214
|
+
liveLogWriter.append(delta);
|
|
215
|
+
lastFlushedTranscriptLength = state.transcript.length;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
if (liveLogWriter) {
|
|
219
|
+
liveLogFlushTimer = setInterval(flushTranscriptToLiveLog, LIVE_LOG_FLUSH_INTERVAL_MS);
|
|
220
|
+
}
|
|
221
|
+
|
|
187
222
|
const donePromise = (async () => {
|
|
188
223
|
try {
|
|
189
224
|
const createAgentSession = await loadCreateAgentSession(deps);
|
|
@@ -258,6 +293,11 @@ export function startAgentSessionWorker(
|
|
|
258
293
|
err instanceof Error ? err.message : String(err),
|
|
259
294
|
);
|
|
260
295
|
} finally {
|
|
296
|
+
if (liveLogFlushTimer) {
|
|
297
|
+
clearInterval(liveLogFlushTimer);
|
|
298
|
+
liveLogFlushTimer = null;
|
|
299
|
+
}
|
|
300
|
+
flushTranscriptToLiveLog();
|
|
261
301
|
state.session?.dispose?.();
|
|
262
302
|
state.session = null;
|
|
263
303
|
}
|