prizmkit 1.1.131 → 1.1.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/command-adapter.js +0 -2
  3. package/bundled/dev-pipeline/assets/skill-subagent-integration.md +11 -6
  4. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +2 -9
  5. package/bundled/dev-pipeline/prizmkit_runtime/processes.py +21 -1
  6. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +104 -17
  7. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +3 -2
  8. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +15 -13
  9. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +3 -13
  10. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +5 -4
  11. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +1 -1
  12. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +4 -4
  13. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +9 -9
  14. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +4 -7
  15. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +3 -3
  16. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +2 -2
  17. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +5 -10
  18. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +5 -5
  19. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +1 -1
  20. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  21. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +2 -3
  22. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +2 -2
  23. package/bundled/dev-pipeline/templates/sections/phase-commit.md +2 -2
  24. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +5 -5
  25. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +5 -5
  26. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +1 -1
  27. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +5 -5
  28. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +1 -1
  29. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +1 -1
  30. package/bundled/dev-pipeline/templates/sections/task-contract.md +4 -0
  31. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +39 -26
  32. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +7 -10
  33. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +3 -3
  34. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +156 -5
  35. package/bundled/dev-pipeline/tests/test_unified_cli.py +34 -7
  36. package/bundled/skills/_metadata.json +3 -3
  37. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +3 -3
  38. package/bundled/skills/prizmkit-code-review/SKILL.md +22 -6
  39. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +243 -0
  40. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +41 -0
  41. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +3 -3
  42. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +93 -1
  43. package/bundled/skills/prizmkit-committer/SKILL.md +6 -13
  44. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +3 -3
  45. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +3 -3
  46. package/bundled/skills/prizmkit-plan/SKILL.md +17 -3
  47. package/bundled/skills/prizmkit-plan/assets/plan-template.md +18 -0
  48. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +242 -0
  49. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +4 -4
  50. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +3 -3
  51. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +3 -3
  52. package/bundled/skills/prizmkit-test/SKILL.md +25 -1
  53. package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +63 -12
  54. package/bundled/skills/prizmkit-test/assets/evidence-manifest.schema.json +1 -1
  55. package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +13 -0
  56. package/bundled/skills/prizmkit-test/references/evidence-protocol.md +6 -1
  57. package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +8 -1
  58. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +4 -1
  59. package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +15 -0
  60. package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +3 -3
  61. package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +744 -23
  62. package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +194 -15
  63. package/bundled/skills/prizmkit-workflow/SKILL.md +1 -1
  64. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +3 -3
  65. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.1.131",
3
- "bundledAt": "2026-07-18T08:21:47.386Z",
4
- "bundledFrom": "c1378b1"
2
+ "frameworkVersion": "1.1.134",
3
+ "bundledAt": "2026-07-19T00:56:53.854Z",
4
+ "bundledFrom": "09d7b00"
5
5
  }
@@ -7,8 +7,6 @@
7
7
  * - Only `description` in frontmatter
8
8
  * - `${SKILL_DIR}` references rewritten to relative paths
9
9
  * - Skills with assets/scripts use directory structure
10
- *
11
- * Code-review-specific named agents are retired; review runs in the Main Agent.
12
10
  */
13
11
 
14
12
  import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
@@ -6,8 +6,9 @@
6
6
 
7
7
  Skill behavior is owned by canonical skills:
8
8
 
9
+ - `/prizmkit-plan` runs its mandatory local Plan/Spec review, then may use its complete skill-local independent Plan Reviewer reference only when the host proves the strict semantic capability gate.
9
10
  - `/prizmkit-implement` executes plan tasks directly and may use its local implementation-subagent reference for narrow active-checkout delegation.
10
- - `/prizmkit-code-review` runs its complete bounded review and repair loop directly in the Main Agent.
11
+ - `/prizmkit-code-review` runs its mandatory bounded Main-Agent review and repair loop, then may use its complete skill-local independent Code Reviewer reference under the same fail-closed capability model.
11
12
 
12
13
  ## Architecture
13
14
 
@@ -21,9 +22,9 @@ dev-pipeline (outer loop)
21
22
  +-- [per session] AI CLI
22
23
  |
23
24
  +-- Context snapshot + specify + plan (orchestrator)
24
- +-- Local plan/spec review loop inside prizmkit-plan
25
+ +-- Mandatory local plan/spec review, then optional strict-gated independent Plan review
25
26
  +-- Implement through /prizmkit-implement
26
- +-- Main-Agent code review through /prizmkit-code-review
27
+ +-- Mandatory Main-Agent code review, then optional strict-gated independent Code review
27
28
  +-- Scoped test gate and browser attempt
28
29
  +-- Retrospective & commit (orchestrator)
29
30
  ```
@@ -32,16 +33,20 @@ dev-pipeline (outer loop)
32
33
 
33
34
  | Skill | Reference | Purpose |
34
35
  |---|---|---|
36
+ | `/prizmkit-plan` | skill-local `references/independent-plan-review.md` | Optional bounded Plan correctness review with strict capability gating and native continuation |
35
37
  | `/prizmkit-implement` | skill-local `references/implementation-subagent-procedure.md` | Optional narrow implementation delegation contract |
36
- | `/prizmkit-code-review` | skill-local `references/review-report-template.md` | Main-Agent review progress and terminal-result contract |
38
+ | `/prizmkit-code-review` | skill-local `references/independent-code-review.md` | Optional bounded implementation correctness review with strict capability gating and native continuation |
39
+ | `/prizmkit-code-review` | skill-local `references/review-report-template.md` | Main-Agent and independent-review progress plus terminal-result contract |
37
40
 
38
- The orchestrator role is handled by the Main Agent directly. Code review does not install or invoke a separate platform agent definition.
41
+ The Main Agent remains the stage owner. No platform adapter installs a named Reviewer definition or maps platform-specific tools into the protocol. Each skill carries its own complete reference.
39
42
 
40
43
  ## Active Checkout Contract
41
44
 
42
45
  Any optional implementation subagent must run in the expected active git top-level. Its prompt contract forbids git worktrees, tool-created worktree isolation, copied repository checkouts, remote isolated checkouts, branch switching, and operating outside the expected active checkout.
43
46
 
44
- Code review always runs in the Main Agent's current workspace so staged, unstaged, and untracked content remains authoritative.
47
+ The Main Agent captures bounded immutable review input from the active checkout after its mandatory review converges. This input includes the exact current Plan artifacts or the complete current implementation change plus only implicated supporting paths. The Reviewer does not discover workspace state by running Git commands and never creates a skill-level worktree.
48
+
49
+ Independent review runs only when the host can structurally provide read-only access, no mutation, no arbitrary command execution, no downstream execution, and native resume of the same execution unit. If any capability is unavailable or unproven, the stage records strict downgrade and creates no weak substitute. A fresh Reviewer plus a summary is never continuation.
45
50
 
46
51
  Pipeline runner-owned linked worktrees are an outer runtime option. They do not authorize a skill-level execution unit to create or enter another worktree.
47
52
 
@@ -17,9 +17,8 @@ PIPELINE_METADATA_EXCLUDES = (
17
17
  ":(top,exclude,glob).*/worktree/**",
18
18
  ":(top,exclude,glob).*/worktrees",
19
19
  ":(top,exclude,glob).*/worktrees/**",
20
- ":(top,exclude).prizmkit/state",
21
- ":(top,exclude,glob).prizmkit/state/**",
22
- ":(top,exclude).prizmkit/manifest.json",
20
+ ":(top,exclude).prizmkit",
21
+ ":(top,exclude,glob).prizmkit/**",
23
22
  )
24
23
 
25
24
  HIDDEN_TOOL_WORKTREE_EXCLUDES = (
@@ -34,12 +33,6 @@ HIDDEN_TOOL_WORKTREE_EXCLUDES = (
34
33
  ":(top,exclude,glob).codex/**",
35
34
  ":(top,exclude).agents",
36
35
  ":(top,exclude,glob).agents/**",
37
- ":(top,exclude).prizmkit/prizm-docs",
38
- ":(top,exclude,glob).prizmkit/prizm-docs/**",
39
- ":(top,exclude).prizmkit/config.json",
40
- ":(top,exclude).prizmkit/manifest.json",
41
- ":(top,exclude).prizmkit/dev-pipeline",
42
- ":(top,exclude,glob).prizmkit/dev-pipeline/**",
43
36
  )
44
37
 
45
38
  UNTRACKED_TRANSIENT_EXCLUDES = (
@@ -6,8 +6,10 @@ import os
6
6
  import signal
7
7
  import subprocess
8
8
  import sys
9
+ import threading
9
10
  import time
10
- from collections.abc import Mapping, Sequence
11
+ from collections.abc import Iterator, Mapping, Sequence
12
+ from contextlib import contextmanager
11
13
  from dataclasses import dataclass, field
12
14
  from pathlib import Path
13
15
 
@@ -62,6 +64,24 @@ class ProcessRunResult:
62
64
  termination: ProcessTerminationResult | None = None
63
65
 
64
66
 
67
+ @contextmanager
68
+ def shield_interruption_signals() -> Iterator[None]:
69
+ """Ignore repeated interruption signals while fail-closed cleanup runs."""
70
+ if threading.current_thread() is not threading.main_thread():
71
+ yield
72
+ return
73
+
74
+ previous_handlers: dict[int, object] = {}
75
+ try:
76
+ for signal_number in (signal.SIGINT, signal.SIGTERM):
77
+ previous_handlers[signal_number] = signal.getsignal(signal_number)
78
+ signal.signal(signal_number, signal.SIG_IGN)
79
+ yield
80
+ finally:
81
+ for signal_number, handler in previous_handlers.items():
82
+ signal.signal(signal_number, handler)
83
+
84
+
65
85
  def _creationflags_for_platform(start_new_process_group: bool) -> int:
66
86
  if os.name != "nt" or not start_new_process_group:
67
87
  return 0
@@ -3,9 +3,12 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import json
6
+ import signal
6
7
  import sys
8
+ import threading
7
9
  import time
8
- from collections.abc import Mapping
10
+ from collections.abc import Iterator, Mapping
11
+ from contextlib import contextmanager
9
12
  from pathlib import Path
10
13
 
11
14
  from .commands import CommandResult # type: ignore # imported only at runtime by commands.py
@@ -27,6 +30,7 @@ from .gitops import (
27
30
  worktree_runtime_context,
28
31
  worktree_save_wip,
29
32
  )
33
+ from .processes import shield_interruption_signals
30
34
  from .runner_bookkeeping import (
31
35
  commit_final_bookkeeping,
32
36
  commit_pre_branch_bookkeeping,
@@ -51,6 +55,26 @@ from .task_checkout import (
51
55
  )
52
56
 
53
57
 
58
+ def _interrupt_from_sigterm(_signal_number, _frame) -> None:
59
+ """Translate daemon SIGTERM into the existing fail-closed interrupt path."""
60
+ raise KeyboardInterrupt
61
+
62
+
63
+ @contextmanager
64
+ def _bridge_sigterm_to_interrupt() -> Iterator[None]:
65
+ """Install a scoped SIGTERM bridge when running on the main thread."""
66
+ if threading.current_thread() is not threading.main_thread():
67
+ yield
68
+ return
69
+
70
+ previous_handler = signal.getsignal(signal.SIGTERM)
71
+ try:
72
+ signal.signal(signal.SIGTERM, _interrupt_from_sigterm)
73
+ yield
74
+ finally:
75
+ signal.signal(signal.SIGTERM, previous_handler)
76
+
77
+
54
78
  def run_pipeline_command(kind: str, action: str, legacy_args: tuple[str, ...], paths) -> CommandResult:
55
79
  """Dispatch a feature/bugfix/refactor Python foreground command."""
56
80
  family = family_for(kind, paths)
@@ -89,7 +113,8 @@ def run_pipeline_command(kind: str, action: str, legacy_args: tuple[str, ...], p
89
113
  if not invocation.list_path.is_file():
90
114
  return CommandResult(1, f"Python {kind} runner", f"Plan list not found: {invocation.list_path}")
91
115
  try:
92
- result = _run_pipeline(family, invocation, paths)
116
+ with _bridge_sigterm_to_interrupt():
117
+ result = _run_pipeline(family, invocation, paths)
93
118
  except Exception as exc: # keep CLI boundary traceback-free
94
119
  return CommandResult(1, f"Python {kind} runner failed", str(exc))
95
120
  details = result.details + ((f"last_status: {result.last_status}",) if result.last_status else ())
@@ -121,7 +146,8 @@ def _run_pipeline(family: RunnerFamily, invocation: RunnerInvocation, paths) ->
121
146
  try:
122
147
  status = _process_item(family, invocation, invocation.item_id, paths, initial_metadata={})
123
148
  except KeyboardInterrupt:
124
- return PipelineRunResult(False, 1, "interrupted", "interrupted")
149
+ with shield_interruption_signals():
150
+ return PipelineRunResult(False, 1, "interrupted", "interrupted")
125
151
  return PipelineRunResult(status == "completed", 1, "single_item_done", status)
126
152
 
127
153
  while True:
@@ -157,15 +183,16 @@ def _run_pipeline(family: RunnerFamily, invocation: RunnerInvocation, paths) ->
157
183
  try:
158
184
  final_status = _process_item(family, invocation, item_id, paths, initial_metadata=next_result.data)
159
185
  except KeyboardInterrupt:
160
- processed += 1
161
- item_statuses[item_id] = "interrupted"
162
- return PipelineRunResult(
163
- False,
164
- processed,
165
- "interrupted",
166
- "interrupted",
167
- _render_item_statuses(item_statuses),
168
- )
186
+ with shield_interruption_signals():
187
+ processed += 1
188
+ item_statuses[item_id] = "interrupted"
189
+ return PipelineRunResult(
190
+ False,
191
+ processed,
192
+ "interrupted",
193
+ "interrupted",
194
+ _render_item_statuses(item_statuses),
195
+ )
169
196
  processed += 1
170
197
  item_statuses[item_id] = final_status
171
198
  if final_status in _completion_compatible_statuses(family):
@@ -768,14 +795,74 @@ def _process_item_locked(
768
795
  classification_fatal_error_code=classification.fatal_error_code,
769
796
  )
770
797
  except KeyboardInterrupt:
771
- _emit_warning(f"Interrupted while processing {item_id}; preserving work and returning to {base_branch}")
772
- if use_worktree and worktree_runtime is not None:
773
- worktree_save_wip(worktree_runtime)
774
- else:
775
- branch_ensure_return(paths.project_root, base_branch, branch_name)
798
+ with shield_interruption_signals():
799
+ _cleanup_interrupted_task(
800
+ item_id=item_id,
801
+ paths=paths,
802
+ base_branch=base_branch,
803
+ branch_name=branch_name,
804
+ use_worktree=use_worktree,
805
+ worktree_runtime=worktree_runtime,
806
+ )
776
807
  raise
777
808
 
778
809
 
810
+ def _cleanup_interrupted_task(
811
+ *,
812
+ item_id: str,
813
+ paths,
814
+ base_branch: str,
815
+ branch_name: str,
816
+ use_worktree: bool,
817
+ worktree_runtime,
818
+ ) -> None:
819
+ """Preserve interrupted task work and report the verified checkout state."""
820
+ _emit_warning(f"Interrupted while processing {item_id}; preserving work safely")
821
+ if use_worktree and worktree_runtime is not None:
822
+ preserved = worktree_save_wip(worktree_runtime)
823
+ if getattr(preserved, "ok", True):
824
+ _emit_warning(
825
+ f"Interrupted task {item_id}: work preserved in {worktree_runtime.worktree_path}; "
826
+ "task worktree remains active"
827
+ )
828
+ return
829
+ _emit_interruption_cleanup_failure(
830
+ preserved,
831
+ f"Could not preserve interrupted work for {item_id}; leaving task worktree active",
832
+ f"Inspect the task worktree: {worktree_runtime.worktree_path}",
833
+ )
834
+ return
835
+
836
+ returned = branch_ensure_return(paths.project_root, base_branch, branch_name)
837
+ if getattr(returned, "ok", True) and current_branch(paths.project_root) == base_branch:
838
+ _emit_warning(f"Interrupted task {item_id}: work preserved and returned to {base_branch}")
839
+ return
840
+ _emit_interruption_cleanup_failure(
841
+ returned,
842
+ f"Could not safely return to {base_branch}; leaving {branch_name} active",
843
+ f"After resolving the Git blocker, run: git checkout {base_branch}",
844
+ )
845
+
846
+
847
+ def _emit_interruption_cleanup_failure(result, message: str, recovery: str) -> None:
848
+ """Emit a concise failed Git step and a non-destructive recovery action."""
849
+ _emit_warning(message)
850
+ commands = tuple(getattr(getattr(result, "plan", None), "commands", ()))
851
+ results = tuple(getattr(result, "results", ()))
852
+ for index, command_result in enumerate(results):
853
+ if getattr(command_result, "return_code", 0) == 0:
854
+ continue
855
+ command = commands[index] if index < len(commands) else None
856
+ if command is not None and getattr(command, "allow_failure", False):
857
+ continue
858
+ args = " ".join(map(str, getattr(command_result, "args", ())))
859
+ detail = str(getattr(command_result, "stderr", "") or getattr(command_result, "stdout", "")).strip()
860
+ suffix = f": {detail.splitlines()[0][:500]}" if detail else ""
861
+ _emit_warning(f"git {args} failed{suffix}")
862
+ break
863
+ _emit_warning(recovery)
864
+
865
+
779
866
  def _is_retryable_ai_outcome(session_status: str, new_status: str) -> bool:
780
867
  """Return whether a persisted post-launch outcome should continue in-process."""
781
868
  if session_status in {"success", "stalled_context_continuation", "workflow_blocked"}:
@@ -20,7 +20,7 @@ from pathlib import Path
20
20
  from .checkpoint_state import load_checkpoint_state
21
21
  from .heartbeat import HeartbeatConfig, HeartbeatMonitor, HeartbeatState, observe_heartbeat_state, write_stale_marker
22
22
  from .launch_profiles import HeadlessLaunchProfile
23
- from .processes import ProcessHandle, ProcessSpec, launch_process, terminate_process_tree
23
+ from .processes import ProcessHandle, ProcessSpec, launch_process, shield_interruption_signals, terminate_process_tree
24
24
  from .status import ProgressSummary
25
25
 
26
26
 
@@ -868,7 +868,8 @@ class AISessionLauncher:
868
868
  )
869
869
  last_progress_emit = now
870
870
  except KeyboardInterrupt:
871
- terminate_process_tree(handle, "interrupted", grace_seconds=self.config.stale_kill_grace_seconds)
871
+ with shield_interruption_signals():
872
+ terminate_process_tree(handle, "interrupted", grace_seconds=self.config.stale_kill_grace_seconds)
872
873
  raise
873
874
  if self.config.live_output and (not self.config.verbose or self.config.suppress_stream_output):
874
875
  final_heartbeat_state = _display_heartbeat_state(
@@ -681,7 +681,7 @@ SECTION_TO_SKILL = {
681
681
  "prizmkit-plan", "Plan & Tasks",
682
682
  [".prizmkit/specs/{slug}/plan.md"],
683
683
  ),
684
- "phase-implement": checkpoint_step("prizmkit-implement", "Implement + Test", []),
684
+ "phase-implement": checkpoint_step("prizmkit-implement", "Implement", []),
685
685
  "phase-prizmkit-test": checkpoint_step(
686
686
  "prizmkit-test", "Scoped Feature Test Gate",
687
687
  [".prizmkit/specs/{slug}/test-report-path.txt",
@@ -1619,10 +1619,10 @@ def _tier_header(pipeline_mode):
1619
1619
  "# Dev-Pipeline Session Bootstrap — Tier 3 "
1620
1620
  "(Main-Agent Full Guardrails)\n",
1621
1621
  "**Tier 3 — Main-Agent Full Guardrails**: For complex "
1622
- "features, the main orchestrator handles context, planning, "
1623
- "implementation, and Code Review directly. No top-level Dev "
1624
- "implementation subagent is spawned, and Code Review never uses "
1625
- "direct or indirect delegation.\n",
1622
+ "features, the main orchestrator handles context, planning, and "
1623
+ "implementation directly, then runs mandatory Main-Agent review. "
1624
+ "After convergence, the review skill may use only its strict-gated "
1625
+ "skill-owned independent Reviewer.\n",
1626
1626
  ),
1627
1627
  }
1628
1628
  return headers.get(pipeline_mode, headers["lite"])
@@ -1658,8 +1658,8 @@ def _tier_reminders(pipeline_mode):
1658
1658
  "Code Review writes only review-report.md",
1659
1659
  "- Gate checks require the Implementation Log (with Gate Evidence) "
1660
1660
  "and a valid review-report.md Final Result before proceeding",
1661
- "- Code Review runs only in the current Main Agent and never uses "
1662
- "direct or indirect delegation",
1661
+ "- Code Review keeps mandatory Main-Agent ownership; after convergence "
1662
+ "it may use only its strict-gated skill-owned independent Reviewer",
1663
1663
  "- On timeout outside Code Review: check snapshot + git diff HEAD "
1664
1664
  "→ model:lite → remaining steps only → max 2 retries per phase → "
1665
1665
  "Main Agent fallback",
@@ -1667,13 +1667,13 @@ def _tier_reminders(pipeline_mode):
1667
1667
  else: # full
1668
1668
  specific = [
1669
1669
  "- Tier 3: full orchestration — the Main Agent implements directly "
1670
- "and owns the complete Code Review loop",
1670
+ "and owns the mandatory Code Review loop",
1671
1671
  "- context-snapshot.md is the implementation knowledge base; "
1672
1672
  "Code Review writes only review-report.md",
1673
1673
  "- Gate checks require the Implementation Log and a valid "
1674
1674
  "review-report.md Final Result before proceeding",
1675
- "- Code Review is excluded from normal work delegation and never "
1676
- "uses direct or indirect delegation or another review entry point",
1675
+ "- Code Review excludes ordinary work delegation and permits only "
1676
+ "the skill-owned independent Reviewer under its strict structural gate",
1677
1677
  "- Do NOT use `run_in_background=true` when spawning normal work "
1678
1678
  "agents outside Code Review",
1679
1679
  "- If a normal work Agent call fails with team/config/lock errors, "
@@ -1865,11 +1865,13 @@ def assemble_sections(pipeline_mode, sections_dir, init_done, is_resume,
1865
1865
  load_section(sections_dir,
1866
1866
  browser_section_file)))
1867
1867
 
1868
+ # --- Headless commit authorization ---
1869
+ sections.append(("headless-commit-authorization",
1870
+ load_section(sections_dir, "headless-commit-authorization.md")))
1871
+
1868
1872
  # --- Commit (tier-dependent) ---
1869
1873
  if pipeline_mode == "full":
1870
- sections.append(("phase-commit",
1871
- load_section(sections_dir,
1872
- "phase-commit-full.md")))
1874
+ sections.append(("phase-commit", load_section(sections_dir, "phase-commit-full.md")))
1873
1875
  else:
1874
1876
  sections.append(("phase-commit",
1875
1877
  load_section(sections_dir,
@@ -300,12 +300,9 @@ def build_replacements(args, bug, global_context, script_dir):
300
300
  dev_url = "http://localhost:{}".format(dev_port) if dev_port.isdigit() else "<UNKNOWN_DETECT_FROM_PROJECT_CONFIG>"
301
301
 
302
302
  pipeline_mode = determine_bugfix_mode(args, bug)
303
- recovery_like = is_recovery_like(args)
304
303
  manual_or_hybrid = verification_type in ("manual", "hybrid")
305
304
  manual_policy = (
306
- "Recovery-class session: automated verification may substitute for manual/hybrid UAT when evidence is documented."
307
- if manual_or_hybrid and recovery_like
308
- else "Fresh manual/hybrid bugfix: stop as partial before commit after automated checks; manual UAT is required."
305
+ "Manual/hybrid verification is executed automatically in headless mode: use available browser, CLI, API, fixture, and test evidence; document the verification evidence and proceed through review, test, retrospective, and commit."
309
306
  if manual_or_hybrid
310
307
  else "Automated verification: complete tests/review and proceed to commit when gates pass."
311
308
  )
@@ -390,7 +387,7 @@ def _bugfix_header(pipeline_mode):
390
387
  title = "# Dev-Pipeline Bug Fix Session Bootstrap — {}\n".format(pipeline_mode.title())
391
388
  desc = {
392
389
  "lite": "**Tier 1 — Single Agent**: direct root-cause fix by the main orchestrator.",
393
- "standard": "**Tier 2 — Main-Agent Review Gates**: direct implementation with Main-Agent-only review gates.",
390
+ "standard": "**Tier 2 — Main-Agent Review Gates**: direct implementation with mandatory Main-Agent review and optional strict capability-gated independent correctness review.",
394
391
  "full": "**Tier 3 — Full Bugfix Guardrails**: direct implementation with stronger diagnosis and review gates.",
395
392
  }.get(pipeline_mode, "**Bugfix pipeline**")
396
393
  return title + "\n" + desc + "\n"
@@ -422,13 +419,6 @@ def assemble_bugfix_sections(pipeline_mode, sections_dir, browser_enabled, manua
422
419
  sections.append(("phase-browser", load_section(sections_dir, browser_section_file)))
423
420
  if manual_gate:
424
421
  sections.append(("bugfix-manual-gate", load_section(sections_dir, "bugfix-phase-manual-verification.md")))
425
- sections.extend([
426
- ("bugfix-session-status", load_section(sections_dir, "bugfix-session-status.md")),
427
- ("bugfix-critical-paths", load_section(sections_dir, "bugfix-critical-paths.md")),
428
- ("failure-capture", load_section(sections_dir, "failure-capture.md")),
429
- ("bugfix-reminders", load_section(sections_dir, "bugfix-reminders.md")),
430
- ])
431
- return sections
432
422
  sections.extend([
433
423
  ("headless-commit-authorization", load_section(sections_dir, "headless-commit-authorization.md")),
434
424
  ("bugfix-phase-commit-report", load_section(sections_dir, "bugfix-phase-commit-report.md")),
@@ -500,7 +490,7 @@ def main():
500
490
  replacements = build_replacements(args, bug, global_context, script_dir)
501
491
  pipeline_mode = replacements["{{PIPELINE_MODE}}"]
502
492
  browser_enabled = replacements["{{BROWSER_ENABLED}}"] == "true"
503
- manual_gate = bug.get("verification_type", "automated") in ("manual", "hybrid") and not is_recovery_like(args)
493
+ manual_gate = bug.get("verification_type", "automated") in ("manual", "hybrid")
504
494
 
505
495
  use_sections = os.path.isdir(sections_dir) and not args.template
506
496
  sections = []
@@ -97,10 +97,11 @@ 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. The current Main Agent is the only Code Review executor. It reviews the complete current change for up to ten rounds, directly repairs accepted findings, and verifies repairs.
101
- 3. Converge only when accepted and unresolved findings are both zero; missing required evidence or round-ten non-convergence produces NEEDS_FIXES.
102
- 4. Do not delegate review directly or indirectly. Do not invoke another review skill or review workflow. Do not relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
103
- 5. `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. 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.""",
104
105
  ),
105
106
  6: (
106
107
  "User Verification",
@@ -411,7 +411,7 @@ def _refactor_header(pipeline_mode):
411
411
  title = "# Dev-Pipeline Refactor Session Bootstrap — {}\n".format(pipeline_mode.title())
412
412
  desc = {
413
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 Main-Agent-only review gates.",
414
+ "standard": "**Tier 2 — Main-Agent Review Gates**: direct refactor with mandatory Main-Agent review and optional strict capability-gated independent correctness review.",
415
415
  "full": "**Tier 3 — Full Refactor Guardrails**: direct refactor with stronger behavior-preservation evidence.",
416
416
  }.get(pipeline_mode, "**Refactor pipeline**")
417
417
  return title + "\n" + desc + "\n"
@@ -30,21 +30,21 @@ 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}}/`. The current Main Agent is the only Code Review executor. It reviews the complete current change for up to ten internal rounds, directly repairs accepted findings, and requires 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 delegate review or use another review entry point.
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.
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
 
37
37
  6. **Retrospective**: Run `/prizmkit-retrospective` to sync `.prizmkit/prizm-docs/` with code changes.
38
38
 
39
- 7. **Commit**: Run `/prizmkit-committer` to commit all changes. Do NOT push.
39
+ 7. **Commit**: Run `/prizmkit-committer` to commit all changes.
40
40
 
41
41
  ### Critical Rules
42
42
 
43
43
  - Do NOT ask for user input — decide autonomously.
44
- - Do NOT push to remote the user will push manually.
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 Code Review must rely on context-snapshot.md rather than re-reading files the Main Agent already read. Code Review runs only in the current Main Agent.
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.
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.
@@ -10,12 +10,12 @@
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 Code Review must finish before exit (`run_in_background=false`). Code Review never uses direct or indirect delegation.
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`).
14
14
 
15
- **Tier 3 — Main-Agent Full Guardrails**: For complex features, the Main Agent handles context, planning, implementation, and Code Review directly. Do not spawn a top-level Dev implementation subagent. Code Review runs through `/prizmkit-code-review` without direct or indirect delegation.
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.
16
16
 
17
- **Agent spawn failure policy (all Agent tool calls)**:
18
- - Code Review must not invoke another review skill/workflow or relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
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
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
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
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.
@@ -52,7 +52,7 @@ 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-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.
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. **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 Code Review must receive context-snapshot.md and rely on it rather than independently re-reading files the Main Agent already read. Code Review runs only in the current Main Agent.
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.
56
56
  4. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
57
57
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
58
58
  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.
@@ -237,7 +237,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
237
237
 
238
238
  ### Review — Code Review
239
239
 
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; never delegate review directly or indirectly. The current Main Agent is the only Code Review executor. Do not invoke another review skill or review workflow, and do not relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
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.
241
241
 
242
242
  - `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
243
  - `REVIEW_NEEDS_FIXES` → increment the shared outer `repair_round` and route `prizmkit-implement` → `prizmkit-code-review` → `prizmkit-test`.
@@ -462,7 +462,7 @@ git add .prizmkit/prizm-docs/
462
462
 
463
463
  **6d.** Run `/prizmkit-committer` → THE ONLY commit for this feature:
464
464
  `feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`
465
- This single commit includes: feature code + tests + .prizmkit/prizm-docs/ updates. Do NOT push.
465
+ This single commit includes: feature code + tests + .prizmkit/prizm-docs/ updates.
466
466
  - MANDATORY: commit must be done via `/prizmkit-committer` skill. Do NOT run manual `git add`/`git commit` as a substitute.
467
467
  - Do NOT run `update-feature-status.py` here — the pipeline runner handles feature-list.json updates automatically after session exit.
468
468
 
@@ -524,10 +524,10 @@ If you encounter an unrecoverable error, context overflow, or are about to exit
524
524
 
525
525
  ## Reminders
526
526
 
527
- - Tier 3: orchestrator implements directly; `/prizmkit-code-review` handles review later
527
+ - Tier 3: orchestrator implements directly; `/prizmkit-code-review` runs mandatory Main-Agent review and optional strict-gated skill-owned independent review
528
528
  - context-snapshot.md contains Main-Agent implementation context; Code Review writes only review-report.md
529
529
  - Gate checks require the Implementation Log and a valid review-report.md Final Result before proceeding
530
- - Code Review never uses direct or indirect delegation; normal work delegation outside review must not use `run_in_background=true`
530
+ - Review execution outside the skill contract is forbidden; normal work delegation must not use `run_in_background=true`
531
531
  - Commit phase must use `/prizmkit-committer`; do NOT replace with manual git commit commands
532
532
  - **NEVER delete, modify, or touch any file under `.prizmkit/state/`** — those are pipeline runtime files managed by the runner
533
533
  - NEVER run `rm -rf`, `git clean`, or any destructive filesystem operations
@@ -11,7 +11,7 @@
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, unless a fresh manual/hybrid verification gate requires stopping as `partial` before commit.
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.
15
15
 
16
16
  **SUBAGENT LIFECYCLE**: Any normal work subagent must be awaited with `run_in_background=false`. Do not spawn persistent background subagents for headless recovery.
17
17
 
@@ -214,10 +214,7 @@ Read the current structured `manifest.json`, `verdict.json`, and `validation.jso
214
214
  Only validated `TEST_PASS` may proceed to commit.
215
215
 
216
216
  {{IF_VERIFICATION_MANUAL_OR_HYBRID}}
217
- **MANUAL VERIFICATION GATE**:
218
- - Fresh manual/hybrid bugfix sessions stop after automated review and before commit.
219
- - Write session-status.json with status="partial", resume_from_phase=4, and STOP — manual UAT is required before commit.
220
- - Recovery/retry/continuation sessions may substitute automated verification for manual/hybrid UAT only when evidence is documented in fix-report.md and session-status.json.
217
+ **MANUAL/HYBRID AUTOMATION**: This L4 session is always headless. Execute manual/hybrid verification with available deterministic browser, CLI/API, fixture, or test tooling. Document the method and evidence, then continue through `/prizmkit-retrospective` and `/prizmkit-committer`; never ask for UAT, wait for a user, or stop as `partial`.
221
218
  - Do not write `verifying` to the external bug-list status field; fine-grained verification is session/checkpoint metadata, while the external list status remains one of `pending`, `in_progress`, `completed`, `failed`, `skipped`, or `needs_info`.
222
219
  {{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}
223
220
 
@@ -227,7 +224,7 @@ Only validated `TEST_PASS` may proceed to commit.
227
224
 
228
225
  ### Headless Commit Authorization
229
226
 
230
- This pipeline launch authorizes one local task commit only after review and authoritative test evidence pass. Never ask a question, wait for input, or request confirmation. Invoke `/prizmkit-committer` with `mode=l4-headless`, `owner=prizmkit-l4`, `local_commit_authorized=true`, and `push_authorized=false`. Never push.
227
+ This pipeline launch authorizes one local task commit only after review and authoritative test evidence pass. Never ask a question, wait for input, or request confirmation. Invoke `/prizmkit-committer` with `mode=l4-headless`, `owner=prizmkit-l4`, and `local_commit_authorized=true`. The runtime controls any optional remote publication after the local commit; do not make a publication decision in this session.
231
228
 
232
229
  **Bug Fix Documentation Policy**:
233
230
  - **DEFAULT**: Run `/prizmkit-retrospective` with structural sync only (Job 1). Skip knowledge injection.
@@ -250,7 +247,7 @@ git add .prizmkit/prizm-docs/
250
247
  **d.** Run `/prizmkit-committer`:
251
248
  - Commit message prefix: `fix({{FIX_SCOPE}}): {{BUG_TITLE}}`
252
249
  - Include both fix code and reproduction test
253
- - Do NOT push
250
+ - The runtime controls any optional remote publication after the local commit; do not make a publication decision in this session
254
251
 
255
252
  **e.** Final verification:
256
253
  ```bash