prizmkit 1.1.130 → 1.1.131

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 (88) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/.env.example +1 -1
  3. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +445 -8
  4. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +87 -66
  5. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +53 -3
  6. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +55 -25
  7. package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +4 -0
  8. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +15 -1
  9. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +396 -4
  10. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +54 -1
  11. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +54 -1
  12. package/bundled/dev-pipeline/scripts/prompt_framework.py +152 -1
  13. package/bundled/dev-pipeline/scripts/update-bug-status.py +53 -0
  14. package/bundled/dev-pipeline/scripts/update-checkpoint.py +294 -69
  15. package/bundled/dev-pipeline/scripts/update-feature-status.py +57 -0
  16. package/bundled/dev-pipeline/scripts/update-refactor-status.py +53 -0
  17. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +2 -2
  18. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +20 -14
  19. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +21 -4
  20. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +18 -0
  21. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +1 -1
  22. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +5 -15
  23. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +21 -0
  24. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +10 -10
  25. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +16 -0
  26. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +26 -23
  27. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +12 -8
  28. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +1 -1
  29. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +21 -0
  30. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +362 -3
  31. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +310 -22
  32. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +132 -0
  33. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +91 -0
  34. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +411 -18
  35. package/bundled/dev-pipeline/tests/test_unified_cli.py +3 -3
  36. package/bundled/skills/_metadata.json +62 -25
  37. package/bundled/skills/app-planner/SKILL.md +4 -3
  38. package/bundled/skills/bug-fix-workflow/SKILL.md +89 -180
  39. package/bundled/skills/bug-planner/SKILL.md +12 -27
  40. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +131 -220
  41. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +36 -90
  42. package/bundled/skills/feature-pipeline-launcher/SKILL.md +129 -271
  43. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +35 -76
  44. package/bundled/skills/feature-planner/SKILL.md +27 -22
  45. package/bundled/skills/feature-planner/assets/planning-guide.md +4 -4
  46. package/bundled/skills/feature-workflow/SKILL.md +94 -121
  47. package/bundled/skills/prizmkit/SKILL.md +130 -94
  48. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +181 -0
  49. package/bundled/skills/prizmkit-code-review/SKILL.md +114 -84
  50. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +1 -1
  51. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +181 -0
  52. package/bundled/skills/prizmkit-committer/SKILL.md +131 -47
  53. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +181 -0
  54. package/bundled/skills/prizmkit-implement/SKILL.md +99 -73
  55. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +1 -1
  56. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +181 -0
  57. package/bundled/skills/prizmkit-init/SKILL.md +5 -5
  58. package/bundled/skills/prizmkit-plan/SKILL.md +132 -105
  59. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +181 -0
  60. package/bundled/skills/prizmkit-retrospective/SKILL.md +111 -53
  61. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +7 -6
  62. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +5 -4
  63. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +181 -0
  64. package/bundled/skills/prizmkit-test/SKILL.md +28 -6
  65. package/bundled/skills/prizmkit-test/references/examples.md +1 -1
  66. package/bundled/skills/prizmkit-test/references/test-report-template.md +1 -1
  67. package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +181 -0
  68. package/bundled/skills/prizmkit-workflow/SKILL.md +266 -0
  69. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +181 -0
  70. package/bundled/skills/recovery-workflow/SKILL.md +62 -241
  71. package/bundled/skills/recovery-workflow/evals/evals.json +17 -33
  72. package/bundled/skills/recovery-workflow/references/detection.md +28 -52
  73. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +105 -439
  74. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +136 -275
  75. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +53 -88
  76. package/bundled/skills/refactor-planner/SKILL.md +12 -57
  77. package/bundled/skills/refactor-planner/references/behavior-preservation.md +111 -230
  78. package/bundled/skills/refactor-planner/references/error-recovery.md +37 -0
  79. package/bundled/skills/refactor-planner/references/planning-phases.md +11 -17
  80. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +1 -1
  81. package/bundled/skills/refactor-workflow/SKILL.md +98 -139
  82. package/bundled/templates/project-memory-template.md +4 -4
  83. package/package.json +1 -1
  84. package/src/index.js +4 -0
  85. package/src/prompts.js +10 -3
  86. package/src/scaffold.js +1 -1
  87. package/bundled/dev-pipeline/tests/test-deploy-safety.sh +0 -223
  88. package/bundled/skills/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
@@ -0,0 +1,181 @@
1
+ # PrizmKit Workflow State Protocol
2
+
3
+ `workflow-state.json` is lifecycle runtime metadata for one formal requirement. It preserves stage handoff, repair routing, orchestrator ownership, and resume information without replacing authoritative artifacts or any host-owned execution checkpoint.
4
+
5
+ ## Location and Identity
6
+
7
+ ```text
8
+ .prizmkit/state/workflows/<requirement-slug>.json
9
+ ```
10
+
11
+ The state file is created only when a lifecycle runs. The active `artifact_dir` is the generic requirement artifact root and must be preserved exactly across every stage:
12
+
13
+ ```text
14
+ .prizmkit/specs/<requirement-slug>/
15
+ .prizmkit/bugfix/<bug-id>/
16
+ .prizmkit/refactor/<refactor-id>/
17
+ ```
18
+
19
+ Never select a different most-recent plan when resuming or handing off. Any execution checkpoint maintained by an external host remains separate from this lifecycle state. Never merge, substitute, or infer one schema from the other. The target project controls whether generated `.prizmkit/` files are committed, ignored, or shared.
20
+
21
+ ## Authority
22
+
23
+ The state file is an index, not the authority for stage completion:
24
+
25
+ | Information | Authority |
26
+ |---|---|
27
+ | Requirement goals and acceptance criteria | `{artifact_dir}/spec.md` |
28
+ | Implementation tasks and completion | `{artifact_dir}/plan.md` plus current workspace |
29
+ | Review findings and verdict | `{artifact_dir}/review-report.md` final result |
30
+ | Test execution, verdict, and repair scope | Validated evidence package and authoritative `verdict.json` |
31
+ | Test report presentation | `{artifact_dir}/test-report.md` as a derived view only |
32
+ | Retrospective completion and result | `{artifact_dir}/retrospective-result.json` |
33
+ | Durable architecture knowledge | `.prizmkit/prizm-docs/` |
34
+ | Local commit | Git history and confirmed or authorized commit identity |
35
+ | Current stage, orchestrator, and resume entry | Workflow state |
36
+ | External orchestration progress | The external host's own checkpoint, never this state |
37
+
38
+ Every consumer compares workflow state with authoritative artifacts and the current workspace. Missing or stale state is reconstructed from those sources and is never accepted as success by itself.
39
+
40
+ ## Schema
41
+
42
+ ```json
43
+ {
44
+ "schema_version": 1,
45
+ "artifact_dir": ".prizmkit/specs/example",
46
+ "orchestrator": "prizmkit-workflow",
47
+ "stage": "test",
48
+ "status": "TEST_PASS",
49
+ "stage_result": "TEST_PASS",
50
+ "completed_stages": ["plan", "implement", "code-review", "test"],
51
+ "repair_scope": null,
52
+ "repair_round": 0,
53
+ "next_stage": "retrospective",
54
+ "resume_from": "prizmkit-retrospective"
55
+ }
56
+ ```
57
+
58
+ ### Fields
59
+
60
+ | Field | Meaning |
61
+ |---|---|
62
+ | `schema_version` | State schema version. Current value is `1`. |
63
+ | `artifact_dir` | The single generic requirement artifact root reused by every stage. |
64
+ | `orchestrator` | `prizmkit-workflow`, another semantic coordinator identifier, or `null` for direct stage use. |
65
+ | `stage` | The stage that most recently wrote state. |
66
+ | `status` | Lifecycle progression status, distinct from the domain `stage_result`. |
67
+ | `stage_result` | Domain result such as `PASS`, `NEEDS_FIXES`, `TEST_*`, `DOCS_UPDATED`, or `NO_DOC_CHANGE`. |
68
+ | `completed_stages` | Ordered stages completed for this requirement. |
69
+ | `repair_scope` | `null`, `test-infrastructure`, `production`, `runtime`, `schema`, `dependency`, `public-interface`, or `unknown`. |
70
+ | `repair_round` | Outer cross-stage repair round, from `0` through `3`. |
71
+ | `next_stage` | Next semantic stage, or `null` after commit. |
72
+ | `resume_from` | Exact atomic skill that can resume, or `null` after commit. |
73
+
74
+ ## Lifecycle and Verdict Mappings
75
+
76
+ The mandatory formal lifecycle is:
77
+
78
+ ```text
79
+ PLAN_READY
80
+ → IMPLEMENTED
81
+ → REVIEW_PASS
82
+ → TEST_PASS
83
+ → RETRO_COMPLETE
84
+ → COMMIT_PENDING
85
+ → COMMITTED
86
+ ```
87
+
88
+ No formal stage is silently optional. Domain evidence maps as follows:
89
+
90
+ ```text
91
+ review-report final PASS → status=REVIEW_PASS, stage_result=PASS
92
+ review-report final NEEDS_FIXES → status=REVIEW_NEEDS_FIXES, stage_result=NEEDS_FIXES
93
+ validated verdict TEST_PASS → status=TEST_PASS, stage_result=TEST_PASS
94
+ validated verdict TEST_FAIL → status=TEST_FAIL, stage_result=TEST_FAIL
95
+ validated verdict TEST_BLOCKED → status=TEST_BLOCKED, stage_result=TEST_BLOCKED
96
+ retrospective result DOCS_UPDATED → status=RETRO_COMPLETE, stage_result=DOCS_UPDATED
97
+ retrospective result NO_DOC_CHANGE → status=RETRO_COMPLETE, stage_result=NO_DOC_CHANGE
98
+ ```
99
+
100
+ `RETRO_COMPLETE` is the stable completion status. `DOCS_UPDATED` and `NO_DOC_CHANGE` are mutually exclusive retrospective results, not substitute statuses. A derived Markdown test report never establishes a `TEST_*` status without validated authoritative evidence.
101
+
102
+ ## Repair Routing
103
+
104
+ ```text
105
+ REVIEW_NEEDS_FIXES
106
+ → implement
107
+ → code-review
108
+ → test
109
+
110
+ TEST_FAIL with repair_scope=test-infrastructure
111
+ → implement
112
+ → test
113
+
114
+ TEST_FAIL with repair_scope=production|runtime|schema|dependency|public-interface
115
+ → implement
116
+ → code-review
117
+ → test
118
+
119
+ TEST_FAIL with repair_scope=unknown
120
+ → conservative production route only when safe
121
+ → otherwise WORKFLOW_BLOCKED
122
+
123
+ TEST_BLOCKED
124
+ → never make speculative production edits
125
+ → interactive execution stops with a prizmkit-test resume entry
126
+ → a trusted headless host may perform bounded environment recovery, then records WORKFLOW_BLOCKED if unresolved
127
+
128
+ RETRO_BLOCKED
129
+ → WORKFLOW_BLOCKED
130
+ WORKFLOW_BLOCKED
131
+ → resume only after the recorded blocker is resolved
132
+ ```
133
+
134
+ The outer workflow permits at most three automatic repair rounds. These are cross-stage rounds (`repair_round` `0` through `3`). The code-review internal loop permits at most ten completed review rounds and is separate; review-internal repairs do not increment the outer counter.
135
+
136
+ ## Orchestrator Ownership and Handoff
137
+
138
+ 1. An atomic stage performs only its own stage, writes the truthful terminal result and `next_stage`, and returns control.
139
+ 2. When `orchestrator` is non-null, only that orchestrator invokes the next skill. The atomic stage must not auto-invoke it again.
140
+ 3. Direct stage use may report one deterministic next invocation but does not claim the next stage ran.
141
+ 4. Every handoff preserves the same `artifact_dir`.
142
+ 5. External automation invokes atomic stages directly and does not invoke `prizmkit-workflow` as a nested coordinator.
143
+ 6. Workflow state never replaces or absorbs an external host's checkpoint.
144
+
145
+ ## Commit Authorization
146
+
147
+ Interactive execution:
148
+
149
+ ```text
150
+ committer previews intended files and message
151
+ → waits for explicit confirmation from the current user
152
+ → creates the local commit
153
+ ```
154
+
155
+ Trusted headless execution:
156
+
157
+ ```text
158
+ a trusted host explicitly authorizes the current local task commit
159
+ → host injects mode=<host-defined-headless-mode>, owner=<trusted-host-identifier>,
160
+ local_commit_authorized=true, push_authorized=false
161
+ → committer verifies gates and commits automatically
162
+ → no question, wait, or push is permitted
163
+ ```
164
+
165
+ A self-declared or otherwise untrusted headless context does not authorize a commit. Push is never implied by either mode.
166
+
167
+ ## Recovery
168
+
169
+ When state is missing, stale, or inconsistent:
170
+
171
+ 1. Read `spec.md` and `plan.md` from `artifact_dir` only when they are not already available in current context.
172
+ 2. Inspect task markers and the current workspace.
173
+ 3. Read the latest review report and final result when needed to establish review authority.
174
+ 4. Validate authoritative test evidence and `repair_scope`.
175
+ 5. Validate `retrospective-result.json` when retrospective is claimed complete.
176
+ 6. Verify the commit when commit is claimed complete.
177
+ 7. When an external host is active, let that host validate its own checkpoint independently; never merge the schemas.
178
+ 8. Reconstruct the latest safe predecessor and report the reconstruction.
179
+ 9. Continue only from the first incomplete or invalid stage.
180
+
181
+ Stale state never bypasses review, testing, retrospective, commit authorization, or external host checkpoint enforcement.
@@ -1,284 +1,105 @@
1
1
  ---
2
2
  name: "recovery-workflow"
3
- description: "Recover and resume interrupted PrizmKit workflow or pipeline sessions. Auto-detects feature-workflow, bug-fix-workflow, refactor-workflow, plan lists, pipeline state, git branches, diffs, spec/plan artifacts, review artifacts, and session summaries; then offers recovery script, manual command, interactive resume, clean retry, or start-fresh options. Use when an AI CLI session timed out, crashed, hit token limits, left partial work, or the user says recover, resume, continue where I left off, pick up where it left off, or salvage partial work."
3
+ description: "Return the exact PrizmKit CLI command that continues an interrupted feature, bugfix, or refactor task on its recorded task branch. Use when a pipeline process or AI session stopped unexpectedly and the user asks to recover, resume, continue, pick up, or salvage that task. This skill detects active task checkout records and reports commands; it does not reconstruct lifecycle phases or run recovery prompts."
4
4
  ---
5
5
 
6
6
  # Recovery Workflow
7
7
 
8
- Recover interrupted workflow or pipeline work. This skill is intentionally different from the ordinary feature/bug/refactor workflows: the success criterion is high-quality continuation of interrupted work, not structural consistency with other workflows.
8
+ Find an interrupted pipeline task's durable checkout record and return the existing runtime command that continues that task on its recorded branch. The runtime already owns branch reuse, checkpoint interpretation, session continuation, and task execution; this skill must not reproduce those mechanisms.
9
9
 
10
- ## When to Use
10
+ ## Boundary
11
11
 
12
- Use this skill when the user says:
13
- - Recover, resume, continue where I left off, or pick up where it left off.
14
- - Session interrupted, timed out, crashed, or hit token limits.
15
- - A pipeline/AI session left partial work and the user wants to salvage or complete it.
16
- - The user does not know whether the interrupted work was feature, bug fix, or refactor work.
12
+ This workflow:
13
+ - Detects active feature, bugfix, and refactor task checkout records.
14
+ - Confirms that each recorded task branch still exists.
15
+ - Returns the exact item-specific `cli.py ... run <TASK_ID>` command.
16
+ - Shows the branch, task family, task ID, and checkout record that justify the command.
17
17
 
18
- Do not use this skill when:
19
- - The user only wants normal pipeline status/logs/stop/retry for a healthy pipeline -> use the matching launcher.
20
- - The user explicitly wants a clean retry of one pipeline item -> use the matching launcher reset guidance.
21
- - The user wants to discard all interrupted work and start fresh -> route to the original workflow after confirmation.
18
+ This workflow does not:
19
+ - Infer implementation, review, test, retrospective, or commit phases.
20
+ - Inspect historical artifact directories to guess interrupted work.
21
+ - Generate a recovery bootstrap prompt or launch a separate recovery AI session.
22
+ - Reset state, delete branches, discard work, or execute the continuation command automatically.
23
+ - Treat completed checkout records, old session logs, plan lists, or stale checkpoint files as active interruptions.
22
24
 
23
- ## Recovery Approach Policy
25
+ ## Detection
24
26
 
25
- Always present the user with recovery choices after detection. Do not silently choose between script recovery and interactive recovery.
26
-
27
- Recommended default:
28
- - Use `python3 ./.prizmkit/dev-pipeline/cli.py recovery run` when the interrupted work appears to be a pipeline or AI-session continuation problem and the user wants autonomous completion.
29
-
30
- Interactive recovery remains valid when:
31
- - The user wants control in the current conversation.
32
- - The recovery script is unavailable or fails.
33
- - The interrupted work is a small current-workspace Fast Path task.
34
- - The user wants to inspect before launching another AI session.
35
-
36
- Clean retry is different from recovery:
37
- - Use clean retry when the user wants to discard the failed item attempt and rerun from scratch.
38
- - Use recovery when partial work, context, or decisions should be preserved.
39
-
40
- ## Detection Signals
41
-
42
- Inspect multiple signals. Do not depend on a single artifact.
43
-
44
- | Signal | Meaning |
45
- |---|---|
46
- | Current branch | `fix/*`, `feat/*`, `refactor/*`, or task-specific branch names can indicate workflow family |
47
- | Git diff / staged / untracked files | Shows partial implementation or planning work |
48
- | `spec.md` / `plan.md` | Current-session Fast Path planning artifacts |
49
- | `.prizmkit/plans/feature-list.json` | Feature pipeline planning artifact |
50
- | `.prizmkit/plans/bug-fix-list.json` | Bugfix pipeline planning artifact |
51
- | `.prizmkit/plans/refactor-list.json` | Refactor pipeline planning artifact |
52
- | `.prizmkit/state/features/` | Feature pipeline state |
53
- | `.prizmkit/state/bugfix/` | Bugfix pipeline state |
54
- | `.prizmkit/state/refactor/` | Refactor pipeline state |
55
- | `session-summary.md` / `context-snapshot.md` | Previous-session context handoff |
56
- | Review artifacts | Evidence that implementation reached review |
57
- | `.prizmkit/bugfix/<BUG_ID>/fix-plan.md` / `fix-report.md` | Optional bug recovery signals when present, not required contract |
58
-
59
- Run the detection script for the first pass:
27
+ Run the bundled detector from the target project root:
60
28
 
61
29
  ```bash
62
- python3 ${SKILL_DIR}/scripts/detect-recovery-state.py
63
- ```
64
-
65
- For the signature matching and phase inference tables, read `${SKILL_DIR}/references/detection.md`.
66
-
67
- ## Recovery Flow
68
-
69
- ### Phase 0: Auto-detect
70
-
71
- 1. Run the detection script.
72
- 2. If the script fails, fall back to manual checks: branch, git status, list files, pipeline state directories, and obvious session artifacts.
73
- 3. Identify primary workflow family: bug-fix, feature, refactor, or unknown.
74
- 4. Identify whether the work is current-workspace Fast Path, planned pipeline work, active pipeline work, failed pipeline item, or ambiguous.
75
-
76
- Checkpoint: recovery target and likely phase are known, or no workflow is detected.
77
-
78
- ### Phase 1: Diagnose workspace health
79
-
80
- Before recommending recovery, inspect and summarize:
81
-
82
- - Current branch.
83
- - Whether the working tree has uncommitted changes.
84
- - Whether code/test files changed.
85
- - Which plan lists exist.
86
- - Which pipeline state directories exist.
87
- - Failed, in-progress, pending, and completed items when status commands are available.
88
- - Residual task branches that may correspond to failed/interrupted work.
89
- - Detected artifacts such as `spec.md`, `plan.md`, review reports, session summaries, or optional bugfix reports.
90
-
91
- Use concise markdown, not box-drawing banners:
92
-
93
- ```markdown
94
- ## Workspace Diagnosis
95
-
96
- - Branch: fix/B-001-login-crash
97
- - Working tree: 3 uncommitted files
98
- - Code changes: 2 source files, 1 test file
99
- - Plan lists: bug-fix-list.json found
100
- - Pipeline state: bugfix has 1 failed item
101
- - Session artifacts: plan.md found, review report not found
102
-
103
- ## Detected Recovery Target
104
-
105
- - Workflow: bug-fix-workflow
106
- - Likely phase: Review
107
- - Reason: fix branch + code changes + no review artifact
108
- - Remaining work: review -> verification -> commit -> merge decision
30
+ python3 ${SKILL_DIR}/scripts/detect-recovery-state.py --project-root .
109
31
  ```
110
32
 
111
- If code changes exist, run or suggest the project test command when it is safe and reasonably detectable. Report failures without hiding them.
112
-
113
- ### Phase 2: Select recovery target
114
-
115
- If multiple failed or interrupted targets exist, use `AskUserQuestion` to choose the first target.
116
-
117
- For up to three targets, list each target explicitly plus an all-sequential option. If there are more than three targets, group choices to avoid an overloaded question:
33
+ The detector reads only active checkout records:
118
34
 
119
35
  ```text
120
- Question: Multiple interrupted targets found. Which should we recover first?
121
- Header: Target
122
- Options:
123
- - Highest-priority failed item — recover the most urgent failed item first
124
- - Choose from summary — show full target list before selecting
125
- - Recover all sequentially — recover each failed/interrupted item in priority order
126
- - Stop here — do not recover now
36
+ .prizmkit/state/features/<F-NNN>/checkout.json
37
+ .prizmkit/state/bugfix/<B-NNN>/checkout.json
38
+ .prizmkit/state/refactor/<R-NNN>/checkout.json
127
39
  ```
128
40
 
129
- ### Phase 3: Select recovery approach
41
+ A candidate is resumable only when:
42
+ - `state` is `active`;
43
+ - `task_id` matches its task family;
44
+ - `active_dev_branch` is present; and
45
+ - the recorded local branch still exists.
130
46
 
131
- Use `AskUserQuestion` for the approach. Do not proceed without an explicit selection.
47
+ The runtime uses the same checkout record when the returned command starts, so it continues on the recorded branch rather than creating a new branch.
132
48
 
133
- ```text
134
- Question: Interrupted work was detected. How would you like to recover?
135
- Header: Recovery
136
- Options:
137
- - Run recovery script (Recommended) — execute python3 ./.prizmkit/dev-pipeline/cli.py recovery run to generate a bootstrap prompt and complete remaining phases in a dedicated AI session
138
- - Resume interactively — continue from the inferred phase in this conversation
139
- - Clean retry — discard the failed item attempt and rerun it from scratch through the matching launcher reset flow
140
- - Start fresh — abandon interrupted work and restart the original workflow
141
- ```
49
+ ## Selection
142
50
 
143
- If the user wants to inspect first, offer:
51
+ ### One candidate
144
52
 
145
- ```bash
146
- python3 ./.prizmkit/dev-pipeline/cli.py recovery detect
147
- python3 ./.prizmkit/dev-pipeline/cli.py recovery run --dry-run
148
- ```
53
+ Return that candidate immediately. Do not add another confirmation round because this skill only reports a command and does not execute it.
149
54
 
150
- ### Phase 4: Execute the selected approach
55
+ ### Multiple candidates
151
56
 
152
- **Run recovery script**:
57
+ Use `AskUserQuestion` to ask which task to continue. Label each option with:
153
58
 
154
- ```bash
155
- python3 ./.prizmkit/dev-pipeline/cli.py recovery run
59
+ ```text
60
+ <TASK_ID> <family> — <branch>
156
61
  ```
157
62
 
158
- After launch, stop this skill and report how the user can monitor the recovery session.
63
+ After selection, return only the selected task's continuation block.
159
64
 
160
- **Resume interactively**:
65
+ ### No candidate
161
66
 
162
- 1. Read the target workflow SKILL.md.
163
- 2. Read available context artifacts in this order:
164
- - `context-snapshot.md` when present.
165
- - `session-summary.md` when present.
166
- - `spec.md`, `plan.md`, review reports, relevant diffs, and list entries.
167
- 3. Read relevant `.prizmkit/prizm-docs/` according to the project progressive-loading protocol.
168
- 4. Continue from the inferred phase using the target workflow's rules.
169
- 5. Preserve existing work where safe; do not restart from scratch unless the user chooses that.
67
+ Report that no active interrupted pipeline task branch was found. Do not fall back to branch-name, plan-list, diff, or artifact guesses. Suggest the matching scenario workflow for fresh work, or the matching pipeline launcher when the user already has a validated plan list and only needs a runtime command.
170
68
 
171
- **Clean retry**:
69
+ ## Continuation Commands
172
70
 
173
- Route to the matching launcher reset flow:
71
+ Return the detector-provided command verbatim. The canonical forms are:
174
72
 
175
73
  ```bash
176
- python3 ./.prizmkit/dev-pipeline/cli.py reset feature <FEATURE_ID> --clean --run .prizmkit/plans/feature-list.json
177
- python3 ./.prizmkit/dev-pipeline/cli.py reset bugfix <BUG_ID> --clean --run .prizmkit/plans/bug-fix-list.json
178
- python3 ./.prizmkit/dev-pipeline/cli.py reset refactor <REFACTOR_ID> --clean --run .prizmkit/plans/refactor-list.json
74
+ python3 ./.prizmkit/dev-pipeline/cli.py feature run F-001
75
+ python3 ./.prizmkit/dev-pipeline/cli.py bugfix run B-001
76
+ python3 ./.prizmkit/dev-pipeline/cli.py refactor run R-001
179
77
  ```
180
78
 
181
- Ask before running a clean retry because it intentionally discards that item's prior session state.
182
-
183
- **Start fresh**:
184
-
185
- Suggest the original workflow:
186
- - `feature-workflow`
187
- - `bug-fix-workflow`
188
- - `refactor-workflow`
189
-
190
- Stop after the user confirms restart.
191
-
192
- ## Per-Workflow Recovery Notes
193
-
194
- ### Bug-fix recovery
195
-
196
- Bug-fix recovery should not assume `fix-plan.md` or `fix-report.md` exists. Use them when present, but also infer from:
197
-
198
- - `fix/*` branch.
199
- - Code/test diff.
200
- - `spec.md` / `plan.md`.
201
- - Review artifacts.
202
- - Commits ahead of the original branch.
203
- - User-provided bug ID or matching bug-fix-list entry.
204
-
205
- Typical inference:
206
-
207
- | Detected state | Resume from |
208
- |---|---|
209
- | Fix branch, no implementation artifacts | Diagnosis / triage |
210
- | `spec.md` or `plan.md`, no code changes | Fix implementation |
211
- | Code/test changes, no review artifact | Review |
212
- | Review artifact or optional `fix-report.md` | User verification |
213
- | Fix commit exists on branch | Merge decision |
79
+ Do not prepend `git checkout`. The runtime resolves the durable checkout identity and continues the task on its recorded branch or linked worktree.
214
80
 
215
- ### Feature recovery
81
+ Do not replace continuation with any reset command. Reset and clean-reset are separate destructive operations owned by the matching pipeline launcher.
216
82
 
217
- Feature recovery is usually list/pipeline driven:
218
-
219
- | Detected state | Resume from |
220
- |---|---|
221
- | No feature list and no Fast Path artifacts | Route selection or feature clarification |
222
- | Valid feature list, no pipeline state | `feature-pipeline-launcher` launch |
223
- | Feature list plus pipeline state | `feature-pipeline-launcher` status/retry or recovery script |
224
- | Current-workspace Fast Path artifacts | Continue `/prizmkit-implement`, review, retrospective, or commit based on state |
225
-
226
- ### Refactor recovery
227
-
228
- Refactor recovery mirrors feature recovery but must preserve behavior checks:
229
-
230
- | Detected state | Resume from |
231
- |---|---|
232
- | No refactor list and no Fast Path artifacts | Route selection or refactor clarification |
233
- | Valid refactor list, no pipeline state | `refactor-pipeline-launcher` launch |
234
- | Refactor list plus pipeline state | `refactor-pipeline-launcher` status/retry or recovery script |
235
- | Current-workspace Fast Path artifacts | Continue implementation, behavior checks, review, retrospective, or commit based on state |
236
-
237
- ## Runtime Status Reference
83
+ ## Output
238
84
 
239
- Recovery may inspect pipeline state before choosing recovery, interactive resume, or clean retry. Use the canonical Python runtime forms:
85
+ Use this exact structure:
240
86
 
241
- ```bash
242
- python3 ./.prizmkit/dev-pipeline/cli.py recovery run
243
- python3 ./.prizmkit/dev-pipeline/cli.py recovery detect
244
- python3 ./.prizmkit/dev-pipeline/cli.py feature status .prizmkit/plans/feature-list.json
245
- python3 ./.prizmkit/dev-pipeline/cli.py bugfix status .prizmkit/plans/bug-fix-list.json
246
- python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
247
- python3 ./.prizmkit/dev-pipeline/cli.py reset feature <F-XXX> --clean --run .prizmkit/plans/feature-list.json
248
- python3 ./.prizmkit/dev-pipeline/cli.py reset bugfix <B-XXX> --clean --run .prizmkit/plans/bug-fix-list.json
87
+ ```text
88
+ INTERRUPTED_TASK_FOUND
89
+ family: <feature | bugfix | refactor>
90
+ task_id: <F-NNN | B-NNN | R-NNN>
91
+ branch: <recorded active_dev_branch>
92
+ checkout: <project-relative checkout.json path>
93
+ command:
94
+ python3 ./.prizmkit/dev-pipeline/cli.py <family> run <TASK_ID>
95
+
96
+ execution: not performed
249
97
  ```
250
98
 
251
- Use the matching launcher for healthy status/logs/retry flows. Use clean retry only after explicit user confirmation because it discards the selected item session state.
252
-
253
- ## Error Handling
254
-
255
- | Scenario | Action |
256
- |---|---|
257
- | No workflow signature matches | Report no interrupted workflow detected and suggest original workflow skills |
258
- | Multiple workflows match | Present the evidence and ask which target to recover first |
259
- | Branch and artifacts disagree | Trust git diff/status as ground truth, but report the discrepancy |
260
- | Detection script fails | Fall back to manual detection checks |
261
- | Tests fail during diagnosis | Report failures and ask whether to continue recovery, fix tests, or stop |
262
- | Recovery script unavailable | Offer interactive recovery or clean retry |
263
- | Clean retry requested with uncommitted changes | Warn that retry may discard item session state; ask for explicit confirmation |
264
-
265
- ## Relationship to Other Skills
266
-
267
- | Skill or command | Relationship |
268
- |---|---|
269
- | `feature-workflow` | Recovery target for interrupted feature workflows |
270
- | `bug-fix-workflow` | Recovery target for interrupted bug-fix workflows |
271
- | `refactor-workflow` | Recovery target for interrupted refactor workflows |
272
- | `feature-pipeline-launcher` | Status/logs/retry for healthy or resumable feature pipelines |
273
- | `bugfix-pipeline-launcher` | Status/logs/retry for healthy or resumable bugfix pipelines |
274
- | `refactor-pipeline-launcher` | Status/logs/retry for healthy or resumable refactor pipelines |
275
- | `/prizmkit-code-review` | Used when interactive recovery resumes at review |
276
- | `/prizmkit-committer` | Used when interactive recovery resumes at commit |
277
- | `python3 ./.prizmkit/dev-pipeline/cli.py recovery run` | Dedicated script recovery counterpart |
278
-
279
- ## Output
99
+ When no candidate exists:
280
100
 
281
- - Recovery diagnosis summary.
282
- - User-selected recovery target and approach.
283
- - Either launched recovery script, interactive continuation, clean retry command, or start-fresh handoff.
284
- - Final recovery summary when interactive recovery completes.
101
+ ```text
102
+ NO_INTERRUPTED_TASK_FOUND
103
+ reason: no active checkout record with an existing task branch
104
+ execution: not performed
105
+ ```
@@ -1,53 +1,37 @@
1
1
  {
2
2
  "skill_name": "recovery-workflow",
3
- "notes": "These test cases require workspace state setup. Recovery now treats fix-plan.md and fix-report.md as optional signals; branch, diff, spec.md, plan.md, review artifacts, and pipeline state are also valid recovery signals.",
3
+ "notes": "Recovery reports item-specific continuation commands from active durable checkout records. It does not reconstruct lifecycle phases or launch a separate recovery session.",
4
4
  "evals": [
5
5
  {
6
6
  "id": 1,
7
- "name": "bugfix-mid-fix-with-plan",
8
- "prompt": "My session broke, help me recover",
9
- "expected_output": "Should auto-detect bug-fix-workflow from fix/B-001-* branch. Should detect fix-plan.md + code changes as optional plan signal plus implementation diff -> infer Review. Should display recovery report with workflow type, phase, artifacts, and code stats. Should ask recovery approach before invoking /prizmkit-code-review or recovery script.",
10
- "setup_description": "Create fix/B-001-login-crash branch, optional .prizmkit/bugfix/B-001/fix-plan.md, modify 3 source files + 1 test file. No fix-report.md, no commits ahead of main.",
7
+ "name": "single-feature-interruption",
8
+ "prompt": "My feature pipeline process stopped. Give me the command to continue it.",
9
+ "expected_output": "Detect one active feature checkout record with an existing branch and return python3 ./.prizmkit/dev-pipeline/cli.py feature run F-001 without executing it.",
10
+ "setup_description": "Create .prizmkit/state/features/F-001/checkout.json with state active and an existing dev/F-001-* local branch.",
11
11
  "files": []
12
12
  },
13
13
  {
14
14
  "id": 2,
15
- "name": "bugfix-diff-no-fix-plan",
16
- "prompt": "Continue the previous bug fix",
17
- "expected_output": "Should auto-detect bug-fix-workflow from fix/B-002-* branch even without fix-plan.md. Code/test changes should infer Review. Should not require .prizmkit/bugfix/B-002/fix-plan.md to exist.",
18
- "setup_description": "Create fix/B-002-null-pointer branch and modify 2 source files + 1 test file. No .prizmkit/bugfix/B-002 directory, no fix-plan.md, no fix-report.md.",
15
+ "name": "single-bugfix-interruption",
16
+ "prompt": "Resume the interrupted bugfix task.",
17
+ "expected_output": "Detect the active bugfix checkout and return python3 ./.prizmkit/dev-pipeline/cli.py bugfix run B-001 without reconstructing phases or executing the command.",
18
+ "setup_description": "Create .prizmkit/state/bugfix/B-001/checkout.json with state active and an existing bugfix/B-001-* local branch.",
19
19
  "files": []
20
20
  },
21
21
  {
22
22
  "id": 3,
23
- "name": "bugfix-plan-only",
24
- "prompt": "Continue the previous work",
25
- "expected_output": "Should auto-detect bug-fix-workflow from fix/B-003-* branch. Should detect spec.md or plan.md but no code changes -> infer Fix. Should read the plan artifact and resume implementation only after user chooses interactive recovery.",
26
- "setup_description": "Create fix/B-003-null-pointer branch with spec.md and plan.md. No code changes.",
23
+ "name": "multiple-interrupted-tasks",
24
+ "prompt": "Continue whichever pipeline task was interrupted.",
25
+ "expected_output": "Detect multiple active checkout records and ask the user to select by task ID, family, and branch before returning one command.",
26
+ "setup_description": "Create active feature and refactor checkout records whose local branches both exist.",
27
27
  "files": []
28
28
  },
29
29
  {
30
30
  "id": 4,
31
- "name": "feature-list-exists",
32
- "prompt": "resume",
33
- "expected_output": "Should auto-detect feature-workflow from .prizmkit/plans/feature-list.json. Should detect list exists but no pipeline state -> infer Launch. Should ask recovery approach; launcher handoff is valid after user selection.",
34
- "setup_description": "On main branch, create .prizmkit/plans/feature-list.json with 3 features. No .prizmkit/state/features/ directory.",
35
- "files": []
36
- },
37
- {
38
- "id": 5,
39
- "name": "refactor-monitoring",
40
- "prompt": "pick up where it left off",
41
- "expected_output": "Should auto-detect refactor-workflow from .prizmkit/plans/refactor-list.json + pipeline state. Should infer Monitor / Recover Pipeline. Should ask whether to run recovery script, resume interactively, clean retry, or start fresh.",
42
- "setup_description": "On main branch, create .prizmkit/plans/refactor-list.json with 2 items. Create .prizmkit/state/refactor/ with status files showing 1 completed, 1 in-progress.",
43
- "files": []
44
- },
45
- {
46
- "id": 6,
47
- "name": "no-workflow-detected",
48
- "prompt": "recover",
49
- "expected_output": "Should detect no workflow signatures in workspace. Should display guidance suggesting /feature-workflow, /bug-fix-workflow, or /refactor-workflow. Should NOT attempt recovery actions.",
50
- "setup_description": "Clean workspace on main branch. No .prizmkit/plans/*.json files, no pipeline state, no fix/* or feat/* or refactor/* branch, no spec.md or plan.md.",
31
+ "name": "historical-state-only",
32
+ "prompt": "Recover the previous pipeline task.",
33
+ "expected_output": "Return NO_INTERRUPTED_TASK_FOUND because completed checkout records, plan lists, session logs, and old checkpoints are not active interruptions.",
34
+ "setup_description": "Create only completed checkout records plus historical sessions and checkpoints.",
51
35
  "files": []
52
36
  }
53
37
  ]