prizmkit 1.1.130 → 1.1.134

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 (119) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/command-adapter.js +0 -2
  3. package/bundled/dev-pipeline/.env.example +1 -1
  4. package/bundled/dev-pipeline/assets/skill-subagent-integration.md +11 -6
  5. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +445 -8
  6. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +2 -9
  7. package/bundled/dev-pipeline/prizmkit_runtime/processes.py +21 -1
  8. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +87 -66
  9. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +53 -3
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +55 -25
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +4 -0
  12. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +119 -18
  13. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +3 -2
  14. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +411 -17
  15. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +57 -14
  16. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +5 -4
  17. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +55 -2
  18. package/bundled/dev-pipeline/scripts/prompt_framework.py +152 -1
  19. package/bundled/dev-pipeline/scripts/update-bug-status.py +53 -0
  20. package/bundled/dev-pipeline/scripts/update-checkpoint.py +294 -69
  21. package/bundled/dev-pipeline/scripts/update-feature-status.py +57 -0
  22. package/bundled/dev-pipeline/scripts/update-refactor-status.py +53 -0
  23. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +5 -5
  24. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +28 -22
  25. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +24 -10
  26. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +20 -2
  27. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +2 -2
  28. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +1 -1
  29. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +5 -10
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +9 -19
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +21 -0
  32. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +1 -1
  33. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +10 -10
  34. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  35. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +15 -0
  36. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +2 -2
  37. package/bundled/dev-pipeline/templates/sections/phase-commit.md +2 -2
  38. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +26 -23
  39. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +5 -5
  40. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +15 -11
  41. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +1 -1
  42. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +6 -6
  43. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +21 -0
  44. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +1 -1
  45. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +1 -1
  46. package/bundled/dev-pipeline/templates/sections/task-contract.md +4 -0
  47. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +362 -3
  48. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +349 -48
  49. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +129 -0
  50. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +91 -0
  51. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +567 -23
  52. package/bundled/dev-pipeline/tests/test_unified_cli.py +37 -10
  53. package/bundled/skills/_metadata.json +63 -26
  54. package/bundled/skills/app-planner/SKILL.md +4 -3
  55. package/bundled/skills/bug-fix-workflow/SKILL.md +89 -180
  56. package/bundled/skills/bug-planner/SKILL.md +12 -27
  57. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +131 -220
  58. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +36 -90
  59. package/bundled/skills/feature-pipeline-launcher/SKILL.md +129 -271
  60. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +35 -76
  61. package/bundled/skills/feature-planner/SKILL.md +27 -22
  62. package/bundled/skills/feature-planner/assets/planning-guide.md +4 -4
  63. package/bundled/skills/feature-workflow/SKILL.md +94 -121
  64. package/bundled/skills/prizmkit/SKILL.md +130 -94
  65. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +181 -0
  66. package/bundled/skills/prizmkit-code-review/SKILL.md +132 -86
  67. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +243 -0
  68. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +42 -1
  69. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +181 -0
  70. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +93 -1
  71. package/bundled/skills/prizmkit-committer/SKILL.md +125 -48
  72. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +181 -0
  73. package/bundled/skills/prizmkit-implement/SKILL.md +99 -73
  74. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +1 -1
  75. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +181 -0
  76. package/bundled/skills/prizmkit-init/SKILL.md +5 -5
  77. package/bundled/skills/prizmkit-plan/SKILL.md +146 -105
  78. package/bundled/skills/prizmkit-plan/assets/plan-template.md +18 -0
  79. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +242 -0
  80. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +4 -4
  81. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +181 -0
  82. package/bundled/skills/prizmkit-retrospective/SKILL.md +111 -53
  83. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +7 -6
  84. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +5 -4
  85. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +181 -0
  86. package/bundled/skills/prizmkit-test/SKILL.md +52 -6
  87. package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +63 -12
  88. package/bundled/skills/prizmkit-test/assets/evidence-manifest.schema.json +1 -1
  89. package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +13 -0
  90. package/bundled/skills/prizmkit-test/references/evidence-protocol.md +6 -1
  91. package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +8 -1
  92. package/bundled/skills/prizmkit-test/references/examples.md +1 -1
  93. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +4 -1
  94. package/bundled/skills/prizmkit-test/references/test-report-template.md +1 -1
  95. package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +15 -0
  96. package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +181 -0
  97. package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +744 -23
  98. package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +194 -15
  99. package/bundled/skills/prizmkit-workflow/SKILL.md +266 -0
  100. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +181 -0
  101. package/bundled/skills/recovery-workflow/SKILL.md +62 -241
  102. package/bundled/skills/recovery-workflow/evals/evals.json +17 -33
  103. package/bundled/skills/recovery-workflow/references/detection.md +28 -52
  104. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +105 -439
  105. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +136 -275
  106. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +53 -88
  107. package/bundled/skills/refactor-planner/SKILL.md +12 -57
  108. package/bundled/skills/refactor-planner/references/behavior-preservation.md +111 -230
  109. package/bundled/skills/refactor-planner/references/error-recovery.md +37 -0
  110. package/bundled/skills/refactor-planner/references/planning-phases.md +11 -17
  111. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +1 -1
  112. package/bundled/skills/refactor-workflow/SKILL.md +98 -139
  113. package/bundled/templates/project-memory-template.md +4 -4
  114. package/package.json +1 -1
  115. package/src/index.js +4 -0
  116. package/src/prompts.js +10 -3
  117. package/src/scaffold.js +1 -1
  118. package/bundled/dev-pipeline/tests/test-deploy-safety.sh +0 -223
  119. package/bundled/skills/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
@@ -1,131 +1,172 @@
1
1
  ---
2
2
  name: "prizmkit-plan"
3
- description: "Specify and plan development tasks: natural language change artifact with spec.md and plan.md. Works for features, bug fixes, refactors, migrations, and other non-trivial changes. Use before /prizmkit-implement when the task needs written scope, design, or executable tasks; use simplified planning for Fast path changes and full planning for high-risk or multi-module work. Trigger on: 'specify', 'plan', 'new task', 'I want to add/build...', 'architect', 'design', 'break it down', 'create tasks'. (project)"
3
+ description: "Start the formal PrizmKit requirement lifecycle by turning a natural-language change into spec.md and plan.md artifacts, running mandatory Main-Agent planning review plus optional capability-gated independent correctness review, initializing workflow state, and handing off to prizmkit-implement. Works for features, bug fixes, refactors, migrations, tests, and other formal requirements. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Plan
7
7
 
8
- A universal spec + plan generator. It turns a natural-language development task into a **change artifact**: `spec.md` (WHAT/WHY) and `plan.md` (HOW + Tasks).
8
+ `/prizmkit-plan` is the entry point for one formal requirement. It converts a natural-language change into a reviewed change artifact: `spec.md` defines WHAT and WHY; `plan.md` defines HOW and executable tasks.
9
9
 
10
- A change artifact is not feature-only. It can describe a feature, bug fix, refactor, migration, test improvement, or other scoped change.
10
+ A change artifact can describe a feature, bug fix, refactor, migration, test improvement, or another scoped requirement.
11
11
 
12
- ### When to Use
13
- - Any non-trivial development task that benefits from written scope and task breakdown
14
- - Before `/prizmkit-implement` when no suitable `plan.md` exists
15
- - Fast path changes that still need a simplified plan and resumable Tasks section
16
- - Full path changes involving multiple files/modules, public interfaces, data models, architecture, security, or unclear requirements
17
- - User says "specify", "plan", "new task", "I want to add...", "architect", "design", or "break it down"
12
+ ## When to Use
18
13
 
19
- ### When NOT to Use
20
- - Direct edit: typo, pure formatting, small docs edit, or tiny config tweak with no behavior impact
21
- - User explicitly asks for a one-off direct edit and the risk is low
22
- - A current artifact directory already has an adequate `spec.md` + `plan.md` for the requested work
14
+ - Starting any formal software requirement.
15
+ - A non-trivial change benefits from written scope, acceptance criteria, and task breakdown.
16
+ - No adequate current `spec.md` and `plan.md` exist for the requested work.
17
+ - User says "specify", "plan", "new task", "I want to add...", "architect", "design", or "break it down".
23
18
 
24
- ## Path Selection
19
+ ## When NOT to Use
25
20
 
26
- Choose the lightest planning depth that protects correctness:
21
+ - Direct edit: typo, pure formatting, small documentation edit, or another explicitly low-risk non-requirement change.
22
+ - The active artifact directory already has an adequate reviewed `spec.md` and `plan.md`; resume from the workflow state instead.
27
23
 
28
- | Path | Planning behavior |
29
- |---|---|
30
- | Direct edit | Skip `/prizmkit-plan`; edit directly and verify the specific change. |
31
- | Fast path | Create a concise `spec.md` and simplified `plan.md` with a Tasks section. |
32
- | Full path | Create full `spec.md` and `plan.md` with architecture, risks, tests, and executable tasks. |
24
+ ## Formal Lifecycle
33
25
 
34
- Use Full path for high-risk, multi-module, public API, data model, security, permission, payment, deployment-impacting, or ambiguous work. Use Fast path for small scoped behavior changes. Explain the chosen path briefly.
26
+ A successful plan starts this fixed lifecycle:
27
+
28
+ ```text
29
+ plan → implement → code-review → test → retrospective → committer
30
+ ```
31
+
32
+ Planning depth may be concise or comprehensive, but no later formal lifecycle stage may be silently skipped.
35
33
 
36
34
  ## Input
37
35
 
38
36
  | Parameter | Required | Description |
39
- |-----------|----------|-------------|
40
- | `description` | Yes | Natural-language description of the task |
41
- | `artifact_dir` | No | Directory to write the change artifact into. If omitted, auto-generates under `.prizmkit/specs/` using a numbered slug. |
42
-
43
- ## Execution
44
-
45
- ### Phase 0: Specify (`spec.md`)
46
-
47
- Skip this phase if `spec.md` already exists in the artifact directory and still matches the requested change.
48
-
49
- Steps:
50
-
51
- 1. Gather the task description. If missing and interactive, ask the user; otherwise abort with a clear error.
52
- 2. Determine artifact directory:
53
- - If `artifact_dir` is provided, use it directly.
54
- - If omitted, scan `.prizmkit/specs/` for existing numbered directories and create `.prizmkit/specs/###-task-slug/`.
55
- - The `.prizmkit/specs/` path is a generic change-artifact location; it is not limited to features.
56
- 3. Load project context: read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs. If L2 is missing for an affected module, use relevant source files as fallback context.
57
- 4. Generate `spec.md` from `${SKILL_DIR}/assets/spec-template.md`:
58
- - Focus on WHAT and WHY, not HOW.
59
- - Include only relevant sections.
60
- - Every goal needs acceptance criteria.
61
- - Mark genuine ambiguity with `[NEEDS CLARIFICATION]`.
62
- 5. If changes involve persistence, add a Data Model section. Read existing schema files to learn naming conventions, ID strategy, constraints, and migration patterns.
63
- 6. Resolve `[NEEDS CLARIFICATION]` markers:
64
- - Interactive: ask targeted questions using `${SKILL_DIR}/references/clarify-guide.md`.
65
- - Non-interactive: choose conservative defaults and annotate the decision.
66
-
67
- Internal ID hygiene: PrizmKit IDs, task IDs, session/run IDs, branch names, absolute worktree paths, and `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths are internal metadata. They may appear in change artifacts, but do not write them into `.prizmkit/prizm-docs/`, product UI copy, API responses, emails, notifications, or expected user-visible test strings.
68
-
69
- ### Phase 1: Design (`plan.md`)
70
-
71
- Precondition: `spec.md` exists.
72
-
73
- Steps:
74
-
75
- 1. Read `spec.md`.
76
- 2. Load project context if not already loaded: root Prizm doc, relevant L1/L2 docs, and source fallback for missing L2 docs.
77
- 3. Resolve any remaining clarification markers.
78
- 4. Generate `plan.md` from `${SKILL_DIR}/assets/plan-template.md`:
79
- - Change approach
80
- - Component/file changes
81
- - Data model changes and migration approach when relevant
82
- - Interface/API contract design when relevant
83
- - Testing strategy, using risk-triggered `/prizmkit-test` criteria
84
- - Risk assessment
85
- - Behavior preservation strategy for refactors or behavior-adjacent changes
86
- 5. Cross-check every spec goal maps to a plan component.
87
- 6. Check alignment with `.prizmkit/prizm-docs/root.prizm` RULES.
88
-
89
- ### Phase 2: Task Generation
90
-
91
- 1. Choose task strategy: MVP-first, incremental, or parallel. Ask in interactive mode when the choice affects execution; otherwise infer from risk and dependencies.
92
- 2. Append `## Tasks` to `plan.md` using `${SKILL_DIR}/assets/plan-template.md`:
93
- - Setup tasks
94
- - Foundation tasks
95
- - Core tasks mapped to goals or logical units
96
- - Polish tasks when needed
97
- - Checkpoint tasks between phases when integration risk exists
98
- 3. Mark parallel tasks with `[P]` only when they can safely run independently.
99
- 4. Run the verification checklist from `${SKILL_DIR}/references/verification-checklist.md` and fix issues before the planning quality gate.
100
-
101
- ### Phase 3: Plan/Spec Review Loop
102
-
103
- Run this phase every time `spec.md` and `plan.md` are created or updated, before reporting the plan or handing off to implementation.
104
-
105
- 1. Explicitly read `${SKILL_DIR}/references/review-plan-spec-loop.md`.
106
- 2. Execute that guide against the current `spec.md` and `plan.md`.
107
- 3. Apply all resolvable `BLOCKER` fixes and accepted `SHOULD_FIX` fixes directly to `spec.md` and/or `plan.md`.
37
+ |---|---|---|
38
+ | `description` | Yes | Natural-language description of the requirement. |
39
+ | `artifact_dir` | No | Directory for the change artifact. If omitted, create a numbered slug under `.prizmkit/specs/`. |
40
+
41
+ ## Atomic Stage Boundary
42
+
43
+ `prizmkit-plan` owns only specification, plan, task generation, and planning-quality review. It writes its truthful terminal result and `next_stage`, then returns control. It must not invoke `prizmkit-implement` itself, including when an external orchestrator is active. The active orchestrator owns the next-stage invocation.
44
+
45
+ ## Phase 0: Initialization Check and Context
46
+
47
+ 1. Check whether project context such as `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json`, or a project brief exists.
48
+ 2. If initialization context is missing:
49
+ - recommend `/prizmkit-init` and explain that it improves project context and cross-session continuity;
50
+ - do not block planning;
51
+ - if the user continues, load the README, manifests, project instruction files, source structure, and relevant source files as fallback.
52
+ 3. If Prizm docs exist, read `root.prizm`, relevant L1 docs, relevant L2 docs when present, and source fallback when L2 is absent.
53
+ 4. Resolve `artifact_dir` once and reuse it for every later lifecycle handoff. Do not re-detect another artifact during the same requirement.
54
+
55
+ ## Phase 1: Specify (`spec.md`)
56
+
57
+ Skip regeneration when `spec.md` already exists and still matches the requested requirement.
58
+
59
+ 1. Gather the requirement description. If it is missing in an interactive run, ask the user; otherwise return a clear blocked result.
60
+ 2. Determine the artifact directory:
61
+ - use the caller-provided `artifact_dir` when present;
62
+ - otherwise scan `.prizmkit/specs/` for existing numbered directories and create `.prizmkit/specs/###-task-slug/`.
63
+ 3. Generate `spec.md` from `${SKILL_DIR}/assets/spec-template.md`:
64
+ - focus on WHAT and WHY, not HOW;
65
+ - include only relevant sections;
66
+ - give every goal acceptance criteria;
67
+ - mark genuine ambiguity with `[NEEDS CLARIFICATION]`.
68
+ 4. For persistence changes, inspect existing schemas and add a Data Model section using project conventions.
69
+ 5. Resolve clarification markers:
70
+ - interactive: use `${SKILL_DIR}/references/clarify-guide.md` and ask targeted questions;
71
+ - non-interactive: choose conservative defaults, annotate them, and block when a safe default is impossible.
72
+
73
+ Internal ID hygiene: PrizmKit IDs, task/session/run IDs, branch names, absolute worktree paths, and internal artifact paths may exist in change artifacts but must not leak into `.prizmkit/prizm-docs/`, product UI copy, API responses, emails, notifications, or expected user-visible test strings.
74
+
75
+ ## Phase 2: Design (`plan.md`)
76
+
77
+ Precondition: `spec.md` exists with no unresolved blocker.
78
+
79
+ 1. Read `spec.md` and relevant project context.
80
+ 2. Resolve remaining clarification markers.
81
+ 3. Choose a planning depth appropriate to the requirement:
82
+ - concise for small, well-scoped formal requirements;
83
+ - comprehensive for multi-module, public API, data model, security, permission, payment, deployment-impacting, or ambiguous requirements.
84
+ 4. Generate `plan.md` from `${SKILL_DIR}/assets/plan-template.md` with:
85
+ - change approach;
86
+ - component and file changes;
87
+ - data migration approach when relevant;
88
+ - interface/API contract design when relevant;
89
+ - test strategy for the mandatory `/prizmkit-test` stage;
90
+ - risks and mitigations;
91
+ - behavior-preservation strategy for refactors.
92
+ 5. Cross-check every spec goal against the plan.
93
+ 6. Check alignment with project rules and available Prizm documentation.
94
+
95
+ ## Phase 3: Task Generation
96
+
97
+ 1. Choose an MVP-first, incremental, or safe parallel task strategy.
98
+ 2. Append `## Tasks` to `plan.md` using `${SKILL_DIR}/assets/plan-template.md`.
99
+ 3. Include setup, foundation, core, polish, and checkpoint tasks only when applicable.
100
+ 4. Mark `[P]` only for tasks that can safely execute independently.
101
+ 5. Include implementation-local verification where useful, while preserving the later full code-review and test stages.
102
+ 6. Run `${SKILL_DIR}/references/verification-checklist.md` and repair plan defects.
103
+
104
+ ## Phase 4: Plan/Spec Review Loop
105
+
106
+ Run every time `spec.md` or `plan.md` is created or changed. This is the mandatory Main-Agent baseline on every host.
107
+
108
+ 1. Read `${SKILL_DIR}/references/review-plan-spec-loop.md`.
109
+ 2. Review the current artifacts against the requirement and project context.
110
+ 3. Apply all resolvable `BLOCKER` fixes and accepted `SHOULD_FIX` fixes.
108
111
  4. Treat `OPTIONAL` findings as non-blocking.
109
- 5. Rerun the review once when fixes were applied, respecting the guide's maximum of 2 total rounds.
110
- 6. If unresolved `BLOCKER` findings remain, stop and ask targeted clarification questions in interactive mode; in non-interactive mode, record the blocker and stop. Do not escalate to a Critic agent.
111
- 7. Only proceed to `/prizmkit-implement` handoff after the loop has no unresolved blockers.
112
+ 5. Rerun once when fixes were applied, with a maximum of two planning-review rounds.
113
+ 6. If a `BLOCKER` remains, ask targeted questions in interactive mode; otherwise record `PLAN_BLOCKED` and stop.
114
+ 7. Continue only when no unresolved blocker remains.
115
+
116
+ The planning review must not implement code, run the full test stage, or launch external orchestration.
117
+
118
+ ## Phase 5: Independent Plan Review
119
+
120
+ Run only after the Main-Agent Plan/Spec review converges. This optional check never replaces or weakens the completed local review.
121
+
122
+ 1. Read `${SKILL_DIR}/references/independent-plan-review.md` and follow its complete contract.
123
+ 2. Apply its all-or-nothing semantic Host Capability Gate. If any required structural capability is unavailable or unproven, create no Reviewer and record strict downgrade in `plan.md`.
124
+ 3. When the gate passes, capture bounded immutable current-state input and create exactly one Plan Reviewer with the reference's Initial Reviewer Prompt.
125
+ 4. Use maximum two Reviewer responses. Adjudicate every correction as `accepted`, `rejected`, or `unresolved`; the Main Agent alone modifies artifacts.
126
+ 5. After an accepted correction, perform targeted Plan/Spec verification and, when one response remains, natively resume the exact same Reviewer. Never create a replacement Reviewer or simulate continuation with a fresh Reviewer plus summary.
127
+ 6. If native resume fails after modification, record downgrade and rerun the Main-Agent local Plan/Spec review over that modification as specified by the reference.
128
+ 7. If the final allowed response causes a modification, run targeted verification, record that the final state was not independently rechecked, and do not exceed the response budget.
129
+ 8. Append the terminal `## Independent Plan Review` record. Appending that audit record does not trigger another response.
130
+ 9. Any unresolved correction produces `PLAN_BLOCKED`; otherwise independent convergence or strict downgrade may continue to handoff from the valid completed Main-Agent review.
131
+
132
+ ## Phase 6: Workflow State and Handoff
133
+
134
+ Read `${SKILL_DIR}/references/workflow-state-protocol.md` and create or update:
135
+
136
+ ```text
137
+ .prizmkit/state/workflows/<requirement-slug>.json
138
+ ```
139
+
140
+ Follow the bundled protocol. At minimum record:
141
+
142
+ ```json
143
+ {
144
+ "schema_version": 1,
145
+ "artifact_dir": ".prizmkit/specs/001-example",
146
+ "stage": "plan",
147
+ "status": "PLAN_READY",
148
+ "completed_stages": ["plan"],
149
+ "repair_round": 0,
150
+ "repair_scope": null,
151
+ "next_stage": "implement",
152
+ "resume_from": "prizmkit-implement"
153
+ }
154
+ ```
112
155
 
113
- The review loop is planning-only. It must not start implementation, run tests/builds, launch a pipeline, create a separate skill, or require a Critic agent.
156
+ The state file is runtime metadata. Do not change the target project's Git or ignore policy.
114
157
 
115
158
  ## Output
116
159
 
117
- | Directory | Files |
118
- |---|---|
119
- | `artifact_dir` or auto-generated `.prizmkit/specs/###-slug/` | `spec.md` + `plan.md` |
160
+ - `spec.md` and `plan.md` in the resolved artifact directory.
161
+ - Workflow state with `PLAN_READY` or a truthful blocked result.
162
+ - Planning depth, key decisions, task count, and checkpoint summary.
163
+ - The same `artifact_dir` for every downstream stage.
120
164
 
121
- Report:
122
- - artifact directory
123
- - chosen path: Fast path or Full path
124
- - key decisions
125
- - task count and checkpoint summary
165
+ ## Handoff
126
166
 
127
- **HANDOFF:** `/prizmkit-implement`
167
+ On `PLAN_READY`:
128
168
 
129
- ## Examples
169
+ 1. If workflow state names an active `orchestrator`, return `PLAN_READY`, `stage_result=PLAN_READY`, `next_stage=implement`, the state path, and the same `artifact_dir` to that orchestrator; do not invoke the next stage independently.
170
+ 2. For direct stage use with no active orchestrator, report exactly one deterministic next action: `/prizmkit-implement`, with `stage_result=PLAN_READY`, the state-file path, and `artifact_dir`; a host may perform that semantic handoff on the user's behalf.
130
171
 
131
- Read `${SKILL_DIR}/references/examples.md` for worked examples of feature, refactoring, and bug fix planning.
172
+ Read `${SKILL_DIR}/references/examples.md` only when a worked planning example is needed.
@@ -113,3 +113,21 @@
113
113
  - [ ] [CP-1] After Setup: project builds and tests pass
114
114
  - [ ] [CP-2] After Foundation: base changes verified
115
115
  - [ ] [CP-3] After each Core group: acceptance criteria pass
116
+
117
+ ## Independent Plan Review
118
+ <!-- Append this terminal audit record after the Main-Agent review and the optional independent-review attempt. -->
119
+ <!-- Appending this terminal record does not trigger another Reviewer response and does not add an implementation task. -->
120
+
121
+ - Capability Gate: <ENABLED | DOWNGRADED>
122
+ - Downgrade Reason: <reason or none>
123
+ - Reviewer Responses: <0..2>
124
+ - Convergence: <no correction | all rejected | final-budget verification | local-review fallback | strict downgrade>
125
+ - Final State Independently Rechecked: <yes | no | not applicable>
126
+ - Unresolved Corrections: <none for PLAN_READY>
127
+
128
+ ### Adjudication
129
+ <!-- Repeat for every proposed correction. Use `None.` when there were no corrections. -->
130
+ - Correction: <summary>
131
+ - Decision: <accepted | rejected | unresolved>
132
+ - Evidence: <evidence>
133
+ - Modification: <actual change or none>
@@ -0,0 +1,242 @@
1
+ # Independent Plan Review
2
+
3
+ ## Purpose
4
+
5
+ Run one optional independent correctness review after the mandatory Main-Agent Plan/Spec review has converged. The Reviewer checks whether the current `spec.md` and `plan.md` correctly express the requirement and are ready for implementation. It is not required to disagree and must return `NO_CORRECTION_NEEDED` when no correction is justified.
6
+
7
+ This reference is complete within `prizmkit-plan`. Do not depend on another skill's prompt or a platform-generated Reviewer role.
8
+
9
+ ## Required Ordering and Budget
10
+
11
+ ```text
12
+ Draft spec.md and plan.md
13
+ → mandatory Main-Agent Plan/Spec review: maximum two rounds
14
+ → optional independent Plan Reviewer: maximum two responses
15
+ → PLAN_READY or PLAN_BLOCKED
16
+ ```
17
+
18
+ The independent budget does not replace, reduce, or extend the local review budget. Create at most one Reviewer for the Plan stage. Never reuse it in another stage.
19
+
20
+ ## Host Capability Gate
21
+
22
+ The gate is all-or-nothing. Before creating a Reviewer, the host must prove this semantic execution contract:
23
+
24
+ ```yaml
25
+ execution_unit:
26
+ count: 1
27
+ access: read-only
28
+ mutation: unavailable
29
+ arbitrary_command_execution: unavailable
30
+ downstream_execution: structurally-unavailable
31
+ context_continuation: same-unit-native-resume
32
+ workspace_observation: bounded-active-checkout-input
33
+ model_configuration: inherit-current-session
34
+ ```
35
+
36
+ Rules:
37
+
38
+ - Prompt instructions cannot satisfy a missing structural capability.
39
+ - The decision must not branch on platform identity, tool name, execution-unit type name, adapter output, or a platform allowlist.
40
+ - If any capability is missing or cannot be proven, do not create a Reviewer. Use Strict Downgrade.
41
+ - A general execution unit with a prompt saying "do not mutate or delegate" is not eligible when those capabilities remain available.
42
+ - The Reviewer inherits the current session's model configuration. Do not add a separate model-selection contract.
43
+
44
+ ## Review Input
45
+
46
+ Before each response, the Main Agent captures one bounded review input that is immutable for one response:
47
+
48
+ ```text
49
+ review-input
50
+ ├── manifest: input identity, response number, project-relative paths, states, and consistency markers
51
+ ├── context: requirement, confirmed clarifications, relevant rules, and prior adjudication on resume
52
+ └── payload: current spec.md, current plan.md, and only targeted supporting material
53
+ ```
54
+
55
+ The Plan payload contains:
56
+
57
+ - current `spec.md`;
58
+ - current `plan.md`, including tasks;
59
+ - original requirement and confirmed clarification decisions;
60
+ - relevant project rules and Prizm documentation;
61
+ - only the source or contract paths needed to verify concrete planning assumptions.
62
+
63
+ Do not provide broad repository access as a substitute for capturing input. The representation may use host-native immutable content or a read-only temporary payload outside the project change set; the protocol does not require a particular temporary path or command.
64
+
65
+ Before ordinary review, the Reviewer verifies that manifest, context, and payload agree. Missing content, unexplained entries, stale content, or mixed-round input produces `REVIEW_BLOCKED`, never partial success.
66
+
67
+ ## Initial Reviewer Prompt
68
+
69
+ Instantiate the bracketed fields and retain every boundary below.
70
+
71
+ ```text
72
+ You are the sole independent Plan Reviewer for this PrizmKit Plan stage.
73
+
74
+ Purpose:
75
+ Objectively determine whether the Main Agent's current specification and implementation plan correctly represent the confirmed requirement and are ready for implementation. You are not an adversary and are not required to disagree. Return NO_CORRECTION_NEEDED when the current artifacts are correct.
76
+
77
+ Response:
78
+ This is response [RESPONSE_NUMBER] of a maximum two responses.
79
+ Review-input identity: [INPUT_ID]
80
+ Manifest: [MANIFEST]
81
+ Context: [CONTEXT]
82
+ Payload: [PAYLOAD]
83
+ Permitted targeted paths, if represented separately: [TARGETED_PATHS_OR_NONE]
84
+
85
+ Execution boundaries:
86
+ - Complete this review personally.
87
+ - Do not create, schedule, resume, continue, request, or coordinate another execution unit.
88
+ - Do not ask the Main Agent to create a helper.
89
+ - Do not re-enter orchestration, delegation, another review workflow, or an equivalent process.
90
+ - Do not modify, create, delete, rename, stage, commit, or otherwise mutate files.
91
+ - Do not execute commands, tests, builds, network calls, or any operation that can change state.
92
+ - Read only the bounded review input and explicitly permitted targeted paths.
93
+ - Do not perform broad repository discovery or a full repository scan.
94
+ - Report only corrections supported by a concrete target and evidence.
95
+ - Do not invent an issue merely to return feedback.
96
+ - Return REVIEW_BLOCKED rather than delegate or provide an incomplete success result.
97
+ - Do not expose private reasoning traces. Return only the required output.
98
+
99
+ First validate input consistency. Then review requirement and scope correctness, terminology and non-goals, acceptance criteria, goal-to-plan coverage, relevant data/interface/security/compatibility/performance/deployment/migration constraints, dependency evidence, task prerequisites and safe parallel markers, task actionability/testability/resumability, and unjustified scope expansion or overengineering.
100
+
101
+ Do not review implementation code, execute tests, or redesign the requirement beyond a necessary correction.
102
+
103
+ Return exactly one result using the Reviewer Output Protocol.
104
+ ```
105
+
106
+ ## Resume Prompt
107
+
108
+ Resume the exact same Reviewer; do not create a new Reviewer with this text. Instantiate the bracketed fields.
109
+
110
+ ```text
111
+ Continue as the same independent Plan Reviewer.
112
+
113
+ Response:
114
+ This is response [RESPONSE_NUMBER] of a maximum two responses.
115
+ New review-input identity: [INPUT_ID]
116
+ New manifest: [MANIFEST]
117
+ Current context: [CONTEXT]
118
+ Current payload: [PAYLOAD]
119
+ Previously accepted corrections: [ACCEPTED_CORRECTIONS_OR_NONE]
120
+ Modifications actually made: [MODIFICATIONS_OR_NONE]
121
+ Previously rejected corrections and rejection evidence: [REJECTIONS_OR_NONE]
122
+ Unresolved items: [UNRESOLVED_OR_NONE]
123
+
124
+ All initial execution boundaries and the Reviewer Output Protocol remain mandatory. Review the current state, not the superseded payload. Do not repeat a rejected correction unless the new state invalidates the recorded rejection evidence. Validate the new input before ordinary review and return exactly one result.
125
+ ```
126
+
127
+ ## Reviewer Output Protocol
128
+
129
+ Return exactly one of these forms. Do not add severity, confidence, dimension, workflow impact, or acceptance fields.
130
+
131
+ ### No Correction Needed
132
+
133
+ ```markdown
134
+ ### Result: NO_CORRECTION_NEEDED
135
+
136
+ ### Corrections
137
+ None.
138
+
139
+ ### Summary
140
+ <one or two sentences confirming what was reviewed>
141
+ ```
142
+
143
+ ### Correction Needed
144
+
145
+ ```markdown
146
+ ### Result: CORRECTION_NEEDED
147
+
148
+ ### Corrections
149
+
150
+ #### Correction 1
151
+ - Target: <spec.md or plan.md location, section, or task>
152
+ - Problem: <what is currently incorrect>
153
+ - Evidence: <concrete basis>
154
+ - Correction: <recommended correction>
155
+
156
+ ### Summary
157
+ <one or two sentences describing the current state>
158
+ ```
159
+
160
+ Every correction contains only `Target`, `Problem`, `Evidence`, and `Correction`.
161
+
162
+ ### Review Blocked
163
+
164
+ ```markdown
165
+ ### Result: REVIEW_BLOCKED
166
+
167
+ ### Blocker
168
+ - Target: <missing or inconsistent review input>
169
+ - Problem: <why a complete review cannot be performed>
170
+ - Evidence: <concrete mismatch or capability failure>
171
+ - Correction: <what input or host condition would unblock review>
172
+
173
+ ### Summary
174
+ No review verdict was produced.
175
+ ```
176
+
177
+ `REVIEW_BLOCKED` is an internal independent-review result, not a lifecycle result.
178
+
179
+ ## Main-Agent Adjudication
180
+
181
+ The Main Agent verifies each proposed correction and records exactly one decision:
182
+
183
+ | Decision | Meaning | Action |
184
+ |---|---|---|
185
+ | `accepted` | Evidence proves an in-scope planning correction is needed. | Main Agent modifies `spec.md` and/or `plan.md` and performs targeted verification. |
186
+ | `rejected` | Current artifacts, source, contracts, or rules disprove the proposed problem. | Record concrete rejection evidence and make no change for it. |
187
+ | `unresolved` | Correctness or a safe correction cannot be established. | Record the item and return `PLAN_BLOCKED`. |
188
+
189
+ The Reviewer never modifies artifacts and cannot overrule adjudication.
190
+
191
+ Independent review converges normally when:
192
+
193
+ 1. the Reviewer returns `NO_CORRECTION_NEEDED`; or
194
+ 2. every correction in the current response is rejected with concrete evidence and no unresolved item remains.
195
+
196
+ ## Response Algorithm
197
+
198
+ 1. Run only after the Main-Agent Plan/Spec review converges with no unresolved `BLOCKER`.
199
+ 2. Apply the Host Capability Gate.
200
+ 3. If eligible, capture response 1 input and create exactly one Reviewer with the Initial Reviewer Prompt.
201
+ 4. Validate the result against the Reviewer Output Protocol.
202
+ 5. Adjudicate every correction. Any unresolved item returns `PLAN_BLOCKED`.
203
+ 6. For accepted corrections, the Main Agent modifies `spec.md` and/or `plan.md` and applies the relevant part of the existing verification checklist.
204
+ 7. If one response remains, capture fresh input and resume the exact same Reviewer with the Resume Prompt.
205
+ 8. If the second response causes a modification, no third response is allowed. Perform targeted Plan/Spec verification, record final-budget handling, and set `Final State Independently Rechecked` to `no`.
206
+ 9. Append the terminal `## Independent Plan Review` record. Appending the record itself never triggers another response.
207
+ 10. End the Reviewer when review converges, reaches the response limit, fails irrecoverably, or the stage becomes blocked. Explicitly terminate it when the host safely supports that operation; otherwise stop sending messages.
208
+
209
+ ## Strict Downgrade
210
+
211
+ Use strict downgrade in any of these cases:
212
+
213
+ - a required capability is unavailable or unproven before creation;
214
+ - Reviewer creation fails;
215
+ - the exact same Reviewer cannot be resumed or resume fails;
216
+ - execution-unit integrity becomes uncertain.
217
+
218
+ Behavior:
219
+
220
+ 1. Never create a weaker or replacement Reviewer.
221
+ 2. Never create a fresh Reviewer with a summary of the prior conversation; a summary is context, not native continuation.
222
+ 3. When no Reviewer is created, record the downgrade and continue from the completed Main-Agent review if it remains valid.
223
+ 4. When creation fails before any response, record the failure and preserve the completed Main-Agent review.
224
+ 5. When resume fails after an accepted modification, Never create a replacement Reviewer; rerun the local Plan/Spec review over the modification within its existing local semantics, record the downgrade and fallback, and return `PLAN_BLOCKED` if that verification cannot establish readiness.
225
+ 6. Reviewer input problems may be corrected and sent to the same Reviewer only while response budget and native continuation remain available. Otherwise downgrade.
226
+ 7. Report temporary input-cleanup failures honestly; cleanup failure does not change an otherwise verified planning result.
227
+
228
+ Strict downgrade is visible reduced assurance, not an error verdict and not permission to weaken the gate.
229
+
230
+ ## Terminal Record
231
+
232
+ Append the terminal record shape from `${SKILL_DIR}/assets/plan-template.md` after review or downgrade. Include:
233
+
234
+ - `Capability Gate: ENABLED | DOWNGRADED`;
235
+ - a concrete downgrade reason or `none`;
236
+ - Reviewer responses used, from `0` through `2`;
237
+ - convergence or fallback mode;
238
+ - whether the final state received an independent recheck;
239
+ - every proposed correction, Main-Agent decision, evidence, and actual modification;
240
+ - unresolved items, which must be absent for `PLAN_READY`.
241
+
242
+ This section is audit metadata, not an implementation task and not input that requires another Reviewer response.
@@ -4,7 +4,7 @@
4
4
 
5
5
  Run this local planning-quality gate after `spec.md` and `plan.md` are drafted or updated, before handing off to `/prizmkit-implement`.
6
6
 
7
- This is not a separate skill and it does not use a Critic agent. It is a bounded review loop executed inside `prizmkit-plan` to improve the planning artifacts only.
7
+ This is not a separate skill and it does not use a Critic agent. It is the mandatory Main-Agent baseline executed inside `prizmkit-plan` to improve the planning artifacts only. Its maximum of two local rounds remains independent of the optional Reviewer described in `independent-plan-review.md`.
8
8
 
9
9
  ## Non-Goals
10
10
 
@@ -13,7 +13,7 @@ Do not do any of the following from this guide:
13
13
  - Start implementation or edit product/source code.
14
14
  - Run tests, builds, lint, or package commands.
15
15
  - Launch a feature, bugfix, or refactor pipeline.
16
- - Spawn or require a Critic agent.
16
+ - Spawn or require a Critic agent inside this Main-Agent loop. The separate optional independent review is considered only after this loop converges and only through `independent-plan-review.md`.
17
17
  - Create a separate review-loop skill.
18
18
  - Expand scope beyond improving `spec.md` and `plan.md`.
19
19
 
@@ -87,8 +87,8 @@ Optional findings do not block handoff.
87
87
  4. Do not apply `OPTIONAL` findings unless they clearly improve readiness without expanding scope.
88
88
  5. If any fixes were applied, rerun this review once.
89
89
  6. Stop after at most 2 total review rounds.
90
- 7. If unresolved `BLOCKER` findings remain after the final round, stop planning and ask targeted clarification questions. Do not escalate to a Critic agent.
91
- 8. If no unresolved blockers remain, report that the planning quality gate passed and hand off to `/prizmkit-implement`.
90
+ 7. If unresolved `BLOCKER` findings remain after the final round, stop planning and ask targeted clarification questions. Do not escalate from this loop to a Critic agent or treat independent review as blocker recovery.
91
+ 8. If no unresolved blockers remain, report that the mandatory Main-Agent planning quality gate passed and hand off to the optional independent Plan review boundary in `independent-plan-review.md`.
92
92
 
93
93
  ## Output Summary
94
94