pi-spine 1.0.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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +563 -0
  3. package/bin/get-version.mjs +35 -0
  4. package/bin/spine-batch.mjs +425 -0
  5. package/bin/spine-cli/batch.mjs +47 -0
  6. package/bin/spine-cli/gate.mjs +10 -0
  7. package/bin/spine-cli/integrate.mjs +10 -0
  8. package/bin/spine-cli/plan.mjs +12 -0
  9. package/bin/spine-cli/shared.mjs +73 -0
  10. package/bin/spine-cli/status.mjs +18 -0
  11. package/bin/spine-cli/verify.mjs +199 -0
  12. package/bin/spine-config.mjs +212 -0
  13. package/bin/spine-dashboard.mjs +178 -0
  14. package/bin/spine-deps.mjs +69 -0
  15. package/bin/spine-doctor.mjs +468 -0
  16. package/bin/spine-gate.mjs +137 -0
  17. package/bin/spine-init.mjs +398 -0
  18. package/bin/spine-integrate.mjs +77 -0
  19. package/bin/spine-journal.mjs +198 -0
  20. package/bin/spine-migrate-from-taskplane.mjs +136 -0
  21. package/bin/spine-plan.mjs +83 -0
  22. package/bin/spine-preflight.mjs +700 -0
  23. package/bin/spine-report-progress.d.mts +28 -0
  24. package/bin/spine-report-progress.mjs +126 -0
  25. package/bin/spine-review-step.d.mts +24 -0
  26. package/bin/spine-review-step.mjs +124 -0
  27. package/bin/spine-rules.mjs +35 -0
  28. package/bin/spine-settings.mjs +186 -0
  29. package/bin/spine-state.mjs +110 -0
  30. package/bin/spine-status.mjs +79 -0
  31. package/bin/spine-tasks.mjs +293 -0
  32. package/bin/spine-worker-runner.mjs +314 -0
  33. package/bin/spine.mjs +404 -0
  34. package/extensions/spine/settings-slash.ts +20 -0
  35. package/extensions/spine/slash-commands.ts +806 -0
  36. package/extensions/spine/worker-tools.ts +279 -0
  37. package/extensions/spine-orchestrator.ts +12 -0
  38. package/package.json +72 -0
  39. package/skills/.gitkeep +0 -0
  40. package/skills/create-spine-tasks/SKILL.md +375 -0
  41. package/skills/create-spine-tasks/references/context-template.md +25 -0
  42. package/skills/create-spine-tasks/references/contract-template.md +98 -0
  43. package/skills/create-spine-tasks/references/explore-template.md +63 -0
  44. package/skills/create-spine-tasks/references/prompt-template.md +276 -0
  45. package/src/batch/abort.mjs +272 -0
  46. package/src/batch/agent-session-worker.mjs +297 -0
  47. package/src/batch/batch-state-io.mjs +53 -0
  48. package/src/batch/contract-verify.mjs +310 -0
  49. package/src/batch/detached-start.mjs +778 -0
  50. package/src/batch/diagnosis.mjs +378 -0
  51. package/src/batch/engine-lanes/merge.mjs +632 -0
  52. package/src/batch/engine-lanes/queue.mjs +208 -0
  53. package/src/batch/engine-lanes/review.mjs +970 -0
  54. package/src/batch/engine-lanes.mjs +388 -0
  55. package/src/batch/engine-scope.mjs +251 -0
  56. package/src/batch/engine.mjs +445 -0
  57. package/src/batch/evidence-command.mjs +157 -0
  58. package/src/batch/evidence.mjs +203 -0
  59. package/src/batch/gate.mjs +359 -0
  60. package/src/batch/git-commit-env.mjs +46 -0
  61. package/src/batch/git-exec.mjs +26 -0
  62. package/src/batch/heartbeat.mjs +430 -0
  63. package/src/batch/integrate.mjs +414 -0
  64. package/src/batch/journal-rebuild.mjs +388 -0
  65. package/src/batch/journal.mjs +373 -0
  66. package/src/batch/lane-commit.mjs +153 -0
  67. package/src/batch/lifecycle.mjs +364 -0
  68. package/src/batch/metrics.mjs +265 -0
  69. package/src/batch/orphan-detect.mjs +210 -0
  70. package/src/batch/post-merge-limbo.mjs +80 -0
  71. package/src/batch/postmortem.mjs +296 -0
  72. package/src/batch/readers/spine-state.mjs +95 -0
  73. package/src/batch/readers/taskplane-state.mjs +136 -0
  74. package/src/batch/reconcile.mjs +729 -0
  75. package/src/batch/resume-common.mjs +104 -0
  76. package/src/batch/resume-engine.mjs +66 -0
  77. package/src/batch/resume-multi-lanes.mjs +479 -0
  78. package/src/batch/resume-multi-validate.mjs +187 -0
  79. package/src/batch/resume-multi.mjs +254 -0
  80. package/src/batch/resume.mjs +475 -0
  81. package/src/batch/retry.mjs +257 -0
  82. package/src/batch/review-scope.mjs +136 -0
  83. package/src/batch/review.mjs +1045 -0
  84. package/src/batch/salvage.mjs +332 -0
  85. package/src/batch/state.mjs +680 -0
  86. package/src/batch/task-stall-budget.mjs +88 -0
  87. package/src/batch/worker-host.mjs +683 -0
  88. package/src/batch/worker-output.mjs +253 -0
  89. package/src/batch/worker-prompt.mjs +84 -0
  90. package/src/batch/worktree.mjs +290 -0
  91. package/src/cli/deps.mjs +141 -0
  92. package/src/cli/handoff.mjs +364 -0
  93. package/src/cli/rules.mjs +429 -0
  94. package/src/cli/settings-set.mjs +171 -0
  95. package/src/cli/settings-show.mjs +140 -0
  96. package/src/cli/settings-slash.mjs +107 -0
  97. package/src/config/contract.mjs +56 -0
  98. package/src/config/cursor-rules/discover.mjs +416 -0
  99. package/src/config/cursor-rules/index.mjs +39 -0
  100. package/src/config/cursor-rules/match-globs.mjs +132 -0
  101. package/src/config/cursor-rules/parse-frontmatter.mjs +222 -0
  102. package/src/config/cursor-rules/priority.mjs +26 -0
  103. package/src/config/cursor-rules/profile.mjs +403 -0
  104. package/src/config/cursor-rules/select.mjs +259 -0
  105. package/src/config/defaults.mjs +36 -0
  106. package/src/config/env-overrides.mjs +207 -0
  107. package/src/config/merge-defaults.mjs +47 -0
  108. package/src/config/pi-spine-root.mjs +93 -0
  109. package/src/config/reviewer-context.mjs +243 -0
  110. package/src/config/settings-fields.mjs +265 -0
  111. package/src/config/worker-backend.mjs +116 -0
  112. package/src/config/worker-context.mjs +402 -0
  113. package/src/config/worker-launch-script.mjs +130 -0
  114. package/src/config/worktree-setup-hook.mjs +122 -0
  115. package/src/dashboard/public/dashboard.css +77 -0
  116. package/src/dashboard/public/dashboard.js +349 -0
  117. package/src/dashboard/public/index.html +80 -0
  118. package/src/dashboard/server.mjs +155 -0
  119. package/src/dashboard/snapshot.mjs +414 -0
  120. package/src/dashboard/sse.mjs +15 -0
  121. package/src/dashboard/view.mjs +292 -0
  122. package/src/doctor/agent-model-inherit.mjs +101 -0
  123. package/src/doctor/batch-size-guidance.mjs +72 -0
  124. package/src/doctor/coexistence.mjs +312 -0
  125. package/src/doctor/rules-manifest.mjs +133 -0
  126. package/src/doctor/stale-path.mjs +156 -0
  127. package/src/doctor/stall-config.mjs +108 -0
  128. package/src/doctor/suggest-max-parallel.mjs +53 -0
  129. package/src/doctor/task-packet-size.mjs +110 -0
  130. package/src/doctor/worktree-health.mjs +71 -0
  131. package/src/migrate/taskplane-config.mjs +116 -0
  132. package/src/planner/cycles.mjs +63 -0
  133. package/src/planner/format-plan.mjs +132 -0
  134. package/src/planner/graph.mjs +99 -0
  135. package/src/planner/index.mjs +125 -0
  136. package/src/planner/lanes.mjs +111 -0
  137. package/src/planner/pending.mjs +39 -0
  138. package/src/planner/scope.mjs +142 -0
  139. package/src/process/liveness.mjs +21 -0
  140. package/src/tasks/packet/discover.mjs +40 -0
  141. package/src/tasks/packet/index.mjs +81 -0
  142. package/src/tasks/packet/merge-deps.mjs +79 -0
  143. package/src/tasks/packet/parse-prompt.mjs +445 -0
  144. package/src/tasks/packet/parse-status.mjs +118 -0
  145. package/src/tasks/packet/validate-contract.mjs +115 -0
  146. package/src/tasks/packet/validate-prompt.mjs +99 -0
  147. package/src/worker-tools/report-progress.d.mts +18 -0
  148. package/src/worker-tools/report-progress.mjs +59 -0
  149. package/src/worker-tools/request-gate.d.mts +17 -0
  150. package/src/worker-tools/request-gate.mjs +54 -0
  151. package/templates/agents/reviewer.md +123 -0
  152. package/templates/agents/supervisor.md +59 -0
  153. package/templates/agents/worker.md +122 -0
  154. package/templates/rules-profile.json +27 -0
  155. package/templates/spine-config.json +64 -0
  156. package/templates/tasks/CONTEXT.md +30 -0
@@ -0,0 +1,375 @@
1
+ ---
2
+ name: create-spine-tasks
3
+ version: 1.0.0
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
+ ---
6
+
7
+ # Create Spine Tasks
8
+
9
+ Creates structured task packets (`PROMPT.md` + `STATUS.md`) for autonomous execution via **pi-spine** (`spine batch start`, `/spine`). The spine engine handles waves, worktree lanes, checkpoint discipline, cross-model review, integrate gates, and the dashboard — so `PROMPT.md` stays focused on **what** to build, not **how** the orchestrator runs.
10
+
11
+ Works from a local pi-spine checkout (`pi install /path/to/pi-spine -l`). No npm publish required.
12
+
13
+ ## Architecture
14
+
15
+ ```
16
+ create-spine-tasks skill → Creates PROMPT.md + STATUS.md (+ dependencies.json edits)
17
+ spine-orchestrator extension → Slash commands, batch guidance
18
+ spine CLI → batch start, plan, preflight, integrate, gates
19
+ ├─ .spine/agents/worker.md → Worker standing orders (checkpoint discipline)
20
+ ├─ .spine/agents/reviewer.md → Reviewer rubric
21
+ └─ .spine/spine-config.json → tasks root, testing commands, lanes, gates
22
+ ```
23
+
24
+ The skill only creates and updates task files. Execution behavior lives in pi-spine and the worker/reviewer agent prompts.
25
+
26
+ ## Prerequisites
27
+
28
+ **If `.spine/spine-config.json` does not exist**, the project has not been initialized. Tell the user to run `spine init` first — the skill needs `paths.tasksRoot` (default `spine-tasks/`) and testing commands.
29
+
30
+ **Migrants from Taskplane:** `spine migrate-from-taskplane` or `spine init --tasks-root taskplane-tasks` keeps existing `TP-*` folders. Use the configured tasks root and ID prefix from `{tasksRoot}/CONTEXT.md`, not hard-coded `spine-tasks/`.
31
+
32
+ ## Configuration
33
+
34
+ **Read `.spine/spine-config.json` first.** Primary keys:
35
+
36
+ | Key | Purpose |
37
+ |-----|---------|
38
+ | `paths.tasksRoot` | Task folder root (default `spine-tasks`) |
39
+ | `testing.test` / `testing.build` / `testing.testWithCoverage` | Test, build, and **coverage gate** commands for PROMPT.md verification (pi-spine default: `npm run coverage:check`, **≥77% line coverage**) |
40
+ | `referenceDocs` | Tier 3 docs for "Context to Read First" (also injected into worker tail when not in `neverLoad`) |
41
+ | `standards` | Explicit rule/doc paths; when `.cursor/rules/` exists these **append** after auto-selected rules (deduped) |
42
+ | `neverLoad` | Docs that must NOT appear in any task or worker context |
43
+
44
+ Override tasks root at runtime with `SPINE_TASKS_ROOT` (env > file).
45
+
46
+ ---
47
+
48
+ ## PRD → Task Decomposition
49
+
50
+ Use this workflow when the user supplies a PRD, epic brief, or feature spec instead of a single task description.
51
+
52
+ ### Step 0: Explore (optional — brownfield / large epics)
53
+
54
+ Run **before** Step A when decomposition needs codebase discovery. Authoring-only — `spine tasks validate` does **not** require explore artifacts.
55
+
56
+ **When to run:**
57
+
58
+ | Signal | Why explore helps |
59
+ |--------|-------------------|
60
+ | Brownfield repo | Unfamiliar modules; map touch points before File Scope |
61
+ | L/XL epic | Must split anyway; findings drive disjoint scopes per wave |
62
+ | File Scope uncertainty | PRD lacks concrete paths; investigate before slicing |
63
+ | Parallel wave planning | Need non-overlapping scopes for lane affinity |
64
+ | Post-refactor on `main` | Re-explore; mark prior findings `Status: superseded` |
65
+
66
+ **When to skip:**
67
+
68
+ - Greenfield with clear PRD and known paths
69
+ - Single S/M task with concrete `## File Scope` already
70
+ - Migrating existing Taskplane packets unchanged
71
+
72
+ **Constraints (read-only):**
73
+
74
+ - No commits; no file edits outside read targets
75
+ - Output path: `{tasksRoot}/_explore/{slug}/findings.md` (git-tracked by default)
76
+ - Findings inform `## File Scope` in downstream packets (Step B) — not batch engine input
77
+
78
+ **Workflow:**
79
+
80
+ 1. Read-only investigation — search code, read docs, trace dependencies.
81
+ 2. Write `{tasksRoot}/_explore/{slug}/findings.md` using [references/explore-template.md](references/explore-template.md) (v1.3 §6.3 schema: Summary, Codebase areas, Risks, Suggested file scopes, Open questions).
82
+ 3. Link the slug in `{tasksRoot}/CONTEXT.md` — explore table row or `Explore complete: {slug}` with date and path.
83
+ 4. Use **Suggested file scopes** from findings when slicing tasks in Step B.
84
+
85
+ See [docs/adoption/upstream-execution-workflow.md](../../docs/adoption/upstream-execution-workflow.md) for optional zero-pi upstream composition (pi-spine does not invoke zero-pi).
86
+
87
+ ### Step A: Read sources
88
+
89
+ 1. PRD / brief / epic doc (user-provided path)
90
+ 2. `{tasksRoot}/CONTEXT.md` — current phase, **Next Task ID**, execution policy
91
+ 3. Existing `{tasksRoot}/dependencies.json` and open task folders (avoid duplicate work)
92
+
93
+ ### Step B: Slice into spine tasks
94
+
95
+ | Rule | Guidance |
96
+ |------|----------|
97
+ | **Size** | Target **M** (2–4 h). **L** → split when possible. **XL** → **must** split into multiple S/M tasks with dependencies. |
98
+ | **Steps** | Max **4** implementation steps per task (exclude Testing & Verification / Documentation & Delivery). More steps → split. |
99
+ | **Parallel waves** | Prefer **≤4** M-sized tasks per wave; 8-task mega-waves stall pi workers (see Phase 15 / SP-086–088). |
100
+ | **Scope** | One deliverable per task; disjoint **File Scope** when tasks can run in parallel. |
101
+ | **IDs** | Use `Next Task ID` from CONTEXT.md; increment after each new task. Greenfield spine projects typically use `SP-###`; Taskplane migrants may keep `TP-###`. |
102
+ | **Waves** | Order via `## Dependencies` and `{tasksRoot}/dependencies.json`. |
103
+ | **Review** | Score complexity (below). Do not default to Level 0 for implementation work. |
104
+
105
+ ### Step C: Update tracking
106
+
107
+ After creating packets:
108
+
109
+ 1. **`{tasksRoot}/CONTEXT.md`** — increment `Next Task ID`; add rows to the phase table for new tasks
110
+ 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>`
112
+
113
+ **Example decomposition** (feature brief → three tasks):
114
+
115
+ | Task | Mission | Deps |
116
+ |------|---------|------|
117
+ | `SP-010-api-schema` | Add request/response types + validation | None |
118
+ | `SP-011-api-handlers` | Implement routes using schema | SP-010 |
119
+ | `SP-012-api-tests` | Integration tests + docs | SP-011 |
120
+
121
+ ---
122
+
123
+ ## Single-Task Creation Workflow
124
+
125
+ ### Step 1: Determine location and next ID
126
+
127
+ 1. Read `paths.tasksRoot` from `.spine/spine-config.json`
128
+ 2. Read `{tasksRoot}/CONTEXT.md` → **Next Task ID** counter
129
+ 3. Use that ID for the new folder; **increment the counter** in the same edit
130
+
131
+ If `CONTEXT.md` is missing (pre-init legacy repo), ask the user to run `spine init` or create `{tasksRoot}/CONTEXT.md` from [references/context-template.md](references/context-template.md).
132
+
133
+ ### Step 2: Assess complexity and size
134
+
135
+ **You MUST score and assign review level before creating PROMPT.md.**
136
+
137
+ Quick reference (full rubric in [Complexity Assessment](#complexity-assessment)):
138
+
139
+ - Score each dimension 0–2: Blast radius, Pattern novelty, Security, Reversibility
140
+ - Sum → Level: 0–1→L0, 2–3→L1, 4–5→L2, 6–8→L3
141
+ - Size: S (<2h), M (2–4h), L (4–8h), XL (8h+ → must split)
142
+
143
+ **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.
144
+
145
+ ### Step 3: Create task folder
146
+
147
+ ```
148
+ {tasksRoot}/{PREFIX-###-slug}/
149
+ ├── PROMPT.md
150
+ └── STATUS.md
151
+ ```
152
+
153
+ Folder name must match the PROMPT heading ID (FR-TASK-01): `# Task: SP-042 — slug name`.
154
+
155
+ ### Step 4: Create PROMPT.md
156
+
157
+ Use [references/prompt-template.md](references/prompt-template.md). Spine-specific requirements:
158
+
159
+ - **Environment** — include `npm run typecheck && SPINE_WORKER_STUB=1 npm test` when that is the project test command
160
+ - **Git Commit Convention** — `feat(SP-###): …` at step boundaries
161
+ - **Worker tools** — when Review Level > 0, steps must note `spine_review_step` after each step
162
+ - **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 the coverage-gate checkbox when no application code changes.
163
+ - **Coverage gate** — when the task changes application code, add a coverage verification checkbox in the Testing step using `testing.testWithCoverage` (≥77% line coverage policy)
164
+ - **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. Legacy `TP-*` packets may omit Contract when `contract.legacyTaskIdPrefixes` includes `TP-`.
165
+ - **Completion** — worker creates `{task-folder}/.DONE`; batch engine may auto-commit remaining work
166
+
167
+ ### Step 5: Create STATUS.md
168
+
169
+ Use the STATUS template in [references/prompt-template.md](references/prompt-template.md). Match PROMPT step structure; omit if the engine will auto-generate (prefer creating it).
170
+
171
+ ### Step 6: Update dependencies (when needed)
172
+
173
+ If the task depends on others, update **both**:
174
+
175
+ - `## Dependencies` in PROMPT.md (orchestrator parses this)
176
+ - `{tasksRoot}/dependencies.json` (canonical graph for `spine plan`)
177
+
178
+ ### Step 7: Report launch command
179
+
180
+ ```bash
181
+ spine tasks validate pending
182
+ spine plan pending
183
+ spine preflight
184
+ SPINE_WORKER_STUB=1 spine batch start SP-042 # stub / CI
185
+ # SPINE_WORKER_STUB=0 spine batch start SP-042 # real pi workers
186
+ ```
187
+
188
+ In pi: `/spine-plan pending` then `/spine SP-042` (single-task) or `spine batch start pending` for a wave.
189
+
190
+ ---
191
+
192
+ ## Complexity Assessment
193
+
194
+ ### Review Levels
195
+
196
+ | Level | Label | Spine behavior |
197
+ |-------|-------|----------------|
198
+ | 0 | None | No `spine_review_step` |
199
+ | 1 | Plan Only | Plan review before each step (or checkpoint marker) |
200
+ | 2 | Plan + Code | Plan + code review at step boundaries |
201
+ | 3 | Full | Plan + code + test review |
202
+
203
+ Workers call **`spine_review_step`** (Pi tool) or `spine review step --step N [--type plan|code]`.
204
+
205
+ When Review Level ≥ 1 (v1.3), workers also run a **final** review (`--type final`) before `.DONE`. Verdicts: `PASS`, `REVISE`, or `REPLAN` (scope wrong — operator edits PROMPT then retries). See [PRD v1.3](../docs/PRD-v1.3-upstream-execution-bridge.md) FR-UXB-04.
206
+
207
+ ### Scoring (0–2 per dimension)
208
+
209
+ | Dimension | 0 (Low) | 1 (Medium) | 2 (High) |
210
+ |-----------|---------|------------|----------|
211
+ | **Blast radius** | Single file | Single module | Multiple modules/services |
212
+ | **Pattern novelty** | Existing patterns | Adapting patterns | New patterns |
213
+ | **Security** | No auth/data | Touches auth | Modifies auth/encryption |
214
+ | **Reversibility** | Easy revert | Needs migration | Data model change |
215
+
216
+ Score 0–1 → Level 0 · 2–3 → Level 1 · 4–5 → Level 2 · 6–8 → Level 3
217
+
218
+ ### Per-step override and checkpoint markers
219
+
220
+ Individual steps can override the task-level review:
221
+
222
+ ```markdown
223
+ ### Step 3: Add RBAC middleware
224
+ > **Review override: code review** — This step touches authorization.
225
+ ```
226
+
227
+ **Checkpoint markers** (`**Plan-review checkpoint**`, `**Code review checkpoint**`) consolidate reviews on single-deliverable tasks. Default is per-step reviews when steps are independent.
228
+
229
+ ---
230
+
231
+ ## Task Sizing
232
+
233
+ | Size | Duration | Action |
234
+ |------|----------|--------|
235
+ | **S** | < 2 hours | Create as-is |
236
+ | **M** | 2–4 hours | Ideal — create as-is |
237
+ | **L** | 4–8 hours | Split if possible |
238
+ | **XL** | 8+ hours | **Must split** — never ship a single PROMPT with Size XL (validator rejects) |
239
+ | **L** | 4–8 hours | **Prefer split** into 2–3 M tasks; if kept, set Size L and expect longer stall budget (SP-088) |
240
+
241
+ **Rule of thumb:** More than **4** implementation steps → split. More than **8** file-scope paths → narrow or split.
242
+
243
+ **Example (incident-driven):** Eight Phase-13 tasks in one batch (`SP-064`…`SP-085`) caused parallel pi stalls. Prefer:
244
+
245
+ | Instead of | Use |
246
+ |------------|-----|
247
+ | One batch with 8 M tasks | Wave A: 4 tasks → land → Wave B: 4 tasks |
248
+ | One L task “refactor engine + resume + tests” | SP-074 engine scope, SP-076 resume DRY, SP-078 tests (deps) |
249
+
250
+ ---
251
+
252
+ ## Tiered Context Loading
253
+
254
+ | Tier | What | Loaded by |
255
+ |------|------|-----------|
256
+ | **1** | PROMPT.md + STATUS.md | Always |
257
+ | **2** | `{tasksRoot}/CONTEXT.md` | When listed in "Context to Read First" |
258
+ | **3** | Specific reference docs | Only what the task needs |
259
+ | **4** | Cursor rules (when `.cursor/rules/` exists) | **Workers:** auto-selected per task via profile `worker.*`, PROMPT File Scope globs, `config.standards` append (FR-WORK-05). **Reviewers:** separate `profile.reviewer.*` selection with review-type scope — plan uses File Scope, code uses git diff paths, final uses always-only rules; 16 KiB cap, no `referenceDocs` (FR-REV-08) |
260
+
261
+ Populate "Context to Read First" from `referenceDocs` in spine config. Never list docs in `neverLoad`.
262
+
263
+ When authoring tasks for Cursor-based repos, **File Scope drives glob-matched worker rules** — include concrete paths (e.g. `src/**/*.mjs`, not only `src/`) so language packs activate. The same File Scope applies to **plan review** rule matching; code reviews match globs against changed diff paths instead. Preview worker selection with `spine rules select --task <id>`; preview reviewer selection with `spine rules select --role reviewer --review-type plan|code|final --task <id>`. See [docs/design/cursor-rules-discovery.md](../../docs/design/cursor-rules-discovery.md).
264
+
265
+ ---
266
+
267
+ ## STATUS.md Hydration
268
+
269
+ STATUS.md is the worker's memory between iterations. Match PROMPT.md granularity — outcome-level checkboxes, not line-by-line implementation scripts.
270
+
271
+ Use `⚠️ Hydrate` when items depend on runtime discovery:
272
+
273
+ ```markdown
274
+ ### Step 2: Handle migration
275
+ **Status:** ⬜ Not Started
276
+ > ⚠️ Hydrate: Expand based on schema gaps identified in Step 1
277
+
278
+ - [ ] Implement v1→v2 compatibility (details depend on Step 1 findings)
279
+ ```
280
+
281
+ **Workers MUST NOT add, remove, or renumber steps at runtime.** Hydration expands checkboxes within existing steps only.
282
+
283
+ ---
284
+
285
+ ## Dependencies Format
286
+
287
+ The planner **machine-parses** dependencies — use exact patterns:
288
+
289
+ ```markdown
290
+ ## Dependencies
291
+
292
+ - **None**
293
+
294
+ - **Task:** SP-010 (schema types must exist)
295
+ - **External:** Docker compose stack running on port 8080
296
+ ```
297
+
298
+ Also add to `{tasksRoot}/dependencies.json`:
299
+
300
+ ```json
301
+ {
302
+ "SP-011-api-handlers": ["SP-010-api-schema"]
303
+ }
304
+ ```
305
+
306
+ Task IDs in JSON use the **folder slug** (full `SP-011-api-handlers`) or bare ID (`SP-011`) consistent with existing repo convention — match what `spine plan` already uses in that project.
307
+
308
+ ---
309
+
310
+ ## File Scope and parallel batches
311
+
312
+ `## File Scope` drives lane affinity. Overlapping scope → same lane (serial). Disjoint scope → parallel lanes.
313
+
314
+ When decomposing a PRD, assign non-overlapping file scopes to tasks that should run in parallel.
315
+
316
+ **Worker rules:** File Scope also drives **glob-matched Cursor rules** injected into batch workers (FR-WORK-05). Tasks touching `**/*.{js,mjs}` activate JS standards; Swift/Python tasks need scope paths that match those rule globs. Keep scope precise — wide scope pulls more rules and increases prompt byte usage.
317
+
318
+ **Reviewer rules (FR-REV-08):** Plan reviews use the same File Scope for glob matching; code reviews use changed paths from `git diff`. Final reviews load always-on rules only. Worker-only packs (`taskplane-worker-cursor.mdc`) are excluded from reviewer context by default.
319
+
320
+ ---
321
+
322
+ ## Unsupported (spine v1)
323
+
324
+ Do **not** generate Taskplane polyrepo **`#### Segment: <repoId>`** markers — pi-spine is monorepo-only (PRD §13.2). Split multi-repo work into separate tasks with dependencies instead.
325
+
326
+ ---
327
+
328
+ ## Checklist (Definition of Ready)
329
+
330
+ Before reporting launch commands:
331
+
332
+ - [ ] `Next Task ID` read from CONTEXT.md and incremented
333
+ - [ ] Folder at `{tasksRoot}/{PREFIX-###-slug}/`
334
+ - [ ] Complexity scored; review level assigned (0–3)
335
+ - [ ] Size S/M/L — split if XL
336
+ - [ ] PROMPT.md from template: Mission, Dependencies, Context, File Scope, Contract (SP-\*), Steps, Do NOT, Git Commit Convention, Amendments
337
+ - [ ] `### Step N: Testing & Verification` present inside `## Steps` before `## Completion Criteria` (required even for docs-only Review Level 0)
338
+ - [ ] STATUS.md with matching steps (hydration markers where needed)
339
+ - [ ] `dependencies.json` updated when task has deps
340
+ - [ ] CONTEXT.md phase table updated for PRD decompositions
341
+ - [ ] Launch: `spine tasks validate pending` → `spine plan pending` → `spine preflight` → `spine batch start <id>`
342
+
343
+ ---
344
+
345
+ ## Git Commit Convention
346
+
347
+ Workers commit at **step boundaries** with the task ID prefix:
348
+
349
+ - `feat(SP-042): complete Step 1 — init defaults`
350
+ - `fix(SP-042): handle missing config path`
351
+ - `hydrate: SP-042 expand Step 2 checkboxes`
352
+
353
+ Hydration commits (STATUS.md expansions) may happen mid-step for crash recovery.
354
+
355
+ ---
356
+
357
+ ## Key Principles
358
+
359
+ - **Self-contained PROMPT.md** — the worker has no memory of this conversation.
360
+ - **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.
361
+ - **Documentation in every task** — "Must Update" / "Check If Affected" prevent doc drift.
362
+ - **Concrete deliverables** — name files to create/modify; avoid shortcuttable vague steps.
363
+ - **Local install** — skill ships with pi-spine; `pi install /path/to/pi-spine -l` loads `./skills`.
364
+
365
+ ---
366
+
367
+ ## References
368
+
369
+ - [references/prompt-template.md](references/prompt-template.md) — PROMPT.md and STATUS.md templates
370
+ - [references/contract-template.md](references/contract-template.md) — `## Contract` field guidance and examples (v2.0 §4)
371
+ - [references/explore-template.md](references/explore-template.md) — Step 0 `findings.md` schema (v1.3 §6.3)
372
+ - [references/context-template.md](references/context-template.md) — `{tasksRoot}/CONTEXT.md` scaffold
373
+ - [docs/PRD.md](../../docs/PRD.md) — task format spec (§13)
374
+ - [docs/adoption/bootstrap-checklist.md](../../docs/adoption/bootstrap-checklist.md) — greenfield setup
375
+ - [docs/adoption/operator-runbook.md](../../docs/adoption/operator-runbook.md) — execution policy
@@ -0,0 +1,25 @@
1
+ # CONTEXT.md Template (spine)
2
+
3
+ `spine init` scaffolds `{tasksRoot}/CONTEXT.md` (see SP-053). Use this shape when creating or refreshing project context manually.
4
+
5
+ Keep it slim — workers load it when referenced from PROMPT.md.
6
+
7
+ ---
8
+
9
+ See also: `skills/create-spine-tasks/references/prompt-template.md` for PROMPT/STATUS shapes.
10
+
11
+ ## Next Task ID counter
12
+
13
+ When creating a new task:
14
+
15
+ 1. Read `Next Task ID` from `{tasksRoot}/CONTEXT.md` (e.g., `SP-016`)
16
+ 2. Use that ID for the new folder name and PROMPT heading
17
+ 3. Increment the counter (e.g., `SP-017`) in the same edit
18
+
19
+ ## Scaffold sections (spine init / SP-053)
20
+
21
+ - **Current State** — 2–3 paragraphs on what exists today
22
+ - **Phase plan** — table of staged/done tasks with deps
23
+ - **Execution policy** — pointer to operator runbook + preflight/land loop
24
+ - **Key Files** — tasks root, spine config, PRD path
25
+ - **Technical Debt / Future Work** — living backlog
@@ -0,0 +1,98 @@
1
+ # Contract template (spine v2.0)
2
+
3
+ Add a `## Contract` section to every new `SP-*` task `PROMPT.md`. Place it after `## File Scope` and before `## Steps`. The contract defines **machine-verifiable proof** checked at final review — not merely worker assertion.
4
+
5
+ Normative schema: [PRD v2.0 implementation handoff §4](../../docs/PRD-v2.0-implementation-handoff.md#4--contract-normative-schema).
6
+
7
+ **Taskplane migrants (`TP-*`):** When `contract.legacyTaskIdPrefixes` includes `TP-`, legacy tasks skip contract validation. New `SP-*` tasks require a contract when `contract.mode` is `required` (pi-spine default).
8
+
9
+ ---
10
+
11
+ ## Authoring format
12
+
13
+ ```markdown
14
+ ## Contract
15
+
16
+ | Field | Value |
17
+ |-------|-------|
18
+ | testCommand | `npm run coverage:check` |
19
+ | fileScopeMustChange | `src/batch/review.mjs`, `bin/spine-tasks.mjs` |
20
+ | fileScopeMustNotChange | `src/planner/**` |
21
+ | minLineCoverage | 77 |
22
+ | artifactsMustExist | `tests/batch/final-verdict.test.mjs` |
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Field guidance
28
+
29
+ | Field | When to include | Value format |
30
+ |-------|-----------------|--------------|
31
+ | `testCommand` | **Required** for code tasks (Review Level ≥ 1, Size M/L, or implementation steps) | Shell command in backticks; max 500 chars; no newlines. Use `` `true` `` for docs-only S tasks with no code changes. |
32
+ | `fileScopeMustChange` | When you need proof specific paths were touched | Comma-separated paths/globs relative to repo root |
33
+ | `fileScopeMustNotChange` | When parallel tasks must not collide | Comma-separated paths/globs |
34
+ | `minLineCoverage` | When task changes application code | Integer 0–100 (pi-spine policy: **77**) |
35
+ | `artifactsMustExist` | When deliverables must exist on disk | Comma-separated file paths |
36
+
37
+ Unknown field names produce **warnings** at validate time (not errors). Duplicate rows are errors.
38
+
39
+ ---
40
+
41
+ ## Examples
42
+
43
+ ### Minimal S task (code change)
44
+
45
+ ```markdown
46
+ ## Contract
47
+
48
+ | Field | Value |
49
+ |-------|-------|
50
+ | testCommand | `npm test -- tests/tasks/validate-cli.test.mjs` |
51
+ ```
52
+
53
+ ### M task with coverage gate
54
+
55
+ ```markdown
56
+ ## Contract
57
+
58
+ | Field | Value |
59
+ |-------|-------|
60
+ | testCommand | `npm run coverage:check` |
61
+ | fileScopeMustChange | `src/tasks/packet/validate-prompt.mjs` |
62
+ | minLineCoverage | 77 |
63
+ ```
64
+
65
+ ### Docs-only Review Level 0 (no application code)
66
+
67
+ ```markdown
68
+ ## Contract
69
+
70
+ | Field | Value |
71
+ |-------|-------|
72
+ | testCommand | `true` |
73
+ ```
74
+
75
+ ### Scope guard for parallel wave
76
+
77
+ ```markdown
78
+ ## Contract
79
+
80
+ | Field | Value |
81
+ |-------|-------|
82
+ | testCommand | `npm run typecheck && SPINE_WORKER_STUB=1 npm test` |
83
+ | fileScopeMustChange | `src/batch/review.mjs` |
84
+ | fileScopeMustNotChange | `src/planner/**`, `src/batch/journal.mjs` |
85
+ | artifactsMustExist | `tests/batch/final-verdict.test.mjs` |
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Validate before plan
91
+
92
+ After authoring packets, run:
93
+
94
+ ```bash
95
+ spine tasks validate pending
96
+ ```
97
+
98
+ Fix contract and PROMPT errors before `spine plan pending` or `spine batch start`.
@@ -0,0 +1,63 @@
1
+ # Explore findings template
2
+
3
+ Use for **Step 0 — Explore (optional)** in the create-spine-tasks skill.
4
+ Output path: `{tasksRoot}/_explore/{slug}/findings.md`
5
+
6
+ **Constraints:** read-only investigation; no commits; no file edits outside read targets. Findings inform File Scope in downstream task packets. `spine tasks validate` does not require explore artifacts.
7
+
8
+ Normative schema: [PRD v1.3 §6.3 FR-UXB-03](../../docs/PRD-v1.3-upstream-execution-bridge.md#63-fr-uxb-03--optional-explore-phase).
9
+
10
+ ---
11
+
12
+ ```markdown
13
+ # Explore: {slug}
14
+
15
+ **Date:** YYYY-MM-DD
16
+ **Status:** complete | superseded
17
+
18
+ ## Summary
19
+
20
+ (1–3 sentences: what was investigated and the main conclusion for decomposition.)
21
+
22
+ ## Codebase areas
23
+
24
+ - `path/` — (why relevant)
25
+
26
+ ## Risks
27
+
28
+ - (risk + mitigation hint)
29
+
30
+ ## Suggested file scopes
31
+
32
+ - (paths for downstream task packets)
33
+
34
+ ## Open questions
35
+
36
+ - (blockers for decomposition; None if clear)
37
+ ```
38
+
39
+ ---
40
+
41
+ ## When to skip explore
42
+
43
+ - Greenfield with clear PRD and known paths
44
+ - Single S/M task with concrete File Scope
45
+ - Migrating existing Taskplane packets unchanged
46
+
47
+ ## When explore is recommended
48
+
49
+ - Brownfield repo with unfamiliar modules
50
+ - L/XL epics (must split anyway)
51
+ - Parallel wave planning needs disjoint File Scopes
52
+ - File Scope uncertainty before decomposition
53
+ - After major refactor on `main` (re-explore; mark prior findings `Status: superseded`)
54
+
55
+ ## Linking in CONTEXT.md
56
+
57
+ Add a row or note:
58
+
59
+ ```markdown
60
+ | Explore: feature-x | 2026-06-10 | complete | spine-tasks/_explore/feature-x/findings.md |
61
+ ```
62
+
63
+ Or: `Explore complete: feature-x (2026-06-10) — spine-tasks/_explore/feature-x/findings.md`