prizmkit 1.1.154 → 1.1.156

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 (164) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codex/skill-adapter.js +1 -1
  3. package/bundled/adapters/pi/skill-adapter.js +2 -1
  4. package/bundled/dev-pipeline/.env.example +2 -6
  5. package/bundled/dev-pipeline/README.md +21 -27
  6. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +341 -15
  7. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +0 -3
  8. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +1 -15
  9. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +48 -14
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +50 -2
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -9
  12. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +3 -3
  13. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +120 -22
  14. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +482 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +64 -11
  16. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +145 -367
  17. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +91 -62
  18. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +105 -69
  19. package/bundled/dev-pipeline/scripts/prompt_framework.py +36 -41
  20. package/bundled/dev-pipeline/scripts/update-bug-status.py +1 -4
  21. package/bundled/dev-pipeline/scripts/update-checkpoint.py +61 -13
  22. package/bundled/dev-pipeline/scripts/update-feature-status.py +1 -4
  23. package/bundled/dev-pipeline/scripts/update-refactor-status.py +1 -4
  24. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +22 -27
  25. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +71 -104
  26. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +59 -111
  27. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +37 -72
  28. package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +39 -0
  29. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +3 -1
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +8 -25
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +3 -3
  32. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +2 -2
  33. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +3 -3
  34. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -2
  35. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +4 -4
  36. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +0 -1
  37. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +7 -4
  38. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +14 -27
  39. package/bundled/dev-pipeline/templates/sections/feature-completion-summary.md +20 -0
  40. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +8 -71
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +7 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +3 -3
  43. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +4 -4
  44. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +5 -17
  45. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +3 -1
  46. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +10 -23
  47. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +2 -2
  48. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +2 -2
  49. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +3 -3
  50. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +2 -2
  51. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +7 -7
  52. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -1
  53. package/bundled/dev-pipeline/templates/sections/retrospective.md +12 -0
  54. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +35 -0
  55. package/bundled/dev-pipeline/templates/session-status-schema.json +45 -62
  56. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +469 -18
  57. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +262 -175
  58. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +62 -23
  59. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +76 -28
  60. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +168 -18
  61. package/bundled/dev-pipeline/tests/test_recovery_workflow.py +111 -0
  62. package/bundled/dev-pipeline/tests/test_reset_preserve.py +0 -2
  63. package/bundled/dev-pipeline/tests/test_runtime_commit.py +608 -0
  64. package/bundled/dev-pipeline/tests/test_unified_cli.py +167 -25
  65. package/bundled/skills/_metadata.json +9 -9
  66. package/bundled/skills/app-planner/SKILL.md +3 -3
  67. package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
  68. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +56 -64
  69. package/bundled/skills/app-planner/references/rules/backend/fixed-rules.md +85 -240
  70. package/bundled/skills/app-planner/references/rules/backend/question-bank.md +25 -25
  71. package/bundled/skills/app-planner/references/rules/backend/question-manifest.json +16 -7
  72. package/bundled/skills/app-planner/references/rules/backend/template.md +74 -92
  73. package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +93 -93
  74. package/bundled/skills/app-planner/references/rules/database/fixed-rules.md +66 -173
  75. package/bundled/skills/app-planner/references/rules/database/question-bank.md +31 -26
  76. package/bundled/skills/app-planner/references/rules/database/question-manifest.json +13 -4
  77. package/bundled/skills/app-planner/references/rules/database/template.md +76 -98
  78. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +68 -95
  79. package/bundled/skills/app-planner/references/rules/frontend/fixed-rules.md +93 -166
  80. package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +46 -36
  81. package/bundled/skills/app-planner/references/rules/frontend/question-manifest.json +11 -2
  82. package/bundled/skills/app-planner/references/rules/frontend/template.md +79 -257
  83. package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +91 -99
  84. package/bundled/skills/app-planner/references/rules/mobile/fixed-rules.md +73 -246
  85. package/bundled/skills/app-planner/references/rules/mobile/question-bank.md +17 -17
  86. package/bundled/skills/app-planner/references/rules/mobile/question-manifest.json +17 -2
  87. package/bundled/skills/app-planner/references/rules/mobile/template.md +73 -85
  88. package/bundled/skills/app-planner/references/rules-configuration.md +133 -65
  89. package/bundled/skills/app-planner/scripts/validate-rules-configuration.py +291 -0
  90. package/bundled/skills/prizmkit/SKILL.md +17 -18
  91. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +22 -18
  92. package/bundled/skills/prizmkit-code-review/SKILL.md +22 -58
  93. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +6 -6
  94. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +2 -2
  95. package/bundled/skills/prizmkit-committer/SKILL.md +82 -132
  96. package/bundled/skills/prizmkit-deploy/SKILL.md +27 -11
  97. package/bundled/skills/prizmkit-deploy/assets/deploy-document-template.md +89 -0
  98. package/bundled/skills/prizmkit-deploy/references/ci-cd-workflows.md +44 -14
  99. package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +19 -3
  100. package/bundled/skills/prizmkit-deploy/references/database-setup.md +22 -12
  101. package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +3 -1
  102. package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +22 -6
  103. package/bundled/skills/prizmkit-deploy/references/deploy-metadata-schema.json +49 -0
  104. package/bundled/skills/prizmkit-deploy/references/live-validation-notes.md +1 -1
  105. package/bundled/skills/prizmkit-deploy/references/pending-input-schema.json +164 -0
  106. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +9 -8
  107. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +6 -6
  108. package/bundled/skills/prizmkit-implement/SKILL.md +30 -66
  109. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +4 -4
  110. package/bundled/skills/prizmkit-init/SKILL.md +4 -0
  111. package/bundled/skills/prizmkit-plan/SKILL.md +21 -64
  112. package/bundled/skills/prizmkit-plan/references/artifact-identity.md +38 -0
  113. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +4 -4
  114. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +5 -5
  115. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +75 -11
  116. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +191 -56
  117. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +18 -18
  118. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +14 -8
  119. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +12 -5
  120. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +23 -12
  121. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +13 -9
  122. package/bundled/skills/prizmkit-retrospective/SKILL.md +94 -97
  123. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +79 -37
  124. package/bundled/skills/prizmkit-retrospective/references/retrospective-result-schema.json +138 -0
  125. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +111 -54
  126. package/bundled/skills/prizmkit-test/SKILL.md +64 -51
  127. package/bundled/skills/prizmkit-test/references/boundary-contract-and-test-double-guidance.md +206 -0
  128. package/bundled/skills/prizmkit-test/references/independent-test-review.md +17 -9
  129. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +45 -21
  130. package/bundled/skills/prizmkit-test/references/test-report-template.md +20 -13
  131. package/bundled/skills/prizmkit-workflow/SKILL.md +35 -37
  132. package/bundled/skills/prizmkit-workflow/references/artifact-identity.md +34 -0
  133. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +22 -18
  134. package/bundled/skills/recovery-workflow/SKILL.md +2 -1
  135. package/bundled/skills/recovery-workflow/references/detection.md +4 -3
  136. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +15 -5
  137. package/bundled/templates/hooks/validate-prizm-docs.py +124 -12
  138. package/package.json +1 -1
  139. package/src/scaffold.js +33 -22
  140. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +0 -16
  141. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +0 -31
  142. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +0 -7
  143. package/bundled/dev-pipeline/templates/sections/critical-paths-lite.md +0 -7
  144. package/bundled/dev-pipeline/templates/sections/directory-convention-agent.md +0 -9
  145. package/bundled/dev-pipeline/templates/sections/directory-convention-lite.md +0 -6
  146. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +0 -15
  147. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -61
  148. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -24
  149. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -12
  150. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +0 -44
  151. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -25
  152. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +0 -20
  153. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +0 -20
  154. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +0 -20
  155. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +0 -17
  156. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +0 -28
  157. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +0 -52
  158. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +0 -52
  159. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +0 -174
  160. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +0 -174
  161. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +0 -174
  162. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +0 -174
  163. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +0 -174
  164. package/bundled/skills/prizmkit-test/references/external-contract-mock-guidance.md +0 -119
@@ -1,174 +0,0 @@
1
- # PrizmKit Workflow State Protocol
2
-
3
- `workflow-state.json` is lifecycle metadata for one formal requirement. It preserves stage handoff, orchestrator ownership, and resume information without replacing skill-owned 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 active `artifact_dir` is 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 another recent plan when resuming. Any external execution checkpoint remains separate from this state. Never merge, substitute, or infer one schema from the other.
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 result | `{artifact_dir}/review-report.md` |
30
- | Test semantics and native execution | `{artifact_dir}/test-report.md` |
31
- | Terminal testing result | `{artifact_dir}/test-result.json` |
32
- | Retrospective completion | `{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 | External host checkpoint |
37
-
38
- Every consumer compares workflow state with the skill-owned artifacts and 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": "completed",
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. |
63
- | `artifact_dir` | Generic requirement artifact root reused by every stage. |
64
- | `orchestrator` | Semantic coordinator identifier, or null for direct stage use. |
65
- | `stage` | Stage that most recently wrote state. |
66
- | `status` | Lifecycle status: `pending`, `in_progress`, `completed`, `failed`, or `skipped`. |
67
- | `stage_result` | Domain result for the current stage, such as `PLAN_READY`, `IMPLEMENTED`, `REVIEW_PASS`, `REVIEW_NEEDS_FIXES`, `TEST_*`, `RETRO_COMPLETE`, or `COMMITTED`. |
68
- | `completed_stages` | Ordered stages completed for this requirement. |
69
- | `repair_scope` | Optional caller-owned routing scope. The test skill reports high-risk repairs through `test-result.json` instead of scheduling another stage. |
70
- | `repair_round` | Optional outer cross-stage repair round, from 0 through 3. It is not a test-internal repair counter. |
71
- | `next_stage` | Next semantic stage, or null when stopped. |
72
- | `resume_from` | Exact atomic skill that can resume, or null when none is selected. |
73
-
74
- `status` and `stage_result` are deliberately separate. Lifecycle status values must never be replaced with domain result values.
75
-
76
- ## Lifecycle and Result Mappings
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 artifacts map to workflow state as follows:
89
-
90
- ```text
91
- plan PLAN_READY → status=completed, stage_result=PLAN_READY
92
- plan PLAN_BLOCKED → status=failed, stage_result=PLAN_BLOCKED
93
- implementation IMPLEMENTED → status=completed, stage_result=IMPLEMENTED
94
- implementation repair/block → status=failed, stage_result=IMPLEMENT_REPAIR or IMPLEMENT_BLOCKED
95
- review-report PASS → status=completed, stage_result=REVIEW_PASS
96
- review-report NEEDS_FIXES → status=failed, stage_result=REVIEW_NEEDS_FIXES
97
- test-result TEST_PASS → status=completed, stage_result=TEST_PASS
98
- test-result TEST_NEEDS_FIXES → status=failed, stage_result=TEST_NEEDS_FIXES
99
- test-result TEST_BLOCKED → status=failed, stage_result=TEST_BLOCKED
100
- retrospective DOCS_UPDATED → status=completed, stage_result=RETRO_COMPLETE
101
- retrospective NO_DOC_CHANGE → status=completed, stage_result=RETRO_COMPLETE
102
- retrospective blocked → status=failed, stage_result=RETRO_BLOCKED
103
- commit authorization pending → status=in_progress, stage_result=COMMIT_PENDING
104
- local commit confirmed → status=completed, stage_result=COMMITTED
105
- commit blocked → status=failed, stage_result=COMMIT_BLOCKED
106
- ```
107
-
108
- `DOCS_UPDATED` and `NO_DOC_CHANGE` remain retrospective artifact `result` values. The workflow `stage_result` is the retrospective stage result `RETRO_COMPLETE`.
109
-
110
- `TEST_PASS` requires both `test-report.md` and a consistent `test-result.json`. No manifest, attestation, evidence package, or test-internal checkpoint is part of this contract.
111
-
112
- ## Non-Pass Results and Routing Boundary
113
-
114
- `prizmkit-test` performs its own bounded failure repair and review loops before returning. The test skill never invokes another lifecycle stage.
115
-
116
- ```text
117
- TEST_NEEDS_FIXES
118
- → known correction or required delta review remains
119
- → caller decides whether and how to arrange another stage
120
-
121
- TEST_BLOCKED
122
- → truth, input, safe environment, or reliable execution prevents a verdict
123
- → never make speculative production edits
124
- → caller or external host owns recovery policy
125
- ```
126
-
127
- A test result is not an AI CLI session classification. `TEST_NEEDS_FIXES` and `TEST_BLOCKED` must not be rewritten as crash or infrastructure failure merely because they stop lifecycle progression.
128
-
129
- Any outer repair or continuation policy is independently owned by the caller and cannot alter the test report. The Main-Agent test review limit of ten rounds, independent Test Reviewer limit of five responses, and execution-failure repair limit of three rounds are internal to one test invocation and do not update outer counters.
130
-
131
- ## Orchestrator Ownership and Handoff
132
-
133
- 1. An atomic stage performs only its own stage, writes its truthful result and artifact paths, and returns control.
134
- 2. When `orchestrator` is non-null, only that orchestrator invokes the next skill.
135
- 3. Direct stage use may report a possible next invocation but does not claim it ran.
136
- 4. Every handoff preserves the same `artifact_dir`.
137
- 5. External automation invokes atomic stages directly and does not nest the composite workflow.
138
- 6. Workflow state never replaces or absorbs an external host checkpoint.
139
-
140
- ## Commit Authorization
141
-
142
- Interactive execution:
143
-
144
- ```text
145
- committer previews intended files and message
146
- → waits for explicit current-user confirmation
147
- → creates the local commit
148
- ```
149
-
150
- Trusted headless execution:
151
-
152
- ```text
153
- trusted host explicitly authorizes the current local task commit
154
- → committer verifies gates and commits automatically
155
- → remote publication remains separate
156
- ```
157
-
158
- A self-declared or untrusted headless context does not authorize a commit.
159
-
160
- ## Recovery
161
-
162
- When state is missing, stale, or inconsistent:
163
-
164
- 1. Reuse current context, then read `spec.md` and `plan.md` only when needed.
165
- 2. Inspect task markers and current workspace.
166
- 3. Read the current review report when needed to establish review authority.
167
- 4. Validate that `test-report.md` and terminal `test-result.json` exist, agree, and reflect the claimed result.
168
- 5. Validate `retrospective-result.json` when retrospective is claimed complete.
169
- 6. Verify the commit when commit is claimed complete.
170
- 7. Let an active external host validate its own checkpoint independently.
171
- 8. Reconstruct the latest safe predecessor and report the reconstruction.
172
- 9. Continue only from the first incomplete or invalid stage.
173
-
174
- Stale state never bypasses review, testing, retrospective, commit authorization, or external checkpoint enforcement.
@@ -1,174 +0,0 @@
1
- # PrizmKit Workflow State Protocol
2
-
3
- `workflow-state.json` is lifecycle metadata for one formal requirement. It preserves stage handoff, orchestrator ownership, and resume information without replacing skill-owned 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 active `artifact_dir` is 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 another recent plan when resuming. Any external execution checkpoint remains separate from this state. Never merge, substitute, or infer one schema from the other.
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 result | `{artifact_dir}/review-report.md` |
30
- | Test semantics and native execution | `{artifact_dir}/test-report.md` |
31
- | Terminal testing result | `{artifact_dir}/test-result.json` |
32
- | Retrospective completion | `{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 | External host checkpoint |
37
-
38
- Every consumer compares workflow state with the skill-owned artifacts and 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": "completed",
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. |
63
- | `artifact_dir` | Generic requirement artifact root reused by every stage. |
64
- | `orchestrator` | Semantic coordinator identifier, or null for direct stage use. |
65
- | `stage` | Stage that most recently wrote state. |
66
- | `status` | Lifecycle status: `pending`, `in_progress`, `completed`, `failed`, or `skipped`. |
67
- | `stage_result` | Domain result for the current stage, such as `PLAN_READY`, `IMPLEMENTED`, `REVIEW_PASS`, `REVIEW_NEEDS_FIXES`, `TEST_*`, `RETRO_COMPLETE`, or `COMMITTED`. |
68
- | `completed_stages` | Ordered stages completed for this requirement. |
69
- | `repair_scope` | Optional caller-owned routing scope. The test skill reports high-risk repairs through `test-result.json` instead of scheduling another stage. |
70
- | `repair_round` | Optional outer cross-stage repair round, from 0 through 3. It is not a test-internal repair counter. |
71
- | `next_stage` | Next semantic stage, or null when stopped. |
72
- | `resume_from` | Exact atomic skill that can resume, or null when none is selected. |
73
-
74
- `status` and `stage_result` are deliberately separate. Lifecycle status values must never be replaced with domain result values.
75
-
76
- ## Lifecycle and Result Mappings
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 artifacts map to workflow state as follows:
89
-
90
- ```text
91
- plan PLAN_READY → status=completed, stage_result=PLAN_READY
92
- plan PLAN_BLOCKED → status=failed, stage_result=PLAN_BLOCKED
93
- implementation IMPLEMENTED → status=completed, stage_result=IMPLEMENTED
94
- implementation repair/block → status=failed, stage_result=IMPLEMENT_REPAIR or IMPLEMENT_BLOCKED
95
- review-report PASS → status=completed, stage_result=REVIEW_PASS
96
- review-report NEEDS_FIXES → status=failed, stage_result=REVIEW_NEEDS_FIXES
97
- test-result TEST_PASS → status=completed, stage_result=TEST_PASS
98
- test-result TEST_NEEDS_FIXES → status=failed, stage_result=TEST_NEEDS_FIXES
99
- test-result TEST_BLOCKED → status=failed, stage_result=TEST_BLOCKED
100
- retrospective DOCS_UPDATED → status=completed, stage_result=RETRO_COMPLETE
101
- retrospective NO_DOC_CHANGE → status=completed, stage_result=RETRO_COMPLETE
102
- retrospective blocked → status=failed, stage_result=RETRO_BLOCKED
103
- commit authorization pending → status=in_progress, stage_result=COMMIT_PENDING
104
- local commit confirmed → status=completed, stage_result=COMMITTED
105
- commit blocked → status=failed, stage_result=COMMIT_BLOCKED
106
- ```
107
-
108
- `DOCS_UPDATED` and `NO_DOC_CHANGE` remain retrospective artifact `result` values. The workflow `stage_result` is the retrospective stage result `RETRO_COMPLETE`.
109
-
110
- `TEST_PASS` requires both `test-report.md` and a consistent `test-result.json`. No manifest, attestation, evidence package, or test-internal checkpoint is part of this contract.
111
-
112
- ## Non-Pass Results and Routing Boundary
113
-
114
- `prizmkit-test` performs its own bounded failure repair and review loops before returning. The test skill never invokes another lifecycle stage.
115
-
116
- ```text
117
- TEST_NEEDS_FIXES
118
- → known correction or required delta review remains
119
- → caller decides whether and how to arrange another stage
120
-
121
- TEST_BLOCKED
122
- → truth, input, safe environment, or reliable execution prevents a verdict
123
- → never make speculative production edits
124
- → caller or external host owns recovery policy
125
- ```
126
-
127
- A test result is not an AI CLI session classification. `TEST_NEEDS_FIXES` and `TEST_BLOCKED` must not be rewritten as crash or infrastructure failure merely because they stop lifecycle progression.
128
-
129
- Any outer repair or continuation policy is independently owned by the caller and cannot alter the test report. The Main-Agent test review limit of ten rounds, independent Test Reviewer limit of five responses, and execution-failure repair limit of three rounds are internal to one test invocation and do not update outer counters.
130
-
131
- ## Orchestrator Ownership and Handoff
132
-
133
- 1. An atomic stage performs only its own stage, writes its truthful result and artifact paths, and returns control.
134
- 2. When `orchestrator` is non-null, only that orchestrator invokes the next skill.
135
- 3. Direct stage use may report a possible next invocation but does not claim it ran.
136
- 4. Every handoff preserves the same `artifact_dir`.
137
- 5. External automation invokes atomic stages directly and does not nest the composite workflow.
138
- 6. Workflow state never replaces or absorbs an external host checkpoint.
139
-
140
- ## Commit Authorization
141
-
142
- Interactive execution:
143
-
144
- ```text
145
- committer previews intended files and message
146
- → waits for explicit current-user confirmation
147
- → creates the local commit
148
- ```
149
-
150
- Trusted headless execution:
151
-
152
- ```text
153
- trusted host explicitly authorizes the current local task commit
154
- → committer verifies gates and commits automatically
155
- → remote publication remains separate
156
- ```
157
-
158
- A self-declared or untrusted headless context does not authorize a commit.
159
-
160
- ## Recovery
161
-
162
- When state is missing, stale, or inconsistent:
163
-
164
- 1. Reuse current context, then read `spec.md` and `plan.md` only when needed.
165
- 2. Inspect task markers and current workspace.
166
- 3. Read the current review report when needed to establish review authority.
167
- 4. Validate that `test-report.md` and terminal `test-result.json` exist, agree, and reflect the claimed result.
168
- 5. Validate `retrospective-result.json` when retrospective is claimed complete.
169
- 6. Verify the commit when commit is claimed complete.
170
- 7. Let an active external host validate its own checkpoint independently.
171
- 8. Reconstruct the latest safe predecessor and report the reconstruction.
172
- 9. Continue only from the first incomplete or invalid stage.
173
-
174
- Stale state never bypasses review, testing, retrospective, commit authorization, or external checkpoint enforcement.
@@ -1,174 +0,0 @@
1
- # PrizmKit Workflow State Protocol
2
-
3
- `workflow-state.json` is lifecycle metadata for one formal requirement. It preserves stage handoff, orchestrator ownership, and resume information without replacing skill-owned 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 active `artifact_dir` is 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 another recent plan when resuming. Any external execution checkpoint remains separate from this state. Never merge, substitute, or infer one schema from the other.
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 result | `{artifact_dir}/review-report.md` |
30
- | Test semantics and native execution | `{artifact_dir}/test-report.md` |
31
- | Terminal testing result | `{artifact_dir}/test-result.json` |
32
- | Retrospective completion | `{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 | External host checkpoint |
37
-
38
- Every consumer compares workflow state with the skill-owned artifacts and 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": "completed",
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. |
63
- | `artifact_dir` | Generic requirement artifact root reused by every stage. |
64
- | `orchestrator` | Semantic coordinator identifier, or null for direct stage use. |
65
- | `stage` | Stage that most recently wrote state. |
66
- | `status` | Lifecycle status: `pending`, `in_progress`, `completed`, `failed`, or `skipped`. |
67
- | `stage_result` | Domain result for the current stage, such as `PLAN_READY`, `IMPLEMENTED`, `REVIEW_PASS`, `REVIEW_NEEDS_FIXES`, `TEST_*`, `RETRO_COMPLETE`, or `COMMITTED`. |
68
- | `completed_stages` | Ordered stages completed for this requirement. |
69
- | `repair_scope` | Optional caller-owned routing scope. The test skill reports high-risk repairs through `test-result.json` instead of scheduling another stage. |
70
- | `repair_round` | Optional outer cross-stage repair round, from 0 through 3. It is not a test-internal repair counter. |
71
- | `next_stage` | Next semantic stage, or null when stopped. |
72
- | `resume_from` | Exact atomic skill that can resume, or null when none is selected. |
73
-
74
- `status` and `stage_result` are deliberately separate. Lifecycle status values must never be replaced with domain result values.
75
-
76
- ## Lifecycle and Result Mappings
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 artifacts map to workflow state as follows:
89
-
90
- ```text
91
- plan PLAN_READY → status=completed, stage_result=PLAN_READY
92
- plan PLAN_BLOCKED → status=failed, stage_result=PLAN_BLOCKED
93
- implementation IMPLEMENTED → status=completed, stage_result=IMPLEMENTED
94
- implementation repair/block → status=failed, stage_result=IMPLEMENT_REPAIR or IMPLEMENT_BLOCKED
95
- review-report PASS → status=completed, stage_result=REVIEW_PASS
96
- review-report NEEDS_FIXES → status=failed, stage_result=REVIEW_NEEDS_FIXES
97
- test-result TEST_PASS → status=completed, stage_result=TEST_PASS
98
- test-result TEST_NEEDS_FIXES → status=failed, stage_result=TEST_NEEDS_FIXES
99
- test-result TEST_BLOCKED → status=failed, stage_result=TEST_BLOCKED
100
- retrospective DOCS_UPDATED → status=completed, stage_result=RETRO_COMPLETE
101
- retrospective NO_DOC_CHANGE → status=completed, stage_result=RETRO_COMPLETE
102
- retrospective blocked → status=failed, stage_result=RETRO_BLOCKED
103
- commit authorization pending → status=in_progress, stage_result=COMMIT_PENDING
104
- local commit confirmed → status=completed, stage_result=COMMITTED
105
- commit blocked → status=failed, stage_result=COMMIT_BLOCKED
106
- ```
107
-
108
- `DOCS_UPDATED` and `NO_DOC_CHANGE` remain retrospective artifact `result` values. The workflow `stage_result` is the retrospective stage result `RETRO_COMPLETE`.
109
-
110
- `TEST_PASS` requires both `test-report.md` and a consistent `test-result.json`. No manifest, attestation, evidence package, or test-internal checkpoint is part of this contract.
111
-
112
- ## Non-Pass Results and Routing Boundary
113
-
114
- `prizmkit-test` performs its own bounded failure repair and review loops before returning. The test skill never invokes another lifecycle stage.
115
-
116
- ```text
117
- TEST_NEEDS_FIXES
118
- → known correction or required delta review remains
119
- → caller decides whether and how to arrange another stage
120
-
121
- TEST_BLOCKED
122
- → truth, input, safe environment, or reliable execution prevents a verdict
123
- → never make speculative production edits
124
- → caller or external host owns recovery policy
125
- ```
126
-
127
- A test result is not an AI CLI session classification. `TEST_NEEDS_FIXES` and `TEST_BLOCKED` must not be rewritten as crash or infrastructure failure merely because they stop lifecycle progression.
128
-
129
- Any outer repair or continuation policy is independently owned by the caller and cannot alter the test report. The Main-Agent test review limit of ten rounds, independent Test Reviewer limit of five responses, and execution-failure repair limit of three rounds are internal to one test invocation and do not update outer counters.
130
-
131
- ## Orchestrator Ownership and Handoff
132
-
133
- 1. An atomic stage performs only its own stage, writes its truthful result and artifact paths, and returns control.
134
- 2. When `orchestrator` is non-null, only that orchestrator invokes the next skill.
135
- 3. Direct stage use may report a possible next invocation but does not claim it ran.
136
- 4. Every handoff preserves the same `artifact_dir`.
137
- 5. External automation invokes atomic stages directly and does not nest the composite workflow.
138
- 6. Workflow state never replaces or absorbs an external host checkpoint.
139
-
140
- ## Commit Authorization
141
-
142
- Interactive execution:
143
-
144
- ```text
145
- committer previews intended files and message
146
- → waits for explicit current-user confirmation
147
- → creates the local commit
148
- ```
149
-
150
- Trusted headless execution:
151
-
152
- ```text
153
- trusted host explicitly authorizes the current local task commit
154
- → committer verifies gates and commits automatically
155
- → remote publication remains separate
156
- ```
157
-
158
- A self-declared or untrusted headless context does not authorize a commit.
159
-
160
- ## Recovery
161
-
162
- When state is missing, stale, or inconsistent:
163
-
164
- 1. Reuse current context, then read `spec.md` and `plan.md` only when needed.
165
- 2. Inspect task markers and current workspace.
166
- 3. Read the current review report when needed to establish review authority.
167
- 4. Validate that `test-report.md` and terminal `test-result.json` exist, agree, and reflect the claimed result.
168
- 5. Validate `retrospective-result.json` when retrospective is claimed complete.
169
- 6. Verify the commit when commit is claimed complete.
170
- 7. Let an active external host validate its own checkpoint independently.
171
- 8. Reconstruct the latest safe predecessor and report the reconstruction.
172
- 9. Continue only from the first incomplete or invalid stage.
173
-
174
- Stale state never bypasses review, testing, retrospective, commit authorization, or external checkpoint enforcement.