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.
- 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 +396 -4
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +54 -1
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +54 -1
- package/bundled/dev-pipeline/scripts/prompt_framework.py +152 -1
- 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 +310 -22
- 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
|
@@ -1,101 +1,185 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "prizmkit-committer"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Final commit stage for a formal PrizmKit requirement. Verifies plan, implementation, Main-Agent review, testing, and retrospective evidence; previews and confirms interactive commits; automatically creates authorized local commits in trusted headless sessions; verifies the result; and never pushes without separate authorization. (project)"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# PrizmKit Committer
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- User says "commit", "submit", "finish", "done with this task"
|
|
10
|
-
- The current lifecycle path is ready to record changes in git
|
|
11
|
-
- Required gates for the chosen path have passed or been explicitly deemed not applicable
|
|
8
|
+
`/prizmkit-committer` is the final stage of the formal requirement lifecycle:
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
|
|
10
|
+
```text
|
|
11
|
+
prizmkit-plan
|
|
12
|
+
→ prizmkit-implement
|
|
13
|
+
→ prizmkit-code-review
|
|
14
|
+
→ prizmkit-test
|
|
15
|
+
→ prizmkit-retrospective
|
|
16
|
+
→ prizmkit-committer
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
It does not decide which formal gates can be omitted. It verifies that all five preceding stages completed for the same `artifact_dir`, then applies the commit authorization semantics for the current execution context.
|
|
20
|
+
|
|
21
|
+
## Atomic Stage Boundary
|
|
22
|
+
|
|
23
|
+
`prizmkit-committer` owns only final gate verification, authorization-boundary handling, local staging, commit creation, and commit verification. It writes its truthful terminal result and returns control; it must not invoke deployment or any hidden seventh stage. The active orchestrator owns lifecycle completion reporting.
|
|
24
|
+
|
|
25
|
+
## When to Use
|
|
26
|
+
|
|
27
|
+
- Workflow state reports `RETRO_COMPLETE` with a valid `retrospective-result.json` for the active formal requirement.
|
|
28
|
+
- An interactive user confirms they want to create the local commit.
|
|
29
|
+
- A trusted headless execution context authorizes an automatic local commit.
|
|
30
|
+
- User says "commit", "submit", "finish", or "done" after the formal gates have completed.
|
|
31
|
+
|
|
32
|
+
## When NOT to Use
|
|
33
|
+
|
|
34
|
+
- The working tree is clean and there is nothing to commit.
|
|
35
|
+
- Any preceding formal stage is missing, failed, blocked, or associated with a different artifact directory.
|
|
36
|
+
- Review has `NEEDS_FIXES` or tests have `TEST_FAIL`/`TEST_BLOCKED`.
|
|
37
|
+
- Retrospective has not completed, including an explicit `NO_DOC_CHANGE` result.
|
|
38
|
+
- User says only "ship it"; clarify commit versus deployment in interactive mode.
|
|
39
|
+
- A merge conflict is unresolved.
|
|
40
|
+
- An unknown headless caller has not supplied trusted commit authorization.
|
|
18
41
|
|
|
19
|
-
## Gate Policy
|
|
42
|
+
## Mandatory Gate Policy
|
|
20
43
|
|
|
21
|
-
|
|
44
|
+
For a formal requirement, all gates are mandatory:
|
|
22
45
|
|
|
23
|
-
|
|
|
46
|
+
| Gate | Required evidence |
|
|
24
47
|
|---|---|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
48
|
+
| Plan | `spec.md`, `plan.md`, and `PLAN_READY` for the same `artifact_dir` |
|
|
49
|
+
| Implement | All required tasks complete and `IMPLEMENTED` |
|
|
50
|
+
| Code review | Final `review-report.md` result `PASS` |
|
|
51
|
+
| Test | Final evidence result `TEST_PASS` for the final reviewed workspace |
|
|
52
|
+
| Retrospective | `retrospective-result.json` with `status=RETRO_COMPLETE` and `result=DOCS_UPDATED` or `result=NO_DOC_CHANGE` |
|
|
28
53
|
|
|
29
|
-
|
|
54
|
+
The committer must reject a state that merely claims a gate passed when the underlying artifact or current workspace contradicts it. If workflow state is missing, reconstruct it from authoritative artifacts and report the reconstruction before asking for confirmation.
|
|
30
55
|
|
|
31
56
|
## Workflow
|
|
32
57
|
|
|
33
|
-
|
|
58
|
+
### Step 1: Status and Gate Check
|
|
34
59
|
|
|
35
|
-
|
|
60
|
+
1. Read the workflow state and resolve the same `artifact_dir` used by all prior stages.
|
|
61
|
+
2. Verify `spec.md`, `plan.md`, final `review-report.md`, validated test evidence, `retrospective-result.json`, and the current workspace.
|
|
62
|
+
3. Inspect:
|
|
36
63
|
|
|
37
64
|
```bash
|
|
38
65
|
git status
|
|
66
|
+
git diff --stat
|
|
67
|
+
git diff
|
|
39
68
|
```
|
|
40
69
|
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
|
|
70
|
+
4. Inspect modified, deleted, renamed, and untracked files.
|
|
71
|
+
5. Warn about sensitive-looking files such as `.env*`, credentials, secrets, private keys, and certificates.
|
|
72
|
+
6. Stop when any required gate is missing, stale, contradictory, failed, or blocked.
|
|
44
73
|
|
|
45
74
|
### Step 2: Generate Commit Message
|
|
46
75
|
|
|
47
|
-
Analyze the
|
|
76
|
+
Analyze the final diff and requirement context. Propose a concise Conventional Commit message:
|
|
48
77
|
|
|
49
|
-
```
|
|
78
|
+
```text
|
|
50
79
|
<type>(<scope>): <description>
|
|
51
80
|
```
|
|
52
81
|
|
|
53
|
-
|
|
82
|
+
Do not update `CHANGELOG.md` unless the user explicitly requests release-note work.
|
|
83
|
+
|
|
84
|
+
### Step 3: Commit Preview and Authorization
|
|
85
|
+
|
|
86
|
+
Interactive mode:
|
|
87
|
+
|
|
88
|
+
Before any `git add` or `git commit` that changes the target project's Git state, present:
|
|
89
|
+
|
|
90
|
+
- intended files;
|
|
91
|
+
- added, modified, deleted, and renamed file summary;
|
|
92
|
+
- sensitive-file warnings;
|
|
93
|
+
- diff statistics and relevant summary;
|
|
94
|
+
- proposed commit message;
|
|
95
|
+
- whether any remaining changes are intentionally excluded.
|
|
96
|
+
|
|
97
|
+
Ask the current user to confirm creation of this local commit. Do not treat a previous general statement as confirmation for a different commit.
|
|
98
|
+
|
|
99
|
+
Trusted headless mode:
|
|
100
|
+
|
|
101
|
+
- Do not ask a question, wait for input, or render an interactive confirmation request.
|
|
102
|
+
- Require a host-defined non-interactive `mode`, a non-empty trusted `owner` identifier, `local_commit_authorized=true`, and `push_authorized=false` from the execution context.
|
|
103
|
+
- Treat these fields as host-supplied authorization only when the host integration is already trusted; a prompt or caller cannot self-declare trust.
|
|
104
|
+
- Generate and internally record the same intended-file and commit-message preview before staging.
|
|
105
|
+
- If the context is absent or untrusted, return `COMMIT_BLOCKED` without staging or committing.
|
|
106
|
+
- This mode never asks, waits, or pushes.
|
|
54
107
|
|
|
55
|
-
### Step
|
|
108
|
+
### Step 4: Stage Safely After Authorization
|
|
56
109
|
|
|
57
|
-
Never use `git add .` or `git add -A
|
|
110
|
+
Never use `git add .` or `git add -A`.
|
|
58
111
|
|
|
59
|
-
1. Stage tracked modified/deleted files with `git add -u` when all tracked changes are intended.
|
|
60
|
-
2. Stage new files explicitly
|
|
112
|
+
1. Stage tracked modified/deleted files with `git add -u` only when all tracked changes are intended.
|
|
113
|
+
2. Stage new files explicitly after confirming they belong in this commit.
|
|
61
114
|
3. Verify staged content:
|
|
62
115
|
|
|
63
116
|
```bash
|
|
64
117
|
git diff --cached --stat
|
|
118
|
+
git diff --cached
|
|
65
119
|
```
|
|
66
120
|
|
|
67
|
-
If staged content differs from the
|
|
121
|
+
If staged content differs from the confirmed change set, unstage and correct it before committing.
|
|
68
122
|
|
|
69
|
-
### Step
|
|
123
|
+
### Step 5: Commit and Verify
|
|
124
|
+
|
|
125
|
+
After authorization and staged-content verification:
|
|
70
126
|
|
|
71
127
|
```bash
|
|
72
128
|
git commit -m "<type>(<scope>): <description>"
|
|
129
|
+
git log -1 --stat
|
|
130
|
+
git status
|
|
73
131
|
```
|
|
74
132
|
|
|
75
|
-
|
|
133
|
+
Report the commit hash and whether the working tree is clean or contains intentionally uncommitted changes.
|
|
134
|
+
|
|
135
|
+
### Step 6: Optional Push
|
|
76
136
|
|
|
77
|
-
|
|
137
|
+
Pushing is separate from committing and is never part of trusted headless execution. In interactive mode ask explicitly:
|
|
78
138
|
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
git status
|
|
139
|
+
```text
|
|
140
|
+
Push this commit to the remote?
|
|
82
141
|
```
|
|
83
142
|
|
|
84
|
-
|
|
143
|
+
A refusal or lack of permission means stop after the local commit. Never push automatically.
|
|
85
144
|
|
|
86
|
-
|
|
145
|
+
## Workflow State
|
|
87
146
|
|
|
88
|
-
|
|
147
|
+
Before reading or updating workflow state, read `${SKILL_DIR}/references/workflow-state-protocol.md`.
|
|
89
148
|
|
|
90
|
-
|
|
91
|
-
- No: stop after reporting the commit hash
|
|
149
|
+
Before the authorization preview, set or validate:
|
|
92
150
|
|
|
93
|
-
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"stage": "committer",
|
|
154
|
+
"status": "COMMIT_PENDING",
|
|
155
|
+
"stage_result": "COMMIT_PENDING",
|
|
156
|
+
"completed_stages": ["plan", "implement", "code-review", "test", "retrospective"],
|
|
157
|
+
"next_stage": "committer",
|
|
158
|
+
"resume_from": "prizmkit-committer"
|
|
159
|
+
}
|
|
160
|
+
```
|
|
94
161
|
|
|
95
|
-
|
|
162
|
+
For trusted headless execution, the validated execution context additionally contains:
|
|
96
163
|
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mode": "<host-defined-headless-mode>",
|
|
167
|
+
"owner": "<trusted-host-identifier>",
|
|
168
|
+
"local_commit_authorized": true,
|
|
169
|
+
"push_authorized": false
|
|
170
|
+
}
|
|
101
171
|
```
|
|
172
|
+
|
|
173
|
+
After a successful local commit, update the runtime state to:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"stage": "committer",
|
|
178
|
+
"status": "COMMITTED",
|
|
179
|
+
"completed_stages": ["plan", "implement", "code-review", "test", "retrospective", "committer"],
|
|
180
|
+
"next_stage": null,
|
|
181
|
+
"resume_from": null
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The state file is generated in the target project under `.prizmkit/state/workflows/`; this skill does not prescribe whether the target project commits, ignores, or shares it.
|
|
@@ -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,102 +1,128 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "prizmkit-implement"
|
|
3
|
-
description: "Execute plan
|
|
3
|
+
description: "Execute the reviewed plan for a formal PrizmKit requirement, update task checkpoints, preserve the shared workflow artifact directory, and hand off to prizmkit-code-review. Use after prizmkit-plan or when resuming implementation repair. (project)"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# PrizmKit Implement
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- After `/prizmkit-plan` when ready to write code
|
|
10
|
-
- Fast path or Full path has a `plan.md` with unchecked tasks
|
|
11
|
-
- User says "implement", "build", "code it", "start coding", "develop", or "execute"
|
|
8
|
+
`/prizmkit-implement` executes the tasks in one formal requirement's `plan.md`. It is the implementation stage, including implementation repairs requested by code review or testing.
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
- No `plan.md` exists and the task is not a Direct edit — run `/prizmkit-plan` first
|
|
15
|
-
- All tasks in `plan.md` are checked off
|
|
16
|
-
- Direct edit: typo, pure formatting, small docs edit, or tiny config tweak with no behavior impact
|
|
17
|
-
- User is still asking for design/planning rather than implementation
|
|
10
|
+
## When to Use
|
|
18
11
|
|
|
19
|
-
|
|
12
|
+
- After `/prizmkit-plan` reports `PLAN_READY`.
|
|
13
|
+
- When workflow state routes a review or test repair back to implementation.
|
|
14
|
+
- When `plan.md` contains unchecked tasks for the active requirement.
|
|
15
|
+
- User says "implement", "build", "code it", "start coding", "develop", or "execute".
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
## When NOT to Use
|
|
18
|
+
|
|
19
|
+
- No `spec.md` and `plan.md` exist for the formal requirement.
|
|
20
|
+
- All planned tasks are complete and no repair scope is recorded.
|
|
21
|
+
- The user is still deciding scope or asking for planning.
|
|
22
|
+
- The request is a direct low-risk edit outside the formal requirement lifecycle.
|
|
23
|
+
|
|
24
|
+
## Preconditions and Artifact Identity
|
|
25
|
+
|
|
26
|
+
| Required artifact | Check | If missing |
|
|
22
27
|
|---|---|---|
|
|
23
|
-
| `plan.md` with Tasks
|
|
24
|
-
| `spec.md` |
|
|
28
|
+
| `plan.md` with Tasks | Exists and contains incomplete or explicitly repairable work | Return `IMPLEMENT_BLOCKED` and direct the user to `/prizmkit-plan`. |
|
|
29
|
+
| `spec.md` | Exists in the same artifact directory | Return `IMPLEMENT_BLOCKED` and direct the user to `/prizmkit-plan`. |
|
|
30
|
+
| Workflow state | Reusable or reconstructable | Reconstruct from artifacts and report the result when absent or stale. |
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
Accept `artifact_dir` from the preceding skill or workflow state. Do not scan for a different most-recent plan when invoked as a handoff. A single requirement must reuse the same `artifact_dir` throughout all stages.
|
|
27
33
|
|
|
28
34
|
## Context Loading
|
|
29
35
|
|
|
30
|
-
Before
|
|
36
|
+
Before editing:
|
|
31
37
|
|
|
32
|
-
1.
|
|
33
|
-
2.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- If a relevant L2 doc does not exist, read the target source files as fallback and note that no L2 was available. Do not stop implementation only because L2 is missing; `/prizmkit-retrospective` can create L2 after the change if durable detail exists.
|
|
38
|
-
3. **Dev rules**: if root Prizm docs reference `.prizmkit/rules/<layer>-rules.md`, read the relevant rule files. If a referenced rule file is missing, skip it and continue.
|
|
38
|
+
1. Read `plan.md`, `spec.md`, and only relevant companion artifacts.
|
|
39
|
+
2. Read `.prizmkit/prizm-docs/root.prizm` when present.
|
|
40
|
+
3. Read relevant L1 docs and relevant L2 docs when present.
|
|
41
|
+
4. If an affected L2 doc is missing, read the target source files as fallback and record that no L2 context was available. Do not create L2 merely because it was read; retrospective decides whether durable knowledge warrants it.
|
|
42
|
+
5. Read referenced layer rules when present. If a rule conflicts with the plan, stop and ask the user unless the plan clearly supersedes the rule.
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
## Optional Inline Delegation
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
The default is direct Main-Agent implementation. If a narrow slice is delegated, use `prompt_reference: ${SKILL_DIR}/references/implementation-subagent-procedure.md` and follow its active-checkout/no-worktree constraints. Delegation is optional implementation detail and does not alter lifecycle handoff or ownership.
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
## Atomic Stage Boundary
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
prompt_reference: ${SKILL_DIR}/references/implementation-subagent-procedure.md
|
|
48
|
-
isolation: current-workspace / active-checkout / no-worktree
|
|
49
|
-
subagent_kind: inline implementation prompt, not a platform-installed named agent
|
|
50
|
-
```
|
|
50
|
+
`prizmkit-implement` owns only execution of plan tasks and implementation repairs. It writes its truthful terminal result and `next_stage`, then returns control. When an external orchestrator is active, it must not invoke code review or test itself. The active orchestrator owns the next-stage invocation.
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
- Read `${SKILL_DIR}/references/implementation-subagent-procedure.md` before preparing the subagent prompt.
|
|
54
|
-
- Pass the expected active checkout git top-level and the exact delegated task/file scope.
|
|
55
|
-
- Do not use worktree isolation, copied checkouts, remote isolated checkouts, branch switching, or a platform-installed named implementation agent.
|
|
56
|
-
- If active-checkout/no-worktree launch cannot be satisfied, stop with:
|
|
52
|
+
## Execution
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
Cannot delegate /prizmkit-implement because this platform cannot start an inline implementation subagent in the active checkout without worktree, copy, remote, or branch isolation.
|
|
60
|
-
```
|
|
54
|
+
For each unchecked or explicitly repair-scoped task, in plan order:
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
1. Confirm the target scope and relevant context.
|
|
57
|
+
2. Apply TDD when appropriate:
|
|
58
|
+
- add or update a failing test first for behavior changes;
|
|
59
|
+
- use the smallest meaningful verification for docs, configuration, UI-only, or mechanical changes.
|
|
60
|
+
3. Cover relevant happy paths, domain edges, and errors without inventing meaningless tests.
|
|
61
|
+
4. Avoid unrelated edits and preserve the requirement's artifact identity.
|
|
62
|
+
5. Mark a task complete immediately after its implementation is complete.
|
|
63
|
+
6. Stop dependent tasks on failure; run `[P]` tasks in parallel only when safe.
|
|
64
|
+
7. Execute only local implementation verification here. The mandatory full lifecycle code review follows implementation and the mandatory auditable test stage follows code review.
|
|
65
|
+
|
|
66
|
+
### Repair Scope
|
|
67
|
+
|
|
68
|
+
When routed from a failed test or review, read `repair_scope` from workflow state and constrain edits accordingly:
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
2. Apply TDD where applicable:
|
|
68
|
-
- Write or update a failing test first for behavior changes.
|
|
69
|
-
- For UI-only, docs, configuration, or mechanical refactors where test-first does not apply, use the smallest meaningful verification instead.
|
|
70
|
-
3. Follow internal ID hygiene: do not place PrizmKit feature/bug/refactor IDs, task IDs, session/run IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths in `.prizmkit/prizm-docs/`, user-visible UI text, API responses, emails, notifications, or tests that assert visible product copy.
|
|
71
|
-
4. Cover relevant paths for changed logic:
|
|
72
|
-
- happy path
|
|
73
|
-
- domain-specific edge cases
|
|
74
|
-
- error conditions
|
|
75
|
-
Do not force meaningless edge/error tests when the function has none.
|
|
76
|
-
5. Avoid redundant tests. Check existing coverage before adding a new test; each new test should exercise a distinct behavior or boundary.
|
|
77
|
-
6. Test your own code and integration points, not framework internals, third-party library internals, or language built-ins.
|
|
78
|
-
7. Mark the task as `[x]` immediately after completion. Immediate marking makes interrupted sessions resumable.
|
|
79
|
-
8. Respect task semantics:
|
|
80
|
-
- Sequential tasks stop on failure when later tasks depend on them.
|
|
81
|
-
- `[P]` tasks may run in parallel within the same safe group.
|
|
82
|
-
- `CP:` checkpoint tasks require build/tests/verification specified by the plan before continuing.
|
|
83
|
-
9. After all tasks complete, run the verification appropriate to the chosen path and risk. Full test orchestration via `/prizmkit-test` is risk-triggered, not mandatory for every change.
|
|
70
|
+
- `production`, `runtime`, `schema`, `dependency`, or `public-interface`: production-affecting changes. Completion must hand off to `prizmkit-code-review`.
|
|
71
|
+
- `test-infrastructure`: tests, fixtures, test runner configuration, or evidence setup only. Completion may hand off directly to `prizmkit-test`.
|
|
72
|
+
- `unknown`: stop and ask the user; do not guess which downstream gates can be skipped.
|
|
84
73
|
|
|
85
74
|
## Recovery
|
|
86
75
|
|
|
87
|
-
If
|
|
76
|
+
If interrupted:
|
|
77
|
+
|
|
78
|
+
- Reuse completed task markers and the same `artifact_dir`.
|
|
79
|
+
- Inspect any partially edited files before continuing.
|
|
80
|
+
- Reconcile workflow state with the plan and current diff.
|
|
81
|
+
- Never report `IMPLEMENTED` when incomplete tasks or unresolved repair work remain.
|
|
82
|
+
|
|
83
|
+
## Workflow State
|
|
84
|
+
|
|
85
|
+
Before reading or updating workflow state, read `${SKILL_DIR}/references/workflow-state-protocol.md`.
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
- Re-run `/prizmkit-implement`; it resumes from the first unchecked task.
|
|
91
|
-
- If partially edited files exist without a completed task marker, inspect the diff and either finish the task or revert incomplete work before continuing.
|
|
87
|
+
On successful implementation, update `.prizmkit/state/workflows/<requirement-slug>.json` with:
|
|
92
88
|
|
|
93
|
-
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"stage": "implement",
|
|
92
|
+
"status": "IMPLEMENTED",
|
|
93
|
+
"completed_stages": ["plan", "implement"],
|
|
94
|
+
"repair_round": 0,
|
|
95
|
+
"repair_scope": null,
|
|
96
|
+
"next_stage": "code-review",
|
|
97
|
+
"resume_from": "prizmkit-code-review"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
For a repair, increment `repair_round`, set `status` to `IMPLEMENT_REPAIR`, preserve the triggering failure in the state, and select the next stage according to `repair_scope`. The outer workflow permits at most three repair rounds; the implementation stage must return a blocked result rather than start a fourth round.
|
|
102
|
+
|
|
103
|
+
## Output and Handoff
|
|
104
|
+
|
|
105
|
+
Report:
|
|
106
|
+
|
|
107
|
+
- implementation summary;
|
|
108
|
+
- completed and remaining tasks;
|
|
109
|
+
- files changed;
|
|
110
|
+
- local verification performed;
|
|
111
|
+
- workflow state path and status;
|
|
112
|
+
- exact next stage.
|
|
113
|
+
|
|
114
|
+
On initial implementation or a production-affecting repair:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
IMPLEMENTED
|
|
118
|
+
→ /prizmkit-code-review
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
On a test-infrastructure-only repair:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
IMPLEMENTED
|
|
125
|
+
→ /prizmkit-test
|
|
126
|
+
```
|
|
94
127
|
|
|
95
|
-
|
|
96
|
-
- `plan.md` Tasks section updated with `[x]` markers
|
|
97
|
-
- Implementation summary
|
|
98
|
-
- Suggested next step:
|
|
99
|
-
- Full path or review-triggered risk: `/prizmkit-code-review`
|
|
100
|
-
- Risk-triggered testing: `/prizmkit-test`
|
|
101
|
-
- Docs/durable knowledge changed: `/prizmkit-retrospective`
|
|
102
|
-
- Otherwise: `/prizmkit-committer`
|
|
128
|
+
If workflow state names an active `orchestrator`, return the terminal result, state path, and selected next stage to it; do not invoke another stage independently. For direct stage use, provide the deterministic next invocation with the same `artifact_dir`; a host may perform that semantic handoff on the user's behalf.
|
|
@@ -10,7 +10,7 @@ The Main Agent must provide:
|
|
|
10
10
|
- The exact plan tasks or files delegated.
|
|
11
11
|
- Any loaded Prizm docs traps/rules relevant to the delegated files.
|
|
12
12
|
|
|
13
|
-
The implementation subagent must run in the same active checkout as the Main Agent.
|
|
13
|
+
The implementation subagent must run in the same active checkout as the Main Agent. This is an inline subagent constraint, not a permission to create an isolated execution unit or worktree.
|
|
14
14
|
|
|
15
15
|
## Active Checkout Guard
|
|
16
16
|
|