prizmkit 1.1.129 → 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.
- package/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/.env.example +1 -1
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +445 -8
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +87 -66
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +53 -3
- package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +55 -25
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +4 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +15 -1
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +398 -6
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +61 -3
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +64 -4
- package/bundled/dev-pipeline/scripts/prompt_framework.py +156 -7
- package/bundled/dev-pipeline/scripts/update-bug-status.py +53 -0
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +294 -69
- package/bundled/dev-pipeline/scripts/update-feature-status.py +57 -0
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +53 -0
- package/bundled/dev-pipeline/templates/bootstrap-prompt.md +2 -2
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +20 -14
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +21 -4
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +18 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +5 -15
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +21 -0
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +10 -10
- package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +16 -0
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +26 -23
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +12 -8
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +21 -0
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +362 -3
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +404 -24
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +132 -0
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +91 -0
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +411 -18
- package/bundled/dev-pipeline/tests/test_unified_cli.py +3 -3
- package/bundled/skills/_metadata.json +62 -25
- package/bundled/skills/app-planner/SKILL.md +4 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +89 -180
- package/bundled/skills/bug-planner/SKILL.md +12 -27
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +131 -220
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +36 -90
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +129 -271
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +35 -76
- package/bundled/skills/feature-planner/SKILL.md +27 -22
- package/bundled/skills/feature-planner/assets/planning-guide.md +4 -4
- package/bundled/skills/feature-workflow/SKILL.md +94 -121
- package/bundled/skills/prizmkit/SKILL.md +130 -94
- package/bundled/skills/prizmkit/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-code-review/SKILL.md +114 -84
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +1 -1
- package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-committer/SKILL.md +131 -47
- package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-implement/SKILL.md +99 -73
- package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +1 -1
- package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-init/SKILL.md +5 -5
- package/bundled/skills/prizmkit-plan/SKILL.md +132 -105
- package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-retrospective/SKILL.md +111 -53
- package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +7 -6
- package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +5 -4
- package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-test/SKILL.md +28 -6
- package/bundled/skills/prizmkit-test/references/examples.md +1 -1
- package/bundled/skills/prizmkit-test/references/test-report-template.md +1 -1
- package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-workflow/SKILL.md +266 -0
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/recovery-workflow/SKILL.md +62 -241
- package/bundled/skills/recovery-workflow/evals/evals.json +17 -33
- package/bundled/skills/recovery-workflow/references/detection.md +28 -52
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +105 -439
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +136 -275
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +53 -88
- package/bundled/skills/refactor-planner/SKILL.md +12 -57
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +111 -230
- package/bundled/skills/refactor-planner/references/error-recovery.md +37 -0
- package/bundled/skills/refactor-planner/references/planning-phases.md +11 -17
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +1 -1
- package/bundled/skills/refactor-workflow/SKILL.md +98 -139
- package/bundled/templates/project-memory-template.md +4 -4
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/prompts.js +10 -3
- package/src/scaffold.js +1 -1
- package/bundled/dev-pipeline/tests/test-deploy-safety.sh +0 -223
- 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,95 +1,153 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "prizmkit-retrospective"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Mandatory retrospective stage after a formal requirement passes code review and testing. Synchronizes durable Prizm documentation or records that no documentation change is needed, updates workflow state, and hands off to prizmkit-committer. (project)"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# PrizmKit Retrospective
|
|
7
7
|
|
|
8
|
-
`/prizmkit-retrospective` is the
|
|
8
|
+
`/prizmkit-retrospective` is the mandatory documentation and durable-knowledge stage after `prizmkit-test` returns `TEST_PASS`.
|
|
9
9
|
|
|
10
10
|
It performs two jobs:
|
|
11
11
|
|
|
12
|
-
1. **Structural Sync** — reflect changed code structure, interfaces, dependencies, and file mappings in `.prizmkit/prizm-docs
|
|
13
|
-
2. **Knowledge Injection** — add durable TRAPS, RULES, and DECISIONS discovered during the task.
|
|
12
|
+
1. **Structural Sync** — reflect changed code structure, interfaces, dependencies, and file mappings in `.prizmkit/prizm-docs/` when the documentation system exists.
|
|
13
|
+
2. **Knowledge Injection** — add durable TRAPS, RULES, and DECISIONS discovered during the task when such knowledge exists.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The stage must always run for a formal requirement. When no documentation update is warranted, it records `NO_DOC_CHANGE` as a successful retrospective result rather than silently skipping the stage.
|
|
16
|
+
|
|
17
|
+
For first-time documentation setup, validation, rebuild, migration, or out-of-band repair after docs drift, use `/prizmkit-prizm-docs` independently.
|
|
18
|
+
|
|
19
|
+
## Formal Lifecycle Position
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
prizmkit-plan
|
|
23
|
+
→ prizmkit-implement
|
|
24
|
+
→ prizmkit-code-review
|
|
25
|
+
→ prizmkit-test
|
|
26
|
+
→ prizmkit-retrospective
|
|
27
|
+
→ prizmkit-committer
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Atomic Stage Boundary
|
|
31
|
+
|
|
32
|
+
`prizmkit-retrospective` owns only structural documentation synchronization, durable knowledge injection, and retrospective result recording. It writes its truthful completion status and result plus `next_stage`, then returns control. It must not invoke `prizmkit-committer` itself; the active orchestrator owns the next-stage invocation.
|
|
16
33
|
|
|
17
34
|
## When to Use
|
|
18
35
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Test-only changes: run only when tests reveal durable boundaries, traps, interface constraints, behavior rules, or regression knowledge worth preserving.
|
|
23
|
-
- User says "retrospective", "retro", "update docs", "sync docs", or "wrap up" during normal development.
|
|
36
|
+
- After `/prizmkit-test` returns `TEST_PASS` for a formal requirement.
|
|
37
|
+
- When workflow state resumes a previously interrupted retrospective.
|
|
38
|
+
- When the user explicitly requests a retrospective or documentation synchronization outside a formal requirement.
|
|
24
39
|
|
|
25
40
|
## When NOT to Use
|
|
26
41
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
|
|
42
|
+
- The requirement has not passed code review and testing.
|
|
43
|
+
- `TEST_FAIL` or `TEST_BLOCKED` remains unresolved.
|
|
44
|
+
- The request is a direct edit outside the formal requirement lifecycle, unless the user explicitly asks for documentation maintenance.
|
|
45
|
+
- First-time docs initialization or out-of-band docs repair; use `/prizmkit-prizm-docs` instead.
|
|
46
|
+
|
|
47
|
+
## Preconditions and Artifact Identity
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
1. Reuse the caller's `artifact_dir`; do not select another requirement.
|
|
50
|
+
2. Confirm the latest review result is `PASS`.
|
|
51
|
+
3. Confirm the latest testing result is `TEST_PASS`.
|
|
52
|
+
4. Read the final source diff with `.prizmkit/` excluded, then use `spec.md`, `plan.md`, the final `review-report.md`, and final test evidence only as supporting context for the non-`.prizmkit/` changes.
|
|
53
|
+
5. If the workflow state is missing or stale, reconstruct it from those authoritative artifacts and report the reconstruction.
|
|
34
54
|
|
|
35
|
-
|
|
36
|
-
|-----------|----------|-------------|
|
|
37
|
-
| `artifact_dir` | No | Directory containing `spec.md`, `plan.md`, and optionally `review-report.md`. If omitted, scan `.prizmkit/` subdirectories for the most recently modified directory with a `plan.md`. When invoked as a handoff step, reuse the caller's `artifact_dir` rather than re-detecting. If no artifact directory is found, run standalone structural sync from `git diff`. |
|
|
55
|
+
`.prizmkit/` is always excluded from retrospective project-change input scope. Do not treat any file under `.prizmkit/`—including plans, artifacts, state, evidence, or existing Prizm docs—as a changed project file from which structural or durable knowledge is inferred. Required lifecycle state/evidence writes and targeted `.prizmkit/prizm-docs/` updates remain outputs; documentation changes must be justified only by observed non-`.prizmkit/` project changes.
|
|
38
56
|
|
|
39
57
|
## Job 1: Structural Sync
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
When `.prizmkit/prizm-docs/` exists, read `${SKILL_DIR}/references/structural-sync-steps.md` and synchronize documentation with the final codebase changes.
|
|
60
|
+
|
|
61
|
+
Review only changed project files outside `.prizmkit/`:
|
|
42
62
|
|
|
43
|
-
|
|
63
|
+
- added, modified, deleted, and renamed source files;
|
|
64
|
+
- structural module files, configuration, interfaces, and tests when they reveal durable project behavior;
|
|
65
|
+
- documentation mappings affected by those non-`.prizmkit/` project changes;
|
|
66
|
+
- stale pointers and stale traps implicated by those project changes;
|
|
67
|
+
- format, pointer, size, and memory-hygiene constraints for any docs the retrospective updates.
|
|
44
68
|
|
|
45
|
-
|
|
46
|
-
- L1 file counts and module mappings
|
|
47
|
-
- L2 KEY_FILES / INTERFACES / DATA_FLOW / DEPENDENCIES for affected diff files
|
|
48
|
-
- New L1/L2 docs when newly changed source directories require them
|
|
49
|
-
- Stale TRAPS cleanup when needed
|
|
69
|
+
Never use `.prizmkit/` changes themselves as structural-sync input.
|
|
50
70
|
|
|
51
|
-
|
|
71
|
+
When `.prizmkit/prizm-docs/` does not exist, do not pretend structural sync occurred. Record `NO_DOC_CHANGE` with reason `PRIZM_DOCS_NOT_INITIALIZED` and recommend `/prizmkit-init` or `/prizmkit-prizm-docs` for a future setup. The formal lifecycle may still continue because initialization is a soft prerequisite.
|
|
72
|
+
|
|
73
|
+
Do not create an L2 document merely because one was missing during implementation. Create it only when the final change contains meaningful durable module knowledge.
|
|
52
74
|
|
|
53
75
|
## Job 2: Knowledge Injection
|
|
54
76
|
|
|
55
|
-
|
|
77
|
+
When the final project change outside `.prizmkit/` reveals durable knowledge, read `${SKILL_DIR}/references/knowledge-injection-steps.md` and inject only stable product/domain knowledge into Prizm docs.
|
|
56
78
|
|
|
57
|
-
|
|
79
|
+
Candidate knowledge includes:
|
|
58
80
|
|
|
59
|
-
|
|
81
|
+
- new traps, race conditions, or surprising coupling;
|
|
82
|
+
- architectural rules or decisions;
|
|
83
|
+
- interface or contract changes;
|
|
84
|
+
- dependencies affecting module behavior;
|
|
85
|
+
- observable behavior changes;
|
|
86
|
+
- test-discovered boundaries or regression rules.
|
|
60
87
|
|
|
61
|
-
|
|
88
|
+
Do not write transient artifact paths, task IDs, branch names, dates, session/run metadata, or changelog material into Prizm docs.
|
|
62
89
|
|
|
63
|
-
|
|
64
|
-
- Verdict `NEEDS_FIXES` → skip Job 2 and warn: "Review report has unresolved findings. Skipping knowledge injection."
|
|
65
|
-
- No `review-report.md` → proceed with warning for Fast path or standalone mode.
|
|
66
|
-
- No artifact directory → skip Job 2 unless the user explicitly provides durable knowledge to record.
|
|
90
|
+
When no durable structural or knowledge change exists, return `NO_DOC_CHANGE` and explain why.
|
|
67
91
|
|
|
68
|
-
|
|
92
|
+
## Verification and Staging
|
|
69
93
|
|
|
70
|
-
|
|
94
|
+
1. Validate any updated docs using the project documentation rules.
|
|
95
|
+
2. Review the final diff and ensure only intended documentation changes are present.
|
|
96
|
+
3. Do not change the target project's Git or ignore policy. If the host or project workflow stages docs, report what was staged; otherwise leave staging to `/prizmkit-committer`.
|
|
97
|
+
4. Never claim documentation synchronization passed if validation failed.
|
|
71
98
|
|
|
72
|
-
|
|
73
|
-
- New architectural rules or decisions
|
|
74
|
-
- Interface signature or contract changes
|
|
75
|
-
- Dependency additions/removals that affect module behavior
|
|
76
|
-
- Observable behavior changes to existing features
|
|
77
|
-
- Test-only discoveries that document new boundary conditions, regression rules, or interface constraints
|
|
99
|
+
## Retrospective Result
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
Write `{artifact_dir}/retrospective-result.json` for every formal requirement:
|
|
80
102
|
|
|
81
|
-
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"status": "RETRO_COMPLETE",
|
|
106
|
+
"result": "DOCS_UPDATED",
|
|
107
|
+
"reason": "Durable module interfaces and traps changed",
|
|
108
|
+
"review_verdict": "PASS",
|
|
109
|
+
"test_verdict": "TEST_PASS"
|
|
110
|
+
}
|
|
111
|
+
```
|
|
82
112
|
|
|
83
|
-
|
|
113
|
+
`status=RETRO_COMPLETE` is the stable completion status. `result` must be exactly `DOCS_UPDATED` or `NO_DOC_CHANGE`; do not use either result as a substitute for completion status. Use `result=NO_DOC_CHANGE` with a concrete reason when no documentation update is warranted. This artifact is the retrospective gate evidence consumed by the committer and external automation; workflow state alone does not prove completion.
|
|
84
114
|
|
|
85
|
-
|
|
86
|
-
|
|
115
|
+
## Workflow State and Handoff
|
|
116
|
+
|
|
117
|
+
Before reading or updating workflow state, read `${SKILL_DIR}/references/workflow-state-protocol.md`.
|
|
118
|
+
|
|
119
|
+
On successful completion, update `.prizmkit/state/workflows/<requirement-slug>.json`:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"stage": "retrospective",
|
|
124
|
+
"status": "RETRO_COMPLETE",
|
|
125
|
+
"completed_stages": ["plan", "implement", "code-review", "test", "retrospective"],
|
|
126
|
+
"next_stage": "committer",
|
|
127
|
+
"resume_from": "prizmkit-committer"
|
|
128
|
+
}
|
|
87
129
|
```
|
|
88
130
|
|
|
89
|
-
|
|
131
|
+
Use `status=RETRO_COMPLETE` for both successful outcomes, with `result=DOCS_UPDATED` when durable docs changed or `result=NO_DOC_CHANGE` when the stage completed without a docs update. Both result values permit the commit stage.
|
|
132
|
+
|
|
133
|
+
If documentation validation or synchronization cannot safely complete, return `RETRO_BLOCKED`, do not commit, and provide the exact recovery entry.
|
|
134
|
+
|
|
135
|
+
## Output and Handoff
|
|
90
136
|
|
|
91
|
-
|
|
137
|
+
Report:
|
|
138
|
+
|
|
139
|
+
- `{artifact_dir}/retrospective-result.json` with `DOCS_UPDATED` or `NO_DOC_CHANGE`;
|
|
140
|
+
- docs updated, created, or intentionally unchanged;
|
|
141
|
+
- durable knowledge decisions;
|
|
142
|
+
- validation evidence;
|
|
143
|
+
- workflow state path and status;
|
|
144
|
+
- the same `artifact_dir` for the next stage.
|
|
145
|
+
|
|
146
|
+
After `RETRO_COMPLETE`:
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
RETRO_COMPLETE
|
|
150
|
+
→ /prizmkit-committer
|
|
151
|
+
```
|
|
92
152
|
|
|
93
|
-
|
|
94
|
-
- Summary of updated, created, and skipped docs with reasons
|
|
95
|
-
- Handoff: `/prizmkit-committer`
|
|
153
|
+
If workflow state names an active `orchestrator`, return `RETRO_COMPLETE`, `stage_result`, the retrospective/state paths, and `next_stage=committer` to it; do not invoke the committer independently. For direct stage use, provide the deterministic `/prizmkit-committer` invocation; a host may perform that semantic handoff on the user's behalf.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# Knowledge Injection — Detailed Steps (2a–2c)
|
|
2
2
|
|
|
3
|
-
**2a.** Gather context
|
|
3
|
+
**2a.** Gather context from the **actual project files changed outside `.prizmkit/`**:
|
|
4
4
|
|
|
5
|
-
- `git diff HEAD` — the
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
5
|
+
- `git diff HEAD -- . ':(exclude).prizmkit/**'` — the source of truth for eligible project changes
|
|
6
|
+
- Current Main-Agent context for the requirement — reuse it rather than rereading artifacts by default
|
|
7
|
+
- Targeted unchanged source, interfaces, callers, dependents, or tests only when an eligible diff raises a concrete ambiguity
|
|
8
|
+
- The affected Prizm docs only as update targets and existing-knowledge checks, never as changed project input
|
|
9
|
+
|
|
10
|
+
Do not scan or mine any `.prizmkit/` file for retrospective knowledge. Plans, review reports, test evidence, workflow state, and existing Prizm docs may describe transient or generated material; they must not create a retrospective fact independently of an observed non-`.prizmkit/` code or project-file change.
|
|
10
11
|
|
|
11
12
|
**2b.** Extract knowledge from what was **observed in code**, not invented:
|
|
12
13
|
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## 1. Get changed files
|
|
4
4
|
|
|
5
|
-
Get changed files from staged and unstaged changes relative to HEAD:
|
|
5
|
+
Get changed project files from staged and unstaged changes relative to HEAD while excluding the entire `.prizmkit/` tree:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
git diff HEAD --name-status
|
|
8
|
+
git diff HEAD --name-status -- . ':(exclude).prizmkit/**'
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
If
|
|
11
|
+
If pathspec exclusion is unavailable, filter every result whose normalized repository-relative path is exactly `.prizmkit` or starts with `.prizmkit/` before classification. Do not infer project structure or durable knowledge from excluded files.
|
|
12
|
+
|
|
13
|
+
If the caller supplied an explicit file list, apply the same `.prizmkit/` exclusion before using it and note the source in the report. If no files remain, structural sync is not needed.
|
|
12
14
|
|
|
13
15
|
## 2. Map files to modules
|
|
14
16
|
|
|
@@ -33,7 +35,6 @@ If a changed source file maps to no module, evaluate whether its directory quali
|
|
|
33
35
|
Skip structural sync when changes are limited to:
|
|
34
36
|
|
|
35
37
|
- comments, whitespace, or formatting
|
|
36
|
-
- `.prizm` files only
|
|
37
38
|
- internal implementation details with no interface, dependency, data-flow, or module mapping impact
|
|
38
39
|
- test-only changes that reveal no durable boundaries, traps, interface constraints, behavior rules, or regression knowledge
|
|
39
40
|
|
|
@@ -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.
|