pi-spine 2.27.0 → 2.27.1

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 (38) hide show
  1. package/bin/spine-worker-runner.mjs +1 -0
  2. package/package.json +1 -1
  3. package/skills/create-spine-tasks/SKILL.md +60 -33
  4. package/skills/create-spine-tasks/references/authoring-evidence.md +58 -0
  5. package/skills/create-spine-tasks/references/contract-template.md +52 -7
  6. package/skills/create-spine-tasks/references/prompt-template.md +72 -8
  7. package/skills/spine-release-operator/SKILL.md +30 -51
  8. package/skills/spine-release-operator/references/issue-intake-checklist.md +3 -1
  9. package/skills/spine-release-operator/references/pi-async-orchestration.md +13 -9
  10. package/skills/spine-release-operator/references/post-integrate-regression-gate.md +8 -1
  11. package/skills/spine-release-operator/references/publish-recovery.md +62 -0
  12. package/src/batch/diagnosis-alternatives.mjs +16 -1
  13. package/src/batch/diagnosis-pending-lane.mjs +18 -0
  14. package/src/batch/diagnosis-review-infra.mjs +144 -0
  15. package/src/batch/diagnosis-suggested-command.mjs +9 -0
  16. package/src/batch/diagnosis.mjs +19 -20
  17. package/src/batch/engine-lanes/merge.mjs +0 -8
  18. package/src/batch/engine-lanes/review-poll.mjs +4 -1
  19. package/src/batch/engine-lanes.mjs +0 -1
  20. package/src/batch/gate-posture-approve.mjs +154 -15
  21. package/src/batch/integrate-path-delete.mjs +85 -0
  22. package/src/batch/integrate-worktree.mjs +20 -27
  23. package/src/batch/provider-quota.mjs +1 -1
  24. package/src/batch/reconcile-diagnosis.mjs +24 -77
  25. package/src/batch/review-artifacts.mjs +3 -2
  26. package/src/batch/review-level-effective.mjs +19 -0
  27. package/src/batch/review-spawn.mjs +12 -1
  28. package/src/batch/review-step-run.mjs +14 -2
  29. package/src/batch/reviewer-provider-error.mjs +153 -0
  30. package/src/batch/worker-prompt.mjs +5 -2
  31. package/src/config/cursor-rules/discover.mjs +38 -1
  32. package/src/config/settings-fields.mjs +5 -0
  33. package/src/config/spine-config-schema.mjs +38 -0
  34. package/src/doctor/pi-extension-hooks.mjs +322 -0
  35. package/src/doctor/run-doctor-checks.mjs +14 -1
  36. package/src/tasks/packet/validate-prompt.mjs +11 -1
  37. package/src/tasks/validate-contract-warn.mjs +16 -0
  38. package/templates/spine-config.json +1 -1
@@ -126,6 +126,7 @@ export async function buildWorkerPiArgs({
126
126
  taskIdHint: taskIdFromFolder(taskFolder),
127
127
  reviewLevel: readReviewLevel(taskFolder),
128
128
  includePromptInclude: false,
129
+ includeAgentInclude: false,
129
130
  config: spineConfig,
130
131
  projectRoot,
131
132
  taskFileScope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-spine",
3
- "version": "2.27.0",
3
+ "version": "2.27.1",
4
4
  "description": "Orchestration spine for long-running pi development",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: create-spine-tasks
3
- version: 1.1.0
3
+ version: 1.2.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
 
@@ -195,17 +195,10 @@ Run **after Step A.5 — Clarify** and **before Step B — Slice**. Authoring-on
195
195
  | **Scope** | One deliverable per task; disjoint **File Scope** when tasks can run in parallel. |
196
196
  | **IDs** | Use `Next Task ID` from CONTEXT.md; increment after each new task. Greenfield spine projects typically use `SP-###`; Taskplane migrants may keep `TP-###`. |
197
197
  | **Waves** | Order via `## Dependencies` and `{tasksRoot}/dependencies.json`. |
198
- | **Review** | Score complexity (below). Do not default to Level 0 for implementation work. |
198
+ | **Type** | Pick `execute` / matrix / `llm` per [Step 2a](#step-2a-choose-task-type) before writing steps. Deterministic work never needs an LLM worker. |
199
+ | **Review** | Score complexity (below). Level 1 is the code default; Level 0 for execute and docs-only; Level 2 only for security, data-model, or hot shared modules. |
199
200
 
200
- **Two-deliverable split evidence (Phase 55):** Every superseded composite task split into exactly two children because it bundled independent deliverables:
201
-
202
- | Superseded | Split into |
203
- |------------|------------|
204
- | SP-419 | SP-466, SP-467 |
205
- | SP-428 | SP-468, SP-469 |
206
- | SP-430 | SP-470, SP-471 |
207
- | SP-436 | SP-474, SP-475 |
208
- | SP-461 | SP-478, SP-479 |
201
+ Split evidence (Phase 55: five composite tasks, each split into exactly two children) lives in [references/authoring-evidence.md](references/authoring-evidence.md#two-deliverable-split-phase-55).
209
202
 
210
203
  ### Step C.5: Analyze (optional — LLM structural review after slice)
211
204
 
@@ -285,10 +278,29 @@ If `CONTEXT.md` is missing (pre-init legacy repo), ask the user to run `spine in
285
278
  Quick reference (full rubric in [Complexity Assessment](#complexity-assessment)):
286
279
 
287
280
  - Score each dimension 0–2: Blast radius, Pattern novelty, Security, Reversibility
288
- - Sum → Level: 0–1→L0, 2–3→L1, 4–5→L2, 6–8→L3
281
+ - Sum → Level: 0–1→L0, 2–5→L1, 6–8→L2; **Security = 2 or Reversibility = 2 → L2** regardless of sum
289
282
  - Size: S (<2h), M (2–4h), L (4–8h), XL (8h+ → must split)
290
283
 
291
- **Do not default to Review Level 0.** Level 0 is only for trivial changes (doc typo, config knob). Most M-sized tasks score ≥2 and need at least Level 1.
284
+ **Code tasks default to Level 1** (plan + final review). Level 0 is for `Type: execute` tasks, docs-only tasks, and trivial config knobs. Level 2 adds a code review spawn per task — reserve it for security, data-model, or hot shared-module changes ([evidence](references/authoring-evidence.md#review-level-recalibration-token-cost-audit-oct-2026)).
285
+
286
+ ### Step 2a: Choose task type
287
+
288
+ Every LLM worker turn costs tokens; a shell command does not. Decide the task type **before** writing steps:
289
+
290
+ | Work | Type | Why |
291
+ |------|------|-----|
292
+ | Deterministic script with a known command (generator, smoke run, evidence collection, deploy, mechanical validation) | `**Type:** execute` | Engine runs Contract `runCommand` in the lane worktree; no LLM worker, no turns spent waiting on output |
293
+ | Same command across N targets (regions, fixtures, models, files) | `**Type:** execute` + `## Matrix` | One packet fans out into rows; `matrixMaxParallel` throttles; failed rows retry alone (`spine batch retry 'SP-X[rowId]'`) |
294
+ | Design, refactor, judgment across files, writing tests | `**Type:** llm` (default) | Needs reasoning and STATUS checkpointing |
295
+ | Script needs to be **written** and then **run** for a long time | Split: `llm` task authors the script → `execute` task (dep edge) runs it | The LLM never supervises a long-running command (the background-and-exit failure in [#276](https://github.com/beettlle/pi-spine/issues/276)) |
296
+
297
+ Execute-task rules:
298
+
299
+ - Set **Review Level 0** — nothing for a reviewer to judge. Until [#336](https://github.com/beettlle/pi-spine/issues/336) lands, Level ≥ 1 still spawns plan and final reviewers on execute tasks.
300
+ - Provide `runCommand` **and** a cheap `testCommand` proof (`test -f out/report.json`). Without `runCommand`, the engine runs `testCommand` as the job and again at contract verify — the expensive command runs twice.
301
+ - Required sections and a `### Step N: Testing & Verification` step are still validated; keep steps short (the engine does not execute them).
302
+ - Contract commands refuse `$`, backticks, `;`, `|`, `||`, and lone `&`; wrap complex logic in a script (`sh scripts/run-row.sh`).
303
+ - Syntax and row semantics: [operator-runbook §2.4–2.5](../../docs/adoption/operator-runbook.md#24-matrix-tasks-parametric-sub-lanes); template: [prompt-template.md](references/prompt-template.md#execute-task-variant).
292
304
 
293
305
  ### Step 3: Create task folder
294
306
 
@@ -307,8 +319,8 @@ Use [references/prompt-template.md](references/prompt-template.md). Spine-specif
307
319
  - **Environment** — include `npm run typecheck && SPINE_WORKER_STUB=1 npm test` when that is the project test command
308
320
  - **Git Commit Convention** — `feat(SP-###): …` at step boundaries
309
321
  - **Worker tools** — when Review Level > 0, steps must note `spine_review_step` after each step
310
- - **Testing step (required for all tasks)** — every packet MUST include `### Step N: Testing & Verification` inside `## Steps`, placed **before** `## Completion Criteria`. This applies to **docs-only Review Level 0 tasks** as well — omitting the step causes `prompt_parse_failed` at batch launch (SP-075). Docs-only tasks still run the full test suite; they may omit lint and coverage-gate checkboxes when no application code changes. **Code tasks:** Contract `testCommand` must prefix project lint/analyze (`npm run lint &&` for pi-spine).
311
- - **Coverage gate** — when the task changes application code, add a coverage verification checkbox in the Testing step using `testing.testWithCoverage` (≥77% line coverage policy)
322
+ - **Testing step (required for all tasks)** — every packet MUST include `### Step N: Testing & Verification` inside `## Steps`, placed **before** `## Completion Criteria`. This applies to **docs-only Review Level 0 tasks** as well — omitting the step causes `prompt_parse_failed` at batch launch (SP-075). Docs-only tasks run **scoped** tests: `rg -l '<changed doc path or anchor>' tests/` and run only the hits (none → note "no tests reference this doc"); post-integrate `release:check` owns the full suite. Use `--test-reporter=dot` on `node --test` commands so passing tests do not flood the worker context. **Code tasks:** Contract `testCommand` must prefix project lint/analyze (`npm run lint &&` for pi-spine).
323
+ - **Coverage gate** — when a **Size L** task changes application code (or the Contract sets `minLineCoverage`), add a coverage verification checkbox in the Testing step using `testing.testWithCoverage` (≥77% line coverage policy). S/M tasks rely on post-integrate `release:check` for coverage.
312
324
  - **Contract (required for new SP-\* tasks)** — add `## Contract` after `## File Scope` using [references/contract-template.md](references/contract-template.md). Include `testCommand` for code tasks; use `` `true` `` for docs-only S tasks. When `testCommand` is `` `true` `` (docs-only), **always** include `fileScopeMustChange` listing at least one documentation deliverable path — without it, workers can pass contract by creating only `.DONE` (SP-214 batch `20260612T204048`, SP-457 batch `20260703T022335`). When using `fileScopeMustNotChange`, follow parallel-only semantics and never ban `spine-tasks/**` (see contract template and [File Scope and parallel batches](#file-scope-and-parallel-batches)). Legacy `TP-*` packets may omit Contract when `contract.legacyTaskIdPrefixes` includes `TP-`.
313
325
  - **Completion** — worker creates `{task-folder}/.DONE`; batch engine may auto-commit remaining work
314
326
  - **Documentation Requirements ↔ File Scope ([#144](https://github.com/beettlle/pi-spine/issues/144))** — every path under **Must Update** in `## Documentation Requirements` **must** also appear in `## File Scope`. Advisory docs belong in **Check If Affected**, not Must Update. Example: if Must Update lists `docs/adoption/operator-runbook.md`, add that path to File Scope alongside code paths — otherwise workers must choose between scope and documentation obligations (SP-435, SP-451).
@@ -343,12 +355,12 @@ In pi: `/spine-plan pending` then `/spine SP-042` (single-task) or `spine batch
343
355
 
344
356
  ### Review Levels
345
357
 
346
- | Level | Label | Spine behavior |
347
- |-------|-------|----------------|
348
- | 0 | None | No `spine_review_step` |
349
- | 1 | Plan Only | Plan review before each step (or checkpoint marker) |
350
- | 2 | Plan + Code | Plan + code review at step boundaries |
351
- | 3 | Full | Plan + code + test review |
358
+ | Level | Label | Engine reviews after `.DONE` (real pi) | Use for |
359
+ |-------|-------|----------------------------------------|---------|
360
+ | 0 | None | None | `Type: execute`, docs-only, trivial config |
361
+ | 1 | Plan Only | Plan + final | **Default for code tasks** |
362
+ | 2 | Plan + Code | Plan + code + final | Security, data-model / migration, hot shared modules (`engine*.mjs`, `parse-prompt.mjs`, reconcile, worktree) |
363
+ | 3 | Full | Same as Level 2 (`isReviewTypeRequired` treats 3 like 2) | Do not assign — no extra review type exists |
352
364
 
353
365
  **Environment compatibility ([#150](https://github.com/beettlle/pi-spine/issues/150)):** Review Level **2+** requires cross-model reviewer support in the execution environment. If running `SPINE_WORKER_STUB=1`, reviews are simulated — do not assign Level 2+ for tasks that need real cross-model review unless the operator has verified environment capability (preflight / batch config). Level 2+ in an unsupported environment can stall or kill lanes (e.g. SP-190 review spawn failure).
354
366
 
@@ -365,7 +377,7 @@ When Review Level ≥ 1 (v1.3), workers also run a **final** review (`--type fin
365
377
  | **Security** | No auth/data | Touches auth | Modifies auth/encryption |
366
378
  | **Reversibility** | Easy revert | Needs migration | Data model change |
367
379
 
368
- Score 0–1 → Level 0 · 2–3 → Level 1 · 4–5 → Level 2 · 6–8 → Level 3
380
+ Score 0–1 → Level 0 · 2–5 → Level 1 · 6–8 → Level 2 · Security = 2 or Reversibility = 2 → Level 2. `Type: execute` → Level 0 regardless of score.
369
381
 
370
382
  ### Per-step override and checkpoint markers
371
383
 
@@ -390,14 +402,7 @@ Individual steps can override the task-level review:
390
402
  | **XL** | 8+ hours | **Must split** — never ship a single PROMPT with Size XL (validator rejects) |
391
403
  | **L** | 4–8 hours | **Prefer split** into 2–3 M tasks; if kept, set Size L and expect longer stall budget (SP-088) |
392
404
 
393
- **Rule of thumb:** More than **4** implementation steps → split. More than **8** file-scope paths → narrow or split.
394
-
395
- **Example (incident-driven):** Eight Phase-13 tasks in one batch (`SP-064`…`SP-085`) caused parallel pi stalls. Prefer:
396
-
397
- | Instead of | Use |
398
- |------------|-----|
399
- | One batch with 8 M tasks | Wave A: 4 tasks → land → Wave B: 4 tasks |
400
- | One L task “refactor engine + resume + tests” | SP-074 engine scope, SP-076 resume DRY, SP-078 tests (deps) |
405
+ **Rule of thumb:** More than **4** implementation steps → split. More than **8** file-scope paths → narrow or split. Prefer waves of ≤4 M tasks; 8-task waves stalled pi workers ([evidence](references/authoring-evidence.md#mega-wave-stalls-phase-13--phase-15)).
401
406
 
402
407
  ---
403
408
 
@@ -518,7 +523,24 @@ Never ban `spine-tasks/**` — workers must update `STATUS.md` and create `.DONE
518
523
  | Review Level 0, Size S, no code deliverable | Size S/M patch with an existing targeted test |
519
524
  | Contract proof is doc mtime, not test output | Contract must prove code behavior |
520
525
 
521
- Docs-only tasks still include `### Step N: Testing & Verification` (full suite in the Testing step) — Contract `` `true` `` only means final verify does not re-run tests. See [contract-template decision table](references/contract-template.md#docs-only-vs-scoped-node---test).
526
+ Docs-only tasks still include `### Step N: Testing & Verification` — run the tests that reference the changed docs (`rg -l '<doc path>' tests/`), not the full suite; post-integrate `release:check` covers the rest. Contract `` `true` `` only means final verify does not re-run tests. See [contract-template decision table](references/contract-template.md#docs-only-vs-scoped-node---test).
527
+
528
+ ---
529
+
530
+ ## Cost-aware authoring
531
+
532
+ Packet shape decides most of a batch's token spend. Each choice below removes LLM turns or reviewer spawns without weakening the merge gate (post-integrate `release:check` still runs the full suite and coverage on `main`).
533
+
534
+ | Lever | Cheaper choice | Cost avoided |
535
+ |-------|----------------|--------------|
536
+ | Task type | `Type: execute` (+ `## Matrix`) for deterministic commands ([Step 2a](#step-2a-choose-task-type)) | Entire LLM worker session; worker turns spent waiting on long command output |
537
+ | Review Level | 1 for code, 0 for execute/docs ([Review Levels](#review-levels)) | Code-review spawn per task (Level 2); plan + final spawns (Level 0) |
538
+ | Testing step | Scoped `node --test --test-reporter=dot <files>`; docs-only runs only `rg -l` hits | Full-suite runs per task; passing-test output in worker context |
539
+ | File Scope | Concrete paths, not directories | Glob-matched rule packs injected on every worker turn |
540
+ | Context to Read First | Only docs the task needs | Re-reading large docs each iteration |
541
+ | Size | S/M with ≤4 steps | Iteration count; stall retries |
542
+
543
+ **Measure before and after:** `spine metrics show --batch <id>` (or `--last 5`, `--json`) reports outcome, duration, and attempts per task. Token and cost columns stay empty until [#338](https://github.com/beettlle/pi-spine/issues/338) populates them — compare duration and retry counts until then. Background data: [references/authoring-evidence.md](references/authoring-evidence.md).
522
544
 
523
545
  ---
524
546
 
@@ -545,7 +567,10 @@ Before reporting launch commands:
545
567
  - [ ] Authoring mode chosen (lean default; full when ambiguity, L/XL epic, or security surface)
546
568
  - [ ] `Next Task ID` read from CONTEXT.md and incremented
547
569
  - [ ] Folder at `{tasksRoot}/{PREFIX-###-slug}/`
548
- - [ ] Complexity scored; review level assigned (0–3)
570
+ - [ ] Complexity scored; review level assigned (0–2; Level 1 for code unless security/data-model/hot module)
571
+ - [ ] Task type chosen ([Step 2a](#step-2a-choose-task-type)): deterministic commands are `Type: execute` (+ `## Matrix` for N targets), not LLM steps
572
+ - [ ] `Type: execute` tasks: Review Level 0, `runCommand` set, cheap `testCommand` proof (no double run of the job)
573
+ - [ ] No LLM step waits on a long-running command — split authoring (`llm`) from running (`execute`) ([#276](https://github.com/beettlle/pi-spine/issues/276))
549
574
  - [ ] Size S/M/L — split if XL
550
575
  - [ ] PROMPT.md from template: Mission, Dependencies, Context, File Scope, Contract (SP-\*), Steps, Do NOT, Git Commit Convention, Amendments
551
576
  - [ ] Mission uses `Closes #N` or `Partial #N` on first line when tracking GitHub issues ([#147](https://github.com/beettlle/pi-spine/issues/147))
@@ -562,6 +587,7 @@ Before reporting launch commands:
562
587
  - [ ] When parallelism is intended: `spine plan` shows `N lanes in parallel` for that wave — or document why overlapping scopes / real deps forced serial collapse ([#193](https://github.com/beettlle/pi-spine/issues/193))
563
588
  - [ ] No false deps: edges only for real data dependencies; preference-order edges that force size-1 waves are rejected ([#193](https://github.com/beettlle/pi-spine/issues/193))
564
589
  - [ ] `### Step N: Testing & Verification` present inside `## Steps` before `## Completion Criteria` (required even for docs-only Review Level 0)
590
+ - [ ] Testing step is scoped: `node --test --test-reporter=dot <files>` for code; `rg -l` hits only for docs-only — no full-suite run in S/M packets
565
591
  - [ ] STATUS.md with matching steps (hydration markers where needed)
566
592
  - [ ] `dependencies.json` updated when task has deps
567
593
  - [ ] CONTEXT.md phase table updated for PRD decompositions
@@ -590,7 +616,7 @@ Hydration commits (STATUS.md expansions) may happen mid-step for crash recovery.
590
616
  - **Lint in code-task contracts** — prefix `testCommand` with project lint/analyze (`npm run lint &&` for pi-spine). Contract verify runs the authored command in-lane; without lint, ESLint failures surface only at operator post-integrate `release:check` (post-mortem v2.15.0 F-C). Docs-only (`testCommand: true`) stays exempt.
591
617
  - **Scoped contract ≠ full regression** — changing shared modules (diagnosis, reconcile, parse-prompt) can break tests outside the task's scoped `testCommand`. Authors must `rg` old strings in `tests/` and include related test files in Contract, or rely on operator post-integrate `release:check` on `main` ([post-integrate-regression-gate.md](../spine-release-operator/references/post-integrate-regression-gate.md)).
592
618
  - **S/M patch tasks: no coverage gate in Contract** — do not chain `npm run coverage:check` or bare `npm test` in `## Contract` `testCommand` on Size S/M tasks; integrate gate owns full coverage at merge. Use scoped `node --test path/to.test.mjs` (SP-521 / [#141](https://github.com/beettlle/pi-spine/issues/141)). `spine tasks validate` warns when violated.
593
- - **Testing step required (never omit)** — every task packet needs `### Step N: Testing & Verification` inside `## Steps`, before `## Completion Criteria`. **Do not skip this for docs-only or Review Level 0 tasks** — the worker rejects packets without a Testing step. Use `testing.test` from spine config; for **code deliverables**, also include `testing.testWithCoverage` and a **≥77% line coverage** checkbox (see prompt template). Docs-only tasks may omit the coverage checkbox.
619
+ - **Testing step required (never omit)** — every task packet needs `### Step N: Testing & Verification` inside `## Steps`, before `## Completion Criteria`. **Do not skip this for docs-only or Review Level 0 tasks** — the worker rejects packets without a Testing step. The step runs the Contract `testCommand` (scoped); for **Size L code deliverables**, also include `testing.testWithCoverage` and a **≥77% line coverage** checkbox (see prompt template). Docs-only and S/M tasks omit the coverage checkbox — post-integrate `release:check` runs the full suite and coverage once per wave.
594
620
  - **Documentation in every task** — "Must Update" / "Check If Affected" prevent doc drift.
595
621
  - **Concrete deliverables** — name files to create/modify; avoid shortcuttable vague steps.
596
622
  - **False deps defeat parallelism** — edge only when B needs A's output; independent work gets disjoint File Scope and no edge. Verify intended parallel waves with `spine plan` (`N lanes in parallel`) before handoff ([#193](https://github.com/beettlle/pi-spine/issues/193)).
@@ -606,6 +632,7 @@ Hydration commits (STATUS.md expansions) may happen mid-step for crash recovery.
606
632
  - [references/clarify-template.md](references/clarify-template.md) — Step A.5 `clarify.md` schema (spec-kit `/speckit.clarify` equivalent)
607
633
  - [references/requirements-checklist-template.md](references/requirements-checklist-template.md) — Step A.6 `checklist.md` schema (spec-kit `/speckit.checklist` equivalent)
608
634
  - [references/context-template.md](references/context-template.md) — `{tasksRoot}/CONTEXT.md` scaffold
635
+ - [references/authoring-evidence.md](references/authoring-evidence.md) — incident and measurement data behind sizing, review-level, and testing rules
609
636
  - [docs/PRD.md](../../docs/PRD.md) — task format spec (§13)
610
637
  - [docs/adoption/bootstrap-checklist.md](../../docs/adoption/bootstrap-checklist.md) — greenfield setup
611
638
  - [docs/adoption/operator-runbook.md](../../docs/adoption/operator-runbook.md) — execution policy
@@ -0,0 +1,58 @@
1
+ # Authoring evidence (create-spine-tasks)
2
+
3
+ Incident and measurement data behind the rules in [SKILL.md](../SKILL.md). Read this when a rule seems arbitrary or an operator asks "why"; authors applying the rules do not need it.
4
+
5
+ ---
6
+
7
+ ## Two-deliverable split (Phase 55)
8
+
9
+ Every superseded composite task split into exactly two children because it bundled independent deliverables:
10
+
11
+ | Superseded | Split into |
12
+ |------------|------------|
13
+ | SP-419 | SP-466, SP-467 |
14
+ | SP-428 | SP-468, SP-469 |
15
+ | SP-430 | SP-470, SP-471 |
16
+ | SP-436 | SP-474, SP-475 |
17
+ | SP-461 | SP-478, SP-479 |
18
+
19
+ ## Mega-wave stalls (Phase 13 / Phase 15)
20
+
21
+ Eight Phase-13 tasks in one batch (`SP-064`…`SP-085`) caused parallel pi stalls; 8-task waves stalled again in Phase 15 (SP-086–088). Prefer:
22
+
23
+ | Instead of | Use |
24
+ |------------|-----|
25
+ | One batch with 8 M tasks | Wave A: 4 tasks → land → Wave B: 4 tasks |
26
+ | One L task "refactor engine + resume + tests" | SP-074 engine scope, SP-076 resume DRY, SP-078 tests (deps) |
27
+
28
+ ## Review Level recalibration (token-cost audit, Oct 2026)
29
+
30
+ Measured on this repository (`main` @ `c6891504`, v2.27.0) — basis for "Level 1 is the code default" ([#326](https://github.com/beettlle/pi-spine/issues/326), [#342](https://github.com/beettlle/pi-spine/issues/342)):
31
+
32
+ | Measure | Value |
33
+ |---------|-------|
34
+ | Engine reviews started, Sep–Oct 2026 | 114 plan · 44 code · 66 final |
35
+ | Journaled verdicts (all retained lane journals) | 140 APPROVE · 96 PASS · **0 REVISE** |
36
+ | `.reviews/` artifacts ever written that say REVISE | 8 of 844 (newest SP-474, 2026-07-05) |
37
+ | Tasks failed by reviewer infrastructure, Sep–Oct | 12 (timeouts, malformed function calls, 400s) |
38
+ | Wall time, failed vs completed attempts | 15.1 h vs 19.9 h |
39
+
40
+ Each review level adds reviewer spawns per task (Level 1: plan + final; Level 2+: plan + code + final). With approval near 100%, the extra spawns cost tokens and add failure surface without catching defects. Level 2 remains right for security, data-model, and hot shared-module changes, where a single missed defect is expensive.
41
+
42
+ ## Execute and matrix adoption
43
+
44
+ As of v2.27.0, **0** real `Type: execute` or `## Matrix` packets had shipped on this repository — every deterministic step (generators, smoke runs, evidence collection) ran inside an LLM worker. Execute and matrix tasks run the Contract command with no LLM worker; see [Step 2a](../SKILL.md#step-2a-choose-task-type).
45
+
46
+ ## Full-suite cost
47
+
48
+ | Measure | Value |
49
+ |---------|-------|
50
+ | Full suite size | 2,877 tests |
51
+ | Coverage run (`coverage-run.tap.log`) | ~176 s |
52
+ | Gate evidence `test-output.txt` | 243 KB |
53
+
54
+ Post-integrate `npm run release:check` already runs the full suite on `main` after every wave. A docs-only or S/M packet that reruns the full suite in its Testing step pays this cost a second time per task ([#341](https://github.com/beettlle/pi-spine/issues/341)).
55
+
56
+ ## Usage fields
57
+
58
+ `spine metrics show` has token and cost columns from [#208](https://github.com/beettlle/pi-spine/issues/208), but 0 of 500 records carry usage until [#338](https://github.com/beettlle/pi-spine/issues/338) lands (workers and reviewers run pi in text mode). Use duration, attempt count, and failure class as cost proxies until then.
@@ -15,7 +15,7 @@ Normative schema: [PRD v2.0 implementation handoff §4](../../docs/PRD-v2.0-impl
15
15
 
16
16
  | Field | Value |
17
17
  |-------|-------|
18
- | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/batch/final-verdict.test.mjs` |
18
+ | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test --test-reporter=dot tests/batch/final-verdict.test.mjs` |
19
19
  | fileScopeMustChange | `src/batch/review.mjs`, `bin/spine-tasks.mjs` |
20
20
  | fileScopeMustNotChange | `src/planner/**` |
21
21
  | minLineCoverage | 77 |
@@ -39,10 +39,12 @@ Avoid `` `bin/a.mjs,bin/b.mjs` `` — `tasks validate` warns (or errors in requi
39
39
  | `testCommand` | **Required** for code tasks (Review Level ≥ 1, Size M/L, or implementation steps) | Shell command in backticks; max 500 chars; no newlines. **Code tasks:** prefix with project lint/analyze (`npm run lint &&` for pi-spine; `flutter analyze` scoped for Flutter). Contract verify executes this command at final review — lint runs in-lane when authored here. Post-integrate `release:check` remains the whole-repo backstop (full suite + coverage). Use `` `true` `` for docs-only S tasks with no code changes. When `` `true` ``, **always** pair with `fileScopeMustChange` (see below). |
40
40
  | `fileScopeMustChange` | When you need proof specific paths were touched; **required** when `testCommand` is `` `true` `` | Comma-separated paths/globs relative to repo root; **one backtick per path** (not `` `a.mjs,b.mjs` ``). Trailing `/` means directory prefix match (e.g. `src/domain/types/` matches any file under that directory). For docs-only tasks, list at least one documentation deliverable path — without it, workers can pass contract by creating only `.DONE` (SP-214 batch `20260612T204048`, SP-457 batch `20260703T022335`). |
41
41
  | `fileScopeMustNotChange` | When **parallel lanes** must not collide on product paths (see semantics below) | Comma-separated paths/globs relative to repo root; **one backtick per path** |
42
- | `minLineCoverage` | When task changes application code | Integer 0–100 (pi-spine policy: **77**) |
42
+ | `minLineCoverage` | Size L tasks that change application code (S/M rely on post-integrate `release:check` coverage) | Integer 0–100 (pi-spine policy: **77**) |
43
43
  | `artifactsMustExist` | When deliverables must exist on disk | Comma-separated file paths; **one backtick per path** |
44
44
  | `stallTimeoutMinutes` | Long external jobs (operator matrix, CI arms) exceeding global/size stall budget | Positive integer minutes; engine uses `max(global, size floor, contract)` |
45
45
  | `extendGraceOnFileScope` | STATUS-only progress during long external work | `true` or `false`; when `true`, file-scope mtime extends stall grace for this task |
46
+ | `runCommand` | `Type: execute` tasks — the job the engine runs instead of an LLM worker | Shell command in backticks; same 500-char and metacharacter rules as `testCommand` (no `$`, backticks, `;`, `\|`, `\|\|`, lone `&`; `&&` allowed). Wrap complex logic in a script. When absent, execute tasks fall back to `testCommand`, which then runs **twice** (as the job and again at contract verify). |
47
+ | `matrixMaxParallel` | `## Matrix` tasks that must not take every lane | Positive integer; effective row concurrency is `min(matrixMaxParallel, lanes.maxParallel)` |
46
48
 
47
49
  Unknown field names produce **warnings** at validate time (not errors). Duplicate rows are errors.
48
50
 
@@ -101,17 +103,17 @@ Symptom in journal: `testCommand` passes but `fileScopeMustNotChange` fails with
101
103
 
102
104
  | Field | Value |
103
105
  |-------|-------|
104
- | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/tasks/validate-cli.test.mjs` |
106
+ | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test --test-reporter=dot tests/tasks/validate-cli.test.mjs` |
105
107
  ```
106
108
 
107
- ### M task with coverage gate
109
+ ### L task with coverage gate
108
110
 
109
111
  ```markdown
110
112
  ## Contract
111
113
 
112
114
  | Field | Value |
113
115
  |-------|-------|
114
- | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/tasks/validate-prompt.test.mjs` |
116
+ | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test --test-reporter=dot tests/tasks/validate-prompt.test.mjs` |
115
117
  | fileScopeMustChange | `src/tasks/packet/validate-prompt.mjs` |
116
118
  | minLineCoverage | 77 |
117
119
  ```
@@ -162,7 +164,7 @@ Use docs-only when the worker's only product deliverable is documentation. Use s
162
164
 
163
165
  | Field | Value |
164
166
  |-------|-------|
165
- | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/batch/final-verdict.test.mjs` |
167
+ | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test --test-reporter=dot tests/batch/final-verdict.test.mjs` |
166
168
  | fileScopeMustChange | `src/batch/review.mjs` |
167
169
  | fileScopeMustNotChange | `src/planner/**`, `src/batch/journal.mjs` |
168
170
  | artifactsMustExist | `tests/batch/final-verdict.test.mjs` |
@@ -177,7 +179,7 @@ Use when a task runs a multi-hour external matrix or CI arm with little in-repo
177
179
 
178
180
  | Field | Value |
179
181
  |-------|-------|
180
- | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/batch/status-classification-align.test.mjs` |
182
+ | testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test --test-reporter=dot tests/batch/status-classification-align.test.mjs` |
181
183
  | stallTimeoutMinutes | 240 |
182
184
  | extendGraceOnFileScope | true |
183
185
  | fileScopeMustChange | `spine-tasks/SP-029-*/STATUS.md` |
@@ -185,6 +187,48 @@ Use when a task runs a multi-hour external matrix or CI arm with little in-repo
185
187
 
186
188
  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.
187
189
 
190
+ When the long job is a **known command**, prefer an execute task (below) — an LLM worker supervising a multi-hour command burns turns waiting for output and can background the command and exit without `.DONE` ([#276](https://github.com/beettlle/pi-spine/issues/276)).
191
+
192
+ ### Execute task (no LLM worker)
193
+
194
+ `**Type:** execute` in the PROMPT header; Review Level 0. The engine runs `runCommand`; `testCommand` is a cheap proof re-run at contract verify.
195
+
196
+ ```markdown
197
+ ## Contract
198
+
199
+ | Field | Value |
200
+ |-------|-------|
201
+ | runCommand | `sh scripts/collect-evidence.sh` |
202
+ | testCommand | `test -f out/evidence.json` |
203
+ | fileScopeMustChange | `out/evidence.json` |
204
+ ```
205
+
206
+ **Anti-pattern:** only `testCommand` set to the expensive job (`` `sh scripts/collect-evidence.sh` ``) — the engine runs it as the job **and** again at verify.
207
+
208
+ ### Execute matrix task
209
+
210
+ Add a `## Matrix` table to the PROMPT; `{matrix.<column>}` placeholders are substituted per row. Write row-distinct outputs so row branches merge cleanly. `matrixMaxParallel` caps concurrent rows (`min(matrixMaxParallel, lanes.maxParallel)`).
211
+
212
+ ```markdown
213
+ ## Matrix
214
+
215
+ | run_id | target |
216
+ |--------|--------|
217
+ | east | us-east-1 |
218
+ | west | us-west-2 |
219
+
220
+ ## Contract
221
+
222
+ | Field | Value |
223
+ |-------|-------|
224
+ | runCommand | `sh scripts/smoke.sh {matrix.target} out/{matrix.run_id}.json` |
225
+ | testCommand | `test -f out/{matrix.run_id}.json` |
226
+ | fileScopeMustChange | `out/{matrix.run_id}.json` |
227
+ | matrixMaxParallel | 2 |
228
+ ```
229
+
230
+ Rows also receive `SPINE_MATRIX_TASK_INDEX` (and Slurm/Kubernetes aliases); contract commands refuse `$`, so read them inside the script. Retry one failed row with `spine batch retry 'SP-X[rowId]'`. Full row semantics: [operator-runbook §2.4](../../../docs/adoption/operator-runbook.md#24-matrix-tasks-parametric-sub-lanes).
231
+
188
232
  ---
189
233
 
190
234
  ## Cross-model authoring (worker ≠ reviewer)
@@ -222,6 +266,7 @@ Reviewers spawn as **fresh sessions** with no memory of the worker session (FR-R
222
266
  | Task type | Recommended `testCommand` |
223
267
  |-----------|---------------------------|
224
268
  | Docs-only, no code changes | `` `true` `` **and** `fileScopeMustChange` with at least one deliverable doc path |
269
+ | `Type: execute` (deterministic job) | `runCommand` = the job; `testCommand` = cheap artifact proof (`` `test -f out/x.json` ``) |
225
270
  | Single module, targeted tests exist (Size S/M) | `` `npm run lint && npm run typecheck && node --test tests/feature.test.mjs` `` or `` `flutter analyze && flutter test test/unit/services/foo_test.dart` `` |
226
271
  | **Shared-module behavior change** (diagnosis, reconcile, parse-prompt, worktree, doctor) | `` `npm run lint &&` `` then chain **all** related `tests/**/*.test.mjs` from `rg` for old strings — not only the new test file (see below) |
227
272
  | Full-suite safe in lane worktree (Size L) | `` `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 npm test` `` |
@@ -2,8 +2,9 @@
2
2
 
3
3
  Copy this template when creating a new task. Replace all `[bracketed]` fields.
4
4
 
5
- **Before creating:** Verify you have scored complexity and assigned Review Level.
6
- Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
5
+ **Before creating:** Verify you have chosen the task type (SKILL Step 2a), scored complexity, and assigned Review Level.
6
+ Code tasks default to Level 1; Level 0 is for `Type: execute`, docs-only, and trivial config; Level 2 only for security, data-model, or hot shared modules.
7
+ Deterministic commands use the [execute-task variant](#execute-task-variant) instead of this LLM template.
7
8
 
8
9
  ---
9
10
 
@@ -12,8 +13,9 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
12
13
 
13
14
  **Created:** [YYYY-MM-DD]
14
15
  **Size:** [S | M | L]
16
+ **Type:** [llm | execute]
15
17
 
16
- ## Review Level: [0-3] ([None | Plan Only | Plan and Code | Full])
18
+ ## Review Level: [0-2] ([None | Plan Only | Plan and Code])
17
19
 
18
20
  **Risk:** [1-2 sentences: severity/blast radius — what breaks and how far the change reaches]
19
21
  **Score:** [N]/8 — Blast radius: [N], Pattern novelty: [N], Security: [N], Reversibility: [N]
@@ -76,6 +78,7 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
76
78
  | Field | Value |
77
79
  |-------|-------|
78
80
  | testCommand | `[shell command in backticks, or \`true\` for docs-only S tasks]` |
81
+ | runCommand | `[execute tasks only: the job command; testCommand then proves the result]` |
79
82
  | fileScopeMustChange | `[optional: comma-separated paths/globs that must change]` |
80
83
  | fileScopeMustNotChange | `[optional: comma-separated paths/globs that must not change]` |
81
84
  | minLineCoverage | `[optional: integer 0–100; use 77 for code tasks]` |
@@ -117,11 +120,13 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
117
120
  > Operator post-integrate `npm run release:check` owns the whole-repo gate (typecheck → lint → full tests → coverage).
118
121
  >
119
122
  > **Code tasks** (File Scope touches `src/`, `bin/`, `tests/`, or `scripts/`): include `npm run lint` in Contract `testCommand` and mirror it here.
120
- > **Docs-only tasks:** keep this step; run the full test suite from project config. Omit lint and coverage checkboxes when no application code changes.
123
+ > **Docs-only tasks:** keep this step; run only tests that reference the changed docs (`rg -l '<doc path>' tests/`). If there are no hits, record "no tests reference this doc". Post-integrate `release:check` owns the full suite. Omit lint and coverage checkboxes when no application code changes.
124
+ >
125
+ > Use `--test-reporter=dot` on `node --test` so passing tests do not flood the worker context.
121
126
 
122
127
  - [ ] Run lint (code tasks only): `npm run lint` — or project analyze command when present
123
- - [ ] Run Contract `testCommand`: `[exact command from ## Contract — typically lint && typecheck && scoped node --test]`
124
- - [ ] Run coverage gate (only when Contract requires it): `[testWithCoverage command, e.g. npm run coverage:check]` — **≥77% line coverage** on in-scope changed code
128
+ - [ ] Run Contract `testCommand`: `[exact command from ## Contract — typically lint && typecheck && scoped node --test --test-reporter=dot]`
129
+ - [ ] Run coverage gate (Size L, or when Contract sets `minLineCoverage`): `[testWithCoverage command, e.g. npm run coverage:check]` — **≥77% line coverage** on in-scope changed code
125
130
  - [ ] Run integration tests (if applicable)
126
131
  - [ ] Fix all failures
127
132
 
@@ -195,6 +200,65 @@ Use unambiguous field names: `**Risk:**` for severity/blast (pairs with **Score*
195
200
 
196
201
  ---
197
202
 
203
+ ## Execute-task variant
204
+
205
+ Use for deterministic commands (generators, smoke runs, evidence collection, deploys). The engine runs `runCommand` in the lane worktree with **no LLM worker**, then verifies the Contract. `validatePrompt` still requires the standard sections and a Testing step; keep them short — the engine does not execute steps. Add a `## Matrix` table to fan out across targets (see [contract-template.md](contract-template.md#execute-matrix-task)).
206
+
207
+ ````markdown
208
+ # Task: [PREFIX-###] — [Name]
209
+
210
+ **Created:** [YYYY-MM-DD]
211
+ **Size:** S
212
+ **Type:** execute
213
+
214
+ ## Review Level: 0 (None)
215
+
216
+ **Risk:** [What the command touches; deterministic, no code authored]
217
+ **Score:** 0/8 — Blast radius: 0, Pattern novelty: 0, Security: 0, Reversibility: 0
218
+
219
+ ## Mission
220
+
221
+ [Closes #N | Partial #N] — Run `[script]` to produce `[artifact]` for [purpose].
222
+
223
+ ## Dependencies
224
+
225
+ - **Task:** [PREFIX-###] ([LLM task that authored the script, when split])
226
+
227
+ ## File Scope
228
+
229
+ - `[out/report.json]`
230
+
231
+ ## Contract
232
+
233
+ | Field | Value |
234
+ |-------|-------|
235
+ | runCommand | `[sh scripts/collect.sh]` |
236
+ | testCommand | `[test -f out/report.json]` |
237
+ | fileScopeMustChange | `[out/report.json]` |
238
+
239
+ ## Steps
240
+
241
+ ### Step 0: Run command
242
+
243
+ - [ ] Engine runs Contract `runCommand`
244
+
245
+ ### Step 1: Testing & Verification
246
+
247
+ - [ ] Contract `testCommand` passes (artifact exists)
248
+
249
+ ## Completion Criteria
250
+
251
+ - [ ] `runCommand` exit 0 and Contract verified
252
+
253
+ ## Do NOT
254
+
255
+ - Modify `.spine/`, `AGENTS.md`, `CLAUDE.md`, or `.gitnexus/` ([#149](https://github.com/beettlle/pi-spine/issues/149))
256
+ ````
257
+
258
+ Keep `testCommand` cheap — it re-runs at contract verify. Omitting `runCommand` makes the engine run `testCommand` as the job **and** again at verify.
259
+
260
+ ---
261
+
198
262
  # STATUS.md Template
199
263
 
200
264
  Create alongside PROMPT.md. If omitted, the execution engine may auto-generate
@@ -206,7 +270,7 @@ this from PROMPT.md.
206
270
  **Current Step:** Not Started
207
271
  **Status:** 🔵 Ready for Execution
208
272
  **Last Updated:** [YYYY-MM-DD]
209
- **Review Level:** [0-3]
273
+ **Review Level:** [0-2]
210
274
  **Review Counter:** 0
211
275
  **Iteration:** 0
212
276
  **Size:** [S | M | L]
@@ -242,7 +306,7 @@ this from PROMPT.md.
242
306
  ### Step [N-1]: Testing & Verification
243
307
  **Status:** ⬜ Not Started
244
308
 
245
- - [ ] FULL test suite passing
309
+ - [ ] Contract `testCommand` passing (full suite runs at post-integrate `release:check`)
246
310
  - [ ] Coverage gate passes (≥77% line coverage on in-scope code, when applicable)
247
311
  - [ ] Integration tests (if applicable)
248
312
  - [ ] All failures fixed