phase-loop-runtime 0.2.0__py3-none-any.whl

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 (370) hide show
  1. phase_loop_runtime/__init__.py +20 -0
  2. phase_loop_runtime/_contract_docs/phase-loop/extraction-readiness.md +90 -0
  3. phase_loop_runtime/_contract_docs/phase-loop/granular-execution-policy.md +137 -0
  4. phase_loop_runtime/_contract_docs/phase-loop/harness-capability-matrix.md +510 -0
  5. phase_loop_runtime/_contract_docs/phase-loop/harness-skill-matrix.md +125 -0
  6. phase_loop_runtime/_contract_docs/phase-loop/harness-substrate-manifest.md +232 -0
  7. phase_loop_runtime/_contract_docs/phase-loop/pi-loop-control.md +247 -0
  8. phase_loop_runtime/_contract_docs/phase-loop/protocol.md +2759 -0
  9. phase_loop_runtime/_contract_docs/phase-loop/runtime-boundary.md +289 -0
  10. phase_loop_runtime/_contract_docs/phase-loop/spec-discovery-roots.md +47 -0
  11. phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-governed-pipeline.md +42 -0
  12. phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-portal-projection.md +34 -0
  13. phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-regenesis.md +29 -0
  14. phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-report.md +32 -0
  15. phase_loop_runtime/_contract_docs/runtime/verification-evidence-contract.md +52 -0
  16. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/commands.txt +2 -0
  17. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/manifest.json +16 -0
  18. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/mixed.json +5 -0
  19. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/manifest.json +16 -0
  20. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/timeout-note.txt +2 -0
  21. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/manifest.json +16 -0
  22. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/redacted-summary.json +6 -0
  23. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/manifest.json +16 -0
  24. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/sample.json +7 -0
  25. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/edge.txt +2 -0
  26. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/manifest.json +16 -0
  27. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/manifest.json +16 -0
  28. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-a.txt +1 -0
  29. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-b.txt +1 -0
  30. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-c.txt +1 -0
  31. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/claimed-results.json +5 -0
  32. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/manifest.json +16 -0
  33. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/manifest.json +16 -0
  34. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/metrics.json +9 -0
  35. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/findings.md +10 -0
  36. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/manifest.json +16 -0
  37. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/manifest.json +16 -0
  38. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/scores.json +4 -0
  39. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/summary.txt +1 -0
  40. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/bundle-check.json +8 -0
  41. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/manifest.json +16 -0
  42. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/operator-note.txt +2 -0
  43. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/events-sample.jsonl +3 -0
  44. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/manifest.json +16 -0
  45. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/receipt.txt +1 -0
  46. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/evidence.json +13 -0
  47. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/manifest.json +16 -0
  48. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/summary.txt +2 -0
  49. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/manifest.json +16 -0
  50. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/matrix.json +9 -0
  51. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/notes.md +4 -0
  52. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/console-summary.txt +2 -0
  53. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/manifest.json +16 -0
  54. phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/screenshot-standin.ppm +5 -0
  55. phase_loop_runtime/adoption_bundle.py +273 -0
  56. phase_loop_runtime/advisor_board/CONTRACTS.md +257 -0
  57. phase_loop_runtime/advisor_board/__init__.py +288 -0
  58. phase_loop_runtime/advisor_board/backing.py +137 -0
  59. phase_loop_runtime/advisor_board/backing_omnigent.py +498 -0
  60. phase_loop_runtime/advisor_board/config.py +225 -0
  61. phase_loop_runtime/advisor_board/events.py +115 -0
  62. phase_loop_runtime/advisor_board/fixtures/advisor-boards.example.toml +59 -0
  63. phase_loop_runtime/advisor_board/fixtures.py +91 -0
  64. phase_loop_runtime/advisor_board/harness_mapping.py +125 -0
  65. phase_loop_runtime/advisor_board/matrix.py +146 -0
  66. phase_loop_runtime/advisor_board/observability.py +481 -0
  67. phase_loop_runtime/advisor_board/presets.py +188 -0
  68. phase_loop_runtime/advisor_board/registries.py +309 -0
  69. phase_loop_runtime/advisor_board/resolver.py +253 -0
  70. phase_loop_runtime/advisor_board/schema.py +269 -0
  71. phase_loop_runtime/advisor_board/standin.py +166 -0
  72. phase_loop_runtime/advisor_board/validation.py +159 -0
  73. phase_loop_runtime/agent_runtime_provider.py +676 -0
  74. phase_loop_runtime/baml_modular.py +656 -0
  75. phase_loop_runtime/baml_src/dotfiles_adoption_manifest.baml +37 -0
  76. phase_loop_runtime/baml_src/dotfiles_c4_document.baml +14 -0
  77. phase_loop_runtime/baml_src/dotfiles_plan_manifest.baml +50 -0
  78. phase_loop_runtime/baml_src/dotfiles_runtime_projection.baml +16 -0
  79. phase_loop_runtime/baml_src/dotfiles_task_catalog.baml +20 -0
  80. phase_loop_runtime/baml_src/emit_phase_closeout.baml +86 -0
  81. phase_loop_runtime/baml_src/evaluate_suspected_fake_evidence.baml +36 -0
  82. phase_loop_runtime/baml_src/verification_evidence.baml +40 -0
  83. phase_loop_runtime/broker.py +181 -0
  84. phase_loop_runtime/build_bundle.py +294 -0
  85. phase_loop_runtime/capability_registry.py +835 -0
  86. phase_loop_runtime/classifier.py +87 -0
  87. phase_loop_runtime/claude_agent_view.py +625 -0
  88. phase_loop_runtime/claude_channel_sidecar.py +1086 -0
  89. phase_loop_runtime/cli.py +2599 -0
  90. phase_loop_runtime/closeout.py +865 -0
  91. phase_loop_runtime/closeout_classifier.py +120 -0
  92. phase_loop_runtime/closeout_evidence_audit.py +112 -0
  93. phase_loop_runtime/closeout_validation.py +144 -0
  94. phase_loop_runtime/closeout_validators.py +203 -0
  95. phase_loop_runtime/consiliency_gates.py +374 -0
  96. phase_loop_runtime/consiliency_ingest.py +399 -0
  97. phase_loop_runtime/consiliency_layout.py +176 -0
  98. phase_loop_runtime/consiliency_scaffold.py +305 -0
  99. phase_loop_runtime/cross_repo_channel.py +331 -0
  100. phase_loop_runtime/discovery.py +2368 -0
  101. phase_loop_runtime/dispatch_lock.py +167 -0
  102. phase_loop_runtime/doc_delta_validator.py +98 -0
  103. phase_loop_runtime/docs_audit.py +285 -0
  104. phase_loop_runtime/docs_freshness.py +468 -0
  105. phase_loop_runtime/docs_surfaces.py +150 -0
  106. phase_loop_runtime/dotfiles_profile_plugin.py +96 -0
  107. phase_loop_runtime/events.py +154 -0
  108. phase_loop_runtime/events_migration.py +96 -0
  109. phase_loop_runtime/evidence_audit.py +1082 -0
  110. phase_loop_runtime/evidence_audit_config.py +172 -0
  111. phase_loop_runtime/fleet_map.py +426 -0
  112. phase_loop_runtime/fleet_metrics.py +298 -0
  113. phase_loop_runtime/fleet_metrics_export.py +196 -0
  114. phase_loop_runtime/git_discipline.py +479 -0
  115. phase_loop_runtime/git_ops.py +122 -0
  116. phase_loop_runtime/git_topology.py +252 -0
  117. phase_loop_runtime/governed_bundle.py +137 -0
  118. phase_loop_runtime/governed_premerge.py +219 -0
  119. phase_loop_runtime/governed_review.py +264 -0
  120. phase_loop_runtime/handoff.py +932 -0
  121. phase_loop_runtime/handoff_path.py +14 -0
  122. phase_loop_runtime/injection.py +740 -0
  123. phase_loop_runtime/install_status.py +88 -0
  124. phase_loop_runtime/lane_scheduler.py +317 -0
  125. phase_loop_runtime/launcher.py +2760 -0
  126. phase_loop_runtime/lease_store.py +553 -0
  127. phase_loop_runtime/maintenance.py +401 -0
  128. phase_loop_runtime/migrate_handoffs.py +201 -0
  129. phase_loop_runtime/models.py +2144 -0
  130. phase_loop_runtime/observability.py +1290 -0
  131. phase_loop_runtime/panel_invoker.py +1638 -0
  132. phase_loop_runtime/phase_loop_drift_audit.py +388 -0
  133. phase_loop_runtime/phase_worktree_executor.py +433 -0
  134. phase_loop_runtime/pipeline_adapter/__init__.py +12 -0
  135. phase_loop_runtime/pipeline_adapter/branch_ops.py +274 -0
  136. phase_loop_runtime/pipeline_adapter/flag.py +55 -0
  137. phase_loop_runtime/pipeline_adapter/markers.py +13 -0
  138. phase_loop_runtime/pipeline_adapter/merge_policy.py +72 -0
  139. phase_loop_runtime/pipeline_adapter/ratification.py +100 -0
  140. phase_loop_runtime/pipeline_adapter/sibling_matcher.py +123 -0
  141. phase_loop_runtime/plan_ir.py +523 -0
  142. phase_loop_runtime/plan_manifest.py +415 -0
  143. phase_loop_runtime/planner_validation.py +176 -0
  144. phase_loop_runtime/profiles.py +462 -0
  145. phase_loop_runtime/prompts.py +365 -0
  146. phase_loop_runtime/provenance.py +165 -0
  147. phase_loop_runtime/publishing.py +339 -0
  148. phase_loop_runtime/py.typed +1 -0
  149. phase_loop_runtime/reconcile.py +1550 -0
  150. phase_loop_runtime/redaction.py +184 -0
  151. phase_loop_runtime/reflection_sync.py +293 -0
  152. phase_loop_runtime/release_guard.py +186 -0
  153. phase_loop_runtime/render.py +432 -0
  154. phase_loop_runtime/repo_validation.py +427 -0
  155. phase_loop_runtime/review_summary.py +150 -0
  156. phase_loop_runtime/roadmap_lint.py +425 -0
  157. phase_loop_runtime/route_log.py +59 -0
  158. phase_loop_runtime/route_policy/__init__.py +11 -0
  159. phase_loop_runtime/route_policy/fixtures/route_selection.golden.json +263 -0
  160. phase_loop_runtime/runner.py +8400 -0
  161. phase_loop_runtime/runtime_paths.py +225 -0
  162. phase_loop_runtime/runtime_projection.py +113 -0
  163. phase_loop_runtime/runtime_resources.py +36 -0
  164. phase_loop_runtime/schema_export.py +292 -0
  165. phase_loop_runtime/schemas/phase_loop_closeout.schema.json +366 -0
  166. phase_loop_runtime/skill_install.py +176 -0
  167. phase_loop_runtime/skill_inventory.py +662 -0
  168. phase_loop_runtime/skill_paths.py +42 -0
  169. phase_loop_runtime/skill_sources_plugin.py +37 -0
  170. phase_loop_runtime/skills_bundle/claude-advisor-board/README.md +1 -0
  171. phase_loop_runtime/skills_bundle/claude-advisor-board/SKILL.md +38 -0
  172. phase_loop_runtime/skills_bundle/claude-advisor-panel/README.md +1 -0
  173. phase_loop_runtime/skills_bundle/claude-advisor-panel/SKILL.md +38 -0
  174. phase_loop_runtime/skills_bundle/claude-execute-detailed/README.md +1 -0
  175. phase_loop_runtime/skills_bundle/claude-execute-detailed/SKILL.md +152 -0
  176. phase_loop_runtime/skills_bundle/claude-execute-phase/README.md +1 -0
  177. phase_loop_runtime/skills_bundle/claude-execute-phase/SKILL.md +745 -0
  178. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/allocate_worktree_name.sh +33 -0
  179. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/audit_lane_file_touches.py +197 -0
  180. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
  181. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
  182. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
  183. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
  184. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
  185. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/state.py +274 -0
  186. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
  187. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/team_teardown.sh +32 -0
  188. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/validate_plan_doc.py +642 -0
  189. phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/verify_harness.sh +96 -0
  190. phase_loop_runtime/skills_bundle/claude-phase-loop/README.md +1 -0
  191. phase_loop_runtime/skills_bundle/claude-phase-loop/SKILL.md +115 -0
  192. phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/README.md +1 -0
  193. phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/SKILL.md +439 -0
  194. phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/assets/review_prompt.md +19 -0
  195. phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
  196. phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/roadmap-template.md +193 -0
  197. phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
  198. phase_loop_runtime/skills_bundle/claude-plan-detailed/README.md +1 -0
  199. phase_loop_runtime/skills_bundle/claude-plan-detailed/SKILL.md +334 -0
  200. phase_loop_runtime/skills_bundle/claude-plan-detailed/assets/review_prompt.md +25 -0
  201. phase_loop_runtime/skills_bundle/claude-plan-phase/README.md +1 -0
  202. phase_loop_runtime/skills_bundle/claude-plan-phase/SKILL.md +776 -0
  203. phase_loop_runtime/skills_bundle/claude-plan-phase/assets/review_prompt.md +17 -0
  204. phase_loop_runtime/skills_bundle/claude-plan-phase/scripts/validate_plan_doc.py +1092 -0
  205. phase_loop_runtime/skills_bundle/claude-run-train/README.md +1 -0
  206. phase_loop_runtime/skills_bundle/claude-run-train/SKILL.md +75 -0
  207. phase_loop_runtime/skills_bundle/claude-skill-editor/README.md +1 -0
  208. phase_loop_runtime/skills_bundle/claude-skill-editor/SKILL.md +243 -0
  209. phase_loop_runtime/skills_bundle/claude-skill-editor/assets/editor_prompt.md +72 -0
  210. phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/README.md +1 -0
  211. phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/SKILL.md +249 -0
  212. phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
  213. phase_loop_runtime/skills_bundle/claude-task-contextualizer/README.md +1 -0
  214. phase_loop_runtime/skills_bundle/claude-task-contextualizer/SKILL.md +74 -0
  215. phase_loop_runtime/skills_bundle/claude-task-contextualizer/references/task-templates.md +103 -0
  216. phase_loop_runtime/skills_bundle/codex-advisor-board/README.md +1 -0
  217. phase_loop_runtime/skills_bundle/codex-advisor-board/SKILL.md +38 -0
  218. phase_loop_runtime/skills_bundle/codex-advisor-panel/README.md +1 -0
  219. phase_loop_runtime/skills_bundle/codex-advisor-panel/SKILL.md +38 -0
  220. phase_loop_runtime/skills_bundle/codex-execute-detailed/README.md +1 -0
  221. phase_loop_runtime/skills_bundle/codex-execute-detailed/SKILL.md +154 -0
  222. phase_loop_runtime/skills_bundle/codex-execute-phase/README.md +1 -0
  223. phase_loop_runtime/skills_bundle/codex-execute-phase/SKILL.md +231 -0
  224. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/allocate_worktree_name.sh +33 -0
  225. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/audit_lane_file_touches.py +197 -0
  226. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
  227. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
  228. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
  229. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
  230. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
  231. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/state.py +274 -0
  232. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
  233. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/team_teardown.sh +32 -0
  234. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/validate_plan_doc.py +642 -0
  235. phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/verify_harness.sh +96 -0
  236. phase_loop_runtime/skills_bundle/codex-phase-loop/README.md +1 -0
  237. phase_loop_runtime/skills_bundle/codex-phase-loop/SKILL.md +248 -0
  238. phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/README.md +1 -0
  239. phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/SKILL.md +150 -0
  240. phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/assets/review_prompt.md +19 -0
  241. phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
  242. phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/roadmap-template.md +193 -0
  243. phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
  244. phase_loop_runtime/skills_bundle/codex-plan-detailed/README.md +1 -0
  245. phase_loop_runtime/skills_bundle/codex-plan-detailed/SKILL.md +119 -0
  246. phase_loop_runtime/skills_bundle/codex-plan-detailed/assets/review_prompt.md +25 -0
  247. phase_loop_runtime/skills_bundle/codex-plan-phase/README.md +1 -0
  248. phase_loop_runtime/skills_bundle/codex-plan-phase/SKILL.md +307 -0
  249. phase_loop_runtime/skills_bundle/codex-plan-phase/assets/review_prompt.md +17 -0
  250. phase_loop_runtime/skills_bundle/codex-plan-phase/scripts/validate_plan_doc.py +1092 -0
  251. phase_loop_runtime/skills_bundle/codex-run-train/README.md +1 -0
  252. phase_loop_runtime/skills_bundle/codex-run-train/SKILL.md +75 -0
  253. phase_loop_runtime/skills_bundle/codex-skill-editor/README.md +1 -0
  254. phase_loop_runtime/skills_bundle/codex-skill-editor/SKILL.md +94 -0
  255. phase_loop_runtime/skills_bundle/codex-skill-editor/assets/editor_prompt.md +72 -0
  256. phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/README.md +1 -0
  257. phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/SKILL.md +114 -0
  258. phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
  259. phase_loop_runtime/skills_bundle/codex-task-contextualizer/README.md +1 -0
  260. phase_loop_runtime/skills_bundle/codex-task-contextualizer/SKILL.md +102 -0
  261. phase_loop_runtime/skills_bundle/codex-task-contextualizer/references/task-templates.md +103 -0
  262. phase_loop_runtime/skills_bundle/gemini-advisor-board/README.md +1 -0
  263. phase_loop_runtime/skills_bundle/gemini-advisor-board/SKILL.md +38 -0
  264. phase_loop_runtime/skills_bundle/gemini-advisor-panel/README.md +1 -0
  265. phase_loop_runtime/skills_bundle/gemini-advisor-panel/SKILL.md +38 -0
  266. phase_loop_runtime/skills_bundle/gemini-execute-detailed/README.md +1 -0
  267. phase_loop_runtime/skills_bundle/gemini-execute-detailed/SKILL.md +144 -0
  268. phase_loop_runtime/skills_bundle/gemini-execute-phase/README.md +1 -0
  269. phase_loop_runtime/skills_bundle/gemini-execute-phase/SKILL.md +198 -0
  270. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/allocate_worktree_name.sh +33 -0
  271. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/audit_lane_file_touches.py +197 -0
  272. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
  273. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
  274. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
  275. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
  276. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
  277. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/state.py +274 -0
  278. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
  279. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/team_teardown.sh +32 -0
  280. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/validate_plan_doc.py +642 -0
  281. phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/verify_harness.sh +96 -0
  282. phase_loop_runtime/skills_bundle/gemini-phase-loop/README.md +1 -0
  283. phase_loop_runtime/skills_bundle/gemini-phase-loop/SKILL.md +111 -0
  284. phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/README.md +1 -0
  285. phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/SKILL.md +147 -0
  286. phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/assets/review_prompt.md +19 -0
  287. phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
  288. phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/roadmap-template.md +193 -0
  289. phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
  290. phase_loop_runtime/skills_bundle/gemini-plan-detailed/README.md +1 -0
  291. phase_loop_runtime/skills_bundle/gemini-plan-detailed/SKILL.md +119 -0
  292. phase_loop_runtime/skills_bundle/gemini-plan-detailed/assets/review_prompt.md +25 -0
  293. phase_loop_runtime/skills_bundle/gemini-plan-phase/README.md +1 -0
  294. phase_loop_runtime/skills_bundle/gemini-plan-phase/SKILL.md +217 -0
  295. phase_loop_runtime/skills_bundle/gemini-plan-phase/assets/review_prompt.md +17 -0
  296. phase_loop_runtime/skills_bundle/gemini-plan-phase/scripts/validate_plan_doc.py +1092 -0
  297. phase_loop_runtime/skills_bundle/gemini-run-train/README.md +1 -0
  298. phase_loop_runtime/skills_bundle/gemini-run-train/SKILL.md +75 -0
  299. phase_loop_runtime/skills_bundle/gemini-skill-editor/README.md +1 -0
  300. phase_loop_runtime/skills_bundle/gemini-skill-editor/SKILL.md +87 -0
  301. phase_loop_runtime/skills_bundle/gemini-skill-editor/assets/editor_prompt.md +72 -0
  302. phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/README.md +1 -0
  303. phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/SKILL.md +109 -0
  304. phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
  305. phase_loop_runtime/skills_bundle/gemini-task-contextualizer/README.md +1 -0
  306. phase_loop_runtime/skills_bundle/gemini-task-contextualizer/SKILL.md +98 -0
  307. phase_loop_runtime/skills_bundle/gemini-task-contextualizer/references/task-templates.md +103 -0
  308. phase_loop_runtime/skills_bundle/opencode-advisor-board/README.md +1 -0
  309. phase_loop_runtime/skills_bundle/opencode-advisor-board/SKILL.md +38 -0
  310. phase_loop_runtime/skills_bundle/opencode-advisor-panel/README.md +1 -0
  311. phase_loop_runtime/skills_bundle/opencode-advisor-panel/SKILL.md +38 -0
  312. phase_loop_runtime/skills_bundle/opencode-execute-detailed/README.md +1 -0
  313. phase_loop_runtime/skills_bundle/opencode-execute-detailed/SKILL.md +144 -0
  314. phase_loop_runtime/skills_bundle/opencode-execute-phase/README.md +1 -0
  315. phase_loop_runtime/skills_bundle/opencode-execute-phase/SKILL.md +196 -0
  316. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/allocate_worktree_name.sh +33 -0
  317. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/audit_lane_file_touches.py +197 -0
  318. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
  319. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
  320. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
  321. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
  322. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
  323. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/state.py +274 -0
  324. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
  325. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/team_teardown.sh +32 -0
  326. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/validate_plan_doc.py +642 -0
  327. phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/verify_harness.sh +96 -0
  328. phase_loop_runtime/skills_bundle/opencode-phase-loop/README.md +1 -0
  329. phase_loop_runtime/skills_bundle/opencode-phase-loop/SKILL.md +113 -0
  330. phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/README.md +1 -0
  331. phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/SKILL.md +147 -0
  332. phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/assets/review_prompt.md +19 -0
  333. phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
  334. phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/roadmap-template.md +193 -0
  335. phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
  336. phase_loop_runtime/skills_bundle/opencode-plan-detailed/README.md +1 -0
  337. phase_loop_runtime/skills_bundle/opencode-plan-detailed/SKILL.md +119 -0
  338. phase_loop_runtime/skills_bundle/opencode-plan-detailed/assets/review_prompt.md +25 -0
  339. phase_loop_runtime/skills_bundle/opencode-plan-phase/README.md +1 -0
  340. phase_loop_runtime/skills_bundle/opencode-plan-phase/SKILL.md +211 -0
  341. phase_loop_runtime/skills_bundle/opencode-plan-phase/assets/review_prompt.md +17 -0
  342. phase_loop_runtime/skills_bundle/opencode-plan-phase/scripts/validate_plan_doc.py +1092 -0
  343. phase_loop_runtime/skills_bundle/opencode-run-train/README.md +1 -0
  344. phase_loop_runtime/skills_bundle/opencode-run-train/SKILL.md +75 -0
  345. phase_loop_runtime/skills_bundle/opencode-skill-editor/README.md +1 -0
  346. phase_loop_runtime/skills_bundle/opencode-skill-editor/SKILL.md +87 -0
  347. phase_loop_runtime/skills_bundle/opencode-skill-editor/assets/editor_prompt.md +72 -0
  348. phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/README.md +1 -0
  349. phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/SKILL.md +109 -0
  350. phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
  351. phase_loop_runtime/skills_bundle/opencode-task-contextualizer/README.md +1 -0
  352. phase_loop_runtime/skills_bundle/opencode-task-contextualizer/SKILL.md +98 -0
  353. phase_loop_runtime/skills_bundle/opencode-task-contextualizer/references/task-templates.md +103 -0
  354. phase_loop_runtime/state.py +156 -0
  355. phase_loop_runtime/state_degradation.py +136 -0
  356. phase_loop_runtime/state_ops.py +676 -0
  357. phase_loop_runtime/train_ledger.py +215 -0
  358. phase_loop_runtime/train_roadmap.py +339 -0
  359. phase_loop_runtime/train_runner.py +1197 -0
  360. phase_loop_runtime/verification_evidence.py +650 -0
  361. phase_loop_runtime/verification_evidence_validator.py +75 -0
  362. phase_loop_runtime/visual_evidence_validator.py +36 -0
  363. phase_loop_runtime/worker_pool.py +123 -0
  364. phase_loop_runtime/worktree_index.py +270 -0
  365. phase_loop_runtime-0.2.0.data/data/share/phase-loop-runtime/protocol/protocol.md +2475 -0
  366. phase_loop_runtime-0.2.0.dist-info/METADATA +106 -0
  367. phase_loop_runtime-0.2.0.dist-info/RECORD +370 -0
  368. phase_loop_runtime-0.2.0.dist-info/WHEEL +5 -0
  369. phase_loop_runtime-0.2.0.dist-info/entry_points.txt +9 -0
  370. phase_loop_runtime-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: opencode-advisor-board
3
+ description: Run a customizable cross-vendor advisor board (formerly advisor-panel; that name remains a working alias) through the agent-harness runtime primitive when a high-stakes change needs independent review evidence.
4
+ ---
5
+
6
+ # Advisor Board
7
+
8
+ Use this skill when a plan, implementation diff, release closeout, or other high-stakes artifact needs an independent cross-vendor review board. This skill was formerly named `advisor-panel`; that name still resolves as an alias, so existing instructions that say "advisor-panel" keep working.
9
+
10
+ ## Source Of Truth
11
+
12
+ The advisor-board (formerly advisor-panel) implementation is owned by `agent-harness`:
13
+
14
+ - Runtime primitive: `phase_loop_runtime.panel_invoker`
15
+ - Board model: `phase_loop_runtime.advisor_board` (seats, boards, resolver, validation)
16
+ - Entry points: `available_panel_legs`, `invoke_panel`, and `invoke_panel_request` (from a `PanelRequest`)
17
+ - Governed workflow integration: phase-loop governed review/pre-merge paths
18
+
19
+ Do not call dotfiles advisor-panel scripts, copy provider-specific shell scripts, or introduce a separate implementation in the skill body. The skill is a thin operator guide over the runtime primitive.
20
+
21
+ ## Use
22
+
23
+ 1. Prefer the repo's governed phase-loop path when reviewing phase execution or pre-merge work.
24
+ 2. For a standalone smoke or diagnostic, build a metadata-only review artifact and call `phase_loop_runtime.panel_invoker.invoke_panel`.
25
+ 3. Require every leg to end with `AGREE`, `PARTIALLY AGREE`, or `DISAGREE`.
26
+ 4. Treat `EMPTY`, `TIMEOUT`, `ERROR`, `DEGRADED`, and `UNAVAILABLE` as structured evidence, not successful reviews.
27
+ 5. Keep provider API keys out of the environment; the runtime strips known API-key variables and uses local subscription CLIs.
28
+
29
+ ## Standalone Smoke Shape
30
+
31
+ ```python
32
+ from phase_loop_runtime.panel_invoker import available_panel_legs, invoke_panel
33
+
34
+ artifact = "Review artifact with acceptance criteria and verification evidence."
35
+ panel = invoke_panel(artifact, available_panel_legs())
36
+ for leg in panel.legs:
37
+ print(leg.leg, leg.status)
38
+ ```
@@ -0,0 +1 @@
1
+ Harness-specific overlay files for this workflow skill.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: opencode-advisor-panel
3
+ description: Run a customizable cross-vendor advisor board (formerly advisor-panel; that name remains a working alias) through the agent-harness runtime primitive when a high-stakes change needs independent review evidence.
4
+ ---
5
+
6
+ # Advisor Board
7
+
8
+ Use this skill when a plan, implementation diff, release closeout, or other high-stakes artifact needs an independent cross-vendor review board. This skill was formerly named `advisor-panel`; that name still resolves as an alias, so existing instructions that say "advisor-panel" keep working.
9
+
10
+ ## Source Of Truth
11
+
12
+ The advisor-board (formerly advisor-panel) implementation is owned by `agent-harness`:
13
+
14
+ - Runtime primitive: `phase_loop_runtime.panel_invoker`
15
+ - Board model: `phase_loop_runtime.advisor_board` (seats, boards, resolver, validation)
16
+ - Entry points: `available_panel_legs`, `invoke_panel`, and `invoke_panel_request` (from a `PanelRequest`)
17
+ - Governed workflow integration: phase-loop governed review/pre-merge paths
18
+
19
+ Do not call dotfiles advisor-panel scripts, copy provider-specific shell scripts, or introduce a separate implementation in the skill body. The skill is a thin operator guide over the runtime primitive.
20
+
21
+ ## Use
22
+
23
+ 1. Prefer the repo's governed phase-loop path when reviewing phase execution or pre-merge work.
24
+ 2. For a standalone smoke or diagnostic, build a metadata-only review artifact and call `phase_loop_runtime.panel_invoker.invoke_panel`.
25
+ 3. Require every leg to end with `AGREE`, `PARTIALLY AGREE`, or `DISAGREE`.
26
+ 4. Treat `EMPTY`, `TIMEOUT`, `ERROR`, `DEGRADED`, and `UNAVAILABLE` as structured evidence, not successful reviews.
27
+ 5. Keep provider API keys out of the environment; the runtime strips known API-key variables and uses local subscription CLIs.
28
+
29
+ ## Standalone Smoke Shape
30
+
31
+ ```python
32
+ from phase_loop_runtime.panel_invoker import available_panel_legs, invoke_panel
33
+
34
+ artifact = "Review artifact with acceptance criteria and verification evidence."
35
+ panel = invoke_panel(artifact, available_panel_legs())
36
+ for leg in panel.legs:
37
+ print(leg.leg, leg.status)
38
+ ```
@@ -0,0 +1 @@
1
+ Harness-specific overlay files for this workflow skill.
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: opencode-execute-detailed
3
+ description: "OpenCode bounded-plan executor for one detailed implementation plan with verification, acceptance reduction, and mandatory reflection closeout."
4
+ ---
5
+
6
+ # OpenCode Execute Detailed
7
+
8
+ Executes one detailed plan artifact produced by `<harness>-plan-detailed`. Use
9
+ this when one OpenCode thread should implement a bounded plan end to end without
10
+ phase lanes or cross-harness dispatch.
11
+
12
+ ## Core Rules
13
+
14
+ Use `phase_loop_runtime.skill_paths` resolver helpers for harness skill roots,
15
+ handoff roots, helper roots, and reflection roots.
16
+
17
+ - Read the detailed plan artifact before editing.
18
+ - Optionally read `.dev-skills/handoffs/<harness>-plan-detailed/latest.md` when
19
+ no explicit plan path is supplied, and only trust it if `from:` is
20
+ `<harness>-plan-detailed`, the repo fields match the current repo, and the
21
+ artifact path resolves under the current repo root.
22
+ - Preserve user work. Never revert changes you did not make.
23
+ - Use `apply_patch` for manual edits when available; otherwise use the active
24
+ session's file-editing tool with the same narrow diff discipline.
25
+ - Keep implementation bounded to the detailed plan's `## Changes` section.
26
+ - Treat ignored, private, raw-data, credential, and evidence-source files as
27
+ read-protected unless the detailed plan explicitly allowlists the exact path
28
+ or glob for read access.
29
+ - Git safety invariant: never commit to `main` or a protected branch, never commit from
30
+ a dirty primary checkout, and never commit/push onto a branch this run does not own (a
31
+ shared or pre-existing colleague branch). When executing a plan, publishing a PR from a
32
+ dedicated branch is the default outcome (see the Workflow + "## Publication") unless a
33
+ runner owns closeout, or the user asked for local-only, planning-only, or no-publication
34
+ work, or verification failed. Never merge, force-push, reset, delete a publication
35
+ branch/worktree holding unmerged work, or run other destructive git commands without
36
+ explicit instruction.
37
+
38
+ ## Inputs
39
+
40
+ - Plan path: explicit detailed plan artifact, or the latest valid
41
+ `.dev-skills/handoffs/<harness>-plan-detailed/latest.md` artifact.
42
+ - Optional handoff: repo-local handoff from `<harness>-plan-detailed`.
43
+
44
+ ## Workflow
45
+
46
+ 1. Resolve the repo root and detailed plan artifact.
47
+ 2. Run `git status --short --untracked-files=all` and keep the starting dirty
48
+ paths for closeout comparison.
49
+ 3. Read the plan artifact in full.
50
+ 4. Validate that it contains non-empty `## Changes`, `## Verification`, and
51
+ `## Acceptance criteria` sections.
52
+ 5. Best-effort mark the detailed plan manifest entry as `executing` through
53
+ `phase_loop_runtime.plan_manifest.update_lifecycle` (`plan-manifest append`)
54
+ after plan validation and before source edits. Use `by=<harness>-execute-detailed`
55
+ and metadata that identifies the run and plan artifact. Manifest lifecycle
56
+ failures emit ledger/reflection warnings only and do not abort execution
57
+ during the dual-mode window.
58
+ 6. **Establish the safe working tree BEFORE editing** (unless a runner owns closeout — see step 2 / the Git safety invariant): resolve a fresh base ref (`origin/<default-branch>` after fetch, or an explicit merge target; never a stale local `main`) and select the working tree — reuse the current branch only if it is clean, non-protected, AND owned by this run; otherwise (`main`/a protected branch, a shared/foreign branch, or a dirty primary checkout) create a worktree+branch off the base: `git worktree add <path> -b <branch> <base>` under `/mnt/workspace/worktrees/<project>-<branch-slug>` if `/mnt/workspace` exists, else a repo sibling `../<project>-<branch-slug>`. Do ALL editing, the `git status` snapshots, the dirty-path classification, and verification in that tree — never on `main`/protected/dirty/shared. Then apply the `## Changes` section in declared order. Use `apply_patch` or the
59
+ active file-editing tool for manual edits. If implementation requires a file
60
+ or behavior not named by the plan, stop and report
61
+ `dirty worktree from non-plan output`.
62
+ 7. Run every command in `## Verification` unless unsafe, unavailable, or blocked
63
+ by missing credentials. Report each command with pass/fail status.
64
+ 8. Compare the final state against each item in `## Acceptance criteria` and
65
+ report satisfied or unmet status.
66
+ 9. Run `git status --short --untracked-files=all` and classify every dirty path
67
+ as plan-owned, pre-existing unrelated, or non-plan output.
68
+
69
+ ## Failure Diagnostics
70
+
71
+ - `verification failed`: a command from `## Verification` failed after one local
72
+ diagnosis and repair attempt, or the failure is outside the detailed plan's
73
+ scope.
74
+ - `acceptance criterion unmet`: a required `## Acceptance criteria` item is not
75
+ satisfied, or the detailed plan lacks `## Changes`, `## Verification`, or
76
+ `## Acceptance criteria`.
77
+ - `dirty worktree from non-plan output`: closeout finds a dirty path that was
78
+ not pre-existing and is not produced by the detailed plan's declared changes.
79
+ - `publication blocked`: a publication precheck failed (no remote / no push auth / no `gh` /
80
+ branch-name collision / push rejected / unresolved base ref), or publishing would otherwise
81
+ require committing to `main`/a protected branch or a branch this run does not own. Verified
82
+ work is preserved locally on a safe branch/worktree; report what blocked the PR.
83
+
84
+
85
+ ## Runner Verification Evidence
86
+
87
+ Before reporting a successful closeout, require the runner-owned verification artifact. The closeout must name `verification_artifact_path`, quote the artifact summary line, and must not report `verification_status=passed` unless that artifact exists and supports the executed work. Treat dependency-manifest install refresh and the full suite before closeout as runner-enforced expectations, not optional narrative checks. A blocked gate may be re-verdicted only by rerunning the originally specified runner check; proxy evidence requires a roadmap or plan amendment before the verdict changes.
88
+
89
+ ## Closeout
90
+
91
+ ### Manifest lifecycle
92
+
93
+ During closeout, best-effort call `phase_loop_runtime.plan_manifest.update_lifecycle` with `completed` when verification and acceptance passed, or `failed` when verification failed, acceptance was unmet, or closeout found non-plan output. Include verification metadata, reflection metadata, dirty-path classification, and the final diagnostic in the lifecycle event. Manifest lifecycle failures are non-fatal during the dual-mode window: emit a ledger warning, record the failure in the mandatory reflection, and preserve the existing detailed executor closeout.
94
+
95
+ Before final response, write a reflection for every non-trivial run. Write it to
96
+ `resolve_skill_bundle_root("codex")/<harness>-execute-detailed/reflections/<repo_hash>/<branch_slug>/<run_id>.md`.
97
+ The reflection must include `## Run context` with skill name, ISO timestamp,
98
+ repo, branch, commit, and artifact path, followed by `## What worked`,
99
+ `## What didn't`, and `## Improvements to SKILL.md`. Skip only when no artifact
100
+ was executed, no edit was made, and no decision was made.
101
+
102
+ Final response must include the detailed plan artifact path, changed files,
103
+ verification command results, acceptance-criteria status, final dirty-path
104
+ classification, and next action or blocker.
105
+
106
+
107
+ ## Publication
108
+
109
+ After a verified implementation, publishing a PR from the working tree established in
110
+ Workflow step 6 is the default outcome — under the Git safety invariant in Core Rules.
111
+ Defer entirely if a runner / pipeline owns closeout (a phase-loop-runner-driven or adapter
112
+ run, or an explicit runner-owned-closeout instruction): the runner owns commit and closeout.
113
+ Do NOT infer "runner owns closeout" from `verification_artifact_path` — every closeout
114
+ records it; it does not signal a runner. The following applies for human-invoked plan
115
+ execution.
116
+
117
+ Call `phase_loop_runtime.publishing.publish_from_worktree(repo, owned_paths, draft=<intent>)`
118
+ (IF-0-P1-1 — the runtime publication primitive), supplying the worktree root, the plan's
119
+ owned paths, and the draft/ready intent:
120
+ - `draft=True` when dependencies remain or verification was partial/skipped;
121
+ - `draft=False` when verification is complete (skipped or partial verification never opens
122
+ a ready PR).
123
+
124
+ The primitive performs the complete #28 flow in code, not prose:
125
+
126
+ 1. **Preflight.** Confirms the branch is non-protected, non-main, and not in a
127
+ dirty/unowned state; confirms a remote, push auth, and the `gh` CLI. A preflight
128
+ failure returns `{status: "publication_blocked", reason: ...}` — keep the committed
129
+ work on the safe branch/worktree and STOP at publish with `publication blocked`;
130
+ never on `main`/a protected branch, and never imply a PR exists.
131
+ 2. **Stage + audit.** Stages only owned paths (`git add -- <paths>`, never `git add -A`),
132
+ audits the staged set (rejects any ignored, private, raw-data, credential, or `.env`
133
+ path; runs `git diff --cached --check`), and fails closed on any violation — path-scoping
134
+ alone does not catch a secret inside an owned file; the read-protection rules and this
135
+ audit are the backstop.
136
+ 3. **Commit + push.** Commits the audited diff and pushes without force. A rejected push
137
+ (divergent / non-fast-forward / branch protection) returns `publication_blocked` — never
138
+ force-push or merge to resolve it.
139
+ 4. **Open the PR.** `gh pr create --draft` or ready (`--fill`) per the intent flag.
140
+
141
+ Returns `{status: "published", branch, head_sha, pr_url}` on success (IF-0-P1-1; report
142
+ `pr_url` in the final response and include `head_sha` in the handoff for downstream
143
+ consumers). Returns `{status: "publication_blocked", reason: <slug>}` on any violation —
144
+ report `publication blocked` with the reason and stop.
@@ -0,0 +1 @@
1
+ Harness-specific overlay files for this workflow skill.
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: opencode-execute-phase
3
+ description: "OpenCode-optimized executor for a `<harness>-plan-phase` lane plan. Use when the user wants OpenCode to implement a planned phase. Executes lanes with clean git preflight, owned-file boundaries, verification, and optional explicit worker-subagent fanout for disjoint lanes."
4
+ ---
5
+
6
+ # OpenCode Execute Phase
7
+
8
+ Executes a phase plan produced by `<harness>-plan-phase`. The default executor is the main OpenCode thread. Worker subagents are optional and only used when the user explicitly asks for subagents, delegation, or parallel execution.
9
+
10
+ ## Core Rules
11
+
12
+ Use `phase_loop_runtime.skill_paths` resolver helpers for harness skill roots, handoff roots, helper roots, and reflection roots.
13
+
14
+ - Read the full phase plan before editing.
15
+ - Preserve user work. Never revert changes you did not make.
16
+ - Use the active session's file-editing tool for manual edits.
17
+ - When implementation depends on current external documentation, use PMCP first. Context7 is the preferred path for library docs; Bright Data or other search/scrape tools may be used only when `gateway_catalog_search` shows they are available.
18
+ - Keep lane ownership boundaries. If implementation requires touching another lane's files, stop and revise the plan or ask the user.
19
+ - Do not run destructive git commands such as `git reset --hard` or `git checkout -- <path>` unless the user explicitly requested that operation.
20
+ - Do not commit, push, or merge unless the user asked for those git actions.
21
+
22
+ ## Runner-Owned Lane Work Units
23
+
24
+ Injected HARNESSLANE runs may include a `HarnessLaneAssignment` from
25
+ `shared/phase-loop/protocol.md`. Treat that assignment as the work-unit
26
+ contract: execute only the selected `lane_id`, write only the listed
27
+ `owned_files`, treat `consumed_interfaces` as read-only, and emit one shared
28
+ `automation:` closeout for that work unit. Installed-skill drift is
29
+ warning-only when the repo-injected context is present.
30
+
31
+ OpenCode lane launches must preserve explicit delivery and permission
32
+ metadata: `<harness> run`, `--dir`, `--agent`, provider-qualified `--model`,
33
+ optional `--variant`, `--format json`, and the shared context file. Review,
34
+ reducer, verify, and closeout prompts are distinct from implementation prompts.
35
+ If the selected policy is unsupported by the active harness, stop with a typed
36
+ non-human blocker instead of silently downgrading.
37
+
38
+ ## Inputs
39
+
40
+ - Plan path: default latest `plans/phase-plan-*.md`.
41
+ - `--dry-run`: parse and print the lane schedule without editing.
42
+ - `--parallel`: allowed only when the user explicitly requests parallel worker execution.
43
+
44
+ If no plan path is explicit, first check the current repo and branch handoff from `<harness>-plan-phase` using `<harness>-config/shared/runtime-state.md`: read the repo-local handoff resolver target `.dev-skills/handoffs/<harness>-plan-phase/latest.md`, validate `from`, `repo`, `repo_root`, `branch`, `branch_slug`, `commit`, and `artifact`, then use the artifact only if it exists under the current repo root. Ignore missing or mismatched handoffs unless the user explicitly asks to reuse cross-branch state.
45
+
46
+ ## Preflight
47
+
48
+ 1. Resolve repo root and plan path.
49
+ 2. Run `git status --short`.
50
+ 3. Run `git status --short -- <plan_path>` and warn if the plan is untracked.
51
+ 4. If the tree has unrelated dirty files, leave them alone and scope edits around them.
52
+ 5. Parse:
53
+ - interface gates;
54
+ - lane DAG;
55
+ - owned files;
56
+ - task lists;
57
+ - verification commands;
58
+ - optional `Dispatch Hints` from the roadmap or plan using the frozen
59
+ vocabulary from `shared/phase-loop/protocol.md`.
60
+ 6. Validate producer dependencies:
61
+ - any lane that consumes another lane's findings, interfaces, or artifacts must list that producer lane in `Depends on`;
62
+ - any lane that writes a synthesized artifact must be downstream of every producer lane it summarizes;
63
+ - if dependencies are missing, stop and require a plan correction before execution.
64
+ 7. For `--dry-run`, report the topological lane order and stop.
65
+
66
+ ## Execution Workflow
67
+
68
+ 1. Execute lanes in topological order.
69
+ 2. For each lane:
70
+ - when the selected executor is OpenCode live, keep the launch contract
71
+ explicit around `<harness> run`, `--dir`, `--agent`, provider-qualified
72
+ `--model`, optional `--variant`, `--format json`, and the shared
73
+ `context_file` artifact;
74
+ - record OpenCode permission posture explicitly and refuse permissive
75
+ defaults unless the runner intentionally opts in;
76
+ - treat installed-skill drift as warning-only metadata when injected repo
77
+ context is present and the child otherwise succeeds;
78
+ - read the owned files and related tests;
79
+ - write or update tests first when practical;
80
+ - implement only lane-scoped changes;
81
+ - run lane verification (normalize any phase-plan pytest `-k` selector whose prose terms contain spaces — e.g. `remote connect` becomes `'remote and connect'` — or quote it; a bare spaced `-k` term is an executor-side normalization, not a plan blocker);
82
+ - run any phase-level checks that cover touched files.
83
+ 3. After each lane:
84
+ - inspect `git diff -- <owned files>`;
85
+ - confirm no peer-owned files were modified;
86
+ - record completed gates.
87
+ 4. After all lanes:
88
+ - run the full phase verification commands;
89
+ - if execution discoveries change downstream work, amend the nearest
90
+ downstream roadmap phase that is not already executing;
91
+ - treat any older downstream phase plan or handoff as stale after a roadmap
92
+ amendment and route the next step back through `<harness>-plan-phase`;
93
+ - describe the change explicitly as a roadmap amendment in the final
94
+ closeout;
95
+ - summarize changed files, tests run, and any residual risks.
96
+
97
+ ## Optional Worker Fanout
98
+
99
+ Use worker subagents only when the user explicitly authorizes parallel agent work and the DAG-ready lanes are disjoint.
100
+
101
+ For every worker brief:
102
+
103
+ - State that they are not alone in the codebase.
104
+ - Assign exact owned files or globs.
105
+ - List files they may read but not edit.
106
+ - Tell them not to revert unrelated changes.
107
+ - Require a final response with changed paths, tests run, failures, and blockers.
108
+ - Do not give two workers overlapping write ownership.
109
+
110
+ The main thread remains responsible for integrating results, reviewing diffs, running final verification, and resolving conflicts.
111
+
112
+ ## Failure Policy
113
+
114
+ - Test failure in a lane: diagnose once, fix within the lane if the cause is local, otherwise stop and report.
115
+ - Ownership violation: stop and revise the plan before continuing.
116
+ - Missing dependency or unclear interface: stop and route back through planning.
117
+ - Verification command unavailable: report the missing tool and run the closest available static check only if it is meaningful.
118
+ - Use only the frozen blocker taxonomy from `shared/phase-loop/protocol.md`,
119
+ including `missing_secret`, `dirty_worktree_conflict`,
120
+ `branch_sync_conflict`, and `repeated_verification_failure`.
121
+
122
+
123
+ ## Runner Verification Evidence
124
+
125
+ Before reporting a successful closeout, require the runner-owned verification artifact. The closeout must name `verification_artifact_path`, quote the artifact summary line, and must not report `verification_status=passed` unless that artifact exists and supports the executed work. Treat dependency-manifest install refresh and the full suite before closeout as runner-enforced expectations, not optional narrative checks. A blocked gate may be re-verdicted only by rerunning the originally specified runner check; proxy evidence requires a roadmap or plan amendment before the verdict changes. A prior run's terminal-summary is authoritative for reconcile-or-skip only when that closeout was accepted; a rejected or blocked prior closeout — regardless of any self-reported `complete`/`passed` — must not be reconciled against. On a re-run, re-do and re-verify the phase work from scratch rather than skipping on a stale summary.
126
+
127
+
128
+ ## Spec Delta Closeout
129
+
130
+ Before final closeout, choose exactly one `spec_delta_closeout.v1` decision: `no_spec_delta`, `roadmap_amendment`, `canonical_spec_update`, `governed_pipeline_refresh`, `mirror_cutover_required`, `dotfiles_skill_source_update`, or `human_source_judgment_required`. Cite metadata-only evidence paths such as the active plan, lane closeouts, targeted pytest output, and `git diff --check` output. Preserve the phase plan's target surfaces and `redaction_posture=metadata_only`; do not include raw specification bodies, raw patch bodies, credentials, provider-supplied payloads, local environment values, or evidence-source contents. Missing or malformed spec-closeout evidence is a repairable automation blocker with `blocker_class=contract_bug` unless the decision is `human_source_judgment_required`.
131
+
132
+ ## Closeout
133
+
134
+ ### Manifest lifecycle
135
+
136
+ After plan validation and before lane execution, perform a best-effort `plan-manifest append` lifecycle update through `phase_loop_runtime.plan_manifest.update_lifecycle` to mark the matching `type=phase` entry `executing` with run metadata. During closeout, update the same entry to `completed` or `failed` with verification metadata, reflection metadata, produced-gate metadata, `if_gates_produced`, and dirty-worktree summary fields as available. `if_gates_produced` must list only the IF gates the active phase produces per its own plan; never carry a prior phase's gate forward into this phase's closeout. Manifest lifecycle failures are non-fatal during the dual-mode window: emit a ledger warning, mention the warning in the mandatory reflection, and preserve the existing bounded phase execution, closeout expectations, and dirty-worktree behavior.
137
+
138
+ Before final closeout, run `git status --short -- <plan_path> <roadmap_path>` for every consumed or updated planning artifact. If any planning artifact is untracked or modified and the user did not explicitly forbid staging, run `git add <path>` for each artifact. Rerun status and report `Artifact state: staged|tracked|modified|unstaged|blocked` for each artifact. Do not commit unless requested. Repo-local handoff files are operational state: do not `git add` an ignored handoff alongside the plan artifact unless the plan's owned-files/allowlist explicitly includes the handoff directory; leave ignored handoffs ignored and exclude them from artifact-state reporting.
139
+
140
+ Determine the next step before final response and handoff:
141
+
142
+ - If the current phase is incomplete or verification failed, report `Next phase: <current alias> - blocked: <blocker>` and `Next command: none - <blocker>`.
143
+ - If another generated phase plan is ready, report `Next phase: <next alias> - execution ready` and `Next command: <harness>-execute-phase <next_plan_path>`.
144
+ - If the roadmap has an unplanned ready phase, report `Next phase: <next alias> - planning ready` and `Next command: <harness>-plan-phase <roadmap_path> <next_alias>`.
145
+ - If the roadmap needs extension, report `Next phase: none - roadmap extension needed` and `Next command: <harness>-phase-roadmap-builder <roadmap_path>`.
146
+ - If all phases are complete, report `Next phase: none - roadmap complete` and `Next command: none - roadmap complete`.
147
+
148
+ Add a machine-readable `automation:` handoff with `verification_status` that agrees with the human-readable next step fields, and use the phrase `manual event` when standalone compatibility event import applies. Closeout payload shape is defined by `EmitPhaseCloseout` in `phase_loop_runtime/baml_src/emit_phase_closeout.baml` (if that path is absent in the checkout, use the operator/prompt-supplied field contract or the installed `phase_loop_runtime` package — the missing vendored BAML source is not a blocker); keep skill text focused on value selection and handoff routing, not duplicated field ceremony.
149
+
150
+ Before final response, write a reflection for every non-trivial run. Write it to `resolve_skill_bundle_root("codex")/<harness>-execute-phase/reflections/<repo_hash>/<branch_slug>/<run_id>.md`. The reflection must include `## Run context` with skill name, ISO timestamp, repo, branch, commit, and artifact path if any, followed by `## What worked`, `## What didn't`, and `## Improvements to SKILL.md`. skip only when no artifact was produced AND no decision was made AND the run was pure inspection.
151
+
152
+ Report:
153
+
154
+ - lanes completed;
155
+ - files changed;
156
+ - planning artifact tracking state;
157
+ - next phase and next command;
158
+ - verification commands and results;
159
+ - commands not run and why;
160
+ - follow-up risks or manual checks.
161
+
162
+ Resolve closeout writes through `shared/phase-loop/handoff_path.py` and the repo-local handoff resolver; legacy harness handoff roots are read only for migration. Follow `<harness>-config/shared/runtime-state.md` and use OpenCode paths only:
163
+
164
+ - Reflection: `resolve_skill_bundle_root("codex")/<harness>-execute-phase/reflections/<repo_hash>/<branch_slug>/<run_id>.md`
165
+ - Handoff: `<repo>/.dev-skills/handoffs/<harness>-execute-phase/<run_id>.md`
166
+ - Latest handoff pointer: `<repo>/.dev-skills/handoffs/<harness>-execute-phase/latest.md`
167
+
168
+ Handoff frontmatter must include `from: <harness>-execute-phase`, `timestamp:`, `repo:`, `repo_root:`, `branch:`, `branch_slug:`, `commit:`, `run_id:`, `artifact:`, `artifact_state:`, `next_skill:`, `next_command:`, and `next_phase:`. Put open follow-up items in the body, and update `latest.md` with the same handoff content.
169
+
170
+
171
+ ## Publication mode
172
+
173
+ After verified phase work, select exactly one of three modes. **Default to (a) unless a
174
+ clear interactive signal is present** — a run missing BOTH the adapter prompt prefix AND
175
+ `PHASE_LOOP_RUN_MODE` is AMBIGUOUS and MUST be treated as (a) (fail safe toward the runner).
176
+
177
+ - (a) Runner-managed closeout (incl. governed mode), OR ambiguous mode. If this is the
178
+ phase-loop adapter (the prompt begins with `<harness>-execute-phase <plan>` from a
179
+ pipeline run dir), or `PHASE_LOOP_RUN_MODE` is set (autonomous/governed), OR neither
180
+ interactive signal is clearly present, the RUNNER owns closeout and commit. Do NOT
181
+ independently publish — defer entirely to runner closeout (`awaiting_phase_closeout` /
182
+ runner commit). Publishing here would bypass the governed pre-merge review panel.
183
+ - (b) Interactive orchestrator on a clean, non-protected feature branch (a clear
184
+ interactive signal, and the merge target passed the merge-target safety gate). After the
185
+ Step-9 clean-tree state, push the merge-target branch and open a PR (`gh pr create`,
186
+ `--draft` if dependencies remain or verification was partial/skipped, else ready) instead
187
+ of leaving the lane merge only local.
188
+ - (c) Merge target is `main` or a protected branch. Already STOPPED at the merge-target
189
+ safety gate before any lane merge — never merge lanes onto `main`/protected. Re-target a
190
+ feature branch or take explicit instruction.
191
+
192
+ This applies only to interactive (non-runner) completion; it never overrides
193
+ `awaiting_phase_closeout`, the runner's deliberate non-complete terminal. Allowed runner
194
+ hygiene (forced lane-worktree removal, `branch -D`, `sweep_stale_worktrees.sh`) is
195
+ unchanged — the destructive-op ban targets publication branches/worktrees holding
196
+ unmerged work.
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env bash
2
+ # allocate_worktree_name.sh — emit a collision-impossible worktree name
3
+ # for a swim-lane teammate.
4
+ #
5
+ # Usage:
6
+ # allocate_worktree_name.sh <sl-id>
7
+ #
8
+ # <sl-id> Lane identifier, e.g. "sl-1" or "sl-2b".
9
+ #
10
+ # Emits exactly one line to stdout:
11
+ # lane-<sl-id>-<UTC-YYYYMMDDHHMMSS>-<4char-random>
12
+ #
13
+ # Rationale: the default `lane-<sl-id>` naming is not unique across rapid
14
+ # consecutive dispatch of in-process teammates — two teammates spawned in
15
+ # the same message can race on the same EnterWorktree slot. The 4-char
16
+ # random suffix + UTC timestamp eliminates the race by construction.
17
+
18
+ set -euo pipefail
19
+
20
+ if [[ $# -ne 1 ]]; then
21
+ echo "usage: allocate_worktree_name.sh <sl-id>" >&2
22
+ exit 2
23
+ fi
24
+
25
+ sl_id="$1"
26
+ ts="$(date -u +%Y%m%dT%H%M%S)"
27
+ rand="$(tr -dc 'a-z0-9' </dev/urandom | head -c 4 || true)"
28
+ if [[ -z "$rand" ]]; then
29
+ # Extremely unlikely; fall back to $RANDOM-derived 4 chars.
30
+ rand="$(printf "%04x" "$((RANDOM & 0xFFFF))")"
31
+ fi
32
+
33
+ echo "lane-${sl_id}-${ts}-${rand}"
@@ -0,0 +1,197 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ audit_lane_file_touches.py — audit a lane's commit against the plan's
4
+ disjoint-owned-files contract.
5
+
6
+ Usage:
7
+ audit_lane_file_touches.py <lane-sha> <plan-doc-path> <this-lane-id>
8
+
9
+ Emits EXACTLY one token on stdout, exit 0 always (verdict is on stdout
10
+ for the orchestrator to act on):
11
+
12
+ CLEAN
13
+ - Every file touched by <lane-sha> (vs its first-parent ancestor)
14
+ falls within <this-lane-id>'s `Owned files` globs from the plan
15
+ doc.
16
+
17
+ PEER_INTRUSION
18
+ - One or more files touched match some OTHER lane's `Owned files`
19
+ globs. The lane wandered into a peer's territory. Orchestrator
20
+ surfaces to user for merge/no-merge decision — defensive cross-
21
+ lane test-mock edits happen and are usually benign, but should be
22
+ reviewed rather than surfacing as a later merge conflict.
23
+
24
+ ORPHAN_FILES
25
+ - One or more files touched fall OUTSIDE every lane's globs. The
26
+ teammate worked outside any declared lane scope — probable bug.
27
+
28
+ Any combination of intrusion + orphan is reported with intrusion winning.
29
+ Details (which peer, which files) are written to stderr.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import re
35
+ import subprocess
36
+ import sys
37
+ from pathlib import Path
38
+ from typing import Dict, List, Optional, Set
39
+
40
+
41
+ _SL_SECTION_RE = re.compile(r"^###\s+(SL-\d+)\b.*$", re.MULTILINE)
42
+ _OWNED_BULLET_RE = re.compile(
43
+ r"^\s*-\s*\*\*Owned files\*\*\s*:\s*(.*?)\s*$",
44
+ re.IGNORECASE,
45
+ )
46
+ _CODE_TOKEN_RE = re.compile(r"`([^`]+)`")
47
+
48
+
49
+ def _fail(msg: str) -> None:
50
+ print(f"audit_lane_file_touches: {msg}", file=sys.stderr)
51
+
52
+
53
+ def _read(path: Path) -> str:
54
+ try:
55
+ return path.read_text(encoding="utf-8")
56
+ except Exception as exc:
57
+ _fail(f"cannot read {path}: {exc}")
58
+ sys.exit(2)
59
+
60
+
61
+ def _extract_lanes_body(src: str) -> str:
62
+ """Return the body between '## Lanes' and the next '## '."""
63
+ lines = src.splitlines()
64
+ out: List[str] = []
65
+ in_section = False
66
+ for line in lines:
67
+ if line.startswith("## ") and line.strip() == "## Lanes":
68
+ in_section = True
69
+ continue
70
+ if in_section and line.startswith("## "):
71
+ break
72
+ if in_section:
73
+ out.append(line)
74
+ return "\n".join(out)
75
+
76
+
77
+ def _parse_owned_globs(lanes_body: str) -> Dict[str, List[str]]:
78
+ """Map SL-N -> list of owned globs as declared in the plan."""
79
+ matches = list(_SL_SECTION_RE.finditer(lanes_body))
80
+ result: Dict[str, List[str]] = {}
81
+ for idx, m in enumerate(matches):
82
+ sl_id = m.group(1)
83
+ start = m.end()
84
+ end = matches[idx + 1].start() if idx + 1 < len(matches) else len(lanes_body)
85
+ body = lanes_body[start:end]
86
+ globs: List[str] = []
87
+ for line in body.splitlines():
88
+ mb = _OWNED_BULLET_RE.match(line)
89
+ if not mb:
90
+ continue
91
+ raw = mb.group(1)
92
+ tokens = _CODE_TOKEN_RE.findall(raw)
93
+ globs.extend(t.strip() for t in tokens if t.strip())
94
+ # Drop annotation-only items like "(NEW)" / "(DELETE)".
95
+ globs = [
96
+ g.split()[0].strip() for g in globs
97
+ if g and not g.startswith("(")
98
+ ]
99
+ result[sl_id] = globs
100
+ return result
101
+
102
+
103
+ def _glob_to_regex(pattern: str) -> re.Pattern:
104
+ """Minimal glob → regex. ** → any depth; * → any non-/; ? → one non-/."""
105
+ s = pattern.strip("`").strip()
106
+ esc = re.escape(s)
107
+ esc = esc.replace(r"\*\*", ".*").replace(r"\*", "[^/]*").replace(r"\?", "[^/]")
108
+ return re.compile("^" + esc + "$")
109
+
110
+
111
+ def _touched_files(sha: str) -> List[str]:
112
+ """Files changed by <sha> relative to its first parent."""
113
+ try:
114
+ r = subprocess.run(
115
+ ["git", "diff", "--name-only", f"{sha}^..{sha}"],
116
+ capture_output=True, text=True, check=True,
117
+ )
118
+ except subprocess.CalledProcessError:
119
+ # Commit has no parent (e.g., root) — fall back to diff against empty tree.
120
+ r = subprocess.run(
121
+ ["git", "show", "--name-only", "--pretty=", sha],
122
+ capture_output=True, text=True, check=True,
123
+ )
124
+ return [line for line in r.stdout.splitlines() if line.strip()]
125
+
126
+
127
+ def main(argv: List[str]) -> int:
128
+ if len(argv) != 4:
129
+ _fail("usage: audit_lane_file_touches.py <lane-sha> <plan-doc-path> <this-lane-id>")
130
+ return 2
131
+
132
+ lane_sha = argv[1]
133
+ plan_path = Path(argv[2])
134
+ this_lane = argv[3]
135
+
136
+ if not plan_path.exists():
137
+ _fail(f"plan doc not found: {plan_path}")
138
+ return 2
139
+
140
+ src = _read(plan_path)
141
+ lanes_body = _extract_lanes_body(src)
142
+ owned_map = _parse_owned_globs(lanes_body)
143
+
144
+ if this_lane not in owned_map:
145
+ _fail(f"lane {this_lane} not found in plan doc's `## Lanes` section")
146
+ return 2
147
+
148
+ # Compile regexes per lane.
149
+ compiled: Dict[str, List[re.Pattern]] = {
150
+ sl: [_glob_to_regex(g) for g in globs]
151
+ for sl, globs in owned_map.items()
152
+ }
153
+
154
+ touched = _touched_files(lane_sha)
155
+
156
+ def match_any(path: str, pats: List[re.Pattern]) -> bool:
157
+ return any(p.match(path) for p in pats)
158
+
159
+ intrusions: Dict[str, List[str]] = {}
160
+ orphans: List[str] = []
161
+ clean: List[str] = []
162
+ for path in touched:
163
+ if match_any(path, compiled[this_lane]):
164
+ clean.append(path)
165
+ continue
166
+ peer_hit: Optional[str] = None
167
+ for sl, pats in compiled.items():
168
+ if sl == this_lane:
169
+ continue
170
+ if match_any(path, pats):
171
+ peer_hit = sl
172
+ break
173
+ if peer_hit is not None:
174
+ intrusions.setdefault(peer_hit, []).append(path)
175
+ else:
176
+ orphans.append(path)
177
+
178
+ # Emit verdict. Intrusion takes precedence over orphan (intrusion is more actionable).
179
+ if intrusions:
180
+ for peer, paths in sorted(intrusions.items()):
181
+ _fail(f"{this_lane} touched files owned by {peer}: {paths}")
182
+ if orphans:
183
+ _fail(f"{this_lane} also touched orphan files (no lane owns): {orphans}")
184
+ print("PEER_INTRUSION")
185
+ return 0
186
+
187
+ if orphans:
188
+ _fail(f"{this_lane} touched files outside any lane's Owned files: {orphans}")
189
+ print("ORPHAN_FILES")
190
+ return 0
191
+
192
+ print("CLEAN")
193
+ return 0
194
+
195
+
196
+ if __name__ == "__main__":
197
+ sys.exit(main(sys.argv))