prizmkit 1.1.107 → 1.1.109

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 (86) hide show
  1. package/bin/create-prizmkit.js +4 -0
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +20 -0
  4. package/bundled/dev-pipeline/prizmkit_runtime/commands.py +1 -0
  5. package/bundled/dev-pipeline/prizmkit_runtime/config.py +81 -14
  6. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +21 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +19 -8
  8. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -1
  9. package/bundled/dev-pipeline/prizmkit_runtime/launch_profiles.py +18 -0
  10. package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +208 -0
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +22 -2
  12. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +3 -1
  13. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +20 -1
  14. package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +508 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +151 -30
  16. package/bundled/dev-pipeline/scripts/continuation.py +0 -1
  17. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +8 -46
  18. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +9 -34
  19. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +42 -33
  20. package/bundled/dev-pipeline/scripts/prizmkit-runtime-helper.py +27 -0
  21. package/bundled/dev-pipeline/scripts/utils.py +94 -0
  22. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +4 -3
  23. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  24. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +39 -65
  25. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +58 -96
  26. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +54 -95
  27. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +6 -18
  28. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +5 -17
  29. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +14 -48
  30. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +7 -13
  31. package/bundled/dev-pipeline/templates/sections/feature-context.md +0 -4
  32. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +31 -61
  33. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +21 -37
  34. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +22 -69
  35. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +0 -14
  36. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -14
  37. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -7
  38. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +1 -3
  39. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -7
  40. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +7 -9
  41. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +4 -8
  42. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +0 -7
  43. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +0 -7
  44. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -7
  45. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +3 -10
  46. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +2 -9
  47. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +15 -16
  48. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +1 -8
  49. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -8
  50. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +9 -15
  51. package/bundled/dev-pipeline/templates/sections/phase0-init.md +1 -8
  52. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +2 -15
  53. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +1 -1
  54. package/bundled/dev-pipeline/tests/conftest.py +0 -1
  55. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +392 -23
  56. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +37 -17
  57. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +118 -14
  58. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +79 -2
  59. package/bundled/dev-pipeline/tests/test_runtime_helper.py +211 -0
  60. package/bundled/dev-pipeline/tests/test_unified_cli.py +663 -13
  61. package/bundled/skills/_metadata.json +4 -4
  62. package/bundled/skills/app-planner/SKILL.md +1 -1
  63. package/bundled/skills/app-planner/references/architecture-decisions.md +1 -1
  64. package/bundled/skills/bug-fix-workflow/SKILL.md +174 -128
  65. package/bundled/skills/bug-planner/SKILL.md +101 -15
  66. package/bundled/skills/bug-planner/references/severity-rules.md +20 -8
  67. package/bundled/skills/feature-planner/SKILL.md +87 -8
  68. package/bundled/skills/feature-planner/assets/planning-guide.md +34 -10
  69. package/bundled/skills/feature-workflow/SKILL.md +100 -81
  70. package/bundled/skills/{prizm-kit → prizmkit}/SKILL.md +1 -1
  71. package/bundled/skills/prizmkit-code-review/SKILL.md +1 -1
  72. package/bundled/skills/refactor-planner/SKILL.md +88 -7
  73. package/bundled/skills/refactor-planner/references/fast-path.md +2 -1
  74. package/bundled/skills/refactor-planner/references/planning-phases.md +29 -11
  75. package/bundled/skills/refactor-workflow/SKILL.md +116 -57
  76. package/bundled/templates/project-memory-template.md +1 -1
  77. package/package.json +1 -1
  78. package/src/ai-cli-launch.js +194 -0
  79. package/src/config.js +26 -14
  80. package/src/index.js +11 -44
  81. package/src/platforms.js +10 -3
  82. package/src/prompts.js +60 -2
  83. package/src/scaffold.js +26 -14
  84. package/bundled/dev-pipeline/scripts/prizmkit-test-gate.py +0 -446
  85. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +0 -20
  86. package/bundled/dev-pipeline/tests/test_prizmkit_test_gate.py +0 -107
@@ -52,21 +52,18 @@ You are running in **headless non-interactive mode** with a FINITE context windo
52
52
 
53
53
  1. **context-snapshot.md is your single source of truth** — After Phase 1 builds it, ALWAYS read context-snapshot.md instead of re-reading individual source files
54
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.
55
+ 3. **Never re-read unmodified files** — Once you have read a file into context, do NOT read it again unless it was modified by an Edit/Write operation after your last read. Use `grep -n '<pattern>' <file>` or `sed -n '<start>,<end>p' <file>` for targeted line lookups instead of full-file Read. Before issuing a Read, ask yourself: "Have I read this file before, and has it changed since?" If the answer is "no, it hasn't changed" — do NOT read it. This applies to all files including those summarized in context-snapshot.md Section 4. Subagents (Critic, Reviewer) must receive context-snapshot.md and rely on it rather than independently re-reading the same files the orchestrator already read.
56
+ 4. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
56
57
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
57
58
  5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`cmd 2>&1 | tee /tmp/out.txt | tail -20`), then scan the head/tail to identify relevant fields, and use targeted filtering (`grep`, `sed`, `awk`) to extract only the information needed for the current task. Only read the filtered result — never the raw full output.
58
59
  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
60
  7. **Capture test output once** — When running test suites, always use `<test-command> 2>&1 | tee /tmp/test-out.txt | tail -20`. Then grep `/tmp/test-out.txt` for details. Never re-run the suite just to apply a different filter.
60
- 8. **Scaffold / generated file awareness** — Files created by scaffolding tools are boilerplate. Tag them, record in context-snapshot.md, NEVER re-read. Edit directly without reading first.
61
61
  9. **Package version verification (BLOCKING)** — Verify dependency versions via registry query before writing them. NEVER guess.
62
62
  10. **Build artifact hygiene** — After build/compile, ensure output is in `.gitignore`.
63
63
  11. **Read offset safety (BLOCKING)** — If Read returns "shorter than offset"/"File is empty"/"Wasted call" — do NOT retry same offset. Run `wc -l <file>` to get real line count, then `sed -n` for exact range. 2 consecutive offset errors → STOP Reading that file. Never guess offsets — `grep -n '<anchor>'` first.
64
64
 
65
65
  ---
66
66
 
67
- {{LOG_SIZE_AWARENESS}}
68
- ---
69
-
70
67
  ## PrizmKit Directory Convention
71
68
 
72
69
  ```
@@ -81,7 +78,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
81
78
  ## Subagent Timeout Recovery
82
79
 
83
80
  If any agent times out:
84
- 1. `ls .prizmkit/specs/{{FEATURE_SLUG}}/` — check what exists
81
+ 1. `{{RUNTIME_HELPER_CMD}} artifact list .prizmkit/specs/{{FEATURE_SLUG}}` — check what exists
85
82
  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"`
86
83
  3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
87
84
 
@@ -92,20 +89,13 @@ If any agent times out:
92
89
  {{IF_INIT_NEEDED}}
93
90
  ### Phase 0: Project Bootstrap
94
91
  - Run `/prizmkit-init` (invoke the prizmkit-init skill)
95
- - Run `python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
92
+ - Run `{{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
96
93
  - **CP-0**: Verify `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json` exist
97
94
  {{END_IF_INIT_NEEDED}}
98
95
  {{IF_INIT_DONE}}
99
96
  ### Phase 0: SKIP (already initialized)
100
97
  {{END_IF_INIT_DONE}}
101
98
 
102
- ### Phase 0.5: Detect Test Commands
103
-
104
- 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`.
105
-
106
- Do not run tests in this phase. Test execution happens after code review in the scoped PrizmKit Test gate.
107
-
108
- > **Test Output Rule**: When the post-review gate runs, capture test output to a temp file (`tee /tmp/test-out.txt`). Then grep the file instead of re-running the suite.
109
99
 
110
100
  ### Phase 1: Build Context Snapshot (you, the orchestrator)
111
101
 
@@ -119,16 +109,16 @@ If failure-log.md exists:
119
109
  - Do NOT delete failure-log.md until this session completes all phases and commits successfully
120
110
 
121
111
  ```bash
122
- ls .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md 2>/dev/null && echo "EXISTS" || echo "MISSING"
112
+ {{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md
123
113
  ```
124
114
 
125
115
  If MISSING — build it now:
126
116
  1. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 prizm docs
127
- 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:
117
+ 2. Detect source code directories from KEY_FILES and STRUCTURE sections in `root.prizm`; if root docs are unavailable, use the helper to list likely source files:
128
118
  ```bash
129
- find . -maxdepth 2 -type f \( -name "*.js" -o -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.java" -o -name "*.rb" -o -name "*.rs" \) -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/vendor/*' | head -30
119
+ {{RUNTIME_HELPER_CMD}} artifact source-files . --json
130
120
  ```
131
- Identify the top-level source directories from the results.
121
+ Identify the top-level source directories from the helper output.
132
122
  3. Scan the detected source directories for files related to this feature; read each one
133
123
  4. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
134
124
  - **Section 1 — Feature Brief**: feature description + acceptance criteria (copy from above)
@@ -154,25 +144,25 @@ If MISSING — build it now:
154
144
  ### Phase 2: Plan & Tasks (you, the orchestrator)
155
145
 
156
146
  ```bash
157
- ls .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null
147
+ {{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}/plan.md
158
148
  ```
159
149
 
160
150
  If either missing, run `/prizmkit-plan` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` to generate missing files:
161
151
  - `plan.md`: architecture — components, interfaces, data flow, files to create/modify, testing approach, and a Tasks section with `[ ]` checkboxes ordered by dependency
162
- - Resolve any `[NEEDS CLARIFICATION]` markers using the feature description do NOT pause for interactive input.
152
+ - Resolve uncertain requirements from the feature description, existing code, and conservative existing-project patterns.
163
153
 
164
154
  **Database Design Gate** (if feature involves data persistence — new tables, schema changes, new entities):
165
155
  Before proceeding past CP-1, verify:
166
156
  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)
167
157
  2. All new tables/fields follow existing naming conventions, ID strategy, timestamp patterns, and constraint style
168
- 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.
158
+ 3. No unresolved data model uncertainty remains in the Data Model section — resolve by reading existing code and making a conservative choice that matches existing patterns. Document the resolution in plan.md.
169
159
  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.
170
160
 
171
161
  **CP-1**: plan.md exists with Tasks section.
172
162
 
173
163
  ### Phase 3: Analyze — Reviewer Subagent
174
164
 
175
- Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false).
165
+ Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`.
176
166
 
177
167
  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.
178
168
 
@@ -193,7 +183,7 @@ Wait for Reviewer to return.
193
183
 
194
184
  **Guard**: Verify critic agent file exists before spawning:
195
185
  ```bash
196
- ls {{CRITIC_SUBAGENT_PATH}} 2>/dev/null && echo "CRITIC:READY" || echo "CRITIC:MISSING"
186
+ {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
197
187
  ```
198
188
  If CRITIC:MISSING — skip Phase 3.5 entirely and proceed to Phase 4. Log: "Critic agent not installed — skipping Plan Challenge."
199
189
 
@@ -201,7 +191,7 @@ If CRITIC:MISSING — skip Phase 3.5 entirely and proceed to Phase 4. Log: "Crit
201
191
 
202
192
  **If {{CRITIC_COUNT}} = 1 → Single Critic** (skip to CP-2.5 after this):
203
193
 
204
- Spawn Critic agent (Agent tool, subagent_type="prizm-dev-team-critic", mode="plan", run_in_background=false).
194
+ Spawn Critic agent (Agent tool, subagent_type="prizm-dev-team-critic", mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`.
205
195
 
206
196
  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.
207
197
 
@@ -209,9 +199,10 @@ Prompt:
209
199
  > "Read {{CRITIC_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
210
200
  > **MODE: Plan Challenge**
211
201
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has project context, Section 4 has file manifest.
212
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
213
- > 3. Read existing source files in the modules this plan touches.
214
- > 4. Challenge plan.md against the project's existing architecture, patterns, and style.
202
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
203
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
204
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
205
+ > 5. Challenge plan.md against the project's existing architecture, patterns, and style.
215
206
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report.md` with findings (or 'No significant challenges')."
216
207
 
217
208
  Wait for Critic to return.
@@ -222,15 +213,16 @@ Wait for Critic to return.
222
213
 
223
214
  **IMPORTANT**: Spawn all 3 Critics in PARALLEL (issue all 3 Agent tool calls in the SAME message turn). Do NOT wait for one before spawning the next.
224
215
 
225
- Spawn Critic-A, Critic-B, Critic-C simultaneously (each with mode="plan", run_in_background=false):
216
+ Spawn Critic-A, Critic-B, Critic-C simultaneously (each with mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`:
226
217
 
227
218
  Critic-A prompt:
228
219
  > "Read {{CRITIC_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
229
220
  > **MODE: Plan Challenge — Lens: Architecture & Scalability**
230
221
  > Focus on: architectural pattern fit, scalability implications, over-engineering risks, component boundary design.
231
222
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
232
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
233
- > 3. Read existing source files in the modules this plan touches.
223
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
224
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
225
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
234
226
  > 4. Challenge plan.md through your architecture lens.
235
227
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-A.md`."
236
228
 
@@ -239,8 +231,9 @@ Critic-B prompt:
239
231
  > **MODE: Plan Challenge — Lens: Data Model & Edge Cases**
240
232
  > Focus on: data model design fit, entity relationships, edge cases in business logic, missing boundary conditions.
241
233
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
242
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
243
- > 3. Read existing source files in the modules this plan touches.
234
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
235
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
236
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
244
237
  > 4. Challenge plan.md through your data/edge-case lens.
245
238
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-B.md`."
246
239
 
@@ -249,8 +242,9 @@ Critic-C prompt:
249
242
  > **MODE: Plan Challenge — Lens: Security & Performance**
250
243
  > Focus on: security attack surface, authentication/authorization gaps, performance bottlenecks, resource leaks.
251
244
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
252
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
253
- > 3. Read existing source files in the modules this plan touches.
245
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
246
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
247
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
254
248
  > 4. Challenge plan.md through your security/performance lens.
255
249
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-C.md`."
256
250
 
@@ -309,15 +303,6 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
309
303
 
310
304
  **CP-2**: All tasks `[x]`, Implementation Log written with Gate Evidence, and blocked gates documented in `failure-log.md`. Test execution is deferred until after code review.
311
305
 
312
- **Checkpoint update**:
313
- ```bash
314
- python3 $PIPELINE_DIR/scripts/update-checkpoint.py \
315
- --checkpoint-path .prizmkit/specs/{{FEATURE_SLUG}}/workflow-checkpoint.json \
316
- --step prizmkit-implement \
317
- --status completed
318
- ```
319
-
320
-
321
306
  ### Review — Code Review
322
307
 
323
308
  Review the completed implementation before the scoped feature test gate runs. Use `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` so the code-review skill can read spec, plan, context snapshot, implementation log, and current diff artifacts. Do not require or read a prior `/prizmkit-test` report here; test generation and test-fix looping happen in the next phase.
@@ -329,7 +314,7 @@ The skill runs an internal review-fix loop (Reviewer Agent → filter → orches
329
314
  **Gate Check — Review Report**:
330
315
  After `/prizmkit-code-review` returns, verify the review report:
331
316
  ```bash
332
- grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
317
+ {{RUNTIME_HELPER_CMD}} text contains .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md --pattern "## Verdict"
333
318
  ```
334
319
  If GATE:MISSING:
335
320
  - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
@@ -347,7 +332,11 @@ Read `review-report.md` and check the Verdict:
347
332
 
348
333
  Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` after review and before commit.
349
334
 
350
- Before invoking the skill, create `.prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started` so stale reports are ignored.
335
+ Before invoking the skill, create a current-run marker so stale reports are ignored:
336
+ ```bash
337
+ {{RUNTIME_HELPER_CMD}} artifact ensure-dir .prizmkit/specs/{{FEATURE_SLUG}}
338
+ {{RUNTIME_HELPER_CMD}} artifact touch .prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started
339
+ ```
351
340
 
352
341
  Gate requirements:
353
342
  - Generate or update tests only for this feature's changed files, changed public interfaces, and acceptance criteria.
@@ -377,13 +366,13 @@ You MUST execute this phase. Do NOT skip it.
377
366
 
378
367
  0a. Check if `playwright-cli` is installed:
379
368
  ```bash
380
- which playwright-cli 2>/dev/null && playwright-cli --version 2>/dev/null || echo "NOT_INSTALLED"
369
+ {{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version
381
370
  ```
382
371
  If output is `NOT_INSTALLED`, install it:
383
372
  ```bash
384
373
  npm install -g @playwright/cli@latest
385
374
  ```
386
- Then verify installation succeeded: `playwright-cli --version`. If installation fails, log `## Browser Verification: SKIPPED — playwright-cli installation failed` in context-snapshot.md and proceed to the next phase.
375
+ Then verify installation succeeded: `{{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version`. If installation fails, log `## Browser Verification: SKIPPED — playwright-cli installation failed` in context-snapshot.md and proceed to the next phase.
387
376
 
388
377
  0b. Learn playwright-cli usage (run once per session):
389
378
  ```bash
@@ -392,21 +381,9 @@ playwright-cli --help
392
381
 
393
382
  0c. Check if playwright-cli skill is installed for the current AI platform:
394
383
  ```bash
395
- CURRENT_PLATFORM=""
396
- if which claude >/dev/null 2>&1; then
397
- CURRENT_PLATFORM="claude"; SKILL_DIR="$HOME/.claude/skills"
398
- elif which cbc >/dev/null 2>&1; then
399
- CURRENT_PLATFORM="codebuddy"; SKILL_DIR="$HOME/.cbc/skills"
400
- else
401
- CURRENT_PLATFORM="unknown"
402
- fi
403
- if [ -d "$SKILL_DIR/playwright-cli" ] || ls "$SKILL_DIR"/playwright* 2>/dev/null | grep -q .; then
404
- echo "SKILL_EXISTS"
405
- else
406
- echo "SKILL_MISSING"
407
- fi
384
+ {{RUNTIME_HELPER_CMD}} platform skill playwright-cli --prefix
408
385
  ```
409
- If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform is NOT claude, copy installed skill from `$HOME/.claude/skills/playwright-cli` to `$SKILL_DIR/playwright-cli`.
386
+ If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform is NOT claude, copy installed skill from `$HOME/.claude/skills/playwright-cli` to the path shown by the helper output for the current platform.
410
387
 
411
388
  0d. Read the installed playwright-cli skill (SKILL.md) for workflow guidance. Use its recommended patterns to construct your verification flow.
412
389
 
@@ -415,28 +392,16 @@ If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform i
415
392
  You know this project's tech stack. Detect and start the dev server yourself:
416
393
 
417
394
  1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
418
- 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:
419
- ```bash
420
- DEV_PORT={{DEV_PORT}}
421
- if [ "$DEV_PORT" = "{{DEV_PORT}}" ]; then
422
- DEV_PORT=$(node -e "const s=require('./package.json').scripts.dev; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')")
423
- if [ -z "$DEV_PORT" ]; then
424
- DEV_PORT=$(echo "$NEXT_PUBLIC_SITE_URL" | sed -nE 's|.*:([0-9]+).*|\1|p')
425
- fi
426
- DEV_PORT=${DEV_PORT:-3000}
427
- fi
428
- echo "Detected DEV_PORT=$DEV_PORT"
429
- ```
395
+ 2. Determine the dev server port from the pre-detected pipeline value (`{{DEV_PORT}}`) or project config. Do NOT hardcode or guess the port. Record it as `DEV_PORT` in your notes.
430
396
  3. Verify the port is available:
431
397
  ```bash
432
- lsof -ti:$DEV_PORT 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"
398
+ {{RUNTIME_HELPER_CMD}} port check $DEV_PORT
433
399
  ```
434
400
  4. Start the dev server in background, capture PID:
435
401
  ```bash
436
- <start-command> &
437
- DEV_SERVER_PID=$!
402
+ {{RUNTIME_HELPER_CMD}} process start --pid-file .prizmkit/state/browser-dev-server.pid -- <start-command tokens>
438
403
  ```
439
- 5. Wait for server to be ready: poll `http://localhost:$DEV_PORT` with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
404
+ 5. Wait for server to be ready: run `{{RUNTIME_HELPER_CMD}} web wait-ready --url http://localhost:$DEV_PORT --timeout 30 --interval 2`
440
405
  6. Open the app in playwright-cli: `playwright-cli open http://localhost:$DEV_PORT`
441
406
  7. If the page requires authentication, use playwright-cli to register a test user and log in first
442
407
 
@@ -450,8 +415,8 @@ Construct your verification workflow based on: (1) the playwright-cli skill docu
450
415
  **Step 3 — Cleanup (REQUIRED — you started it, you stop it)**:
451
416
 
452
417
  1. Close the playwright-cli browser: `playwright-cli close`
453
- 2. Kill the dev server process: `kill $DEV_SERVER_PID 2>/dev/null || true`
454
- 3. Verify port is released: `lsof -ti:$DEV_PORT | xargs kill -9 2>/dev/null || true`
418
+ 2. Kill the dev server process: `{{RUNTIME_HELPER_CMD}} process cleanup-pid <pid-from-.prizmkit/state/browser-dev-server.pid>`
419
+ 3. Verify port is released: `{{RUNTIME_HELPER_CMD}} process cleanup-port $DEV_PORT`
455
420
  {{END_IF_BROWSER_TOOL_PLAYWRIGHT}}
456
421
  {{IF_BROWSER_TOOL_OPENCLI}}
457
422
  **Using: opencli** (reuses Chrome logged-in sessions)
@@ -464,45 +429,42 @@ Construct your verification workflow based on: (1) the playwright-cli skill docu
464
429
 
465
430
  0a. Check if `opencli` is installed:
466
431
  ```bash
467
- which opencli 2>/dev/null && opencli --version 2>/dev/null || echo "NOT_INSTALLED"
432
+ {{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version
468
433
  ```
469
434
  If `NOT_INSTALLED`: `npm install -g @jackwener/opencli@latest`. If installation fails, log `## Browser Verification: SKIPPED — opencli installation failed` and proceed.
470
435
 
471
436
  0b. Verify Browser Bridge: `opencli doctor`. If fails, log skip and proceed.
472
437
 
473
- 0c. Learn usage: `opencli browser --help 2>/dev/null || opencli --help`
438
+ 0c. Learn usage: `opencli browser --help`
474
439
 
475
- **Step 1 — Start Dev Server**: (same port detection as playwright path)
476
- ```bash
477
- DEV_PORT={{DEV_PORT}}
478
- if [ "$DEV_PORT" = "{{DEV_PORT}}" ]; then
479
- DEV_PORT=$(node -e "const s=require('./package.json').scripts.dev; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')" 2>/dev/null)
480
- DEV_PORT=${DEV_PORT:-3000}
481
- fi
482
- ```
483
- Start server, wait for ready, then: `opencli browser open http://localhost:$DEV_PORT && opencli browser state`
440
+ **Step 1 — Start Dev Server**:
441
+ 1. Determine `DEV_PORT` from the pipeline value (`{{DEV_PORT}}`) or project config; do not guess.
442
+ 2. Verify port available: `{{RUNTIME_HELPER_CMD}} port check <DEV_PORT>`
443
+ 3. Start server: `{{RUNTIME_HELPER_CMD}} process start --pid-file .prizmkit/state/browser-dev-server.pid -- <start-command tokens>`
444
+ 4. Wait for ready: `{{RUNTIME_HELPER_CMD}} web wait-ready --url http://localhost:<DEV_PORT> --timeout 30 --interval 2`
445
+ 5. Open: `opencli browser open http://localhost:<DEV_PORT>`; then inspect: `opencli browser state`
484
446
 
485
447
  **Step 2 — Verification**:
486
448
 
487
449
  Use `opencli browser state` to discover elements with `[N]` indices, then verify:
488
450
  {{BROWSER_VERIFY_STEPS}}
489
451
 
490
- Chain commands: `opencli browser click <N> && opencli browser wait time 1 && opencli browser state`
452
+ Run page-changing commands sequentially, then run `opencli browser state` to refresh indices.
491
453
 
492
454
  **Step 3 — Cleanup**:
493
455
  1. `opencli browser close`
494
- 2. `kill $DEV_SERVER_PID 2>/dev/null || true`
495
- 3. `lsof -ti:$DEV_PORT | xargs kill -9 2>/dev/null || true`
456
+ 2. `{{RUNTIME_HELPER_CMD}} process cleanup-pid <pid-from-.prizmkit/state/browser-dev-server.pid>`
457
+ 3. `{{RUNTIME_HELPER_CMD}} process cleanup-port $DEV_PORT`
496
458
  {{END_IF_BROWSER_TOOL_OPENCLI}}
497
459
  {{IF_BROWSER_TOOL_AUTO}}
498
460
  **Tool Selection**: Choose the best browser tool at runtime.
499
461
 
500
462
  **Step 0 — Detect available tools**:
501
463
  ```bash
502
- echo "=== playwright-cli ===" && which playwright-cli 2>/dev/null && playwright-cli --version 2>/dev/null || echo "NOT_INSTALLED"
503
- echo "=== opencli ===" && which opencli 2>/dev/null && opencli --version 2>/dev/null || echo "NOT_INSTALLED"
464
+ {{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version
465
+ {{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version
504
466
  ```
505
- If opencli installed: `opencli doctor 2>/dev/null || echo "OPENCLI_BRIDGE_FAILED"`
467
+ If opencli is installed, run `opencli doctor`. If it fails, mark OpenCLI unusable and choose playwright-cli or skip browser verification.
506
468
 
507
469
  **Decision table**:
508
470
  | Condition | Tool |