prizmkit 1.1.72 → 1.1.74
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/agents/prizm-dev-team-dev.md +11 -1
- package/bundled/dev-pipeline/lib/heartbeat.sh +71 -42
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +38 -0
- package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +21 -0
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +1 -1
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +5 -9
- package/bundled/dev-pipeline/templates/sections/feature-context.md +3 -18
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +6 -12
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +10 -3
- package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +1 -0
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +4 -8
- package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +26 -2
- package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +38 -0
- package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +21 -0
- package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +1 -1
- package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +27 -0
- package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +543 -14
- package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +664 -14
- package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +741 -14
- package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +2 -2
- package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +1 -1
- package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +3 -3
- package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +3 -18
- package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +239 -40
- package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +75 -26
- package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +142 -36
- package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +2 -2
- package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +7 -17
- package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +10 -3
- package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +3 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +7 -3
- package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +1 -3
- package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +1 -1
- package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +2 -2
- package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +13 -17
- package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +2 -4
- package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +1 -1
- package/bundled/skills/_metadata.json +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,92 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dev-Pipeline Session Bootstrap — Tier 3 (Full Team)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Session Context
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
- **Feature ID**: {{FEATURE_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
|
|
6
|
+
- **Complexity**: {{COMPLEXITY}}
|
|
7
|
+
- **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}}
|
|
8
|
+
|
|
9
|
+
## Your Mission
|
|
10
|
+
|
|
11
|
+
You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATURE_TITLE}}".
|
|
12
|
+
|
|
13
|
+
**CRITICAL**: You MUST NOT exit until ALL work is complete and committed. When you spawn subagents, wait for each to finish (run_in_background=false). Do NOT spawn agents in background and exit — that kills the session.
|
|
14
|
+
|
|
15
|
+
**Tier 3 — Full Team**: For complex features, use the full pipeline (Phase 0–6) with Dev + Reviewer agents spawned via the Agent tool.
|
|
16
|
+
|
|
17
|
+
**Agent spawn failure policy (all Agent tool calls)**:
|
|
18
|
+
- If spawning Dev, Reviewer, or Critic fails with team/config/lock errors, retry at most once.
|
|
19
|
+
- If the second attempt fails, do not keep spawning variants and do not enter artifact polling for Implementation Log, challenge report, or review report markers.
|
|
20
|
+
- Use the documented inline/recovery fallback for that phase: write the required report yourself where possible, complete remaining Dev work directly in the orchestrator when safe, or write `failure-log.md` with the spawn error and last observable state before stopping for recovery.
|
|
21
|
+
- Apply the same cap to any re-spawn for report repair or resume prompts; do not burn multiple minutes on identical team/config/lock failures.
|
|
22
|
+
|
|
23
|
+
### Feature Description
|
|
7
24
|
|
|
8
25
|
{{FEATURE_DESCRIPTION}}
|
|
9
26
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
{{USER_CONTEXT}}
|
|
28
|
+
|
|
29
|
+
### Acceptance Criteria
|
|
30
|
+
|
|
31
|
+
{{ACCEPTANCE_CRITERIA}}
|
|
32
|
+
|
|
33
|
+
### Project Brief
|
|
34
|
+
|
|
35
|
+
> Product ideas checklist from planning. Lines marked [x] are already implemented. When your feature touches any [ ] item, ensure alignment. After implementation, mark relevant items [x] and append the key file/directory paths.
|
|
36
|
+
|
|
37
|
+
{{PROJECT_BRIEF}}
|
|
38
|
+
|
|
39
|
+
### Dependencies (Already Completed)
|
|
40
|
+
|
|
41
|
+
{{COMPLETED_DEPENDENCIES}}
|
|
42
|
+
|
|
43
|
+
### App Global Context
|
|
44
|
+
|
|
45
|
+
{{GLOBAL_CONTEXT}}
|
|
46
|
+
|
|
47
|
+
## ⚠️ Context Budget Rules (CRITICAL — read before any phase)
|
|
48
|
+
|
|
49
|
+
You are running in **headless non-interactive mode** with a FINITE context window. Exceeding it will crash the session and lose all work. Follow these rules strictly:
|
|
50
|
+
|
|
51
|
+
0. **NON-INTERACTIVE MODE** — There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, NEVER use interactive prompts (e.g. "Would you like me to…"). If a skill has an interactive step (e.g. offer remediation, ask for approval), skip it and proceed autonomously. Make decisions based on the data available and move forward.
|
|
52
|
+
|
|
53
|
+
1. **context-snapshot.md is your single source of truth** — After Phase 1-2 builds it, ALWAYS read context-snapshot.md instead of re-reading individual source files
|
|
54
|
+
2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
|
|
55
|
+
3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
|
|
56
|
+
4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
|
|
57
|
+
5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`& { <command> } 2>&1 | Tee-Object (Join-Path $env:TEMP "out.txt") | Select-Object -Last 20`), then scan the first/last lines to identify relevant fields, and use targeted filtering (`Select-String`, regex matching, PowerShell object filtering) to extract only the information needed for the current task. Only read the filtered result — never the raw full output.
|
|
58
|
+
6. **No intermediate commits** — Do NOT run `git add`/`git commit` during Phase 1-5. All changes are committed once at the end in Phase 6 via `/prizmkit-committer`.
|
|
59
|
+
7. **Batch independent operations** — Issue multiple independent `Write`/`Read` calls in a single message turn when they have no dependencies. Combine multiple directory creations into one `New-Item -ItemType Directory -Force` command. Never run `npm test` twice just to apply a different Select-String filter — capture output to `(Join-Path $env:TEMP "test-out.txt")` once and use Select-String on the file.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## PrizmKit Directory Convention
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes Sections 1-4; Dev appends Implementation Log; Reviewer appends Review Notes
|
|
67
|
+
.prizmkit/specs/{{FEATURE_SLUG}}/spec.md
|
|
68
|
+
.prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**`context-snapshot.md`** is the shared knowledge base. Orchestrator writes Sections 1-4; Dev appends Implementation Log; Reviewer appends Review Notes. This eliminates redundant I/O across all agents.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Subagent Timeout Recovery
|
|
76
|
+
|
|
77
|
+
If any agent times out:
|
|
78
|
+
1. `Get-ChildItem -LiteralPath ".prizmkit/specs/{{FEATURE_SLUG}}/" -ErrorAction SilentlyContinue` — check what exists
|
|
79
|
+
2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and any Implementation Log/Review Notes from previous agents. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
|
|
80
|
+
3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Execution
|
|
85
|
+
|
|
86
|
+
### PowerShell Python Helper
|
|
87
|
+
|
|
88
|
+
Define this helper once in the active PowerShell session before running PrizmKit Python scripts:
|
|
16
89
|
|
|
17
|
-
## PowerShell checkpoint update
|
|
18
90
|
```powershell
|
|
19
91
|
function Invoke-PrizmPython {
|
|
20
92
|
param([Parameter(ValueFromRemainingArguments = $true)][string[]]$Arguments)
|
|
@@ -36,8 +108,663 @@ function Invoke-PrizmPython {
|
|
|
36
108
|
}
|
|
37
109
|
throw "Python 3 is required. Install Python and ensure python or py is in PATH."
|
|
38
110
|
}
|
|
39
|
-
Invoke-PrizmPython {{PIPELINE_DIR}}\scripts\update-checkpoint.py --checkpoint-path {{CHECKPOINT_PATH}} --step prizmkit-implement --status completed
|
|
40
111
|
```
|
|
41
112
|
|
|
42
|
-
|
|
43
|
-
|
|
113
|
+
|
|
114
|
+
{{IF_INIT_NEEDED}}
|
|
115
|
+
### Phase 0: Project Bootstrap
|
|
116
|
+
- Run `/prizmkit-init` (invoke the prizmkit-init skill)
|
|
117
|
+
- Run `Invoke-PrizmPython {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
|
|
118
|
+
- **CP-0**: Verify `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json` exist
|
|
119
|
+
{{END_IF_INIT_NEEDED}}
|
|
120
|
+
{{IF_INIT_DONE}}
|
|
121
|
+
### Phase 0: Record Test Baseline & Detect Test Commands
|
|
122
|
+
|
|
123
|
+
**Step 1 — Detect test commands**: You know this project's tech stack. Identify ALL test commands that apply (e.g., `go test ./...`, `npm test`, `cargo test`, `pytest`, `make test`, etc.). Record them as `TEST_CMDS`.
|
|
124
|
+
|
|
125
|
+
**Step 2 — Record pre-existing failure baseline**:
|
|
126
|
+
```powershell
|
|
127
|
+
& { {{TEST_CMD}} } 2>&1 | Tee-Object (Join-Path $env:TEMP "test-baseline.txt") | Select-Object -Last 20
|
|
128
|
+
```
|
|
129
|
+
Save the list of **pre-existing failing tests** (if any) as `BASELINE_FAILURES`. These are known failures that existed before this session — Dev must NOT be blamed for them, but must list them in COMPLETION_SIGNAL.
|
|
130
|
+
|
|
131
|
+
> **⚠️ Test Output Rule**: Always capture test output to a temp file (`Tee-Object (Join-Path $env:TEMP "test-out.txt")`). Then use Select-String on the file instead of re-running the suite.
|
|
132
|
+
{{END_IF_INIT_DONE}}
|
|
133
|
+
|
|
134
|
+
### Step 1: Initialize
|
|
135
|
+
|
|
136
|
+
1. Run init script:
|
|
137
|
+
`Invoke-PrizmPython {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
|
|
138
|
+
|
|
139
|
+
2. Check for existing artifacts:
|
|
140
|
+
`Get-ChildItem -LiteralPath ".prizmkit/specs/{{FEATURE_SLUG}}/" -ErrorAction SilentlyContinue`
|
|
141
|
+
|
|
142
|
+
{{IF_FRESH_START}}
|
|
143
|
+
```powershell
|
|
144
|
+
Invoke-PrizmPython {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}
|
|
145
|
+
```
|
|
146
|
+
{{END_IF_FRESH_START}}
|
|
147
|
+
|
|
148
|
+
### Phase 1-2: Specify + Plan — Orchestrator (you)
|
|
149
|
+
|
|
150
|
+
Check existing artifacts first:
|
|
151
|
+
```powershell
|
|
152
|
+
Get-ChildItem -LiteralPath ".prizmkit/specs/{{FEATURE_SLUG}}/" -ErrorAction SilentlyContinue
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- Both (spec.md, plan.md) exist → **SKIP to CP-1**
|
|
156
|
+
- `context-snapshot.md` exists → use it directly, skip Phase 1
|
|
157
|
+
- Some missing → generate only missing files
|
|
158
|
+
|
|
159
|
+
Before planning, check whether feature code already exists in the project (search in source directories identified from `root.prizm` or the project tree scan):
|
|
160
|
+
```powershell
|
|
161
|
+
Get-ChildItem -Path . -Recurse -File -Include *.js,*.ts,*.py,*.go,*.java,*.rb,*.rs -ErrorAction SilentlyContinue |
|
|
162
|
+
Where-Object { $_.FullName -notmatch '\\(node_modules|\.git|dist|build|vendor|\.prizmkit)\\' } |
|
|
163
|
+
Select-String -Pattern "{{FEATURE_SLUG}}" -List |
|
|
164
|
+
Select-Object -First 20 -ExpandProperty Path
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Record result as `EXISTING_CODE` (list of files, or empty).
|
|
168
|
+
|
|
169
|
+
If `EXISTING_CODE` is non-empty: your spec/plan/tasks must reflect this existing implementation — document what exists, identify gaps, do NOT re-implement what is already done.
|
|
170
|
+
|
|
171
|
+
**Step A — Build Context Snapshot** (skip if `context-snapshot.md` already exists):
|
|
172
|
+
|
|
173
|
+
1. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 prizm docs
|
|
174
|
+
2. Detect source code directories: read KEY_FILES and STRUCTURE sections from `root.prizm` to identify where source code lives (e.g. `src/`, `app/`, `lib/`, `cmd/`, `packages/`, or project root). If `root.prizm` is missing, scan the project tree:
|
|
175
|
+
```powershell
|
|
176
|
+
Get-ChildItem -Path . -Recurse -File -Depth 2 -Include *.js,*.ts,*.py,*.go,*.java,*.rb,*.rs -ErrorAction SilentlyContinue |
|
|
177
|
+
Where-Object { $_.FullName -notmatch '\\(node_modules|\.git|dist|build|vendor)\\' } |
|
|
178
|
+
Select-Object -First 30 -ExpandProperty FullName
|
|
179
|
+
```
|
|
180
|
+
Identify the top-level source directories from the results.
|
|
181
|
+
3. Scan the detected source directories for files related to this feature; read each one
|
|
182
|
+
4. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
|
|
183
|
+
- **Section 1 — Feature Brief**: feature description (2-3 lines) + acceptance criteria (copy from above)
|
|
184
|
+
- **Section 2 — Verification Gates**: copy the gate checklist from the Task Contract above
|
|
185
|
+
- **Section 3 — Key TRAPS & RULES**: extract only relevant TRAPS/RULES from prizm-docs that apply to files in this scope. Do NOT copy full L0/L1/L2 content.
|
|
186
|
+
- **Section 4 — File Manifest**: For each file relevant to this feature, list: file path, why it's needed (modify/reference/test), key interface signatures (function names + params + return types). Do NOT include full file content — agents read files on-demand. Format:
|
|
187
|
+
### Files to Modify
|
|
188
|
+
| File | Why Needed | Key Interfaces |
|
|
189
|
+
|------|-----------|----------------|
|
|
190
|
+
| `<source-dir>/config.js` | Add runtime config layer | `config` (Zod object), `configSchema` |
|
|
191
|
+
|
|
192
|
+
### Files for Reference
|
|
193
|
+
| File | Why Needed | Key Interfaces |
|
|
194
|
+
|------|-----------|----------------|
|
|
195
|
+
| `<source-dir>/security/permission-guard.js` | Permission check integration | `checkCommandPermission(userId, cmd)` |
|
|
196
|
+
|
|
197
|
+
### Known TRAPS (from .prizmkit/prizm-docs/)
|
|
198
|
+
- <trap entries extracted from L1/L2 docs>
|
|
199
|
+
4. Confirm: `Test-Path -LiteralPath ".prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md"`
|
|
200
|
+
|
|
201
|
+
**After Step A**: Use context-snapshot.md Section 4 File Manifest to guide targeted file reads. Do NOT scan directories or read unrelated files.
|
|
202
|
+
|
|
203
|
+
**Step B — Planning Artifacts** (generate only missing files):
|
|
204
|
+
|
|
205
|
+
```powershell
|
|
206
|
+
@(".prizmkit/specs/{{FEATURE_SLUG}}/spec.md", ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md") | ForEach-Object { if (Test-Path -LiteralPath $_) { $_ } }
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
- spec.md missing: Run `/prizmkit-plan` → generate spec.md. Resolve any `[NEEDS CLARIFICATION]` markers using the feature description — do NOT pause for interactive input.
|
|
210
|
+
- plan.md missing: Run `/prizmkit-plan` → generate plan.md (architecture, components, interface design, data model, testing strategy, risk assessment, and Tasks section with `[ ]` checkboxes)
|
|
211
|
+
|
|
212
|
+
> All files go under `.prizmkit/specs/{{FEATURE_SLUG}}/`. Confirm each with `Test-Path` after writing.
|
|
213
|
+
|
|
214
|
+
**Database Design Gate** (if feature involves data persistence — new tables, schema changes, new entities):
|
|
215
|
+
Before proceeding past CP-1, verify:
|
|
216
|
+
1. Plan.md Data Model section references existing schema/model files (scan for `*.prisma`, `*.sql`, `migrations/`, `models/`, `*.entity.*` files; read them if not already in context-snapshot)
|
|
217
|
+
2. All new tables/fields follow existing naming conventions, ID strategy, timestamp patterns, and constraint style
|
|
218
|
+
3. No `[NEEDS CLARIFICATION]` remains in Data Model section — resolve by reading existing code and making a conservative choice that matches existing patterns. Document the resolution in plan.md.
|
|
219
|
+
4. If a DB design decision genuinely cannot be resolved from existing code alone, document the assumption made and flag it in the Implementation Log for user review.
|
|
220
|
+
|
|
221
|
+
**CP-1**: Both spec.md and plan.md exist.
|
|
222
|
+
|
|
223
|
+
### Phase 3: Analyze — Reviewer Agent
|
|
224
|
+
|
|
225
|
+
Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false).
|
|
226
|
+
|
|
227
|
+
Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for report artifacts; fix/check the plan inline or write `failure-log.md` before stopping for recovery.
|
|
228
|
+
|
|
229
|
+
Prompt:
|
|
230
|
+
> "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
|
|
231
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
|
|
232
|
+
> 2. Cross-check `spec.md` and `plan.md` (including Tasks section) for consistency.
|
|
233
|
+
> 3. Before flagging CRITICAL or HIGH issues, read the relevant source files listed in the File Manifest to verify.
|
|
234
|
+
> Report: CRITICAL, HIGH, MEDIUM issues found (or 'No issues found')."
|
|
235
|
+
|
|
236
|
+
Wait for Reviewer to return.
|
|
237
|
+
- If CRITICAL issues found: fix them yourself — read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full project context. Fix ONLY the listed CRITICAL issues in spec.md/plan.md. Then re-run analyze (max 1 round).
|
|
238
|
+
|
|
239
|
+
**CP-2**: No CRITICAL issues.
|
|
240
|
+
|
|
241
|
+
{{IF_CRITIC_ENABLED}}
|
|
242
|
+
### Phase 3.5: Plan Challenge — Critic Agent(s)
|
|
243
|
+
|
|
244
|
+
**Guard**: Verify critic agent file exists before spawning:
|
|
245
|
+
```powershell
|
|
246
|
+
if (Test-Path -LiteralPath "{{CRITIC_SUBAGENT_PATH}}") { "CRITIC:READY" } else { "CRITIC:MISSING" }
|
|
247
|
+
```
|
|
248
|
+
If CRITIC:MISSING — skip Phase 3.5 entirely and proceed to Phase 4. Log: "Critic agent not installed — skipping Plan Challenge."
|
|
249
|
+
|
|
250
|
+
**Choose ONE path based on `{{CRITIC_COUNT}}`:**
|
|
251
|
+
|
|
252
|
+
**If {{CRITIC_COUNT}} = 1 → Single Critic** (skip to CP-2.5 after this):
|
|
253
|
+
|
|
254
|
+
Spawn Critic agent (Agent tool, subagent_type="prizm-dev-team-critic", mode="plan", run_in_background=false).
|
|
255
|
+
|
|
256
|
+
Spawn failure cap: for team/config/lock errors, retry at most once for this Critic spawn. If the second attempt fails, do not poll for challenge reports; perform the plan challenge inline and record the fallback.
|
|
257
|
+
|
|
258
|
+
Prompt:
|
|
259
|
+
> "Read {{CRITIC_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
|
|
260
|
+
> **MODE: Plan Challenge**
|
|
261
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
|
|
262
|
+
> 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
|
|
263
|
+
> 3. Read existing source files in the modules this plan touches.
|
|
264
|
+
> 4. Challenge plan.md against the project's existing architecture, patterns, and style.
|
|
265
|
+
> Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report.md` with findings (or 'No significant challenges')."
|
|
266
|
+
|
|
267
|
+
**If {{CRITIC_COUNT}} = 3 → Multi-Critic Voting** (skip Single Critic above):
|
|
268
|
+
|
|
269
|
+
Spawn 3 Critic agents sequentially (each with mode="plan", run_in_background=false), each with a different focus lens:
|
|
270
|
+
|
|
271
|
+
Critic-A prompt (append to base prompt above):
|
|
272
|
+
> "**Focus Lens: Architecture & Scalability.** Prioritize: architectural pattern fit, scalability implications, over-engineering risks, component boundary design.
|
|
273
|
+
> Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-A.md`."
|
|
274
|
+
|
|
275
|
+
Critic-B prompt (append to base prompt above):
|
|
276
|
+
> "**Focus Lens: Data Model & Edge Cases.** Prioritize: data model design fit, entity relationships, edge cases in business logic, missing boundary conditions.
|
|
277
|
+
> Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-B.md`."
|
|
278
|
+
|
|
279
|
+
Critic-C prompt (append to base prompt above):
|
|
280
|
+
> "**Focus Lens: Security & Performance.** Prioritize: security attack surface, authentication/authorization gaps, performance bottlenecks, resource leaks.
|
|
281
|
+
> Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-C.md`."
|
|
282
|
+
|
|
283
|
+
After all critics return, read all 3 reports:
|
|
284
|
+
- Challenge raised by **2/3 or more** critics → **must respond** (adjust plan or justify why not)
|
|
285
|
+
- Challenge raised by **1/3 only** → logged in context-snapshot but not blocking
|
|
286
|
+
- Max 1 plan revision round.
|
|
287
|
+
|
|
288
|
+
**CP-2.5**: Plan challenges reviewed and resolved.
|
|
289
|
+
{{END_IF_CRITIC_ENABLED}}
|
|
290
|
+
|
|
291
|
+
### Phase 4: Implement — Dev Agent
|
|
292
|
+
|
|
293
|
+
**Build artifacts rule** (passed to Dev): After any build/compile command (`go build`, `npm run build`, `tsc`, etc.), ensure the output binary or build directory is in `.gitignore`. Never commit compiled binaries, build output, or generated artifacts.
|
|
294
|
+
|
|
295
|
+
Before spawning Dev, check plan.md Tasks section:
|
|
296
|
+
```powershell
|
|
297
|
+
if (Test-Path -LiteralPath ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md") {
|
|
298
|
+
(Select-String -Path ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md" -Pattern '^- \[ \]' -ErrorAction SilentlyContinue).Count
|
|
299
|
+
} else {
|
|
300
|
+
0
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
- If result is `0` (all tasks already `[x]`) → **SKIP Phase 4**, go directly to Phase 5. Do NOT spawn Dev.
|
|
304
|
+
- If result is non-zero → spawn Dev agent below.
|
|
305
|
+
|
|
306
|
+
Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false).
|
|
307
|
+
|
|
308
|
+
Spawn failure cap: for team/config/lock errors, retry at most once for this Dev spawn. If the second attempt fails, do not poll for `## Implementation Log`; write `failure-log.md` and either implement remaining tasks directly in the orchestrator or stop for recovery.
|
|
309
|
+
|
|
310
|
+
Prompt:
|
|
311
|
+
> "Read {{DEV_SUBAGENT_PATH}}. Implement feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
|
|
312
|
+
> **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has File Manifest with paths and interfaces.
|
|
313
|
+
> ⚠️ DO NOT re-read source files already listed in Section 4 File Manifest unless you need implementation detail beyond the interface summary.
|
|
314
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full context.
|
|
315
|
+
> 2. Run `/prizmkit-implement` to execute the tasks in plan.md. Run tests with: `{{TEST_CMD}}`. Known baseline failures (pre-existing, not your fault): `{{BASELINE_FAILURES}}`.
|
|
316
|
+
> 3. If plan.md has more than 5 tasks: run `/compact` after completing every 3 tasks to manage context budget. If `/compact` is unavailable, continue without it.
|
|
317
|
+
> 4. After implement completes, verify the '## Implementation Log' section was written to context-snapshot.md.
|
|
318
|
+
> 5. Do NOT execute any git commands (no git add/commit/reset/push).
|
|
319
|
+
> Do NOT exit until all tasks are [x] and the '## Implementation Log' section is written in context-snapshot.md."
|
|
320
|
+
|
|
321
|
+
**Gate Check — Implementation Log**:
|
|
322
|
+
After Dev agent returns, verify the Implementation Log was written:
|
|
323
|
+
```powershell
|
|
324
|
+
if (Select-String -Path ".prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md" -Pattern "## Implementation Log" -Quiet -ErrorAction SilentlyContinue) { "GATE:PASS" } else { "GATE:MISSING" }
|
|
325
|
+
```
|
|
326
|
+
If GATE:MISSING — send message to Dev (re-spawn if needed): "Write the '## Implementation Log' section to context-snapshot.md before I can proceed to review. Include: files changed/created, key decisions, deviations from plan, notable discoveries."
|
|
327
|
+
|
|
328
|
+
Wait for Dev to return. **If Dev times out before all tasks are `[x]`**:
|
|
329
|
+
1. Check progress: `(Select-String -Path ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md" -Pattern '^- \[ \]' -ErrorAction SilentlyContinue).Count`
|
|
330
|
+
2. If any tasks remain: re-spawn Dev with this recovery prompt:
|
|
331
|
+
> "Read {{DEV_SUBAGENT_PATH}}. You are resuming implementation of feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
|
|
332
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — Section 4 has File Manifest, 'Implementation Log' (if present) shows what was already done.
|
|
333
|
+
> 2. Run `git diff HEAD` to see actual code changes already made.
|
|
334
|
+
> 3. Run `/prizmkit-implement` to complete the remaining `[ ]` tasks. Run tests with: `{{TEST_CMD}}`.
|
|
335
|
+
> 4. Do NOT execute any git commands."
|
|
336
|
+
3. Max 2 recovery retries. After 2 failures, orchestrator implements remaining tasks directly.
|
|
337
|
+
|
|
338
|
+
All tasks `[x]`, tests pass.
|
|
339
|
+
|
|
340
|
+
### Phase 5: Review + Test — Reviewer Agent
|
|
341
|
+
|
|
342
|
+
Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
|
|
343
|
+
|
|
344
|
+
Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for `review-report.md`; write `failure-log.md` with the spawn error and last observable state before stopping or performing an inline fallback.
|
|
345
|
+
|
|
346
|
+
Prompt:
|
|
347
|
+
> "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
|
|
348
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/spec.md` for goals and acceptance criteria
|
|
349
|
+
> 2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` for architecture decisions and completed tasks
|
|
350
|
+
> 3. Run /prizmkit-code-review with artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/. The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes review-report.md.
|
|
351
|
+
> 4. Run the full test suite using `{{TEST_CMD}}`. When running tests: `& { {{TEST_CMD}} } 2>&1 | Tee-Object (Join-Path $env:TEMP "review-test-out.txt") | Select-Object -Last 20`, then Select-String `(Join-Path $env:TEMP "review-test-out.txt")` for details — do NOT re-run the suite multiple times.
|
|
352
|
+
> 5. review-report.md will be written to .prizmkit/specs/{{FEATURE_SLUG}}/ by prizmkit-code-review.
|
|
353
|
+
> Report: verdict (PASS/NEEDS_FIXES), number of rounds, findings fixed/rejected."
|
|
354
|
+
|
|
355
|
+
Wait for Reviewer to return.
|
|
356
|
+
|
|
357
|
+
**Gate Check — Review Report**:
|
|
358
|
+
After Reviewer agent returns, verify the review report was written:
|
|
359
|
+
```powershell
|
|
360
|
+
if (Select-String -Path ".prizmkit/specs/{{FEATURE_SLUG}}/review-report.md" -Pattern "## Verdict" -Quiet -ErrorAction SilentlyContinue) { "GATE:PASS" } else { "GATE:MISSING" }
|
|
361
|
+
```
|
|
362
|
+
If GATE:MISSING:
|
|
363
|
+
- Do not re-spawn Reviewer or re-run `/prizmkit-code-review` in an unbounded report-repair loop.
|
|
364
|
+
- Perform one bounded status check; retry at most once: inspect Reviewer output, code-review skill output, `review-report.md` path, and any Reviewer/Dev spawn messages.
|
|
365
|
+
- If the missing report is caused by team/config/lock errors from Reviewer or the internal code-review loop, write `failure-log.md` with the spawn/skill error and last observable state.
|
|
366
|
+
- If the report is still missing after that single check/retry, either perform a safe inline fallback review and write `review-report.md` with `## Verdict`, or stop with a clear recovery failure.
|
|
367
|
+
|
|
368
|
+
Read `review-report.md` and check the Verdict:
|
|
369
|
+
- `PASS` → proceed to next phase
|
|
370
|
+
- `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed
|
|
371
|
+
|
|
372
|
+
**CP-3**: Integration tests pass, review complete.
|
|
373
|
+
|
|
374
|
+
{{IF_BROWSER_INTERACTION}}
|
|
375
|
+
### Phase 5.5: Browser Verification — MANDATORY
|
|
376
|
+
|
|
377
|
+
You MUST execute this phase. Do NOT skip it.
|
|
378
|
+
|
|
379
|
+
**Browser Tool**: {{BROWSER_TOOL}}
|
|
380
|
+
|
|
381
|
+
{{IF_BROWSER_TOOL_PLAYWRIGHT}}
|
|
382
|
+
**Using: playwright-cli**
|
|
383
|
+
|
|
384
|
+
**CRITICAL CONSTRAINT — playwright-cli ONLY, NO Playwright MCP**:
|
|
385
|
+
- You MUST use `playwright-cli` (the CLI tool) for ALL browser interactions in this phase
|
|
386
|
+
- **NEVER** use Playwright MCP server, Playwright MCP tools, or any MCP-based browser automation
|
|
387
|
+
- If you have Playwright MCP configured, IGNORE it entirely — use the CLI command `playwright-cli` exclusively
|
|
388
|
+
- All browser actions go through `playwright-cli <command>` in the PowerShell tool, not through any MCP tool call
|
|
389
|
+
|
|
390
|
+
**Step 0 — Playwright CLI Readiness Check (BLOCKING — must pass before any browser action)**:
|
|
391
|
+
|
|
392
|
+
0a. Check if `playwright-cli` is installed:
|
|
393
|
+
```powershell
|
|
394
|
+
$playwright = Get-Command playwright-cli -ErrorAction SilentlyContinue
|
|
395
|
+
if ($playwright) { playwright-cli --version } else { "NOT_INSTALLED" }
|
|
396
|
+
```
|
|
397
|
+
If output is `NOT_INSTALLED`, install it:
|
|
398
|
+
```powershell
|
|
399
|
+
npm install -g @playwright/cli@latest
|
|
400
|
+
```
|
|
401
|
+
Then verify installation succeeded:
|
|
402
|
+
```powershell
|
|
403
|
+
playwright-cli --version
|
|
404
|
+
```
|
|
405
|
+
If installation fails, log the error in context-snapshot.md under `## Browser Verification: SKIPPED — playwright-cli installation failed` and proceed to the next phase. Do NOT attempt browser verification without playwright-cli.
|
|
406
|
+
|
|
407
|
+
0b. Learn playwright-cli usage (run once per session to understand available commands):
|
|
408
|
+
```powershell
|
|
409
|
+
playwright-cli --help
|
|
410
|
+
```
|
|
411
|
+
Use this output to determine the correct commands for your verification steps. Do NOT guess command syntax — refer to the help output.
|
|
412
|
+
|
|
413
|
+
0c. Check if playwright-cli skill is installed for the current AI platform:
|
|
414
|
+
```powershell
|
|
415
|
+
$currentPlatform = "unknown"
|
|
416
|
+
$skillDir = $null
|
|
417
|
+
if (Get-Command claude -ErrorAction SilentlyContinue) {
|
|
418
|
+
$currentPlatform = "claude"
|
|
419
|
+
$skillDir = Join-Path $HOME ".claude\skills"
|
|
420
|
+
} elseif (Get-Command cbc -ErrorAction SilentlyContinue) {
|
|
421
|
+
$currentPlatform = "codebuddy"
|
|
422
|
+
$skillDir = Join-Path $HOME ".cbc\skills"
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
$skillExists = $false
|
|
426
|
+
if ($skillDir) {
|
|
427
|
+
$directSkill = Join-Path $skillDir "playwright-cli"
|
|
428
|
+
$matchingSkills = Get-ChildItem -Path $skillDir -Filter "playwright*" -ErrorAction SilentlyContinue
|
|
429
|
+
$skillExists = (Test-Path -LiteralPath $directSkill) -or [bool]$matchingSkills
|
|
430
|
+
}
|
|
431
|
+
if ($skillExists) { "SKILL_EXISTS" } else { "SKILL_MISSING" }
|
|
432
|
+
```
|
|
433
|
+
If `SKILL_MISSING`:
|
|
434
|
+
```powershell
|
|
435
|
+
playwright-cli install --skills
|
|
436
|
+
```
|
|
437
|
+
If the current platform is NOT claude, move the installed skill files to the correct location:
|
|
438
|
+
```powershell
|
|
439
|
+
$claudeSkillDir = Join-Path $HOME ".claude\skills"
|
|
440
|
+
$sourceSkill = Join-Path $claudeSkillDir "playwright-cli"
|
|
441
|
+
if ($currentPlatform -ne "claude" -and $currentPlatform -ne "unknown" -and $skillDir -and (Test-Path -LiteralPath $sourceSkill)) {
|
|
442
|
+
New-Item -ItemType Directory -Force -Path $skillDir | Out-Null
|
|
443
|
+
Copy-Item -Recurse -Force -Path $sourceSkill -Destination $skillDir
|
|
444
|
+
"Moved playwright-cli skill from claude to $currentPlatform"
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
0d. Read the installed playwright-cli skill for workflow guidance:
|
|
449
|
+
After skill installation, read the skill's SKILL.md to understand recommended workflows and patterns. Use these patterns to construct your verification flow — do NOT invent your own patterns if the skill provides them.
|
|
450
|
+
|
|
451
|
+
**Step 1 — Start Dev Server**:
|
|
452
|
+
|
|
453
|
+
You know this project's tech stack. Detect and start the dev server yourself:
|
|
454
|
+
|
|
455
|
+
1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
|
|
456
|
+
2. **Detect the dev server port** — use the pre-detected port from pipeline if available, otherwise extract from project config. Do NOT hardcode or guess the port:
|
|
457
|
+
```powershell
|
|
458
|
+
$DEV_PORT = "{{DEV_PORT}}"
|
|
459
|
+
if ($DEV_PORT -eq "{{DEV_PORT}}" -or [string]::IsNullOrWhiteSpace($DEV_PORT)) {
|
|
460
|
+
$detectedPort = ""
|
|
461
|
+
if (Test-Path -LiteralPath "package.json") {
|
|
462
|
+
$detectedPort = node -e "const p=require('./package.json'); const s=(p.scripts?.dev) || ''; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')"
|
|
463
|
+
}
|
|
464
|
+
if (-not $detectedPort -and $env:NEXT_PUBLIC_SITE_URL -match ':([0-9]+)') {
|
|
465
|
+
$detectedPort = $Matches[1]
|
|
466
|
+
}
|
|
467
|
+
if ($detectedPort) { $DEV_PORT = $detectedPort } else { $DEV_PORT = "3000" }
|
|
468
|
+
}
|
|
469
|
+
"Detected DEV_PORT=$DEV_PORT"
|
|
470
|
+
```
|
|
471
|
+
3. Verify the port is available and start the dev server in the background, capturing its process id:
|
|
472
|
+
```powershell
|
|
473
|
+
$portBusy = Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue
|
|
474
|
+
if ($portBusy) { "PORT_IN_USE" } else { "PORT_FREE" }
|
|
475
|
+
$devServerCommand = "<start-command>"
|
|
476
|
+
$server = Start-Process -FilePath "powershell" -ArgumentList @("-NoProfile", "-Command", $devServerCommand) -PassThru
|
|
477
|
+
$DEV_SERVER_PID = $server.Id
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Wait for server to be ready: poll `http://localhost:$DEV_PORT` until it returns 200 or 302 (max 30 seconds, 2s interval):
|
|
481
|
+
```powershell
|
|
482
|
+
$ready = $false
|
|
483
|
+
for ($i = 0; $i -lt 15; $i++) {
|
|
484
|
+
try {
|
|
485
|
+
$response = Invoke-WebRequest -Uri "http://localhost:$DEV_PORT" -UseBasicParsing -TimeoutSec 2
|
|
486
|
+
if ($response.StatusCode -in @(200, 302)) { $ready = $true; break }
|
|
487
|
+
} catch {
|
|
488
|
+
Start-Sleep -Seconds 2
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (-not $ready) { "DEV_SERVER_NOT_READY" }
|
|
492
|
+
```
|
|
493
|
+
4. Open the app in playwright-cli: `playwright-cli open "http://localhost:$DEV_PORT"`
|
|
494
|
+
5. If the page requires authentication, use playwright-cli to register a test user and log in first
|
|
495
|
+
|
|
496
|
+
**Step 2 — Verification**:
|
|
497
|
+
|
|
498
|
+
Use `playwright-cli snapshot` on the running app to discover actual element refs, then verify these goals:
|
|
499
|
+
{{BROWSER_VERIFY_STEPS}}
|
|
500
|
+
|
|
501
|
+
Construct your verification workflow based on:
|
|
502
|
+
1. The playwright-cli skill documentation (read in Step 0d)
|
|
503
|
+
2. The `playwright-cli --help` output (captured in Step 0b)
|
|
504
|
+
3. The current task's Verification Gates and implemented features
|
|
505
|
+
|
|
506
|
+
Decide the concrete playwright-cli actions (click, fill, snapshot, screenshot, etc.) yourself based on the snapshot output and your knowledge of the implemented code. The goals above describe WHAT to verify — you determine HOW using playwright-cli commands.
|
|
507
|
+
|
|
508
|
+
Take a final screenshot for evidence: `playwright-cli screenshot`
|
|
509
|
+
|
|
510
|
+
**Step 3 — Cleanup (REQUIRED — you started it, you stop it)**:
|
|
511
|
+
|
|
512
|
+
1. Close the playwright-cli browser: `playwright-cli close`
|
|
513
|
+
2. Stop the dev server process and any remaining process bound to the dev server port:
|
|
514
|
+
```powershell
|
|
515
|
+
if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
|
|
516
|
+
Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
|
|
517
|
+
Select-Object -ExpandProperty OwningProcess -Unique |
|
|
518
|
+
ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
{{END_IF_BROWSER_TOOL_PLAYWRIGHT}}
|
|
522
|
+
{{IF_BROWSER_TOOL_OPENCLI}}
|
|
523
|
+
**Using: opencli** (reuses Chrome logged-in sessions)
|
|
524
|
+
|
|
525
|
+
**CRITICAL CONSTRAINT — opencli browser ONLY**:
|
|
526
|
+
- You MUST use `opencli browser` for ALL browser interactions in this phase
|
|
527
|
+
- All browser actions go through `opencli browser <command>` in the PowerShell tool
|
|
528
|
+
|
|
529
|
+
**Step 0 — OpenCLI Readiness Check (BLOCKING)**:
|
|
530
|
+
|
|
531
|
+
0a. Check if `opencli` is installed:
|
|
532
|
+
```powershell
|
|
533
|
+
$opencli = Get-Command opencli -ErrorAction SilentlyContinue
|
|
534
|
+
if ($opencli) { opencli --version } else { "NOT_INSTALLED" }
|
|
535
|
+
```
|
|
536
|
+
If `NOT_INSTALLED`: `npm install -g @jackwener/opencli@latest`. If installation fails, log `## Browser Verification: SKIPPED — opencli installation failed` and proceed.
|
|
537
|
+
|
|
538
|
+
0b. Verify Browser Bridge: `opencli doctor`. If fails, log skip and proceed.
|
|
539
|
+
|
|
540
|
+
0c. Learn usage:
|
|
541
|
+
```powershell
|
|
542
|
+
opencli browser --help 2>$null
|
|
543
|
+
if ($LASTEXITCODE -ne 0) { opencli --help }
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
**Step 1 — Start Dev Server**: use the same port detection and server lifecycle pattern as the playwright-cli path:
|
|
547
|
+
```powershell
|
|
548
|
+
$DEV_PORT = "{{DEV_PORT}}"
|
|
549
|
+
if ($DEV_PORT -eq "{{DEV_PORT}}" -or [string]::IsNullOrWhiteSpace($DEV_PORT)) {
|
|
550
|
+
$detectedPort = ""
|
|
551
|
+
if (Test-Path -LiteralPath "package.json") {
|
|
552
|
+
$detectedPort = node -e "const p=require('./package.json'); const s=(p.scripts?.dev) || ''; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')"
|
|
553
|
+
}
|
|
554
|
+
if (-not $detectedPort -and $env:NEXT_PUBLIC_SITE_URL -match ':([0-9]+)') {
|
|
555
|
+
$detectedPort = $Matches[1]
|
|
556
|
+
}
|
|
557
|
+
if ($detectedPort) { $DEV_PORT = $detectedPort } else { $DEV_PORT = "3000" }
|
|
558
|
+
}
|
|
559
|
+
"Detected DEV_PORT=$DEV_PORT"
|
|
560
|
+
```
|
|
561
|
+
```powershell
|
|
562
|
+
$portBusy = Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue
|
|
563
|
+
if ($portBusy) { "PORT_IN_USE" } else { "PORT_FREE" }
|
|
564
|
+
$devServerCommand = "<start-command>"
|
|
565
|
+
$server = Start-Process -FilePath "powershell" -ArgumentList @("-NoProfile", "-Command", $devServerCommand) -PassThru
|
|
566
|
+
$DEV_SERVER_PID = $server.Id
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
Wait for server to be ready: poll `http://localhost:$DEV_PORT` until it returns 200 or 302 (max 30 seconds, 2s interval):
|
|
570
|
+
```powershell
|
|
571
|
+
$ready = $false
|
|
572
|
+
for ($i = 0; $i -lt 15; $i++) {
|
|
573
|
+
try {
|
|
574
|
+
$response = Invoke-WebRequest -Uri "http://localhost:$DEV_PORT" -UseBasicParsing -TimeoutSec 2
|
|
575
|
+
if ($response.StatusCode -in @(200, 302)) { $ready = $true; break }
|
|
576
|
+
} catch {
|
|
577
|
+
Start-Sleep -Seconds 2
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
if (-not $ready) { "DEV_SERVER_NOT_READY" }
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
Start server, wait for ready, then:
|
|
584
|
+
```powershell
|
|
585
|
+
opencli browser open "http://localhost:$DEV_PORT"
|
|
586
|
+
if ($LASTEXITCODE -eq 0) { opencli browser state }
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
**Step 2 — Verification**:
|
|
590
|
+
|
|
591
|
+
Use `opencli browser state` to discover elements with `[N]` indices, then verify:
|
|
592
|
+
{{BROWSER_VERIFY_STEPS}}
|
|
593
|
+
|
|
594
|
+
Chain commands in PowerShell with semicolons and inspect each result, for example: `opencli browser click <N>; opencli browser wait time 1; opencli browser state`
|
|
595
|
+
|
|
596
|
+
**Step 3 — Cleanup**:
|
|
597
|
+
1. `opencli browser close`
|
|
598
|
+
2. Stop the dev server process and any remaining process bound to the dev server port:
|
|
599
|
+
```powershell
|
|
600
|
+
if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
|
|
601
|
+
Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
|
|
602
|
+
Select-Object -ExpandProperty OwningProcess -Unique |
|
|
603
|
+
ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
{{END_IF_BROWSER_TOOL_OPENCLI}}
|
|
607
|
+
{{IF_BROWSER_TOOL_AUTO}}
|
|
608
|
+
**Tool Selection**: Choose the best browser tool at runtime.
|
|
609
|
+
|
|
610
|
+
**Step 0 — Detect available tools**:
|
|
611
|
+
```powershell
|
|
612
|
+
"=== playwright-cli ==="
|
|
613
|
+
$playwright = Get-Command playwright-cli -ErrorAction SilentlyContinue
|
|
614
|
+
if ($playwright) { playwright-cli --version } else { "NOT_INSTALLED" }
|
|
615
|
+
"=== opencli ==="
|
|
616
|
+
$opencli = Get-Command opencli -ErrorAction SilentlyContinue
|
|
617
|
+
if ($opencli) { opencli --version } else { "NOT_INSTALLED" }
|
|
618
|
+
if ($opencli) {
|
|
619
|
+
opencli doctor 2>$null
|
|
620
|
+
if ($LASTEXITCODE -ne 0) { "OPENCLI_BRIDGE_FAILED" }
|
|
621
|
+
}
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**Decision table**:
|
|
625
|
+
| Condition | Tool |
|
|
626
|
+
|-----------|------|
|
|
627
|
+
| Only playwright-cli available | playwright-cli |
|
|
628
|
+
| Only opencli available (doctor passes) | opencli |
|
|
629
|
+
| Both — local dev server, forms, components | playwright-cli |
|
|
630
|
+
| Both — needs real login state (OAuth/SSO) | opencli |
|
|
631
|
+
| Both — third-party integration verification | opencli |
|
|
632
|
+
| Neither available | Install playwright-cli as default |
|
|
633
|
+
|
|
634
|
+
Then follow the corresponding tool's workflow above (Steps 1-3).
|
|
635
|
+
|
|
636
|
+
{{END_IF_BROWSER_TOOL_AUTO}}
|
|
637
|
+
|
|
638
|
+
**Step 4 — Reporting**:
|
|
639
|
+
|
|
640
|
+
Append results to `context-snapshot.md`:
|
|
641
|
+
```
|
|
642
|
+
## Browser Verification
|
|
643
|
+
Tool: <playwright-cli or opencli>
|
|
644
|
+
URL: http://localhost:$DEV_PORT
|
|
645
|
+
Dev Server Command: <actual command used>
|
|
646
|
+
Tool version: <version>
|
|
647
|
+
Steps executed: [list of commands used]
|
|
648
|
+
Screenshot: [path]
|
|
649
|
+
Result: PASS / FAIL (reason)
|
|
650
|
+
Server cleanup: confirmed
|
|
651
|
+
Browser cleanup: confirmed
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
If verification fails, log the failure details but continue to commit. Failures do NOT block the commit, but you MUST attempt verification and MUST clean up the dev server.
|
|
655
|
+
{{END_IF_BROWSER_INTERACTION}}
|
|
656
|
+
|
|
657
|
+
### Phase 6: Retrospective & Commit (SINGLE COMMIT) — DO NOT SKIP
|
|
658
|
+
|
|
659
|
+
**Bug Fix Documentation Policy**:
|
|
660
|
+
- DEFAULT: Run `/prizmkit-retrospective` with structural sync only (update file counts, interfaces, dependencies). Skip knowledge injection.
|
|
661
|
+
- UPDATE DOCS (run full retrospective — Job 1 + Job 2) when bug fix causes: interface signature changes, dependency additions/removals, observable behavior changes to existing features, or newly discovered TRAPs.
|
|
662
|
+
- Simple bugs: No new spec.md/plan.md needed. Use fast path.
|
|
663
|
+
- Complex bugs (multi-module, cascading): Use `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/<BUG_ID>/`.
|
|
664
|
+
- Commit prefix: `fix(<scope>):` (not `feat:`).
|
|
665
|
+
|
|
666
|
+
**6a.** Check if feature already committed:
|
|
667
|
+
```powershell
|
|
668
|
+
git log --oneline | Select-String -Pattern "{{FEATURE_ID}}" | Select-Object -First 3
|
|
669
|
+
```
|
|
670
|
+
- If a commit for `{{FEATURE_ID}}` already exists → **skip 6d** (do NOT run /prizmkit-committer, do NOT run git reset, do NOT stage or unstage anything). Proceed directly to 6e Final verification.
|
|
671
|
+
- If no existing commit → proceed normally with 6b–6d.
|
|
672
|
+
|
|
673
|
+
**6b.** Run `/prizmkit-retrospective` (**before commit**, maintains `.prizmkit/prizm-docs/` architecture index):
|
|
674
|
+
- **Structural sync**: update KEY_FILES/INTERFACES/DEPENDENCIES/file counts for changed modules
|
|
675
|
+
- **Architecture knowledge** (feature sessions only): extract TRAPS, RULES, DECISIONS from completed work into `.prizmkit/prizm-docs/`
|
|
676
|
+
- **L2 coverage check**: For any module/sub-module with source files created or significantly modified in this session but no L2 `.prizm` doc — evaluate whether L2 is warranted and create if so. The current session has the best context for accurate KEY_FILES, TRAPS, and DECISIONS.
|
|
677
|
+
- Stage doc changes: `git add .prizmkit/prizm-docs/`
|
|
678
|
+
⚠️ Do NOT commit here. Only stage.
|
|
679
|
+
- **For bug-fix sessions**: structural sync (Job 1) by default. Run knowledge injection (Job 2) when the fix causes interface signature changes, dependency additions/removals, observable behavior changes, or reveals new TRAPs
|
|
680
|
+
|
|
681
|
+
**6c.** Stage all feature code explicitly (NEVER use `git add -A` or `git add .`):
|
|
682
|
+
```powershell
|
|
683
|
+
git add <specific-files-created-or-modified>
|
|
684
|
+
git add .prizmkit/prizm-docs/
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
**6d.** Run `/prizmkit-committer` → THE ONLY commit for this feature:
|
|
688
|
+
`feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`
|
|
689
|
+
This single commit includes: feature code + tests + .prizmkit/prizm-docs/ updates. Do NOT push.
|
|
690
|
+
- MANDATORY: commit must be done via `/prizmkit-committer` skill. Do NOT run manual `git add`/`git commit` as a substitute.
|
|
691
|
+
- Do NOT run `update-feature-status.py` here — the pipeline runner handles feature-list.json updates automatically after session exit.
|
|
692
|
+
|
|
693
|
+
**6e.** Final verification:
|
|
694
|
+
```powershell
|
|
695
|
+
git status --short
|
|
696
|
+
```
|
|
697
|
+
Working tree MUST be clean after this step. If any feature-related files remain, stage them into the SAME commit via `git add <file>; if ($LASTEXITCODE -eq 0) { git commit --amend --no-edit }`, do NOT create a separate commit.
|
|
698
|
+
|
|
699
|
+
**Exception**: `session-summary.md` in the artifact directory is a local cross-session artifact generated by `/prizmkit-committer` — it is NOT committed to git. Ignore it in the clean-tree check.
|
|
700
|
+
|
|
701
|
+
**6f.** Write completion summary for downstream dependency context:
|
|
702
|
+
|
|
703
|
+
Write `.prizmkit/specs/{{FEATURE_SLUG}}/completion-summary.json` with the key changes from this session. This file is NOT committed to git — the pipeline runner reads it to propagate context to dependent features.
|
|
704
|
+
|
|
705
|
+
```json
|
|
706
|
+
{
|
|
707
|
+
"completion_notes": [
|
|
708
|
+
"<each item: one key change, API, model, or integration point that downstream features may need>",
|
|
709
|
+
"Example: Added User model (id, email, password_hash, display_name) in prisma/schema.prisma",
|
|
710
|
+
"Example: POST /api/auth/register and POST /api/auth/login endpoints in src/api/auth.ts",
|
|
711
|
+
"Example: Auth middleware in src/middleware/auth.ts — validates JWT on protected routes"
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
Rules for writing completion notes:
|
|
717
|
+
- Focus on **what downstream features need to know**: new APIs, models, exported functions, key file paths
|
|
718
|
+
- Each note should be self-contained and concise (one line, under 120 characters preferred)
|
|
719
|
+
- Include 3-8 notes covering the most important changes
|
|
720
|
+
- Do NOT include test files, config changes, or internal implementation details unless they affect other features
|
|
721
|
+
- If this feature has no downstream dependents, still write the summary (it serves as documentation)
|
|
722
|
+
|
|
723
|
+
## Critical Paths
|
|
724
|
+
|
|
725
|
+
| Resource | Path |
|
|
726
|
+
|----------|------|
|
|
727
|
+
| Feature Artifacts Dir | `.prizmkit/specs/{{FEATURE_SLUG}}/` |
|
|
728
|
+
| Context Snapshot | `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` |
|
|
729
|
+
| Team Config | `{{TEAM_CONFIG_PATH}}` |
|
|
730
|
+
| Dev Agent Def | {{DEV_SUBAGENT_PATH}} |
|
|
731
|
+
| Reviewer Agent Def | {{REVIEWER_SUBAGENT_PATH}} |
|
|
732
|
+
{{IF_CRITIC_ENABLED}}
|
|
733
|
+
| Critic Agent Def | {{CRITIC_SUBAGENT_PATH}} |
|
|
734
|
+
{{END_IF_CRITIC_ENABLED}}
|
|
735
|
+
| Project Root | {{PROJECT_ROOT}} |
|
|
736
|
+
| Feature List Path | {{FEATURE_LIST_PATH}} |
|
|
737
|
+
|
|
738
|
+
## Failure Capture Protocol
|
|
739
|
+
|
|
740
|
+
If you encounter an unrecoverable error, context overflow, or are about to exit without completing all phases:
|
|
741
|
+
|
|
742
|
+
1. Write `.prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md` BEFORE exiting:
|
|
743
|
+
```
|
|
744
|
+
FAILURE_TYPE: timeout | test_failure | review_rejected | context_overflow | unknown
|
|
745
|
+
PHASE: <Get-Command phase failed>
|
|
746
|
+
ROOT_CAUSE: <1-2 sentence explanation>
|
|
747
|
+
ATTEMPTED: <approaches already tried>
|
|
748
|
+
SUGGESTION: <what the next session should try differently>
|
|
749
|
+
DISCOVERED_TRAPS:
|
|
750
|
+
- [CRITICAL|HIGH|LOW] <gotcha discovered during this failed session> | FIX: <approach>
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
2. This file is intentionally lightweight — write it BEFORE context runs out.
|
|
754
|
+
|
|
755
|
+
**Lifecycle**: failure-log.md is a temporary cross-session artifact. Do NOT commit it to git. After a successful session (all phases complete + commit done), delete it:
|
|
756
|
+
```powershell
|
|
757
|
+
Remove-Item -Force -ErrorAction SilentlyContinue .prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
## Reminders
|
|
761
|
+
|
|
762
|
+
- Tier 3: full team — Dev (implementation) → Reviewer (review + test) — spawn agents directly via Agent tool
|
|
763
|
+
- context-snapshot.md is append-only: orchestrator writes Sections 1-4, Dev appends Implementation Log, Reviewer appends Review Notes
|
|
764
|
+
- Gate checks enforce Implementation Log and Review Notes are written before proceeding
|
|
765
|
+
- Do NOT use `run_in_background=true` when spawning agents
|
|
766
|
+
- Commit phase must use `/prizmkit-committer`; do NOT replace with manual git commit commands
|
|
767
|
+
- Do NOT run `git add`/`git commit` during Phase 1-5 — all changes are committed once in Phase 6
|
|
768
|
+
- If any files remain after the commit, amend the existing commit — do NOT create a follow-up commit
|
|
769
|
+
- When staging files, always use explicit file names — NEVER use `git add -A` or `git add .`
|
|
770
|
+
- On timeout: check snapshot → model:lite → remaining steps only → max 2 retries → orchestrator fallback
|