prizmkit 1.1.137 → 1.1.139

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 (49) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -1
  3. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -1
  4. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +3 -5
  5. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +24 -39
  6. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +3 -5
  7. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +4 -5
  8. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +3 -5
  9. package/bundled/dev-pipeline/scripts/prompt_framework.py +9 -10
  10. package/bundled/dev-pipeline/scripts/update-checkpoint.py +51 -0
  11. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +3 -3
  12. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +24 -26
  13. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +5 -4
  14. package/bundled/dev-pipeline/templates/feature-list-schema.json +1 -1
  15. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +3 -2
  16. package/bundled/dev-pipeline/templates/sections/bugfix-mission.md +1 -1
  17. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +2 -10
  18. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +2 -1
  19. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +2 -2
  20. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +5 -5
  21. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +5 -5
  22. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
  23. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +2 -12
  24. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +2 -10
  25. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +1 -1
  26. package/bundled/dev-pipeline/templates/sections/refactor-mission.md +1 -1
  27. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +2 -2
  28. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +2 -10
  29. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +2 -1
  30. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +5 -4
  31. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +47 -0
  32. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +10 -16
  33. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +3 -1
  34. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +1 -6
  35. package/bundled/dev-pipeline/tests/test_unified_cli.py +3 -5
  36. package/bundled/skills/_metadata.json +2 -2
  37. package/bundled/skills/prizmkit-test/SKILL.md +22 -24
  38. package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +5 -73
  39. package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +1 -2
  40. package/bundled/skills/prizmkit-test/references/boundary-coverage-protocol.md +2 -2
  41. package/bundled/skills/prizmkit-test/references/evidence-protocol.md +14 -11
  42. package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +12 -17
  43. package/bundled/skills/prizmkit-test/references/examples.md +3 -5
  44. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +6 -8
  45. package/bundled/skills/prizmkit-test/references/test-report-template.md +4 -7
  46. package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +5 -7
  47. package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +251 -204
  48. package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +292 -181
  49. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.1.137",
3
- "bundledAt": "2026-07-19T22:45:14.904Z",
4
- "bundledFrom": "c036667"
2
+ "frameworkVersion": "1.1.139",
3
+ "bundledAt": "2026-07-20T10:59:24.300Z",
4
+ "bundledFrom": "a055a29"
5
5
  }
@@ -96,7 +96,6 @@ class PromptGenerationResult:
96
96
  output_path: Path
97
97
  model: str = ""
98
98
  pipeline_mode: str = ""
99
- agent_count: int = 0
100
99
  checkpoint_path: Path | None = None
101
100
  artifact_path: Path | None = None
102
101
  raw: Mapping[str, object] = field(default_factory=dict)
@@ -96,7 +96,6 @@ def generate_prompt(
96
96
  output_path=output_path,
97
97
  model=str(data.get("model") or ""),
98
98
  pipeline_mode=str(data.get("pipeline_mode") or ""),
99
- agent_count=int(data.get("agent_count") or 0),
100
99
  checkpoint_path=Path(str(checkpoint)) if checkpoint else None,
101
100
  artifact_path=_artifact_path(family, visible_root, item_id, data),
102
101
  raw=data,
@@ -424,16 +424,14 @@ def _child_log_activity_summary(progress: Mapping[str, object]) -> str:
424
424
  def _emit_prompt_summary(prompt: PromptGenerationResult, session_id: str) -> None:
425
425
  if prompt.pipeline_mode:
426
426
  _emit_info(f"Pipeline mode: {_pipeline_mode_label(prompt.pipeline_mode)}")
427
- if prompt.agent_count:
428
- _emit_info(f"Agents: {prompt.agent_count}")
429
427
  _emit_info(f"Spawning AI CLI session: {session_id}")
430
428
 
431
429
 
432
430
  def _pipeline_mode_label(mode: str) -> str:
433
431
  labels = {
434
- "lite": "lite (Tier 1 — Single Agent)",
435
- "standard": "standard (Tier 2 — Main-Agent Review Gates)",
436
- "full": "full (Tier 3 — Main-Agent Full Guardrails)",
432
+ "lite": "lite (Tier 1 — Scoped Guidance)",
433
+ "standard": "standard (Tier 2 — Review Gates)",
434
+ "full": "full (Full Guidance)",
437
435
  }
438
436
  return labels.get(mode, mode)
439
437
 
@@ -1615,13 +1615,10 @@ def _tier_header(pipeline_mode):
1615
1615
  "The standard label remains metadata only for compatibility.\n",
1616
1616
  ),
1617
1617
  "full": (
1618
- "# Dev-Pipeline Session Bootstrap — Tier 3 "
1619
- "(Main-Agent Full Guardrails)\n",
1620
- "**Tier 3 Main-Agent Full Guardrails**: For complex "
1621
- "features, the main orchestrator handles context, planning, and "
1622
- "implementation directly, then runs mandatory Main-Agent review. "
1623
- "After convergence, the review skill may use only its strict-gated "
1624
- "skill-owned independent Reviewer.\n",
1618
+ "# Dev-Pipeline Session Bootstrap — Full Guidance\n",
1619
+ "**Full Guidance**: Follow the active skills and runtime contracts "
1620
+ "for context, planning, implementation, review, testing, recovery, "
1621
+ "and commit.\n",
1625
1622
  ),
1626
1623
  }
1627
1624
  return headers.get(pipeline_mode, headers["lite"])
@@ -1634,8 +1631,8 @@ def _tier_reminders(pipeline_mode):
1634
1631
  "— never skip these",
1635
1632
  "- Build context-snapshot.md FIRST; use it throughout instead of "
1636
1633
  "re-reading files",
1637
- "- `/prizmkit-committer` is mandatory do NOT skip the commit phase, "
1638
- "and do NOT replace it with manual git commit commands",
1634
+ "- `/prizmkit-committer` is mandatory after all required gates pass "
1635
+ "do NOT replace it with manual git commit commands",
1639
1636
  "- Do NOT run `git add`/`git commit` during implementation phases — "
1640
1637
  "all changes are committed once in the commit phase",
1641
1638
  "- If any files remain after the commit, amend the existing commit — "
@@ -1657,34 +1654,27 @@ def _tier_reminders(pipeline_mode):
1657
1654
  "Code Review writes only review-report.md",
1658
1655
  "- Gate checks require the Implementation Log (with Gate Evidence) "
1659
1656
  "and a valid review-report.md Final Result before proceeding",
1660
- "- Code Review keeps mandatory Main-Agent ownership; after convergence "
1661
- "it may use only its strict-gated skill-owned independent Reviewer",
1662
- "- On timeout outside Code Review: check snapshot + git diff HEAD "
1663
- "→ model:lite → remaining steps only → max 2 retries per phase → "
1664
- "Main Agent fallback",
1657
+ "- Follow the active skills and runtime contracts for execution "
1658
+ "units, review ownership, timeout, and recovery",
1665
1659
  ]
1666
1660
  else: # full
1667
1661
  specific = [
1668
- "- Tier 3: full orchestration the Main Agent implements directly "
1669
- "and owns the mandatory Code Review loop",
1662
+ "- Tier 3: follow the active skills and runtime contracts for "
1663
+ "execution topology and review ownership",
1670
1664
  "- context-snapshot.md is the implementation knowledge base; "
1671
1665
  "Code Review writes only review-report.md",
1672
1666
  "- Gate checks require the Implementation Log and a valid "
1673
1667
  "review-report.md Final Result before proceeding",
1674
- "- Code Review excludes ordinary work delegation and permits only "
1675
- "the skill-owned independent Reviewer under its strict structural gate",
1676
- "- Do NOT use `run_in_background=true` when spawning normal work "
1677
- "agents outside Code Review",
1678
- "- If a normal work Agent call fails with team/config/lock errors, "
1679
- "retry at most once; after a second failure, use the documented "
1680
- "inline/recovery fallback or write `failure-log.md` rather than "
1681
- "spawning variants or polling indefinitely",
1668
+ "- Review execution outside the owning skill contract is forbidden",
1669
+ "- Do not infer execution-unit permissions or retry behavior from "
1670
+ "this prompt; use the owning skill/runtime contract",
1682
1671
  "- NEVER delete, modify, or touch any file under `.prizmkit/state/` "
1683
1672
  "— those are pipeline runtime files managed by the runner",
1684
1673
  "- NEVER run `rm -rf`, `git clean`, or destructive filesystem "
1685
1674
  "cleanup during the feature session",
1686
- "- On timeout: check snapshot model:lite remaining steps "
1687
- "only max 2 retries orchestrator fallback",
1675
+ "- On execution-unit timeout: preserve the active checkout and "
1676
+ "artifacts and follow the owning contract's recovery or downgrade "
1677
+ "path",
1688
1678
  ]
1689
1679
 
1690
1680
  lines = ["## Reminders\n"] + specific + common
@@ -1715,18 +1705,16 @@ def assemble_sections(pipeline_mode, sections_dir, init_done, is_resume,
1715
1705
  "## Your Mission\n\n"
1716
1706
  "You are the **session orchestrator**. Implement Feature "
1717
1707
  "{{FEATURE_ID}}: \"{{FEATURE_TITLE}}\".\n\n"
1718
- "**CRITICAL**: You MUST NOT exit until ALL work is complete "
1719
- "and committed."
1708
+ "**CRITICAL**: Do not exit while recoverable work remains. "
1709
+ "If a required gate is blocked or the workflow cannot safely "
1710
+ "continue, record the blocker and stop with a truthful blocked "
1711
+ "status; do not claim success or commit an incomplete change."
1720
1712
  )
1721
1713
  if pipeline_mode != "lite":
1722
1714
  mission += (
1723
- " When you spawn normal work subagents, wait for each to finish "
1724
- "(run_in_background=false)."
1725
- )
1726
- if pipeline_mode == "full":
1727
- mission += (
1728
- " Do NOT spawn work agents in background and exit — "
1729
- "that kills the session."
1715
+ " Follow the active skill and runtime contracts for any "
1716
+ "execution units they create, including completion, timeout, "
1717
+ "resume, and failure handling."
1730
1718
  )
1731
1719
  mission += "\n\n" + tier_desc
1732
1720
  sections.append(("mission", mission))
@@ -1753,7 +1741,7 @@ def assemble_sections(pipeline_mode, sections_dir, init_done, is_resume,
1753
1741
  sections.append(("directory-convention",
1754
1742
  load_section(sections_dir, dc_file)))
1755
1743
 
1756
- # --- Subagent Timeout Recovery (only for agent tiers) ---
1744
+ # --- Execution-unit timeout recovery ---
1757
1745
  if pipeline_mode in ("standard", "full"):
1758
1746
  sections.append(("timeout-recovery",
1759
1747
  load_section(sections_dir,
@@ -2310,14 +2298,11 @@ def main():
2310
2298
 
2311
2299
  # ── Success JSON ───────────────────────────────────────────────────
2312
2300
  feature_model = feature.get("model", "")
2313
- mode_agent_counts = {"lite": 1, "standard": 3, "full": 3}
2314
- agent_count = mode_agent_counts.get(pipeline_mode, 1)
2315
2301
  output = {
2316
2302
  "success": True,
2317
2303
  "output_path": os.path.abspath(args.output),
2318
2304
  "model": feature_model,
2319
2305
  "pipeline_mode": pipeline_mode,
2320
- "agent_count": agent_count,
2321
2306
  "render_mode": "sections" if use_sections else "legacy",
2322
2307
  "validation_warnings": len(warnings),
2323
2308
  "validation_errors": len(errors),
@@ -20,7 +20,6 @@ from prompt_framework import (
20
20
  generate_checkpoint_from_sections,
21
21
  load_section,
22
22
  merge_checkpoint_state,
23
- mode_agent_count,
24
23
  normalize_mode,
25
24
  pipeline_checkpoint_metadata,
26
25
  read_text_file,
@@ -386,9 +385,9 @@ def render_template(template_content, replacements, bug):
386
385
  def _bugfix_header(pipeline_mode):
387
386
  title = "# Dev-Pipeline Bug Fix Session Bootstrap — {}\n".format(pipeline_mode.title())
388
387
  desc = {
389
- "lite": "**Tier 1 — Single Agent**: direct root-cause fix by the main orchestrator.",
390
- "standard": "**Tier 2 — Main-Agent Review Gates**: direct implementation with mandatory Main-Agent review and optional strict capability-gated independent correctness review.",
391
- "full": "**Tier 3 — Full Bugfix Guardrails**: direct implementation with stronger diagnosis and review gates.",
388
+ "lite": "**Tier 1 — Scoped Bugfix Guidance**: use the active skills and runtime contracts for diagnosis, implementation, review, and verification.",
389
+ "standard": "**Tier 2 — Bugfix Review Gates**: use the active skills and runtime contracts for diagnosis, implementation, review, and verification.",
390
+ "full": "**Tier 3 — Full Bugfix Guardrails**: use the active skills and runtime contracts for diagnosis, implementation, review, recovery, and verification.",
392
391
  }.get(pipeline_mode, "**Bugfix pipeline**")
393
392
  return title + "\n" + desc + "\n"
394
393
 
@@ -574,7 +573,6 @@ def main():
574
573
  "checkpoint_path": checkpoint_path,
575
574
  "model": bug.get("model", ""),
576
575
  "pipeline_mode": pipeline_mode,
577
- "agent_count": mode_agent_count(pipeline_mode),
578
576
  "render_mode": "sections" if use_sections else "legacy",
579
577
  "validation_warnings": len(warnings),
580
578
  "validation_errors": len(errors),
@@ -97,11 +97,10 @@ Implement the minimal fix (red → green):
97
97
  """\
98
98
  Verify fix quality:
99
99
  1. Run `/prizmkit-code-review` with the current bugfix artifact directory.
100
- 2. Run the mandatory Main-Agent review over the complete current change for up to ten rounds; directly repair accepted findings and verify repairs.
101
- 3. After Main-Agent convergence, allow only the one skill-owned independent Reviewer under the strict structural capability gate. If any capability is unavailable or unproven, record downgrade and create none.
102
- 4. Converge only when accepted and unresolved findings are both zero; missing required evidence or round-ten non-convergence produces NEEDS_FIXES.
103
- 5. Do not invoke another review skill or add review execution outside the skill contract.
104
- 6. `review-report.md` is the only persisted review artifact. Continue only after its last Final Result is valid; preserve append-only progress for recovery.""",
100
+ 2. Follow the skill's current review contract for review execution, repairs, verification, evidence, and handoff.
101
+ 3. Do not invoke another review skill or add a second review path outside the skill contract.
102
+ 4. Continue only after `review-report.md` has a valid last Final Result; preserve append-only progress for recovery.
103
+ 5. A missing, incomplete, unsafe, or non-converged review produces NEEDS_FIXES rather than a synthesized pass.""",
105
104
  ),
106
105
  6: (
107
106
  "User Verification",
@@ -20,7 +20,6 @@ from prompt_framework import (
20
20
  generate_checkpoint_from_sections,
21
21
  load_section,
22
22
  merge_checkpoint_state,
23
- mode_agent_count,
24
23
  normalize_mode,
25
24
  pipeline_checkpoint_metadata,
26
25
  read_text_file,
@@ -410,9 +409,9 @@ def render_template(template_content, replacements, resume_phase, refactor):
410
409
  def _refactor_header(pipeline_mode):
411
410
  title = "# Dev-Pipeline Refactor Session Bootstrap — {}\n".format(pipeline_mode.title())
412
411
  desc = {
413
- "lite": "**Tier 1 — Single Agent**: direct behavior-preserving refactor by the main orchestrator.",
414
- "standard": "**Tier 2 — Main-Agent Review Gates**: direct refactor with mandatory Main-Agent review and optional strict capability-gated independent correctness review.",
415
- "full": "**Tier 3 — Full Refactor Guardrails**: direct refactor with stronger behavior-preservation evidence.",
412
+ "lite": "**Tier 1 — Scoped Refactor Guidance**: use the active skills and runtime contracts for planning, implementation, review, and behavior verification.",
413
+ "standard": "**Tier 2 — Refactor Review Gates**: use the active skills and runtime contracts for planning, implementation, review, and behavior verification.",
414
+ "full": "**Tier 3 — Full Refactor Guardrails**: use the active skills and runtime contracts for planning, implementation, review, recovery, and behavior verification.",
416
415
  }.get(pipeline_mode, "**Refactor pipeline**")
417
416
  return title + "\n" + desc + "\n"
418
417
 
@@ -592,7 +591,6 @@ def main():
592
591
  "checkpoint_path": checkpoint_path,
593
592
  "model": refactor.get("model", ""),
594
593
  "pipeline_mode": pipeline_mode,
595
- "agent_count": mode_agent_count(pipeline_mode),
596
594
  "render_mode": "sections" if use_sections else "legacy",
597
595
  "validation_warnings": len(warnings),
598
596
  "validation_errors": len(errors),
@@ -117,6 +117,14 @@ def pipeline_checkpoint_metadata(artifact_dir, evidence=None, stage="plan",
117
117
  blocked_reason=None, terminal_status=None):
118
118
  """Build family-neutral semantic L4 metadata without replacing L1 state."""
119
119
  evidence = evidence or {}
120
+ if evidence:
121
+ evidence_paths = {
122
+ "manifest": evidence.get("manifest_path"),
123
+ "verdict": evidence.get("verdict_path"),
124
+ "validation": evidence.get("validation_path"),
125
+ }
126
+ else:
127
+ evidence_paths = {"manifest": None, "verdict": None, "validation": None}
120
128
  current_stage = None if terminal_status else stage
121
129
  semantic_next_stage = None if terminal_status else next_stage
122
130
  return {
@@ -129,11 +137,7 @@ def pipeline_checkpoint_metadata(artifact_dir, evidence=None, stage="plan",
129
137
  "stage_result": stage_result,
130
138
  "repair_scope": repair_scope,
131
139
  "repair_round": repair_round,
132
- "authoritative_evidence_paths": {
133
- "manifest": evidence.get("manifest_path"),
134
- "verdict": evidence.get("verdict_path"),
135
- "validation": evidence.get("validation_path"),
136
- },
140
+ "authoritative_evidence_paths": evidence_paths,
137
141
  "next_stage": semantic_next_stage,
138
142
  "resume_from": resume_from,
139
143
  "blocked_reason": blocked_reason,
@@ -444,11 +448,6 @@ def normalize_mode(value, default="lite"):
444
448
  return value if value in {"lite", "standard", "full"} else default
445
449
 
446
450
 
447
- def mode_agent_count(pipeline_mode):
448
- """Return the prompt metadata agent count for a mode."""
449
- return {"lite": 1, "standard": 3, "full": 3}.get(pipeline_mode, 1)
450
-
451
-
452
451
  def detect_dev_server_port(project_root):
453
452
  """Return a detected dev-server port string, or an unknown placeholder."""
454
453
  unknown = "<UNKNOWN_DETECT_FROM_PROJECT_CONFIG>"
@@ -213,6 +213,43 @@ def _checkpoint_project_root(checkpoint_path):
213
213
  return str(parent.parent)
214
214
  return str(path.parent)
215
215
 
216
+ def _discover_test_evidence_paths(checkpoint_path, data):
217
+ """Discover the latest finalized test package from the artifact handoff pointer."""
218
+ project_root = Path(_checkpoint_project_root(checkpoint_path))
219
+ candidates = []
220
+ artifact_dir = data.get("artifact_dir")
221
+ if isinstance(artifact_dir, str) and artifact_dir:
222
+ candidates.append(project_root / artifact_dir)
223
+ for state_key in ("feature_state", "bugfix_state", "refactor_state"):
224
+ state = data.get(state_key)
225
+ if isinstance(state, dict) and isinstance(state.get("artifact_dir"), str):
226
+ candidates.append(project_root / state["artifact_dir"])
227
+ item_slug = data.get("item_slug")
228
+ if isinstance(item_slug, str) and item_slug:
229
+ candidates.append(project_root / ".prizmkit" / "specs" / item_slug)
230
+ candidates.append(project_root / ".prizmkit" / "bugfix" / item_slug)
231
+ candidates.append(project_root / ".prizmkit" / "refactor" / item_slug)
232
+
233
+ for artifact in candidates:
234
+ pointer = artifact / "test-report-path.txt"
235
+ try:
236
+ report = Path(pointer.read_text(encoding="utf-8").strip()).resolve()
237
+ except (OSError, ValueError):
238
+ continue
239
+ evidence_dir = report.parent
240
+ paths = {
241
+ "manifest": str(evidence_dir / "manifest.json"),
242
+ "verdict": str(evidence_dir / "verdict.json"),
243
+ "validation": str(evidence_dir / "validation.json"),
244
+ }
245
+ if all(Path(value).is_file() for value in paths.values()):
246
+ return {
247
+ key: str(Path(value).relative_to(project_root))
248
+ for key, value in paths.items()
249
+ }
250
+ return None
251
+
252
+
216
253
  def _finalize_semantics(checkpoint_path, data, state_key):
217
254
  """Derive a deterministic terminal status after an atomic mutation."""
218
255
  candidate = validate_checkpoint_data(
@@ -286,11 +323,25 @@ def update_checkpoint(
286
323
  return {"ok": False, "error": verdict_error}
287
324
 
288
325
  semantic_update = _normalize_semantic_update(semantic_update)
326
+ if (
327
+ semantic_update.get("stage_result") == "TEST_BLOCKED"
328
+ and not semantic_update.get("authoritative_evidence_paths")
329
+ ):
330
+ discovered = _discover_test_evidence_paths(checkpoint_path, data)
331
+ if discovered:
332
+ semantic_update["authoritative_evidence_paths"] = discovered
289
333
  semantic_error = _validate_semantic_update(step, semantic_update)
290
334
  if semantic_error:
291
335
  return {"ok": False, "error": semantic_error}
292
336
 
293
337
  stage_result = semantic_update.get("stage_result")
338
+ if step.get("skill") == "prizmkit-test" and stage_result in TEST_RESULTS:
339
+ evidence = semantic_update.get("authoritative_evidence_paths") or step.get("authoritative_evidence_paths")
340
+ if not isinstance(evidence, dict) or set(evidence) != {"manifest", "verdict", "validation"}:
341
+ return {
342
+ "ok": False,
343
+ "error": "Every terminal test verdict requires manifest, verdict, and validation evidence paths",
344
+ }
294
345
  if new_status == "completed" and step.get("skill") == "prizmkit-code-review":
295
346
  stage_result = stage_result or step.get("stage_result")
296
347
  if stage_result != "REVIEW_PASS":
@@ -20,7 +20,7 @@
20
20
  ## Instructions
21
21
 
22
22
  You are running in **headless non-interactive mode** — no human is available for input.
23
- Infer what needs to be done from the feature context above and follow the standard dev loop.
23
+ Infer what needs to be done from the feature context above and follow the active skill and runtime contracts. Do not exit while recoverable work remains. If a required gate is blocked or the workflow cannot safely continue, record the blocker and stop with a truthful blocked status; do not claim success or commit an incomplete change.
24
24
 
25
25
  ### Execution Steps
26
26
 
@@ -30,7 +30,7 @@ Infer what needs to be done from the feature context above and follow the standa
30
30
 
31
31
  3. **Implement**: Run `/prizmkit-implement` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` to execute the plan using TDD (write tests first, then implement).
32
32
 
33
- 4. **Review**: Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. Its mandatory Main-Agent loop reviews the complete current change for up to ten internal rounds and directly repairs accepted findings. After convergence, its one skill-owned independent Reviewer is optional only under a strict structural capability gate; otherwise the skill records downgrade and creates none. Require the last `## Final Result`. `REVIEW_PASS` proceeds to test; `REVIEW_NEEDS_FIXES` increments the shared outer repair round and routes implement → code-review → test. Do not invoke another review entry point or add review execution outside the skill contract.
33
+ 4. **Review**: Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` and follow the skill's current review contract for review execution, repairs, verification, evidence, and handoff. Require the last `## Final Result`. `REVIEW_PASS` proceeds to test; `REVIEW_NEEDS_FIXES` increments the shared outer repair round and routes implement → code-review → test. Do not invoke another review entry point or add a second review path outside the skill contract.
34
34
 
35
35
  5. **Test**: After review passes, run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. Treat the Markdown report only as a derived view. Consume `.prizmkit/test/evidence/<evidence-id>/manifest.json`, `verdict.json`, and `validation.json`; verify identity/scope, every manifest hash, verdict/validator agreement, and current target hashes before accepting `TEST_PASS`. `TEST_FAIL/test-infrastructure` routes implement → test; production/runtime/schema/dependency/public-interface routes implement → code-review → test; unknown unsafe scope blocks. `TEST_BLOCKED` allows bounded environment recovery or a test-stage resume but never speculative production edits. Stop outer repairs after three rounds; preserve evidence and truthful recovery metadata.
36
36
 
@@ -44,7 +44,7 @@ Infer what needs to be done from the feature context above and follow the standa
44
44
  - Remote publication is controlled by the runtime after the local commit; do not make a publication decision in this session.
45
45
  - Write all artifacts to `.prizmkit/specs/{{FEATURE_SLUG}}/`.
46
46
  - If a step fails after 3 attempts, write a status report and stop.
47
- - **Never re-read unmodified files**: once you read a file into context, do NOT read it again unless it was modified by an Edit/Write after your last read — use `grep -n`/`sed -n` for specific lines. Before issuing a Read, ask: "Have I read this file before, and has it changed since?" If no — do NOT read it. Normal work delegation outside the optional skill-owned review contract must rely on context-snapshot.md rather than re-reading files the Main Agent already read. Code Review keeps mandatory Main-Agent ownership and may use only its strict-gated skill-owned Reviewer after convergence.
47
+ - **Never re-read unmodified files**: once you read a file into context, do NOT read it again unless it was modified by an Edit/Write after your last read — use `grep -n`/`sed -n` for specific lines. Before issuing a Read, ask: "Have I read this file before, and has it changed since?" If no — do NOT read it. Follow the active skill and runtime contracts when an execution unit is created; do not infer its permissions, continuation, or retry behavior from this fallback prompt.
48
48
  - **Read offset safety**: if Read returns "shorter than offset"/"empty" — run `wc -l` then `sed -n`, do NOT retry same offset.
49
49
  - **Hard Round Cap**: after 6 total test-fix rounds, STOP trial-and-error. Switch to read-once-then-rewrite. Do NOT exceed 7 rounds.
50
50
  - **Layered test**: debug with single-file tests, only run full suite as gate when single-file is green.
@@ -1,4 +1,4 @@
1
- # Dev-Pipeline Session Bootstrap — Tier 3 (Main-Agent Full Guardrails)
1
+ # Dev-Pipeline Session Bootstrap — Full Guidance
2
2
 
3
3
  ## Session Context
4
4
 
@@ -10,15 +10,14 @@
10
10
 
11
11
  You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATURE_TITLE}}".
12
12
 
13
- **CRITICAL**: You MUST NOT exit until ALL work is complete and committed. Normal work delegation outside the optional skill-owned review contract must finish before exit (`run_in_background=false`).
13
+ **CRITICAL**: Do not exit while recoverable work remains. If a required gate is blocked or the workflow cannot safely continue, record the blocker and stop with a truthful blocked status; do not claim success or commit an incomplete change.
14
14
 
15
- **Tier 3 — Main-Agent Full Guardrails**: For complex features, the Main Agent handles context, planning, and implementation directly, then runs the mandatory Main-Agent review in `/prizmkit-code-review`. After convergence, that skill may use one skill-owned independent Reviewer only when its strict structural capability gate passes; otherwise it records downgrade and creates none. Do not spawn a top-level Dev implementation subagent.
15
+ **Tier 3 — Full Guardrails**: Follow the active skills and runtime contracts for context loading, planning, implementation, review, testing, recovery, and commit. The active contracts determine the execution topology and permissions for any execution units they create.
16
16
 
17
- **Agent spawn failure policy (all execution-unit creation)**:
18
- - Code Review must not invoke another review skill/workflow or add review execution outside the single optional Reviewer owned and gated by `prizmkit-code-review`.
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 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.
17
+ **Execution-unit failure policy**:
18
+ - Do not invoke another review skill/workflow or add review execution outside the contract owned by `prizmkit-code-review`.
19
+ - If an execution unit cannot be created or resumed under its owning skill's contract, follow that contract's downgrade or recovery path; do not create an unapproved replacement.
20
+ - Do not enter indefinite polling or repeated retries after the owning contract's retry budget is exhausted.
22
21
 
23
22
  ### Feature Description
24
23
 
@@ -50,9 +49,9 @@ You are running in **headless non-interactive mode** with a FINITE context windo
50
49
 
51
50
  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
51
 
53
- 1. **context-snapshot.md is your single source of truth** — After Phase 1-2 makes it available, use it instead of re-reading individual source files. If you just created or updated it in this session, continue from the in-context content; read it only when resuming/continuing, after context compaction/loss, or when handing work to a subagent.
52
+ 1. **context-snapshot.md is your single source of truth** — After Phase 1-2 makes it available, use it instead of re-reading individual source files. If you just created or updated it in this session, continue from the in-context content; read it only when resuming/continuing, after context compaction/loss, or when handing work to an execution unit.
54
53
  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. **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 platform file/search tools for targeted lookup; when shell-free helper lookup is needed, run `{{RUNTIME_HELPER_CMD}} text search <file> --pattern "<pattern>" --json`, then read only the smallest bounded range with the platform file-reading tool 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. Normal work delegation outside the optional skill-owned review contract must receive context-snapshot.md and rely on it rather than independently re-reading files the Main Agent already read. Code Review keeps mandatory Main-Agent ownership and may use only its strict-gated skill-owned Reviewer after convergence.
54
+ 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 platform file/search tools for targeted lookup; when shell-free helper lookup is needed, run `{{RUNTIME_HELPER_CMD}} text search <file> --pattern "<pattern>" --json`, then read only the smallest bounded range with the platform file-reading tool 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. Follow the active skill and runtime contracts when an execution unit is created; do not infer its permissions, continuation, or retry behavior from this bootstrap.
56
55
  4. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
57
56
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
58
57
  5. **Minimize tool output** — Never load full command output into context. First capture command output to a temp file using the command/tool output option or the host-appropriate redirection, then inspect only the final relevant lines and use targeted search helpers to extract the information needed for the current task. Only read the filtered result — never the raw full output.
@@ -76,14 +75,13 @@ You are running in **headless non-interactive mode** with a FINITE context windo
76
75
 
77
76
  ---
78
77
 
79
- ## Subagent Timeout Recovery
78
+ ## Execution-Unit Timeout Recovery
80
79
 
81
- If any agent times out:
80
+ If an execution unit times out:
82
81
  1. `{{RUNTIME_HELPER_CMD}} artifact list .prizmkit/specs/{{FEATURE_SLUG}}` — check what exists
83
- 2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and the Implementation Log from previous normal work execution. 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"`
84
- 3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
85
-
86
- ---
82
+ 2. If `context-snapshot.md` exists: open a recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and the Implementation Log from the previous execution. 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"`
83
+ 3. Apply the owning skill or runtime contract for retry, native continuation, strict downgrade, or Main-Agent fallback. Do not create an unapproved replacement execution unit.
84
+ 4. Do not poll indefinitely after the owning contract's retry budget is exhausted; write `failure-log.md` with the timeout and last observable state when recovery is blocked.
87
85
 
88
86
  ## Execution
89
87
 
@@ -181,7 +179,7 @@ Before proceeding past CP-1, verify:
181
179
 
182
180
  ### Phase 3: Plan Self-Check — Orchestrator Direct
183
181
 
184
- Do not delegate planning analysis. The current Main Agent performs a bounded self-check before implementation:
182
+ The active planning skill and runtime determine whether any additional planning execution is appropriate. Do not treat this bounded self-check as a substitute for the planning skill's own review contract:
185
183
 
186
184
  1. Re-read only `context-snapshot.md`, `spec.md`, and `plan.md`.
187
185
  2. Cross-check spec.md and plan.md Tasks against the feature description and acceptance criteria.
@@ -191,26 +189,26 @@ Do not delegate planning analysis. The current Main Agent performs a bounded sel
191
189
  **CP-2**: Plan self-check complete; no CRITICAL plan issues remain.
192
190
 
193
191
 
194
- ### Implement — Orchestrator Direct (no Dev subagent)
192
+ ### Implement — Plan Execution
195
193
 
196
- **Rationale**: Development is deterministic plan execution the orchestrator already built full context in Phase 1-2. Spawning a Dev subagent forces it to rebuild context (re-reading files the orchestrator already read), wastes context, and risks worktree double-edit. The orchestrator implements directly.
194
+ Execute the reviewed plan through the active implementation skill. The skill and runtime determine the execution topology; preserve the shared artifact directory, active checkout, and task checkpoints.
197
195
 
198
196
  Before starting, check plan.md Tasks:
199
197
  ```bash
200
198
  {{RUNTIME_HELPER_CMD}} text count .prizmkit/specs/{{FEATURE_SLUG}}/plan.md --pattern "- [ ]"
201
199
  ```
202
200
  - If result is `0` (all tasks already `[x]`) → **SKIP to Review**.
203
- - If non-zero → implement directly below.
201
+ - If non-zero → execute the remaining tasks below.
204
202
 
205
203
  **Build artifacts rule**: After any build/compile command, ensure output is in `.gitignore`. Never commit binaries/build output.
206
204
 
207
205
  **3a.** Run `/prizmkit-implement` directly:
208
206
  - Continue from the `spec.md` / `plan.md` / `context-snapshot.md` content you created in Phase 1-2; do not re-read self-authored artifacts just because implementation starts
209
207
  - Re-read `plan.md` or `context-snapshot.md` only when resuming/continuing, when current context was compacted or lost, or when task checkbox state may have changed outside this session
210
- - Implementation remains in the current Main Agent; do not delegate it to a Dev subagent
208
+ - Follow the implementation skill's current execution and delegation contract
211
209
  - Use context-snapshot.md Section 4 File Manifest for targeted source reads; avoid re-reading source files already summarized there unless they changed after the snapshot
212
210
  - Implements task-by-task, marking each `[x]` immediately
213
- - Remeber to update checkpoints after finishing a series of tasks
211
+ - Remember to update checkpoints after finishing a series of tasks
214
212
 
215
213
  **3b. Focused checks only (no test gate here)**:
216
214
  - During implementation, do not run mandatory periodic or full-suite tests.
@@ -237,7 +235,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
237
235
 
238
236
  ### Review — Code Review
239
237
 
240
- Review the completed implementation before the full Feature test gate. Run `/prizmkit-code-review artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` in the current Main Agent. The mandatory Main-Agent loop reviews and repairs the complete change for up to ten rounds. After it converges, the skill may use its one skill-owned independent Reviewer only when every strict structural capability is proven; otherwise it records downgrade and creates none. Do not invoke another review skill or add any review execution beyond that skill contract.
238
+ Review the completed implementation before the full Feature test gate. Run `/prizmkit-code-review artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` and follow the skill's current review contract for review execution, repairs, verification, evidence, and handoff. Do not invoke another review skill or add a second review path outside that contract.
241
239
 
242
240
  - `REVIEW_PASS` → record `stage=code-review`, `status=REVIEW_PASS`, `stage_result=PASS`, `next_stage=prizmkit-test`, and `resume_from=prizmkit-test`; then run the test gate.
243
241
  - `REVIEW_NEEDS_FIXES` → increment the shared outer `repair_round` and route `prizmkit-implement` → `prizmkit-code-review` → `prizmkit-test`.
@@ -524,14 +522,14 @@ If you encounter an unrecoverable error, context overflow, or are about to exit
524
522
 
525
523
  ## Reminders
526
524
 
527
- - Tier 3: orchestrator implements directly; `/prizmkit-code-review` runs mandatory Main-Agent review and optional strict-gated skill-owned independent review
525
+ - Tier 3: orchestrator follows the active skill and runtime contracts; they determine execution topology, review ownership, and delegation boundaries
528
526
  - context-snapshot.md contains Main-Agent implementation context; Code Review writes only review-report.md
529
527
  - Gate checks require the Implementation Log and a valid review-report.md Final Result before proceeding
530
- - Review execution outside the skill contract is forbidden; normal work delegation must not use `run_in_background=true`
528
+ - Review execution outside the owning skill contract is forbidden; execution-unit retry and background behavior come from the active skill/runtime contract
531
529
  - Commit phase must use `/prizmkit-committer`; do NOT replace with manual git commit commands
532
530
  - **NEVER delete, modify, or touch any file under `.prizmkit/state/`** — those are pipeline runtime files managed by the runner
533
531
  - NEVER run `rm -rf`, `git clean`, or any destructive filesystem operations
534
532
  - Do NOT run `git add`/`git commit` during Phase 1-5 — all changes are committed once in Phase 6
535
533
  - If any files remain after the commit, amend the existing commit — do NOT create a follow-up commit
536
534
  - When staging files, always use explicit file names — NEVER use `git add -A` or `git add .`
537
- - On timeout: check snapshot model:lite remaining steps only max 2 retries orchestrator fallback
535
+ - On execution-unit timeout: follow the owning skill/runtime contract, preserve the active checkout and artifacts, and record a truthful blocker when recovery is exhausted
@@ -11,9 +11,9 @@
11
11
 
12
12
  You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
13
13
 
14
- **CRITICAL**: You MUST NOT exit until ALL automated work is complete and committed. Manual/hybrid verification labels do not authorize a partial stop: select deterministic local verification tooling and record its evidence.
14
+ **CRITICAL**: Do not exit while recoverable work remains. If a required gate is blocked or the workflow cannot safely continue, record the blocker and stop with a truthful blocked status; do not claim success or commit an incomplete change.
15
15
 
16
- **SUBAGENT LIFECYCLE**: Any normal work subagent must be awaited with `run_in_background=false`. Do not spawn persistent background subagents for headless recovery.
16
+ **Execution model**: Follow the active skills and runtime contracts for planning, implementation, review, recovery, and commit. Those contracts determine the execution topology, permissions, and delegation boundaries.
17
17
 
18
18
  **NON-INTERACTIVE MODE**: There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input. Make decisions autonomously and move forward.
19
19
 
@@ -46,7 +46,7 @@ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
46
46
  0. **NON-INTERACTIVE MODE** — NEVER ask for confirmation. Proceed autonomously.
47
47
  1. **context-snapshot.md is your single source of truth** — After it is built, read context-snapshot.md instead of re-reading individual source files.
48
48
  2. **Never re-read your own writes** — Trust your write was correct.
49
- 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 after your last read. Use `grep -n` or `sed -n` for targeted lookups instead of full-file Read. Before issuing a Read, ask: "Have I read this file before, and has it changed since?" If no — do NOT read it. Subagents must rely on context-snapshot.md rather than re-reading files the orchestrator already read.
49
+ 3. **Never re-read unmodified files** — Once you read a file into context, do NOT read it again unless it was modified by an Edit/Write after your last read. Use `grep -n` or `sed -n` for targeted lookups instead of full-file Read. Before issuing a Read, ask: "Have I read this file before, and has it changed since?" If no — do NOT read it. Follow the active skill and runtime contracts when an execution unit is created; do not infer its permissions, continuation, or retry behavior from this bootstrap.
50
50
  4. **Stay focused** — Do NOT explore code unrelated to this bug.
51
51
  4. **Minimize tool output** — Capture to temp file, scan head/tail, filter with grep/sed/awk. Never load full output.
52
52
  5. **No intermediate commits** — All changes committed once at the end via `/prizmkit-committer`.
@@ -315,7 +315,8 @@ Write to: `{{SESSION_STATUS_PATH}}`
315
315
 
316
316
  ## Reminders
317
317
 
318
- - Use L1 Skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-committer`, `/prizmkit-retrospective`
318
+ - Follow the active skills and runtime contracts; they determine execution topology, review ownership, and delegation boundaries
319
+ - On execution-unit timeout, preserve the active checkout and artifacts and follow the owning contract's recovery or downgrade path
319
320
  - All skills use `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`
320
321
  - plan.md first task MUST be reproduction test (RED → GREEN TDD)
321
322
  - Commit with `fix(<scope>):` prefix, NOT `feat:`
@@ -75,7 +75,7 @@
75
75
  "high",
76
76
  "critical"
77
77
  ],
78
- "description": "Estimated implementation complexity. Determines pipeline execution tier: low/medium → lite (single agent), high → standard (orchestrator + reviewer), critical → full (orchestrator + stronger guardrails)."
78
+ "description": "Estimated implementation complexity. Determines prompt depth and guardrails: low/medium → lite, high → standard, critical → full. Execution topology is defined by the active skills and runtime, not by this field."
79
79
  },
80
80
  "dependencies": {
81
81
  "type": "array",
@@ -17,7 +17,7 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
17
17
 
18
18
  **NON-INTERACTIVE MODE**: You are running in headless non-interactive mode. There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, and NEVER use interactive prompts. Resolve uncertainty from existing code, project docs, and conservative behavior-preserving defaults.
19
19
 
20
- **MAIN-AGENT-DIRECT RULE**: Do not spawn a top-level Dev implementation subagent. The Main Agent plans, implements via `/prizmkit-implement`, and runs `/prizmkit-code-review` directly without direct or indirect review delegation.
20
+ **Execution model**: Follow the active skills and runtime contracts for planning, implementation, review, recovery, and commit. Those contracts determine the execution topology, permissions, and delegation boundaries.
21
21
 
22
22
  **REFACTOR DOCUMENTATION POLICY**:
23
23
  - Default: run `/prizmkit-retrospective` with full sync because refactoring changes structure and interfaces.
@@ -267,7 +267,8 @@ Before exiting, write `{{SESSION_STATUS_PATH}}`:
267
267
  ## Reminders
268
268
 
269
269
  - Use L1 skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-retrospective`, `/prizmkit-committer`.
270
- - Do not spawn a top-level Dev implementation subagent; Code Review keeps mandatory Main-Agent ownership and may use only its strict-gated skill-owned Reviewer after convergence.
270
+ - Follow the active skills and runtime contracts; they determine execution topology, review ownership, and delegation boundaries
271
+ - On execution-unit timeout, preserve the active checkout and artifacts and follow the owning contract's recovery or downgrade path
271
272
  - Behavior preservation is the first priority.
272
273
  - Browser verification is a mandatory attempt by default; it blocks only when explicitly required.
273
274
  - If `DEV_PORT` is unknown, discover it from project config; do not guess port 3000.