prizmkit 1.1.79 → 1.1.80

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 (92) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/scripts/init-pipeline.py +2 -0
  3. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +2 -0
  4. package/bundled/skills/_metadata.json +1 -1
  5. package/bundled/skills/app-planner/SKILL.md +10 -347
  6. package/bundled/skills/app-planner/references/infrastructure-convention-discovery.md +108 -0
  7. package/bundled/skills/app-planner/references/project-conventions-discovery.md +59 -0
  8. package/bundled/skills/app-planner/references/project-state-detection.md +88 -0
  9. package/bundled/skills/app-planner/references/rules-configuration.md +46 -0
  10. package/bundled/skills/bug-fix-workflow/SKILL.md +1 -30
  11. package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +66 -0
  12. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +3 -40
  13. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +49 -0
  14. package/bundled/skills/feature-pipeline-launcher/SKILL.md +3 -46
  15. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +55 -0
  16. package/bundled/skills/feature-workflow/SKILL.md +5 -121
  17. package/bundled/skills/feature-workflow/references/brainstorm-guide.md +137 -0
  18. package/bundled/skills/prizm-kit/SKILL.md +11 -0
  19. package/bundled/skills/prizmkit-code-review/SKILL.md +66 -135
  20. package/bundled/skills/prizmkit-code-review/references/dev-agent-prompt.md +30 -0
  21. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +31 -0
  22. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +62 -0
  23. package/bundled/skills/prizmkit-code-review/scripts/check_loop.py +186 -0
  24. package/bundled/skills/prizmkit-committer/SKILL.md +6 -0
  25. package/bundled/skills/prizmkit-deploy/SKILL.md +48 -72
  26. package/bundled/skills/prizmkit-deploy/references/data-safety-examples.md +120 -0
  27. package/bundled/skills/prizmkit-deploy/references/ssh-bootstrap-flow.md +49 -0
  28. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +41 -0
  29. package/bundled/skills/prizmkit-deploy/references/ssh-takeover.md +20 -0
  30. package/bundled/skills/prizmkit-implement/SKILL.md +6 -0
  31. package/bundled/skills/prizmkit-plan/SKILL.md +1 -83
  32. package/bundled/skills/prizmkit-plan/references/examples.md +85 -0
  33. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +13 -0
  34. package/bundled/skills/prizmkit-test/SKILL.md +3 -151
  35. package/bundled/skills/prizmkit-test/references/examples.md +70 -0
  36. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +49 -0
  37. package/bundled/skills/prizmkit-test/references/test-report-template.md +42 -0
  38. package/bundled/skills/recovery-workflow/SKILL.md +1 -30
  39. package/bundled/skills/recovery-workflow/references/detection.md +58 -0
  40. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +3 -45
  41. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +54 -0
  42. package/bundled/skills/refactor-planner/SKILL.md +9 -149
  43. package/bundled/skills/refactor-planner/references/fast-path.md +59 -0
  44. package/bundled/skills/refactor-planner/references/planning-phases.md +135 -0
  45. package/bundled/skills/refactor-workflow/SKILL.md +4 -103
  46. package/bundled/skills/refactor-workflow/references/brainstorm-guide.md +116 -0
  47. package/bundled/skills-windows/app-planner/SKILL.md +10 -349
  48. package/bundled/skills-windows/app-planner/references/infrastructure-convention-discovery.md +108 -0
  49. package/bundled/skills-windows/app-planner/references/project-conventions-discovery.md +59 -0
  50. package/bundled/skills-windows/app-planner/references/project-state-detection.md +90 -0
  51. package/bundled/skills-windows/app-planner/references/rules-configuration.md +46 -0
  52. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +1 -30
  53. package/bundled/skills-windows/bug-fix-workflow/references/bug-diagnosis.md +66 -0
  54. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +2 -29
  55. package/bundled/skills-windows/bugfix-pipeline-launcher/references/configuration.md +49 -0
  56. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +2 -35
  57. package/bundled/skills-windows/feature-pipeline-launcher/references/configuration.md +55 -0
  58. package/bundled/skills-windows/feature-workflow/SKILL.md +5 -121
  59. package/bundled/skills-windows/feature-workflow/references/brainstorm-guide.md +137 -0
  60. package/bundled/skills-windows/prizm-kit/SKILL.md +11 -0
  61. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +66 -135
  62. package/bundled/skills-windows/prizmkit-code-review/references/dev-agent-prompt.md +30 -0
  63. package/bundled/skills-windows/prizmkit-code-review/references/review-report-template.md +31 -0
  64. package/bundled/skills-windows/prizmkit-code-review/references/reviewer-agent-prompt.md +62 -0
  65. package/bundled/skills-windows/prizmkit-code-review/scripts/check_loop.py +186 -0
  66. package/bundled/skills-windows/prizmkit-committer/SKILL.md +6 -0
  67. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +49 -73
  68. package/bundled/skills-windows/prizmkit-deploy/references/data-safety-examples.md +120 -0
  69. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +3 -3
  70. package/bundled/skills-windows/prizmkit-deploy/references/ssh-bootstrap-flow.md +49 -0
  71. package/bundled/skills-windows/prizmkit-deploy/references/ssh-execution-flow.md +41 -0
  72. package/bundled/skills-windows/prizmkit-deploy/references/ssh-takeover.md +20 -0
  73. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +2 -2
  74. package/bundled/skills-windows/prizmkit-implement/SKILL.md +6 -0
  75. package/bundled/skills-windows/prizmkit-plan/SKILL.md +1 -83
  76. package/bundled/skills-windows/prizmkit-plan/references/examples.md +85 -0
  77. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +13 -0
  78. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +1 -1
  79. package/bundled/skills-windows/prizmkit-test/SKILL.md +3 -151
  80. package/bundled/skills-windows/prizmkit-test/references/examples.md +70 -0
  81. package/bundled/skills-windows/prizmkit-test/references/test-generation-steps.md +49 -0
  82. package/bundled/skills-windows/prizmkit-test/references/test-report-template.md +42 -0
  83. package/bundled/skills-windows/recovery-workflow/SKILL.md +1 -52
  84. package/bundled/skills-windows/recovery-workflow/references/detection.md +58 -0
  85. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +2 -32
  86. package/bundled/skills-windows/refactor-pipeline-launcher/references/configuration.md +54 -0
  87. package/bundled/skills-windows/refactor-planner/SKILL.md +9 -149
  88. package/bundled/skills-windows/refactor-planner/references/fast-path.md +59 -0
  89. package/bundled/skills-windows/refactor-planner/references/planning-phases.md +135 -0
  90. package/bundled/skills-windows/refactor-workflow/SKILL.md +4 -103
  91. package/bundled/skills-windows/refactor-workflow/references/brainstorm-guide.md +116 -0
  92. package/package.json +1 -1
@@ -131,71 +131,11 @@ Record everything the user provides — these become inputs for Step 1.3.
131
131
 
132
132
  ### Step 1.3: Parallel Deep Reading
133
133
 
134
- **Goal**: Build comprehensive understanding of the project context before discussing detailed requirements. Spawn multiple agents in parallel to read all relevant materials simultaneously.
135
-
136
- **Parallel reading tasks** (launch concurrently):
137
-
138
- | Agent | What to read | Purpose |
139
- |-------|-------------|---------|
140
- | Agent A | User-provided code paths — read existing source files | Understand current architecture, patterns, conventions |
141
- | Agent B | User-provided documents — design docs, specs, PRDs | Understand intended requirements and constraints |
142
- | Agent C | `.prizmkit/prizm-docs/` — root.prizm, L1/L2 docs, TRAPS, RULES | Understand existing architecture knowledge and known pitfalls |
143
- | Agent D | Database/schema files + `.prizmkit/config.json` | Understand data model and tech stack preferences |
144
-
145
- **Also gather** (can be included in any agent's task):
146
- - Directory structure of the project
147
- - Existing test patterns and conventions
148
- - Dependency relationships between existing modules
149
-
150
- **After all agents complete**: Synthesize findings into a coherent understanding before proceeding to discussion.
134
+ Read `${SKILL_DIR}/references/brainstorm-guide.md` §Step 1.3 for the parallel agent dispatch procedure spawn 4 agents (A: code paths, B: documents, C: prizm-docs, D: database/config) to build comprehensive project context before discussion. Synthesize findings before proceeding.
151
135
 
152
136
  ### Step 1.4: Discuss Requirements
153
137
 
154
- **Now** with deep knowledge of the actual codebase and documentsdiscuss the requirements with the user. This discussion is grounded in real context, not abstract questions.
155
-
156
- Present what you learned from the parallel reading:
157
- - Current project structure and patterns (with specific references)
158
- - Existing data model and schema conventions
159
- - Known TRAPS and pitfalls from `.prizmkit/prizm-docs/`
160
- - Integration points with existing modules
161
-
162
- Then ask targeted questions based on what you read. **Adapt question depth to the feature complexity** — a simple CRUD feature needs fewer questions than a real-time collaboration system.
163
-
164
- **Functional Requirements:**
165
- - What are the core user actions/workflows?
166
- - What inputs does the system accept? What outputs does it produce?
167
- - What are the key business rules and validation logic?
168
- - Are there different user roles with different permissions?
169
-
170
- **Data Model & Database** (if applicable):
171
- - What entities/data need to be stored?
172
- - What are the relationships between entities?
173
- - Are there existing database tables this feature must integrate with?
174
- - What fields are required vs optional? What data types?
175
- - Any unique constraints, indexes, or special query patterns needed?
176
- - **RULE**: If the project has existing database tables, ALL new table designs must reference and conform to the existing schema style (naming conventions, ID strategy, timestamp patterns, constraint patterns). Ask the user to confirm the data model before proceeding.
177
-
178
- **User Experience:**
179
- - What does the user see and interact with?
180
- - What is the expected flow/sequence of actions?
181
- - How should errors be displayed to the user?
182
- - Are there any specific UI/UX requirements?
183
-
184
- **Integration & Architecture:**
185
- - "Based on the existing code, this feature would integrate with [modules]. Does that match your expectations?"
186
- - Any external APIs or services involved?
187
- - What authentication/authorization model applies?
188
- - Any real-time requirements (WebSocket, SSE, polling)?
189
-
190
- **Edge Cases & Error Handling:**
191
- - What happens when things go wrong? (network failure, invalid input, concurrent access)
192
- - What are the boundary conditions? (empty states, max limits, permissions denied)
193
- - Any rate limiting, quotas, or resource constraints?
194
-
195
- **Non-Functional Requirements:**
196
- - Performance expectations? (response time, throughput)
197
- - Scalability considerations?
198
- - Security requirements? (encryption, audit logs, compliance)
138
+ Read `${SKILL_DIR}/references/brainstorm-guide.md` §Step 1.4 for the full requirements discussion frameworkfunctional requirements, data model, user experience, integration/architecture, edge cases, and non-functional requirements. Ask targeted questions based on what was learned from parallel reading. **Adapt question depth to the feature complexity.**
199
139
 
200
140
  ### Step 1.5: Confirm and Supplement
201
141
 
@@ -206,57 +146,11 @@ After the discussion:
206
146
  3. **Identify gaps** — if any areas are still unclear, list them explicitly and ask follow-up questions
207
147
  4. **Repeat** until the user confirms: "That covers everything" or "Let's proceed"
208
148
 
209
- **Signs that brainstorming is complete:**
210
- - All functional requirements have concrete acceptance criteria
211
- - Data model entities and relationships are defined
212
- - Edge cases and error handling are addressed
213
- - Integration points are identified
214
- - The user has confirmed the summary is accurate
215
-
216
- **Signs that more questions are needed:**
217
- - User's answers contain vague terms ("handle it appropriately", "make it user-friendly", "standard behavior")
218
- - Core business rules are undefined ("depends on the situation")
219
- - Data relationships are unclear ("somehow connected")
220
- - User says "I'm not sure" — help them think through it with concrete options
149
+ Read `${SKILL_DIR}/references/brainstorm-guide.md` §Completion Signs for the full checklist of when brainstorming is complete vs when more questions are needed.
221
150
 
222
151
  ### Step 1.6: Requirements Summary
223
152
 
224
- Once brainstorming is complete, produce a structured requirements summary:
225
-
226
- ```markdown
227
- ## Requirements Summary
228
-
229
- ### Project/Feature: [Name]
230
-
231
- ### Core Functionality
232
- - [Bullet list of what the system does]
233
-
234
- ### User Roles
235
- - [Role]: [What they can do]
236
-
237
- ### Data Model Overview
238
- - [Entity]: [Key fields, relationships]
239
-
240
- ### Key Business Rules
241
- - [Rule 1]
242
- - [Rule 2]
243
-
244
- ### Integration Points
245
- - [External system/API/module]
246
-
247
- ### Edge Cases & Error Handling
248
- - [Case]: [Expected behavior]
249
-
250
- ### Non-Functional Requirements
251
- - [Requirement]
252
-
253
- ### Reference Materials Reviewed
254
- - [List of code paths, documents, .prizmkit/prizm-docs/ files that were read]
255
-
256
- ### Confirmed by user: ✓
257
- ```
258
-
259
- Present this summary to the user and get explicit confirmation before proceeding.
153
+ Once brainstorming is complete, produce a structured requirements summary. Read `${SKILL_DIR}/references/brainstorm-guide.md` §Requirements Summary Template for the structured output format. Present the summary to the user and get explicit confirmation before proceeding.
260
154
 
261
155
  **CHECKPOINT CP-FW-0**: Requirements fully clarified and confirmed by user.
262
156
 
@@ -503,17 +397,7 @@ While the pipeline runs, the user can continue the conversation:
503
397
 
504
398
  ## Comparison with Alternative Workflows
505
399
 
506
- | Dimension | feature-workflow | bug-fix-workflow | refactor-workflow |
507
- |-----------|-----------------|------------------|-------------------|
508
- | **Purpose** | New features (batch) | Single bug fix (interactive) | Code restructuring (batch) |
509
- | **Brainstorming** | Yes — collect materials, parallel read, discuss | No (bug report is input) | Yes — clarify type, collect materials, parallel read, discuss |
510
- | **Planning Skill** | `feature-planner` | None (triage built-in) | `refactor-planner` |
511
- | **Branch** | Pipeline manages per-feature | `fix/<BUG_ID>-*` | Pipeline manages per-refactor |
512
- | **Execution** | Foreground or background daemon | In-session, interactive | Foreground or background daemon |
513
- | **Input** | Rough idea or requirements | Bug report / stack trace | Rough refactoring idea or target |
514
- | **Output** | Multiple `feat()` commits | Single `fix()` commit | Multiple `refactor()` commits |
515
- | **Behavior Change** | Expected (new functionality) | Fix behavior | Forbidden (structure only) |
516
- | **Batch alternative** | (this is the batch flow) | `bug-planner` + `bugfix-pipeline-launcher` | (this is the batch flow) |
400
+ Read `${SKILL_DIR}/references/brainstorm-guide.md` §Comparison for the full comparison table (feature-workflow vs bug-fix-workflow vs refactor-workflow across 9 dimensions).
517
401
 
518
402
  ---
519
403
 
@@ -0,0 +1,137 @@
1
+ # Brainstorm Guide — Detailed Procedures
2
+
3
+ Procedural details for Phase 1 brainstorming in feature-workflow.
4
+
5
+ ## Step 1.3: Parallel Deep Reading
6
+
7
+ **Goal**: Build comprehensive understanding of the project context before discussing detailed requirements. Spawn multiple agents in parallel to read all relevant materials simultaneously.
8
+
9
+ **Parallel reading tasks** (launch concurrently):
10
+
11
+ | Agent | What to read | Purpose |
12
+ |-------|-------------|---------|
13
+ | Agent A | User-provided code paths — read existing source files | Understand current architecture, patterns, conventions |
14
+ | Agent B | User-provided documents — design docs, specs, PRDs | Understand intended requirements and constraints |
15
+ | Agent C | `.prizmkit/prizm-docs/` — root.prizm, L1/L2 docs, TRAPS, RULES | Understand existing architecture knowledge and known pitfalls |
16
+ | Agent D | Database/schema files + `.prizmkit/config.json` | Understand data model and tech stack preferences |
17
+
18
+ **Also gather** (can be included in any agent's task):
19
+ - Directory structure of the project
20
+ - Existing test patterns and conventions
21
+ - Dependency relationships between existing modules
22
+
23
+ **After all agents complete**: Synthesize findings into a coherent understanding before proceeding to discussion.
24
+
25
+ ## Step 1.4: Discuss Requirements
26
+
27
+ **Now** — with deep knowledge of the actual codebase and documents — discuss the requirements with the user. This discussion is grounded in real context, not abstract questions.
28
+
29
+ Present what you learned from the parallel reading:
30
+ - Current project structure and patterns (with specific references)
31
+ - Existing data model and schema conventions
32
+ - Known TRAPS and pitfalls from `.prizmkit/prizm-docs/`
33
+ - Integration points with existing modules
34
+
35
+ Then ask targeted questions based on what you read. **Adapt question depth to the feature complexity** — a simple CRUD feature needs fewer questions than a real-time collaboration system.
36
+
37
+ ### Functional Requirements
38
+ - What are the core user actions/workflows?
39
+ - What inputs does the system accept? What outputs does it produce?
40
+ - What are the key business rules and validation logic?
41
+ - Are there different user roles with different permissions?
42
+
43
+ ### Data Model & Database (if applicable)
44
+ - What entities/data need to be stored?
45
+ - What are the relationships between entities?
46
+ - Are there existing database tables this feature must integrate with?
47
+ - What fields are required vs optional? What data types?
48
+ - Any unique constraints, indexes, or special query patterns needed?
49
+ - **RULE**: If the project has existing database tables, ALL new table designs must reference and conform to the existing schema style (naming conventions, ID strategy, timestamp patterns, constraint patterns). Ask the user to confirm the data model before proceeding.
50
+
51
+ ### User Experience
52
+ - What does the user see and interact with?
53
+ - What is the expected flow/sequence of actions?
54
+ - How should errors be displayed to the user?
55
+ - Are there any specific UI/UX requirements?
56
+
57
+ ### Integration & Architecture
58
+ - "Based on the existing code, this feature would integrate with [modules]. Does that match your expectations?"
59
+ - Any external APIs or services involved?
60
+ - What authentication/authorization model applies?
61
+ - Any real-time requirements (WebSocket, SSE, polling)?
62
+
63
+ ### Edge Cases & Error Handling
64
+ - What happens when things go wrong? (network failure, invalid input, concurrent access)
65
+ - What are the boundary conditions? (empty states, max limits, permissions denied)
66
+ - Any rate limiting, quotas, or resource constraints?
67
+
68
+ ### Non-Functional Requirements
69
+ - Performance expectations? (response time, throughput)
70
+ - Scalability considerations?
71
+ - Security requirements? (encryption, audit logs, compliance)
72
+
73
+ ## Comparison with Alternative Workflows
74
+
75
+ | Dimension | feature-workflow | bug-fix-workflow | refactor-workflow |
76
+ |-----------|-----------------|------------------|--------------------|
77
+ | **Purpose** | New features (batch) | Single bug fix (interactive) | Code restructuring (batch) |
78
+ | **Brainstorming** | Yes — collect materials, parallel read, discuss | No (bug report is input) | Yes — clarify type, collect materials, parallel read, discuss |
79
+ | **Planning Skill** | `feature-planner` | None (triage built-in) | `refactor-planner` |
80
+ | **Branch** | Pipeline manages per-feature | `fix/<BUG_ID>-*` | Pipeline manages per-refactor |
81
+ | **Execution** | Foreground or background daemon | In-session, interactive | Foreground or background daemon |
82
+ | **Input** | Rough idea or requirements | Bug report / stack trace | Rough refactoring idea or target |
83
+ | **Output** | Multiple `feat()` commits | Single `fix()` commit | Multiple `refactor()` commits |
84
+ | **Behavior Change** | Expected (new functionality) | Fix behavior | Forbidden (structure only) |
85
+ | **Batch alternative** | (this is the batch flow) | `bug-planner` + `bugfix-pipeline-launcher` | (this is the batch flow) |
86
+
87
+ ## Completion Signs
88
+
89
+ **Signs that brainstorming is complete:**
90
+ - All functional requirements have concrete acceptance criteria
91
+ - Data model entities and relationships are defined
92
+ - Edge cases and error handling are addressed
93
+ - Integration points are identified
94
+ - The user has confirmed the summary is accurate
95
+
96
+ **Signs that more questions are needed:**
97
+ - User's answers contain vague terms ("handle it appropriately", "make it user-friendly", "standard behavior")
98
+ - Core business rules are undefined ("depends on the situation")
99
+ - Data relationships are unclear ("somehow connected")
100
+ - User says "I'm not sure" — help them think through it with concrete options
101
+
102
+ ## Requirements Summary Template
103
+
104
+ Once brainstorming is complete, produce a structured requirements summary using the following format. Present the summary to the user and get explicit confirmation before proceeding.
105
+
106
+ ```markdown
107
+ ## Requirements Summary
108
+
109
+ ### Project/Feature: [Name]
110
+
111
+ ### Core Functionality
112
+ - [Bullet list of what the system does]
113
+
114
+ ### User Roles
115
+ - [Role]: [What they can do]
116
+
117
+ ### Data Model Overview
118
+ - [Entity]: [Key fields, relationships]
119
+
120
+ ### Key Business Rules
121
+ - [Rule 1]
122
+ - [Rule 2]
123
+
124
+ ### Integration Points
125
+ - [External system/API/module]
126
+
127
+ ### Edge Cases & Error Handling
128
+ - [Case]: [Expected behavior]
129
+
130
+ ### Non-Functional Requirements
131
+ - [Requirement]
132
+
133
+ ### Reference Materials Reviewed
134
+ - [List of code paths, documents, .prizmkit/prizm-docs/ files that were read]
135
+
136
+ ### Confirmed by user: ✓
137
+ ```
@@ -5,6 +5,17 @@ description: "Full-lifecycle dev toolkit index. Routes to the right PrizmKit ski
5
5
 
6
6
  # PrizmKit — Full-Lifecycle Development Toolkit
7
7
 
8
+ ### When to Use
9
+ - User asks "which command?", "help", "how do I start a feature", "get started", "what tools"
10
+ - User wants to understand the PrizmKit development lifecycle
11
+ - User invokes "/prizmkit" or asks about dev workflow
12
+ - User is new to the project and needs orientation
13
+
14
+ ### When NOT to Use
15
+ - User already knows which specific skill to use — invoke it directly
16
+ - Mid-implementation — use the specific skill needed (/prizmkit-implement, /prizmkit-code-review, etc.)
17
+ - User wants to execute immediately without orientation — go directly to /prizmkit-plan or /prizmkit-implement
18
+
8
19
  ## Task Execution Model
9
20
 
10
21
  PrizmKit uses **headless mode** — each task runs as an independent AI CLI session with NO context carryover between tasks. Every session starts by reading docs and ends by maintaining docs.
@@ -32,108 +32,98 @@ The loop repeats until the Reviewer finds no issues or the max round limit is re
32
32
 
33
33
  1. **Read spec.md** from the artifact directory — extract goals and acceptance criteria.
34
34
  2. **Read plan.md** from the artifact directory — extract architecture decisions and completed tasks.
35
- 3. **Read dev rules** (if configured): Read `.prizmkit/prizm-docs/root.prizm` and check for a `RULES:` line. If present, read all referenced `.prizmkit/rules/<layer>-rules.md` files. If a referenced file does not exist, skip it silently and continue. These define per-layer conventions that the code should follow.
35
+ 3. **Read dev rules** (if configured): If `.prizmkit/prizm-docs/root.prizm` exists, read it and check for a `RULES:` line. If present, read all referenced `.prizmkit/rules/<layer>-rules.md` files. If `root.prizm` or a referenced rules file does not exist, continue with "No custom dev rules configured use general best practices."
36
36
  4. **Capture workspace diff**: run `git diff` (unstaged) + `git diff --cached` (staged) + `git status` to understand the full scope of changes. For new files in git status, note their paths for the Reviewer to read.
37
- - If no changes are detected, output PASS and stop.
37
+ - If no changes are detected, skip Phase 1 and proceed to Phase 2 with verdict PASS, rounds 0, and an empty findings list. Always write `review-report.md`; downstream pipeline steps use it as the review gate.
38
38
 
39
39
  ## Phase 1: Review-Fix Loop
40
40
 
41
- ```
42
- ┌─── Loop (max 3 rounds) ──────────────────────────────┐
43
- │ │
44
- │ Step 1: Spawn Reviewer Agent (read-only) │
45
- │ → Input: git diff + spec goals + plan decisions + dev rules│
46
- │ → Output: structured findings or PASS │
47
- │ │
48
- │ Step 2: Check result │
49
- │ → If PASS (no findings): exit loop │
50
- │ │
51
- │ Step 3: Main Agent filters findings │
52
- │ → For each finding: accept (reasonable) or reject │
53
- │ → If all rejected: exit loop │
54
- │ │
55
- │ Step 4: Spawn Dev Agent (read-write) │
56
- │ → Input: accepted findings + spec/plan context │
57
- │ → Output: fix report │
58
- │ │
59
- │ Step 5: Back to Step 1 │
60
- │ │
61
- │ Hard limit: exit after 3 rounds regardless │
62
- │ → On max-round exhaustion: output a summary of all │
63
- │ unresolved findings to the conversation, then write │
64
- │ review-report.md with NEEDS_FIXES verdict. │
65
- └────────────────────────────────────────────────────────┘
41
+ ### Gate Mode Detection
42
+
43
+ The loop exit conditions are enforced by a gatekeeper. Check Python availability first:
44
+
45
+ ```bash
46
+ python3 --version 2>/dev/null && echo "SCRIPT_MODE" || echo "TEXT_MODE"
66
47
  ```
67
48
 
68
- ### Step 1: Spawn Reviewer Agent
49
+ - **Script mode** (Python available): Use `${SKILL_DIR}/scripts/check_loop.py` to enforce exit conditions with round tracking, max-rounds enforcement, and divergence detection. The script prevents accidentally exceeding the 3-round limit.
50
+ - **Text mode** (no Python): Follow §Text Fallback Constraints — identical behavior enforced manually.
51
+
52
+ ### Step 0: Initialize Loop State
53
+
54
+ The script is stateless — no `--reset` or runtime files. Initialize these values before starting:
69
55
 
70
- Include the dev rules read in Phase 0 step 3 in the `## Dev Rules` section of the prompt below. Spawn a **read-only** agent (subagent_type: `Explore`) with the following prompt:
56
+ **Script mode** `findings_history = []`, `max_rounds = 3`, `round = 1`.
57
+ **Text mode** — track manually: `round = 1`, `findings_history = []`.
71
58
 
59
+ ### Loop Flow
60
+
61
+ ```
62
+ 1. Spawn Reviewer Agent (read-only) → findings or PASS
63
+ 2. Parse result:
64
+ - PASS → Call Loop Exit Gate → Phase 2
65
+ - NEEDS_FIXES → count findings → Step 3 (do not call gate yet)
66
+ 3. Main Agent filters findings → Call Loop Exit Gate → if endLoop: Phase 2
67
+ 4. Spawn Dev Agent (read-write) → apply fixes
68
+ 5. Increment round and return to Step 1
72
69
  ```
73
- You are a code reviewer. Review workspace changes against the spec goals, plan decisions, and per-layer dev rules.
74
70
 
75
- ## Spec Goals
76
- {goals and acceptance criteria from spec.md}
71
+ ### Loop Exit Gate
72
+
73
+ Call the gate only in these cases:
77
74
 
78
- ## Plan Decisions
79
- {architecture decisions and task list from plan.md}
75
+ 1. Reviewer returned `PASS`.
76
+ 2. Main Agent has finished filtering `NEEDS_FIXES` findings.
80
77
 
81
- ## Dev Rules (per-layer conventions)
82
- {rules from .prizmkit/rules/<layer>-rules.md, or "No custom dev rules configured — use general best practices."}
78
+ Do not call the gate for `NEEDS_FIXES` before filtering, because `accepted_count` is not known yet. Only exit the loop when `endLoop` is `true` — the gate is the sole authority on exit decisions.
83
79
 
84
- ## Review Round
85
- Round {N}. {round_context}
80
+ **Script mode invocation:**
81
+ ```bash
82
+ echo '{"reviewer_result":"NEEDS_FIXES","accepted_count":2,"findings_count":3,"round":1,"findings_history":[],"max_rounds":3,"filtering_done":true}' | python3 ${SKILL_DIR}/scripts/check_loop.py
83
+ ```
86
84
 
87
- ## What to Review
88
- Run these commands to see the current workspace changes:
89
- - `git diff` (unstaged changes)
90
- - `git diff --cached` (staged changes)
91
- - `git status` (new/deleted files)
85
+ | Input field | Type | Description |
86
+ |-------------|------|-------------|
87
+ | `reviewer_result` | `"PASS"` or `"NEEDS_FIXES"` | Reviewer's verdict |
88
+ | `accepted_count` | int | Findings accepted by Main Agent. Use `0` for Reviewer PASS or when all findings were rejected after filtering. |
89
+ | `findings_count` | int | Total findings returned by Reviewer this round |
90
+ | `round` | int | Current round number (1-based, model-supplied — the script does not auto-increment) |
91
+ | `findings_history` | `[int, ...]` | Findings count per round, used for divergence detection. Initialize as `[]`. Pass back the value from the previous gate call's output. |
92
+ | `max_rounds` | int | Maximum review rounds before forced exit. Default `3`. |
93
+ | `filtering_done` | bool | `true` only after Main Agent has filtered `NEEDS_FIXES` findings. For Reviewer PASS, this may be omitted. |
92
94
 
93
- For new files shown in git status, read their full content.
94
- For modified files, read enough surrounding context to understand the change.
95
+ Output: `{"endLoop": bool, "reason": str, "verdict": "PASS"|"NEEDS_FIXES"|null, "round": int, "maxRounds": int, "divergenceWarning": bool, "findings_history": [int, ...]}`
95
96
 
96
- ## Review Dimensions
97
- Evaluate the changes across these dimensions (focus on what's relevant):
97
+ The script enforces three exit conditions in order: (1) Reviewer PASS → exit with verdict PASS, (2) filtered `NEEDS_FIXES` with zero accepted findings → exit with verdict PASS, (3) max rounds reached after filtering → exit with verdict NEEDS_FIXES. It records `findings_count` once per round by round index, so repeated gate calls cannot duplicate history entries. If `divergenceWarning` is true, warn the user the loop may not be converging.
98
98
 
99
- 1. **Goal alignment**: Do the changes accomplish all goals from spec.md? Anything missing or off-target?
100
- 2. **Defects**: Logic bugs, missing error handling, boundary condition issues, incorrect behavior.
101
- 3. **Completeness**: Files that should have been changed but weren't? Missing tests, types, imports, exports?
102
- 4. **Consistency**: Do changes follow the project's existing patterns, naming conventions, and code style?
103
- 5. **Security**: Hardcoded secrets, injection vulnerabilities, unsafe operations.
104
- 6. **Rules compliance**: (Skip this dimension if no dev rules were provided.) Do changes follow the per-layer dev rules? Flag violations of framework conventions, naming patterns, state management, or other rules defined for that layer.
99
+ **Text mode** enforce §Text Fallback Constraints manually with identical logic.
105
100
 
106
- ## Output Format
107
- Respond with EXACTLY this format:
101
+ ### Text Fallback Constraints
108
102
 
109
- ### Result: PASS | NEEDS_FIXES
103
+ When Python is unavailable, apply these rules exactly — they match the script's logic:
110
104
 
111
- ### Findings
112
- (If PASS, write "No issues found.")
105
+ 1. **PASS exit**: Reviewer returns `PASS` → exit loop, verdict PASS.
106
+ 2. **Pre-filter NEEDS_FIXES**: Count findings and continue to filtering. Do not apply all-rejected or max-round exits before filtering.
107
+ 3. **All-rejected exit**: After filtering, if all findings were rejected → exit loop, verdict PASS.
108
+ 4. **Max rounds**: After filtering, if `round >= 3` and accepted findings remain → exit loop, verdict NEEDS_FIXES. Write `review-report.md` with unresolved findings.
109
+ 5. **Divergence**: If findings count strictly increases for 3 consecutive recorded rounds, warn user the loop may not converge.
110
+ 6. **Counter**: Increment `round` after each complete cycle (Steps 1-4). Track `findings_history` by round index to detect divergence — record `findings_count` once per round.
113
111
 
114
- #### Finding N
115
- - **Severity**: high | medium | low
116
- - **Dimension**: goal-alignment | defect | completeness | consistency | security | rules-compliance
117
- - **Location**: filepath:line (or "project-level")
118
- - **Problem**: What is wrong and why it matters
119
- - **Suggestion**: Recommended fix approach
120
- - **Verification**: How to confirm the fix is correct
112
+ ### Step 1: Spawn Reviewer Agent
121
113
 
122
- ### Summary
123
- One to two sentences about the overall state of the changes.
124
- ```
114
+ Include the dev rules read in Phase 0 step 3 in the `## Dev Rules` section of the prompt. Spawn a platform-supported **read-only** reviewer agent; use `subagent_type: Explore` only on platforms that support it. If no read-only agent is available, perform the review in the Main Agent without editing files. Read `${SKILL_DIR}/references/reviewer-agent-prompt.md` for the full prompt template — fill `{goals}`, `{plan decisions}`, `{dev rules}`, `{round N}`, and `{round_context}` before spawning.
125
115
 
126
- **Round context** varies by round:
116
+ Round context varies by round:
127
117
  - Round 1: "This is the first review. Examine all changes comprehensively."
128
118
  - Round 2+: "Previous round found issues that were fixed. Focus on: (1) whether previous fixes are correct, (2) whether fixes introduced new problems, (3) any remaining issues. Do not re-report issues that have already been fixed."
129
119
 
130
- ### Step 2: Check Result
120
+ ### Step 2: Check Result + Gate
131
121
 
132
122
  Parse the Reviewer Agent's output:
133
- - If `Result: PASS` → exit loop, proceed to Phase 2.
134
- - If `Result: NEEDS_FIXES` → extract findings and continue to Step 3.
123
+ - If `Result: PASS` → call the **Loop Exit Gate** with `{"reviewer_result": "PASS", "accepted_count": 0, "findings_count": 0, "round": <current_round>, "findings_history": <current_history>, "max_rounds": 3}`. If `endLoop=true`, proceed to Phase 2.
124
+ - If `Result: NEEDS_FIXES` → count findings, do not call the gate yet, then continue to Step 3.
135
125
 
136
- ### Step 3: Main Agent Filters Findings
126
+ ### Step 3: Main Agent Filters Findings + Gate
137
127
 
138
128
  Review each finding and decide whether it's reasonable. This prevents unnecessary or harmful changes.
139
129
 
@@ -146,76 +136,17 @@ Review each finding and decide whether it's reasonable. This prevents unnecessar
146
136
  - **Accepted**: The finding is reasonable — include it in the Dev Agent's task.
147
137
  - **Rejected** (with reason): Brief explanation (e.g., "Out of scope", "Style preference, not a defect").
148
138
 
149
- If all findings are rejected exit loop, proceed to Phase 2.
139
+ After filtering: call the **Loop Exit Gate** with `{"reviewer_result": "NEEDS_FIXES", "accepted_count": <N>, "findings_count": <total findings this round>, "round": <current_round>, "findings_history": <current_history>, "max_rounds": 3, "filtering_done": true}`. If `endLoop=true`, proceed to Phase 2.
150
140
 
151
141
  ### Step 4: Spawn Dev Agent
152
142
 
153
- Spawn a **general-purpose** agent (read-write) with the following prompt:
154
-
155
- ```
156
- You are a developer fixing code review findings. Apply each fix carefully without breaking existing functionality.
157
-
158
- ## Spec Context
159
- {goals from spec.md for reference}
160
-
161
- ## Findings to Fix
162
- {accepted findings list — each with Severity, Location, Problem, Suggestion, Verification}
163
-
164
- ## Instructions
165
- 1. Read each finding carefully.
166
- 2. For each finding:
167
- a. Read the relevant code and understand the context.
168
- b. Implement the fix based on the suggestion.
169
- c. If a suggestion is not feasible (would break other functionality, technically impossible), explain why.
170
- 3. After all fixes, report what you did.
171
-
172
- ## Output Format
173
- For each finding, report:
174
- - **Finding N**: [fixed | unable-to-fix]
175
- - **What was done**: Brief description
176
- - **Files modified**: List of changed files
177
- (If unable-to-fix, explain why)
178
- ```
143
+ Spawn a platform-supported **read-write** developer agent. If no write-capable agent is available, the Main Agent applies accepted fixes directly. Read `${SKILL_DIR}/references/dev-agent-prompt.md` for the full prompt template — fill `{spec context}` and `{accepted findings}` before spawning.
179
144
 
180
145
  After the Dev Agent returns, record results and return to Step 1 for the next round.
181
146
 
182
147
  ## Phase 2: Output
183
148
 
184
- Write `review-report.md` to the artifact directory:
185
-
186
- ```markdown
187
- # Review Report
188
-
189
- ## Verdict: PASS
190
- ## Rounds: 2
191
- ## Total findings: 3 → Fixed: 2, Rejected: 1
192
-
193
- ## Round 1
194
- Findings: 3 | Accepted: 2, Rejected: 1
195
-
196
- ### Finding 1: Missing null check in parseConfig
197
- - Severity: high
198
- - Dimension: defect
199
- - Location: src/config.ts:42
200
- - Problem: parseConfig crashes when input is undefined
201
- - Status: fixed (round 1)
202
-
203
- ### Finding 2: Export missing from index.ts
204
- - Severity: medium
205
- - Dimension: completeness
206
- - Location: src/index.ts
207
- - Problem: New parseConfig function not exported
208
- - Status: fixed (round 1)
209
-
210
- ### Finding 3: Consider renaming variable
211
- - Severity: low
212
- - Dimension: consistency
213
- - Location: src/config.ts:15
214
- - Problem: Variable `d` should be more descriptive
215
- - Status: rejected — Style preference; existing code uses short names in this module
216
-
217
- ## Round 2: PASS — no new findings
218
- ```
149
+ Always write `review-report.md` to the artifact directory, including no-change PASS results. Read `${SKILL_DIR}/references/review-report-template.md` for the full output format.
219
150
 
220
151
  - `PASS`: Reviewer returned no findings (or all remaining findings were rejected as unreasonable)
221
152
  - `NEEDS_FIXES`: 3 rounds completed but unresolved findings remain
@@ -0,0 +1,30 @@
1
+ # Dev Agent Prompt Template
2
+
3
+ Used in Phase 1 Step 4 of `/prizmkit-code-review`. The orchestrator fills `{spec context}` and `{accepted findings}` before spawning the Dev Agent.
4
+
5
+ ```
6
+ You are a developer fixing code review findings. Apply each fix carefully without breaking existing functionality.
7
+
8
+ ## Spec Context
9
+ {goals from spec.md for reference}
10
+
11
+ ## Findings to Fix
12
+ {accepted findings list — each with Severity, Location, Problem, Suggestion, Verification}
13
+
14
+ ## Instructions
15
+ 1. Read each finding carefully.
16
+ 2. For each finding:
17
+ a. Read the relevant code and understand the context.
18
+ b. Implement the fix based on the suggestion.
19
+ c. If a suggestion is not feasible (would break other functionality, technically impossible), explain why.
20
+ 3. After all fixes, report what you did.
21
+
22
+ ## Output Format
23
+ For each finding, report:
24
+ - **Finding N**: [fixed | unable-to-fix]
25
+ - **What was done**: Brief description
26
+ - **Files modified**: List of changed files
27
+ (If unable-to-fix, explain why)
28
+ ```
29
+
30
+ After the Dev Agent returns, record results and return to Step 1 for the next round.
@@ -0,0 +1,31 @@
1
+ # Review Report Output Template
2
+
3
+ Used in Phase 2 of `/prizmkit-code-review`. Always write `review-report.md` to the artifact directory using this format.
4
+
5
+ ```markdown
6
+ # Review Report
7
+
8
+ ## Verdict: <PASS|NEEDS_FIXES>
9
+ ## Rounds: <number of review rounds completed; use 0 for no-change PASS>
10
+ ## Total findings: <total> → Fixed: <fixed>, Rejected: <rejected>, Unresolved: <unresolved>
11
+
12
+ ## Round <N>
13
+ Findings: <count> | Accepted: <count>, Rejected: <count>
14
+
15
+ ### Finding <N>: <short title>
16
+ - Severity: <high|medium|low>
17
+ - Dimension: <goal-alignment|defect|completeness|consistency|security|rules-compliance>
18
+ - Location: <filepath:line or project-level>
19
+ - Problem: <what was wrong and why it mattered>
20
+ - Status: <fixed (round N)|rejected — reason|unresolved — reason>
21
+
22
+ ## Final Summary
23
+ <One to three sentences summarizing the review outcome, including no-change PASS when applicable.>
24
+ ```
25
+
26
+ For `PASS` with no findings, write `Total findings: 0 → Fixed: 0, Rejected: 0, Unresolved: 0` and `## Round 0: PASS — no workspace changes to review` or `## Round N: PASS — no issues found`.
27
+
28
+ ## Verdict Rules
29
+
30
+ - `PASS`: Reviewer returned no findings, no workspace changes existed, or all remaining findings were rejected as unreasonable.
31
+ - `NEEDS_FIXES`: Max rounds completed but accepted findings remain unresolved.