@trac3er/oh-my-god 2.1.0 → 2.1.4

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 (371) hide show
  1. package/.agents/skills/omg/AGENTS.fragment.md +2 -2
  2. package/.agents/skills/omg/algorithms/SKILL.md +1 -1
  3. package/.agents/skills/omg/algorithms/openai.yaml +1 -1
  4. package/.agents/skills/omg/api-twin/SKILL.md +1 -1
  5. package/.agents/skills/omg/api-twin/openai.yaml +1 -1
  6. package/.agents/skills/omg/claim-judge/SKILL.md +1 -1
  7. package/.agents/skills/omg/claim-judge/openai.yaml +1 -1
  8. package/.agents/skills/omg/codex-rules.md +1 -1
  9. package/.agents/skills/omg/control-plane/SKILL.md +1 -1
  10. package/.agents/skills/omg/control-plane/openai.yaml +1 -1
  11. package/.agents/skills/omg/data-lineage/SKILL.md +1 -1
  12. package/.agents/skills/omg/data-lineage/openai.yaml +1 -1
  13. package/.agents/skills/omg/delta-classifier/SKILL.md +1 -1
  14. package/.agents/skills/omg/delta-classifier/openai.yaml +1 -1
  15. package/.agents/skills/omg/eval-gate/SKILL.md +1 -1
  16. package/.agents/skills/omg/eval-gate/openai.yaml +1 -1
  17. package/.agents/skills/omg/health/SKILL.md +1 -1
  18. package/.agents/skills/omg/health/openai.yaml +1 -1
  19. package/.agents/skills/omg/hook-governor/SKILL.md +1 -1
  20. package/.agents/skills/omg/hook-governor/openai.yaml +1 -1
  21. package/.agents/skills/omg/incident-replay/SKILL.md +1 -1
  22. package/.agents/skills/omg/incident-replay/openai.yaml +1 -1
  23. package/.agents/skills/omg/lsp-pack/SKILL.md +1 -1
  24. package/.agents/skills/omg/lsp-pack/openai.yaml +1 -1
  25. package/.agents/skills/omg/mcp-fabric/SKILL.md +1 -1
  26. package/.agents/skills/omg/mcp-fabric/openai.yaml +1 -1
  27. package/.agents/skills/omg/plan-council/SKILL.md +1 -1
  28. package/.agents/skills/omg/plan-council/openai.yaml +1 -1
  29. package/.agents/skills/omg/preflight/SKILL.md +1 -1
  30. package/.agents/skills/omg/preflight/openai.yaml +1 -1
  31. package/.agents/skills/omg/proof-gate/SKILL.md +1 -1
  32. package/.agents/skills/omg/proof-gate/openai.yaml +1 -1
  33. package/.agents/skills/omg/remote-supervisor/SKILL.md +1 -1
  34. package/.agents/skills/omg/remote-supervisor/openai.yaml +1 -1
  35. package/.agents/skills/omg/robotics/SKILL.md +1 -1
  36. package/.agents/skills/omg/robotics/openai.yaml +1 -1
  37. package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +1 -1
  38. package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +1 -1
  39. package/.agents/skills/omg/security-check/SKILL.md +1 -1
  40. package/.agents/skills/omg/security-check/openai.yaml +1 -1
  41. package/.agents/skills/omg/test-intent-lock/SKILL.md +1 -1
  42. package/.agents/skills/omg/test-intent-lock/openai.yaml +1 -1
  43. package/.agents/skills/omg/tracebank/SKILL.md +1 -1
  44. package/.agents/skills/omg/tracebank/openai.yaml +1 -1
  45. package/.agents/skills/omg/vision/SKILL.md +1 -1
  46. package/.agents/skills/omg/vision/openai.yaml +1 -1
  47. package/.claude-plugin/marketplace.json +3 -3
  48. package/.claude-plugin/plugin.json +1 -1
  49. package/CHANGELOG.md +16 -0
  50. package/CLI-ADAPTER-MAP.md +3 -3
  51. package/OMG-setup.sh +114 -1
  52. package/OMG_COMPAT_CONTRACT.md +1 -1
  53. package/README.md +2 -1
  54. package/artifacts/release/.claude-plugin/marketplace.json +3 -3
  55. package/artifacts/release/.claude-plugin/plugin.json +1 -1
  56. package/artifacts/release/OMG_COMPAT_CONTRACT.md +1 -1
  57. package/artifacts/release/dist/enterprise/bundle/.claude-plugin/marketplace.json +3 -3
  58. package/artifacts/release/dist/enterprise/bundle/.claude-plugin/plugin.json +1 -1
  59. package/artifacts/release/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +1 -1
  60. package/artifacts/release/dist/enterprise/bundle/plugins/advanced/plugin.json +26 -9
  61. package/artifacts/release/dist/enterprise/bundle/registry/bundles/algorithms.yaml +1 -1
  62. package/artifacts/release/dist/enterprise/bundle/registry/bundles/api-twin.yaml +1 -1
  63. package/artifacts/release/dist/enterprise/bundle/registry/bundles/claim-judge.yaml +1 -1
  64. package/artifacts/release/dist/enterprise/bundle/registry/bundles/control-plane.yaml +1 -1
  65. package/artifacts/release/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +1 -1
  66. package/artifacts/release/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +1 -1
  67. package/artifacts/release/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +1 -1
  68. package/artifacts/release/dist/enterprise/bundle/registry/bundles/health.yaml +1 -1
  69. package/artifacts/release/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +1 -1
  70. package/artifacts/release/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +1 -1
  71. package/artifacts/release/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +1 -1
  72. package/artifacts/release/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +1 -1
  73. package/artifacts/release/dist/enterprise/bundle/registry/bundles/plan-council.yaml +1 -1
  74. package/artifacts/release/dist/enterprise/bundle/registry/bundles/preflight.yaml +1 -1
  75. package/artifacts/release/dist/enterprise/bundle/registry/bundles/proof-gate.yaml +1 -1
  76. package/artifacts/release/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +1 -1
  77. package/artifacts/release/dist/enterprise/bundle/registry/bundles/robotics.yaml +1 -1
  78. package/artifacts/release/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
  79. package/artifacts/release/dist/enterprise/bundle/registry/bundles/security-check.yaml +1 -1
  80. package/artifacts/release/dist/enterprise/bundle/registry/bundles/test-intent-lock.yaml +1 -1
  81. package/artifacts/release/dist/enterprise/bundle/registry/bundles/tracebank.yaml +1 -1
  82. package/artifacts/release/dist/enterprise/bundle/registry/bundles/vision.yaml +1 -1
  83. package/artifacts/release/dist/enterprise/bundle/registry/omg-capability.schema.json +1 -1
  84. package/artifacts/release/dist/enterprise/bundle/settings.json +3 -3
  85. package/artifacts/release/dist/enterprise/manifest.json +30 -40
  86. package/artifacts/release/dist/public/bundle/.claude-plugin/marketplace.json +3 -3
  87. package/artifacts/release/dist/public/bundle/.claude-plugin/plugin.json +1 -1
  88. package/artifacts/release/dist/public/bundle/OMG_COMPAT_CONTRACT.md +1 -1
  89. package/artifacts/release/dist/public/bundle/plugins/advanced/plugin.json +26 -9
  90. package/artifacts/release/dist/public/bundle/registry/bundles/algorithms.yaml +1 -1
  91. package/artifacts/release/dist/public/bundle/registry/bundles/api-twin.yaml +1 -1
  92. package/artifacts/release/dist/public/bundle/registry/bundles/claim-judge.yaml +1 -1
  93. package/artifacts/release/dist/public/bundle/registry/bundles/control-plane.yaml +1 -1
  94. package/artifacts/release/dist/public/bundle/registry/bundles/data-lineage.yaml +1 -1
  95. package/artifacts/release/dist/public/bundle/registry/bundles/delta-classifier.yaml +1 -1
  96. package/artifacts/release/dist/public/bundle/registry/bundles/eval-gate.yaml +1 -1
  97. package/artifacts/release/dist/public/bundle/registry/bundles/health.yaml +1 -1
  98. package/artifacts/release/dist/public/bundle/registry/bundles/hook-governor.yaml +1 -1
  99. package/artifacts/release/dist/public/bundle/registry/bundles/incident-replay.yaml +1 -1
  100. package/artifacts/release/dist/public/bundle/registry/bundles/lsp-pack.yaml +1 -1
  101. package/artifacts/release/dist/public/bundle/registry/bundles/mcp-fabric.yaml +1 -1
  102. package/artifacts/release/dist/public/bundle/registry/bundles/plan-council.yaml +1 -1
  103. package/artifacts/release/dist/public/bundle/registry/bundles/preflight.yaml +1 -1
  104. package/artifacts/release/dist/public/bundle/registry/bundles/proof-gate.yaml +1 -1
  105. package/artifacts/release/dist/public/bundle/registry/bundles/remote-supervisor.yaml +1 -1
  106. package/artifacts/release/dist/public/bundle/registry/bundles/robotics.yaml +1 -1
  107. package/artifacts/release/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
  108. package/artifacts/release/dist/public/bundle/registry/bundles/security-check.yaml +1 -1
  109. package/artifacts/release/dist/public/bundle/registry/bundles/test-intent-lock.yaml +1 -1
  110. package/artifacts/release/dist/public/bundle/registry/bundles/tracebank.yaml +1 -1
  111. package/artifacts/release/dist/public/bundle/registry/bundles/vision.yaml +1 -1
  112. package/artifacts/release/dist/public/bundle/registry/omg-capability.schema.json +1 -1
  113. package/artifacts/release/dist/public/bundle/settings.json +3 -3
  114. package/artifacts/release/dist/public/manifest.json +30 -40
  115. package/artifacts/release/plugins/advanced/plugin.json +26 -9
  116. package/artifacts/release/registry/bundles/algorithms.yaml +1 -1
  117. package/artifacts/release/registry/bundles/api-twin.yaml +1 -1
  118. package/artifacts/release/registry/bundles/claim-judge.yaml +1 -1
  119. package/artifacts/release/registry/bundles/control-plane.yaml +1 -1
  120. package/artifacts/release/registry/bundles/data-lineage.yaml +1 -1
  121. package/artifacts/release/registry/bundles/delta-classifier.yaml +1 -1
  122. package/artifacts/release/registry/bundles/eval-gate.yaml +1 -1
  123. package/artifacts/release/registry/bundles/health.yaml +1 -1
  124. package/artifacts/release/registry/bundles/hook-governor.yaml +1 -1
  125. package/artifacts/release/registry/bundles/incident-replay.yaml +1 -1
  126. package/artifacts/release/registry/bundles/lsp-pack.yaml +1 -1
  127. package/artifacts/release/registry/bundles/mcp-fabric.yaml +1 -1
  128. package/artifacts/release/registry/bundles/plan-council.yaml +1 -1
  129. package/artifacts/release/registry/bundles/preflight.yaml +1 -1
  130. package/artifacts/release/registry/bundles/proof-gate.yaml +1 -1
  131. package/artifacts/release/registry/bundles/remote-supervisor.yaml +1 -1
  132. package/artifacts/release/registry/bundles/robotics.yaml +1 -1
  133. package/artifacts/release/registry/bundles/secure-worktree-pipeline.yaml +1 -1
  134. package/artifacts/release/registry/bundles/security-check.yaml +1 -1
  135. package/artifacts/release/registry/bundles/test-intent-lock.yaml +1 -1
  136. package/artifacts/release/registry/bundles/tracebank.yaml +1 -1
  137. package/artifacts/release/registry/bundles/vision.yaml +1 -1
  138. package/artifacts/release/registry/omg-capability.schema.json +1 -1
  139. package/artifacts/release/settings.json +3 -3
  140. package/build/lib/commands/OMG:profile-review.md +43 -0
  141. package/build/lib/commands/OMG:validate.md +59 -0
  142. package/build/lib/control_plane/service.py +40 -1
  143. package/build/lib/hooks/_agent_registry.py +2 -0
  144. package/build/lib/hooks/firewall.py +263 -4
  145. package/build/lib/hooks/intentgate-keyword-detector.py +15 -3
  146. package/build/lib/hooks/policy_engine.py +77 -0
  147. package/build/lib/hooks/prompt-enhancer.py +146 -0
  148. package/build/lib/hooks/session-end-capture.py +374 -6
  149. package/build/lib/hooks/session-start.py +13 -35
  150. package/build/lib/hooks/setup_wizard.py +333 -1
  151. package/build/lib/hooks/shadow_manager.py +111 -2
  152. package/build/lib/hooks/stop_dispatcher.py +108 -4
  153. package/build/lib/plugins/advanced/plugin.json +26 -9
  154. package/build/lib/plugins/core/plugin.json +44 -11
  155. package/build/lib/registry/bundles/algorithms.yaml +1 -1
  156. package/build/lib/registry/bundles/api-twin.yaml +1 -1
  157. package/build/lib/registry/bundles/claim-judge.yaml +1 -1
  158. package/build/lib/registry/bundles/control-plane.yaml +1 -1
  159. package/build/lib/registry/bundles/data-lineage.yaml +1 -1
  160. package/build/lib/registry/bundles/delta-classifier.yaml +1 -1
  161. package/build/lib/registry/bundles/eval-gate.yaml +1 -1
  162. package/build/lib/registry/bundles/health.yaml +1 -1
  163. package/build/lib/registry/bundles/hook-governor.yaml +1 -1
  164. package/build/lib/registry/bundles/incident-replay.yaml +1 -1
  165. package/build/lib/registry/bundles/lsp-pack.yaml +1 -1
  166. package/build/lib/registry/bundles/mcp-fabric.yaml +1 -1
  167. package/build/lib/registry/bundles/plan-council.yaml +1 -1
  168. package/build/lib/registry/bundles/preflight.yaml +1 -1
  169. package/build/lib/registry/bundles/proof-gate.yaml +1 -1
  170. package/build/lib/registry/bundles/remote-supervisor.yaml +1 -1
  171. package/build/lib/registry/bundles/robotics.yaml +1 -1
  172. package/build/lib/registry/bundles/secure-worktree-pipeline.yaml +1 -1
  173. package/build/lib/registry/bundles/security-check.yaml +1 -1
  174. package/build/lib/registry/bundles/test-intent-lock.yaml +1 -1
  175. package/build/lib/registry/bundles/tracebank.yaml +1 -1
  176. package/build/lib/registry/bundles/vision.yaml +1 -1
  177. package/build/lib/registry/omg-capability.schema.json +1 -1
  178. package/build/lib/runtime/adoption.py +1 -1
  179. package/build/lib/runtime/background_verification.py +62 -0
  180. package/build/lib/runtime/claim_judge.py +165 -5
  181. package/build/lib/runtime/compat.py +15 -1
  182. package/build/lib/runtime/context_engine.py +261 -4
  183. package/build/lib/runtime/contract_compiler.py +370 -93
  184. package/build/lib/runtime/defense_state.py +79 -8
  185. package/build/lib/runtime/delta_classifier.py +80 -2
  186. package/build/lib/runtime/evidence_query.py +56 -4
  187. package/build/lib/runtime/evidence_registry.py +16 -0
  188. package/build/lib/runtime/evidence_requirements.py +47 -0
  189. package/build/lib/runtime/forge_agents.py +179 -9
  190. package/build/lib/runtime/forge_contracts.py +208 -2
  191. package/build/lib/runtime/interaction_journal.py +318 -42
  192. package/build/lib/runtime/memory_store.py +134 -1
  193. package/build/lib/runtime/mutation_gate.py +57 -11
  194. package/build/lib/runtime/omg_compat_contract_snapshot.json +2 -2
  195. package/build/lib/runtime/omg_mcp_server.py +14 -4
  196. package/build/lib/runtime/preflight.py +14 -0
  197. package/build/lib/runtime/profile_io.py +294 -0
  198. package/build/lib/runtime/proof_gate.py +122 -7
  199. package/build/lib/runtime/release_run_coordinator.py +339 -0
  200. package/build/lib/runtime/release_surfaces.py +243 -0
  201. package/build/lib/runtime/rollback_manifest.py +136 -0
  202. package/build/lib/runtime/router_critics.py +50 -0
  203. package/build/lib/runtime/runtime_contracts.py +137 -0
  204. package/build/lib/runtime/security_check.py +16 -0
  205. package/build/lib/runtime/session_health.py +60 -16
  206. package/build/lib/runtime/team_router.py +156 -13
  207. package/build/lib/runtime/test_intent_lock.py +102 -0
  208. package/build/lib/runtime/tool_plan_gate.py +249 -24
  209. package/build/lib/runtime/validate.py +194 -0
  210. package/build/lib/runtime/verification_controller.py +52 -2
  211. package/commands/OMG:diagnose-plugins.md +33 -0
  212. package/commands/OMG:profile-review.md +43 -0
  213. package/commands/OMG:setup.md +4 -1
  214. package/commands/OMG:validate.md +59 -0
  215. package/control_plane/service.py +40 -1
  216. package/dist/enterprise/bundle/.claude-plugin/marketplace.json +3 -3
  217. package/dist/enterprise/bundle/.claude-plugin/plugin.json +1 -1
  218. package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +1 -1
  219. package/dist/enterprise/bundle/plugins/advanced/plugin.json +26 -9
  220. package/dist/enterprise/bundle/registry/bundles/algorithms.yaml +1 -1
  221. package/dist/enterprise/bundle/registry/bundles/api-twin.yaml +1 -1
  222. package/dist/enterprise/bundle/registry/bundles/claim-judge.yaml +1 -1
  223. package/dist/enterprise/bundle/registry/bundles/control-plane.yaml +1 -1
  224. package/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +1 -1
  225. package/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +1 -1
  226. package/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +1 -1
  227. package/dist/enterprise/bundle/registry/bundles/health.yaml +1 -1
  228. package/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +1 -1
  229. package/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +1 -1
  230. package/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +1 -1
  231. package/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +1 -1
  232. package/dist/enterprise/bundle/registry/bundles/plan-council.yaml +1 -1
  233. package/dist/enterprise/bundle/registry/bundles/preflight.yaml +1 -1
  234. package/dist/enterprise/bundle/registry/bundles/proof-gate.yaml +1 -1
  235. package/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +1 -1
  236. package/dist/enterprise/bundle/registry/bundles/robotics.yaml +1 -1
  237. package/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
  238. package/dist/enterprise/bundle/registry/bundles/security-check.yaml +1 -1
  239. package/dist/enterprise/bundle/registry/bundles/test-intent-lock.yaml +1 -1
  240. package/dist/enterprise/bundle/registry/bundles/tracebank.yaml +1 -1
  241. package/dist/enterprise/bundle/registry/bundles/vision.yaml +1 -1
  242. package/dist/enterprise/bundle/registry/omg-capability.schema.json +1 -1
  243. package/dist/enterprise/bundle/settings.json +3 -3
  244. package/dist/enterprise/manifest.json +30 -40
  245. package/dist/oh_my_god-2.1.4-py3-none-any.whl +0 -0
  246. package/dist/oh_my_god-2.1.4.tar.gz +0 -0
  247. package/dist/public/bundle/.claude-plugin/marketplace.json +3 -3
  248. package/dist/public/bundle/.claude-plugin/plugin.json +1 -1
  249. package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +1 -1
  250. package/dist/public/bundle/plugins/advanced/plugin.json +26 -9
  251. package/dist/public/bundle/registry/bundles/algorithms.yaml +1 -1
  252. package/dist/public/bundle/registry/bundles/api-twin.yaml +1 -1
  253. package/dist/public/bundle/registry/bundles/claim-judge.yaml +1 -1
  254. package/dist/public/bundle/registry/bundles/control-plane.yaml +1 -1
  255. package/dist/public/bundle/registry/bundles/data-lineage.yaml +1 -1
  256. package/dist/public/bundle/registry/bundles/delta-classifier.yaml +1 -1
  257. package/dist/public/bundle/registry/bundles/eval-gate.yaml +1 -1
  258. package/dist/public/bundle/registry/bundles/health.yaml +1 -1
  259. package/dist/public/bundle/registry/bundles/hook-governor.yaml +1 -1
  260. package/dist/public/bundle/registry/bundles/incident-replay.yaml +1 -1
  261. package/dist/public/bundle/registry/bundles/lsp-pack.yaml +1 -1
  262. package/dist/public/bundle/registry/bundles/mcp-fabric.yaml +1 -1
  263. package/dist/public/bundle/registry/bundles/plan-council.yaml +1 -1
  264. package/dist/public/bundle/registry/bundles/preflight.yaml +1 -1
  265. package/dist/public/bundle/registry/bundles/proof-gate.yaml +1 -1
  266. package/dist/public/bundle/registry/bundles/remote-supervisor.yaml +1 -1
  267. package/dist/public/bundle/registry/bundles/robotics.yaml +1 -1
  268. package/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
  269. package/dist/public/bundle/registry/bundles/security-check.yaml +1 -1
  270. package/dist/public/bundle/registry/bundles/test-intent-lock.yaml +1 -1
  271. package/dist/public/bundle/registry/bundles/tracebank.yaml +1 -1
  272. package/dist/public/bundle/registry/bundles/vision.yaml +1 -1
  273. package/dist/public/bundle/registry/omg-capability.schema.json +1 -1
  274. package/dist/public/bundle/settings.json +3 -3
  275. package/dist/public/manifest.json +30 -40
  276. package/docs/install/opencode.md +30 -0
  277. package/docs/proof.md +11 -0
  278. package/docs/release-checklist.md +14 -1
  279. package/hooks/_agent_registry.py +2 -0
  280. package/hooks/firewall.py +263 -4
  281. package/hooks/intentgate-keyword-detector.py +15 -3
  282. package/hooks/policy_engine.py +77 -0
  283. package/hooks/prompt-enhancer.py +146 -0
  284. package/hooks/session-end-capture.py +374 -6
  285. package/hooks/session-start.py +13 -35
  286. package/hooks/setup_wizard.py +342 -2
  287. package/hooks/shadow_manager.py +111 -2
  288. package/hooks/stop_dispatcher.py +108 -4
  289. package/hud/omg-hud.mjs +30 -6
  290. package/lab/pipeline.py +197 -26
  291. package/package.json +1 -1
  292. package/plugins/advanced/plugin.json +26 -9
  293. package/plugins/core/plugin.json +51 -12
  294. package/pyproject.toml +10 -2
  295. package/registry/bundles/algorithms.yaml +1 -1
  296. package/registry/bundles/api-twin.yaml +1 -1
  297. package/registry/bundles/claim-judge.yaml +1 -1
  298. package/registry/bundles/control-plane.yaml +1 -1
  299. package/registry/bundles/data-lineage.yaml +1 -1
  300. package/registry/bundles/delta-classifier.yaml +1 -1
  301. package/registry/bundles/eval-gate.yaml +1 -1
  302. package/registry/bundles/health.yaml +1 -1
  303. package/registry/bundles/hook-governor.yaml +1 -1
  304. package/registry/bundles/incident-replay.yaml +1 -1
  305. package/registry/bundles/lsp-pack.yaml +1 -1
  306. package/registry/bundles/mcp-fabric.yaml +1 -1
  307. package/registry/bundles/plan-council.yaml +1 -1
  308. package/registry/bundles/preflight.yaml +1 -1
  309. package/registry/bundles/proof-gate.yaml +1 -1
  310. package/registry/bundles/remote-supervisor.yaml +1 -1
  311. package/registry/bundles/robotics.yaml +1 -1
  312. package/registry/bundles/secure-worktree-pipeline.yaml +1 -1
  313. package/registry/bundles/security-check.yaml +1 -1
  314. package/registry/bundles/test-intent-lock.yaml +1 -1
  315. package/registry/bundles/tracebank.yaml +1 -1
  316. package/registry/bundles/vision.yaml +1 -1
  317. package/registry/omg-capability.schema.json +1 -1
  318. package/runtime/adoption.py +7 -5
  319. package/runtime/background_verification.py +62 -0
  320. package/runtime/claim_judge.py +165 -5
  321. package/runtime/compat.py +48 -1
  322. package/runtime/context_engine.py +261 -4
  323. package/runtime/contract_compiler.py +370 -93
  324. package/runtime/defense_state.py +79 -8
  325. package/runtime/delta_classifier.py +80 -2
  326. package/runtime/evidence_query.py +56 -4
  327. package/runtime/evidence_registry.py +16 -0
  328. package/runtime/evidence_requirements.py +47 -0
  329. package/runtime/forge_agents.py +179 -9
  330. package/runtime/forge_contracts.py +208 -2
  331. package/runtime/hook_governor.py +19 -1
  332. package/runtime/interaction_journal.py +318 -42
  333. package/runtime/memory_store.py +134 -1
  334. package/runtime/mutation_gate.py +57 -11
  335. package/runtime/omg_compat_contract_snapshot.json +2 -2
  336. package/runtime/omg_mcp_server.py +14 -4
  337. package/runtime/plugin_diagnostics.py +248 -0
  338. package/runtime/plugin_interop.py +1007 -0
  339. package/runtime/preflight.py +14 -0
  340. package/runtime/profile_io.py +294 -0
  341. package/runtime/proof_gate.py +122 -7
  342. package/runtime/providers/opencode_provider.py +94 -0
  343. package/runtime/release_run_coordinator.py +339 -0
  344. package/runtime/release_surfaces.py +243 -0
  345. package/runtime/rollback_manifest.py +136 -0
  346. package/runtime/router_critics.py +50 -0
  347. package/runtime/runtime_contracts.py +137 -0
  348. package/runtime/security_check.py +16 -0
  349. package/runtime/session_health.py +60 -16
  350. package/runtime/team_router.py +156 -13
  351. package/runtime/test_intent_lock.py +102 -0
  352. package/runtime/tool_plan_gate.py +218 -19
  353. package/runtime/validate.py +289 -0
  354. package/runtime/verification_controller.py +52 -2
  355. package/scripts/omg.py +306 -3
  356. package/scripts/prepare-release-proof-fixtures.py +191 -7
  357. package/scripts/print-canonical-version.py +80 -0
  358. package/scripts/sync-release-identity.py +476 -0
  359. package/scripts/validate-release-identity.py +246 -0
  360. package/scripts/verify-standalone.sh +3 -0
  361. package/settings.json +3 -3
  362. package/templates/plugins-allowlist.yaml +19 -0
  363. package/artifacts/release/dist/enterprise/bundle/.gemini/settings.json +0 -11
  364. package/artifacts/release/dist/enterprise/bundle/.kimi/mcp.json +0 -11
  365. package/artifacts/release/dist/public/bundle/.gemini/settings.json +0 -11
  366. package/artifacts/release/dist/public/bundle/.kimi/mcp.json +0 -11
  367. package/build/lib/yaml.py +0 -321
  368. package/dist/enterprise/bundle/.gemini/settings.json +0 -11
  369. package/dist/enterprise/bundle/.kimi/mcp.json +0 -11
  370. package/dist/public/bundle/.gemini/settings.json +0 -11
  371. package/dist/public/bundle/.kimi/mcp.json +0 -11
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
  import hashlib
5
5
  import asyncio
6
6
  import importlib
7
+ import importlib.util
7
8
  import json
8
9
  import os
9
10
  from pathlib import Path
@@ -20,6 +21,8 @@ import yaml
20
21
 
21
22
  from runtime.asset_loader import resolve_asset, resolve_assets
22
23
  from runtime.proof_chain import _normalize_evidence_pack
24
+ from runtime.evidence_requirements import requirements_for_profile
25
+ from runtime.runtime_contracts import schema_versions
23
26
  from runtime.adoption import (
24
27
  CANONICAL_MARKETPLACE_ID,
25
28
  CANONICAL_PACKAGE_NAME,
@@ -141,6 +144,23 @@ HOST_COMPILED_ARTIFACTS = {
141
144
  ),
142
145
  }
143
146
 
147
+ _REQUIRED_EXECUTION_PRIMITIVES = (
148
+ "release_run_coordinator_state",
149
+ "tdd_proof_chain_lock",
150
+ "rollback_manifest",
151
+ "intent_gate_state",
152
+ "profile_digest",
153
+ "session_health_state",
154
+ "council_verdicts",
155
+ "forge_starter_proof",
156
+ )
157
+
158
+ _REQUIRED_CONTEXT_METADATA = (
159
+ "context_checksum",
160
+ "profile_version",
161
+ "intent_gate_version",
162
+ )
163
+
144
164
 
145
165
  def _ensure_list(
146
166
  *,
@@ -1419,78 +1439,58 @@ def _check_mcp_fabric() -> dict[str, Any]:
1419
1439
 
1420
1440
 
1421
1441
  def _check_version_identity_drift(root: Path) -> dict[str, Any]:
1422
- """Check version/identity drift across all public surface files.
1423
-
1424
- Returns a dict with:
1425
- - status: "ok" or "error"
1426
- - blockers: list of named blockers for each mismatch
1427
- - drift_details: dict mapping file paths to their found versions
1428
- """
1429
1442
  canonical_version = CANONICAL_VERSION
1430
1443
  blockers: list[str] = []
1431
1444
  drift_details: dict[str, str] = {}
1432
-
1433
- # Files to check with their JSON paths to extract version
1434
- files_to_check = [
1435
- ("package.json", ["version"]),
1436
- ("pyproject.toml", None), # Special case: extract from version = "X.Y.Z"
1437
- ("settings.json", ["_omg", "_version"]),
1438
- (".claude-plugin/plugin.json", ["version"]),
1439
- (".claude-plugin/marketplace.json", ["version"]),
1440
- ("plugins/core/plugin.json", ["version"]),
1441
- ("plugins/advanced/plugin.json", ["version"]),
1442
- ("CHANGELOG.md", None), # Special case: check for version in header
1443
- ]
1444
-
1445
- for file_path, json_path in files_to_check:
1446
- full_path = root / file_path
1447
- if not full_path.exists():
1448
- blockers.append(f"version_drift: missing file {file_path}")
1449
- continue
1450
-
1451
- found_version = None
1452
-
1453
- try:
1454
- if file_path == "pyproject.toml":
1455
- # Extract from version = "X.Y.Z"
1456
- content = full_path.read_text(encoding="utf-8")
1457
- for line in content.split("\n"):
1458
- if line.startswith("version = "):
1459
- found_version = line.split('"')[1]
1460
- break
1461
- elif file_path == "CHANGELOG.md":
1462
- # Extract from "## X.Y.Z -" header (skip "Unreleased" section)
1463
- content = full_path.read_text(encoding="utf-8")
1464
- for line in content.split("\n"):
1465
- if line.startswith("## ") and " - " in line:
1466
- version_str = line.split(" - ")[0].replace("## ", "").strip()
1467
- if version_str.lower() != "unreleased":
1468
- found_version = version_str
1469
- break
1470
- else:
1471
- # JSON file: use json_path to navigate
1472
- data = _load_json(full_path)
1473
- current = data
1474
- if json_path:
1475
- for key in json_path:
1476
- current = current.get(key)
1477
- if current is None:
1478
- break
1479
- found_version = current
1480
- except Exception as e:
1481
- blockers.append(f"version_drift: failed to parse {file_path}: {e}")
1445
+
1446
+ from runtime.release_surfaces import AUTHORED_SURFACES
1447
+
1448
+ sync_script = Path(__file__).resolve().parents[1] / "scripts" / "sync-release-identity.py"
1449
+ if not sync_script.exists():
1450
+ return {
1451
+ "status": "error",
1452
+ "canonical_version": canonical_version,
1453
+ "blockers": ["version_drift: missing scripts/sync-release-identity.py"],
1454
+ "drift_details": {},
1455
+ }
1456
+
1457
+ spec = importlib.util.spec_from_file_location("sync_release_identity", sync_script)
1458
+ if spec is None or spec.loader is None:
1459
+ return {
1460
+ "status": "error",
1461
+ "canonical_version": canonical_version,
1462
+ "blockers": ["version_drift: unable to load scripts/sync-release-identity.py"],
1463
+ "drift_details": {},
1464
+ }
1465
+
1466
+ module = importlib.util.module_from_spec(spec)
1467
+ spec.loader.exec_module(module)
1468
+ check_surface = getattr(module, "check_surface", None)
1469
+ if not callable(check_surface):
1470
+ return {
1471
+ "status": "error",
1472
+ "canonical_version": canonical_version,
1473
+ "blockers": ["version_drift: scripts/sync-release-identity.py missing check_surface"],
1474
+ "drift_details": {},
1475
+ }
1476
+
1477
+ for surface in AUTHORED_SURFACES:
1478
+ raw_drifts = check_surface(root, surface, canonical_version)
1479
+ if not isinstance(raw_drifts, list):
1480
+ blockers.append(
1481
+ f"version_drift: {surface.file_path} has version <invalid drift payload>, expected {canonical_version}"
1482
+ )
1482
1483
  continue
1483
-
1484
- if found_version is None:
1485
- blockers.append(f"version_drift: could not extract version from {file_path}")
1486
- elif str(found_version) != canonical_version:
1484
+ for drift in raw_drifts:
1485
+ if not isinstance(drift, (tuple, list)) or len(drift) != 2:
1486
+ continue
1487
+ label, found = drift
1488
+ found_value = "<not found>" if found is None else str(found)
1487
1489
  blockers.append(
1488
- f"version_drift: {file_path} has version {found_version}, expected {canonical_version}"
1490
+ f"version_drift: {label} has version {found_value}, expected {canonical_version}"
1489
1491
  )
1490
- drift_details[file_path] = str(found_version)
1491
- else:
1492
- drift_details[file_path] = str(found_version)
1493
-
1492
+ drift_details[str(label)] = found_value
1493
+
1494
1494
  return {
1495
1495
  "status": "ok" if not blockers else "error",
1496
1496
  "canonical_version": canonical_version,
@@ -1811,6 +1811,10 @@ def build_release_readiness(
1811
1811
  checks["proof_chain"] = proof_chain_check
1812
1812
  blockers.extend(proof_chain_check.get("blockers", []))
1813
1813
 
1814
+ execution_primitives = _check_execution_primitives(output_root=output, evidence_profile="release")
1815
+ checks["execution_primitives"] = execution_primitives
1816
+ blockers.extend(execution_primitives.get("blockers", []))
1817
+
1814
1818
  security_blockers = [
1815
1819
  blocker
1816
1820
  for blocker in evidence_check.get("blockers", [])
@@ -1879,35 +1883,11 @@ def build_release_readiness(
1879
1883
 
1880
1884
 
1881
1885
  def _check_recent_evidence(output_root: Path) -> dict[str, Any]:
1882
- evidence_dir = output_root / ".omg" / "evidence"
1883
- if not evidence_dir.exists():
1884
- return {"status": "missing", "blockers": []}
1885
-
1886
- evidence_files = sorted(path for path in evidence_dir.glob("*.json") if path.is_file())
1887
- if not evidence_files:
1886
+ latest = _latest_evidence_pack(output_root)
1887
+ if latest is None:
1888
1888
  return {"status": "missing", "blockers": []}
1889
1889
 
1890
- evidence_payloads: list[tuple[Path, dict[str, Any]]] = []
1891
- for path in evidence_files:
1892
- try:
1893
- payload = _load_json(path)
1894
- except Exception:
1895
- continue
1896
- if payload.get("schema") == "EvidencePack":
1897
- try:
1898
- payload = _normalize_evidence_pack(payload)
1899
- except ValueError as exc:
1900
- return {
1901
- "status": "error",
1902
- "evidence_file": str(path.relative_to(output_root)),
1903
- "blockers": [f"invalid evidence pack: {exc}"],
1904
- }
1905
- evidence_payloads.append((path, payload))
1906
-
1907
- if not evidence_payloads:
1908
- return {"status": "missing", "blockers": []}
1909
-
1910
- evidence_path, payload = evidence_payloads[-1]
1890
+ evidence_path, payload = latest
1911
1891
  blockers: list[str] = []
1912
1892
  if not payload.get("security_scans"):
1913
1893
  blockers.append("cosmetic evidence: security_scans is empty")
@@ -1936,10 +1916,307 @@ def _check_recent_evidence(output_root: Path) -> dict[str, Any]:
1936
1916
  return {
1937
1917
  "status": "ok" if not blockers else "error",
1938
1918
  "evidence_file": str(evidence_path.relative_to(output_root)),
1919
+ "run_id": str(payload.get("run_id", "")).strip(),
1939
1920
  "blockers": blockers,
1940
1921
  }
1941
1922
 
1942
1923
 
1924
+ def _latest_evidence_pack(output_root: Path) -> tuple[Path, dict[str, Any]] | None:
1925
+ evidence_dir = output_root / ".omg" / "evidence"
1926
+ if not evidence_dir.exists():
1927
+ return None
1928
+
1929
+ evidence_files = sorted(path for path in evidence_dir.glob("*.json") if path.is_file())
1930
+ evidence_payloads: list[tuple[Path, dict[str, Any]]] = []
1931
+ for path in evidence_files:
1932
+ try:
1933
+ payload = _load_json(path)
1934
+ except Exception:
1935
+ continue
1936
+ if payload.get("schema") != "EvidencePack":
1937
+ continue
1938
+ try:
1939
+ payload = _normalize_evidence_pack(payload)
1940
+ except ValueError as exc:
1941
+ return path, {"schema": "EvidencePack", "invalid": f"invalid evidence pack: {exc}"}
1942
+ evidence_payloads.append((path, payload))
1943
+
1944
+ if not evidence_payloads:
1945
+ return None
1946
+ return evidence_payloads[-1]
1947
+
1948
+
1949
+ def _required_fields_for_module(module: str) -> list[str]:
1950
+ metadata = schema_versions().get(module, {})
1951
+ required = metadata.get("required_fields", []) if isinstance(metadata, dict) else []
1952
+ if isinstance(required, list):
1953
+ return [str(field) for field in required if str(field).strip()]
1954
+ return []
1955
+
1956
+
1957
+ def _missing_context_metadata(payload: dict[str, Any]) -> list[str]:
1958
+ missing: list[str] = []
1959
+ for key in _REQUIRED_CONTEXT_METADATA:
1960
+ value = str(payload.get(key, "")).strip()
1961
+ if not value:
1962
+ missing.append(key)
1963
+ return missing
1964
+
1965
+
1966
+ def _check_execution_primitives(*, output_root: Path, evidence_profile: str | None = None) -> dict[str, Any]:
1967
+ blockers: list[str] = []
1968
+ missing: list[str] = []
1969
+ invalid: list[str] = []
1970
+ evidence_paths: dict[str, str] = {key: "" for key in _REQUIRED_EXECUTION_PRIMITIVES}
1971
+ resolved_profile = (evidence_profile or "").strip()
1972
+ required_evidence_requirements = requirements_for_profile(resolved_profile)
1973
+
1974
+ latest = _latest_evidence_pack(output_root)
1975
+ if latest is None:
1976
+ missing.extend(list(_REQUIRED_EXECUTION_PRIMITIVES))
1977
+ blockers.extend(f"missing_execution_primitive: {item}" for item in missing)
1978
+ return {
1979
+ "status": "error",
1980
+ "run_id": "",
1981
+ "evidence_profile": resolved_profile,
1982
+ "required_evidence_requirements": list(required_evidence_requirements),
1983
+ "required": list(_REQUIRED_EXECUTION_PRIMITIVES),
1984
+ "missing": missing,
1985
+ "invalid": invalid,
1986
+ "evidence_paths": evidence_paths,
1987
+ "blockers": blockers,
1988
+ }
1989
+
1990
+ evidence_path, evidence_payload = latest
1991
+ invalid_evidence = str(evidence_payload.get("invalid", "")).strip()
1992
+ if invalid_evidence:
1993
+ invalid.append(f"release_evidence_pack:{invalid_evidence}")
1994
+ blockers.append(f"invalid_execution_primitive: release_evidence_pack: {invalid_evidence}")
1995
+ return {
1996
+ "status": "error",
1997
+ "run_id": "",
1998
+ "evidence_profile": resolved_profile,
1999
+ "required_evidence_requirements": list(required_evidence_requirements),
2000
+ "required": list(_REQUIRED_EXECUTION_PRIMITIVES),
2001
+ "missing": list(_REQUIRED_EXECUTION_PRIMITIVES),
2002
+ "invalid": invalid,
2003
+ "evidence_paths": evidence_paths,
2004
+ "blockers": blockers,
2005
+ }
2006
+
2007
+ if not resolved_profile:
2008
+ resolved_profile = str(evidence_payload.get("evidence_profile", "")).strip()
2009
+ required_evidence_requirements = requirements_for_profile(resolved_profile)
2010
+
2011
+ run_id = str(evidence_payload.get("run_id", "")).strip()
2012
+ if not run_id:
2013
+ invalid.append("run_id_unresolved")
2014
+ blockers.append("invalid_execution_primitive: run_id_unresolved")
2015
+
2016
+ evidence_metadata_missing = _missing_context_metadata(evidence_payload)
2017
+ if evidence_metadata_missing:
2018
+ invalid.append("release_evidence_pack:missing_context_metadata")
2019
+ blockers.append(
2020
+ "invalid_execution_primitive: release_evidence_pack: "
2021
+ f"missing_context_metadata={','.join(sorted(evidence_metadata_missing))}"
2022
+ )
2023
+
2024
+ checks: list[tuple[str, str, str]] = [
2025
+ ("release_run_coordinator_state", "release_run_coordinator", "ReleaseRunCoordinatorState"),
2026
+ ("rollback_manifest", "rollback_manifest", "RollbackManifest"),
2027
+ ("intent_gate_state", "intent_gate", "IntentGateDecision"),
2028
+ ("session_health_state", "session_health", "SessionHealth"),
2029
+ ("council_verdicts", "council_verdicts", "CouncilVerdicts"),
2030
+ ]
2031
+ for token, module, schema_name in checks:
2032
+ matched_path, matched_payload = _find_state_for_run(output_root=output_root, module=module, run_id=run_id)
2033
+ if matched_path is None or matched_payload is None:
2034
+ missing.append(token)
2035
+ blockers.append(f"missing_execution_primitive: {token}")
2036
+ continue
2037
+ evidence_paths[token] = str(matched_path.relative_to(output_root)).replace("\\", "/")
2038
+ schema = str(matched_payload.get("schema", "")).strip()
2039
+ if schema != schema_name:
2040
+ invalid.append(f"{token}:schema_mismatch")
2041
+ blockers.append(f"invalid_execution_primitive: {token}: schema_mismatch")
2042
+ continue
2043
+ required_fields = _required_fields_for_module(module)
2044
+ missing_fields = [field for field in required_fields if field not in matched_payload]
2045
+ if missing_fields:
2046
+ invalid.append(f"{token}:missing_fields")
2047
+ blockers.append(
2048
+ f"invalid_execution_primitive: {token}: missing_fields={','.join(sorted(missing_fields))}"
2049
+ )
2050
+ if token in {"intent_gate_state", "session_health_state", "council_verdicts"}:
2051
+ metadata_missing = _missing_context_metadata(matched_payload)
2052
+ if metadata_missing:
2053
+ invalid.append(f"{token}:missing_context_metadata")
2054
+ blockers.append(
2055
+ f"invalid_execution_primitive: {token}: "
2056
+ f"missing_context_metadata={','.join(sorted(metadata_missing))}"
2057
+ )
2058
+
2059
+ profile_path = output_root / ".omg" / "state" / "profile.yaml"
2060
+ if not profile_path.exists():
2061
+ missing.append("profile_digest")
2062
+ blockers.append("missing_execution_primitive: profile_digest")
2063
+ else:
2064
+ evidence_paths["profile_digest"] = str(profile_path.relative_to(output_root)).replace("\\", "/")
2065
+ try:
2066
+ profile_payload = yaml.safe_load(profile_path.read_text(encoding="utf-8"))
2067
+ except Exception:
2068
+ profile_payload = None
2069
+ profile_version = ""
2070
+ if isinstance(profile_payload, dict):
2071
+ profile_version = str(
2072
+ profile_payload.get("profile_version")
2073
+ or profile_payload.get("version")
2074
+ or ""
2075
+ ).strip()
2076
+ if not profile_version:
2077
+ provenance = profile_payload.get("profile_provenance")
2078
+ if isinstance(provenance, dict):
2079
+ profile_version = str(
2080
+ provenance.get("checksum")
2081
+ or provenance.get("version")
2082
+ or ""
2083
+ ).strip()
2084
+ if not profile_version:
2085
+ invalid.append("profile_digest:missing_profile_version")
2086
+ blockers.append("invalid_execution_primitive: profile_digest: missing_profile_version")
2087
+
2088
+ lock_path, lock_payload = _find_test_intent_lock(output_root=output_root, run_id=run_id, evidence_payload=evidence_payload)
2089
+ if lock_path is None or lock_payload is None:
2090
+ missing.append("tdd_proof_chain_lock")
2091
+ blockers.append("missing_execution_primitive: tdd_proof_chain_lock")
2092
+ else:
2093
+ evidence_paths["tdd_proof_chain_lock"] = str(lock_path.relative_to(output_root)).replace("\\", "/")
2094
+ lock_status = str(lock_payload.get("status", "")).strip().lower()
2095
+ if lock_status in {"", "error", "blocked"}:
2096
+ invalid.append("tdd_proof_chain_lock:status_invalid")
2097
+ blockers.append("invalid_execution_primitive: tdd_proof_chain_lock: status_invalid")
2098
+
2099
+ forge_path, forge_payload = _find_forge_starter_proof(output_root=output_root, run_id=run_id)
2100
+ if forge_path is None or forge_payload is None:
2101
+ missing.append("forge_starter_proof")
2102
+ blockers.append("missing_execution_primitive: forge_starter_proof")
2103
+ else:
2104
+ evidence_paths["forge_starter_proof"] = str(forge_path.relative_to(output_root)).replace("\\", "/")
2105
+ forge_schema = str(forge_payload.get("schema", "")).strip()
2106
+ if forge_schema != "ForgeSpecialistDispatchEvidence":
2107
+ invalid.append("forge_starter_proof:schema_mismatch")
2108
+ blockers.append("invalid_execution_primitive: forge_starter_proof: schema_mismatch")
2109
+ if forge_payload.get("proof_backed") is not True:
2110
+ invalid.append("forge_starter_proof:not_proof_backed")
2111
+ blockers.append("invalid_execution_primitive: forge_starter_proof: proof_backed_false")
2112
+ forge_metadata_missing = _missing_context_metadata(forge_payload)
2113
+ if forge_metadata_missing:
2114
+ invalid.append("forge_starter_proof:missing_context_metadata")
2115
+ blockers.append(
2116
+ "invalid_execution_primitive: forge_starter_proof: "
2117
+ f"missing_context_metadata={','.join(sorted(forge_metadata_missing))}"
2118
+ )
2119
+
2120
+ return {
2121
+ "status": "ok" if not blockers else "error",
2122
+ "run_id": run_id,
2123
+ "evidence_profile": resolved_profile,
2124
+ "required_evidence_requirements": list(required_evidence_requirements),
2125
+ "evidence_pack": str(evidence_path.relative_to(output_root)).replace("\\", "/"),
2126
+ "required": list(_REQUIRED_EXECUTION_PRIMITIVES),
2127
+ "missing": sorted(set(missing)),
2128
+ "invalid": sorted(set(invalid)),
2129
+ "evidence_paths": evidence_paths,
2130
+ "blockers": blockers,
2131
+ }
2132
+
2133
+
2134
+ def _find_state_for_run(
2135
+ *,
2136
+ output_root: Path,
2137
+ module: str,
2138
+ run_id: str,
2139
+ ) -> tuple[Path | None, dict[str, Any] | None]:
2140
+ state_dir = output_root / ".omg" / "state" / module
2141
+ if not state_dir.exists():
2142
+ return None, None
2143
+
2144
+ preferred = state_dir / f"{run_id}.json"
2145
+ if run_id and preferred.exists():
2146
+ try:
2147
+ payload = _load_json(preferred)
2148
+ except Exception:
2149
+ payload = {}
2150
+ if isinstance(payload, dict):
2151
+ return preferred, payload
2152
+
2153
+ for path in sorted(state_dir.glob("*.json")):
2154
+ try:
2155
+ payload = _load_json(path)
2156
+ except Exception:
2157
+ continue
2158
+ if not isinstance(payload, dict):
2159
+ continue
2160
+ if run_id and str(payload.get("run_id", "")).strip() != run_id:
2161
+ continue
2162
+ return path, payload
2163
+ return None, None
2164
+
2165
+
2166
+ def _find_test_intent_lock(
2167
+ *,
2168
+ output_root: Path,
2169
+ run_id: str,
2170
+ evidence_payload: dict[str, Any],
2171
+ ) -> tuple[Path | None, dict[str, Any] | None]:
2172
+ lock_dir = output_root / ".omg" / "state" / "test-intent-lock"
2173
+ if not lock_dir.exists():
2174
+ return None, None
2175
+
2176
+ lock_id = ""
2177
+ test_delta = evidence_payload.get("test_delta")
2178
+ if isinstance(test_delta, dict):
2179
+ lock_id = str(test_delta.get("lock_id", "")).strip()
2180
+
2181
+ for path in sorted(lock_dir.glob("*.json")):
2182
+ try:
2183
+ payload = _load_json(path)
2184
+ except Exception:
2185
+ continue
2186
+ if not isinstance(payload, dict):
2187
+ continue
2188
+ payload_lock_id = str(payload.get("lock_id", "")).strip()
2189
+ if lock_id and payload_lock_id == lock_id:
2190
+ return path, payload
2191
+ intent = payload.get("intent")
2192
+ if isinstance(intent, dict):
2193
+ intent_run = str(intent.get("run_id", "")).strip()
2194
+ if run_id and intent_run == run_id:
2195
+ return path, payload
2196
+ payload_run = str(payload.get("run_id", "")).strip()
2197
+ if run_id and payload_run == run_id:
2198
+ return path, payload
2199
+ return None, None
2200
+
2201
+
2202
+ def _find_forge_starter_proof(*, output_root: Path, run_id: str) -> tuple[Path | None, dict[str, Any] | None]:
2203
+ evidence_dir = output_root / ".omg" / "evidence"
2204
+ if not evidence_dir.exists():
2205
+ return None, None
2206
+ for path in sorted(evidence_dir.glob("forge-specialists-*.json")):
2207
+ try:
2208
+ payload = _load_json(path)
2209
+ except Exception:
2210
+ continue
2211
+ if not isinstance(payload, dict):
2212
+ continue
2213
+ payload_run = str(payload.get("run_id", "")).strip()
2214
+ if run_id and payload_run and payload_run != run_id:
2215
+ continue
2216
+ return path, payload
2217
+ return None, None
2218
+
2219
+
1943
2220
  def _check_test_intent_claims(payload: dict[str, Any]) -> list[str]:
1944
2221
  test_delta = payload.get("test_delta")
1945
2222
  claims = payload.get("claims", [])
@@ -10,19 +10,23 @@ from typing import Any
10
10
  _DEFENSE_STATE_REL_PATH = Path(".omg") / "state" / "defense_state" / "current.json"
11
11
  _CONTEXT_PRESSURE_REL_PATH = Path(".omg") / "state" / ".context-pressure.json"
12
12
  _UNTRUSTED_STATE_REL_PATH = Path(".omg") / "state" / "untrusted-content.json"
13
+ _ACTIVE_RUN_REL_PATH = Path(".omg") / "shadow" / "active-run"
14
+ _INTENT_GATE_REL_PATH = Path(".omg") / "state" / "intent_gate"
13
15
 
14
16
  _SAFE_STATE: dict[str, Any] = {
15
17
  "risk_level": "low",
16
18
  "injection_hits": 0,
17
19
  "contamination_score": 0.0,
18
20
  "overthinking_score": 0.0,
21
+ "premature_fixer_score": 0.0,
22
+ "clarification_sensitive": False,
19
23
  "actions": [],
20
24
  "updated_at": "",
21
25
  "reasons": [],
22
26
  "thresholds": {
23
27
  "critical": {"injection_hits": 3, "contamination_score": 0.7},
24
28
  "high": {"injection_hits": 1, "contamination_score": 0.4},
25
- "medium": {"overthinking_score": 0.5},
29
+ "medium": {"overthinking_score": 0.5, "premature_fixer_score": 0.5},
26
30
  },
27
31
  "context_pressure": {
28
32
  "tool_count": 0,
@@ -44,6 +48,7 @@ class DefenseState:
44
48
  injection_hits: int = 0,
45
49
  contamination_score: float = 0.0,
46
50
  overthinking_score: float = 0.0,
51
+ premature_fixer_score: float | None = None,
47
52
  ) -> dict[str, Any]:
48
53
  pressure = self._read_json(self.project_dir / _CONTEXT_PRESSURE_REL_PATH)
49
54
  pressure_tool_count = self._to_int(pressure.get("tool_count"), default=0)
@@ -52,28 +57,49 @@ class DefenseState:
52
57
  if pressure_threshold > 0:
53
58
  pressure_ratio = pressure_tool_count / pressure_threshold
54
59
  combined_overthinking = max(float(overthinking_score), pressure_ratio)
60
+ normalized_injection_hits = max(0, int(injection_hits))
61
+ normalized_contamination = self._clamp_score(contamination_score)
62
+ normalized_overthinking = self._clamp_score(combined_overthinking)
63
+
64
+ clarification = self._read_clarification_signal()
65
+ clarification_sensitive = bool(
66
+ clarification["requires_clarification"]
67
+ or clarification["intent_class"] == "ambiguous_config"
68
+ )
69
+ premature_fixer_score = self._compute_premature_fixer_score(
70
+ clarification_sensitive=clarification_sensitive,
71
+ requires_clarification=bool(clarification["requires_clarification"]),
72
+ confidence=self._to_float(clarification.get("confidence"), default=0.0),
73
+ injection_hits=normalized_injection_hits,
74
+ contamination_score=normalized_contamination,
75
+ overthinking_score=normalized_overthinking,
76
+ )
77
+ scanner_premature_fixer = self._clamp_score(premature_fixer_score)
78
+ premature_fixer_score = max(premature_fixer_score, scanner_premature_fixer)
55
79
 
56
80
  trust_posture = self._read_trust_posture()
57
81
  level, actions, reasons = self._score(
58
- injection_hits=max(0, int(injection_hits)),
59
- contamination_score=self._clamp_score(contamination_score),
60
- overthinking_score=self._clamp_score(combined_overthinking),
82
+ injection_hits=normalized_injection_hits,
83
+ contamination_score=normalized_contamination,
84
+ overthinking_score=normalized_overthinking,
61
85
  )
62
86
  if pressure_ratio >= 1.0:
63
87
  reasons.append("context pressure is above configured threshold")
64
88
 
65
89
  state: dict[str, Any] = {
66
90
  "risk_level": level,
67
- "injection_hits": max(0, int(injection_hits)),
68
- "contamination_score": self._clamp_score(contamination_score),
69
- "overthinking_score": self._clamp_score(combined_overthinking),
91
+ "injection_hits": normalized_injection_hits,
92
+ "contamination_score": normalized_contamination,
93
+ "overthinking_score": normalized_overthinking,
94
+ "premature_fixer_score": round(premature_fixer_score, 4),
95
+ "clarification_sensitive": clarification_sensitive,
70
96
  "actions": actions,
71
97
  "updated_at": datetime.now(timezone.utc).isoformat(),
72
98
  "reasons": reasons,
73
99
  "thresholds": {
74
100
  "critical": {"injection_hits": 3, "contamination_score": 0.7},
75
101
  "high": {"injection_hits": 1, "contamination_score": 0.4},
76
- "medium": {"overthinking_score": 0.5},
102
+ "medium": {"overthinking_score": 0.5, "premature_fixer_score": 0.5},
77
103
  },
78
104
  "context_pressure": {
79
105
  "tool_count": pressure_tool_count,
@@ -96,6 +122,8 @@ class DefenseState:
96
122
  "injection_hits": self._to_int(payload.get("injection_hits"), default=0),
97
123
  "contamination_score": self._clamp_score(payload.get("contamination_score", 0.0)),
98
124
  "overthinking_score": self._clamp_score(payload.get("overthinking_score", 0.0)),
125
+ "premature_fixer_score": self._clamp_score(payload.get("premature_fixer_score", 0.0)),
126
+ "clarification_sensitive": bool(payload.get("clarification_sensitive", False)),
99
127
  "actions": self._to_str_list(payload.get("actions")),
100
128
  "updated_at": str(payload.get("updated_at", "")),
101
129
  "reasons": self._to_str_list(payload.get("reasons")),
@@ -105,6 +133,49 @@ class DefenseState:
105
133
  "action_recommendations": self._to_str_list(payload.get("action_recommendations")),
106
134
  }
107
135
 
136
+ def _read_clarification_signal(self) -> dict[str, Any]:
137
+ active_run_path = self.project_dir / _ACTIVE_RUN_REL_PATH
138
+ if not active_run_path.exists():
139
+ return {"requires_clarification": False, "intent_class": "", "confidence": 0.0}
140
+
141
+ try:
142
+ run_id = active_run_path.read_text(encoding="utf-8").strip()
143
+ except OSError:
144
+ run_id = ""
145
+ if not run_id:
146
+ return {"requires_clarification": False, "intent_class": "", "confidence": 0.0}
147
+
148
+ intent_gate_path = self.project_dir / _INTENT_GATE_REL_PATH / f"{run_id}.json"
149
+ payload = self._read_json(intent_gate_path)
150
+ confidence = self._clamp_score(self._to_float(payload.get("confidence"), default=0.0))
151
+ return {
152
+ "requires_clarification": bool(payload.get("requires_clarification") is True),
153
+ "intent_class": str(payload.get("intent_class", "")).strip(),
154
+ "confidence": confidence,
155
+ }
156
+
157
+ def _compute_premature_fixer_score(
158
+ self,
159
+ *,
160
+ clarification_sensitive: bool,
161
+ requires_clarification: bool,
162
+ confidence: float,
163
+ injection_hits: int,
164
+ contamination_score: float,
165
+ overthinking_score: float,
166
+ ) -> float:
167
+ if not clarification_sensitive:
168
+ return 0.0
169
+
170
+ score = 0.0
171
+ if requires_clarification:
172
+ score += 0.2
173
+ score += min(0.2, self._clamp_score(confidence) * 0.2)
174
+ score += min(0.2, max(0, injection_hits) * 0.1)
175
+ score += min(0.2, self._clamp_score(contamination_score) * 0.25)
176
+ score += min(0.2, self._clamp_score(overthinking_score) * 0.25)
177
+ return self._clamp_score(score)
178
+
108
179
  def _read_trust_posture(self) -> str:
109
180
  payload = self._read_json(self.project_dir / _UNTRUSTED_STATE_REL_PATH)
110
181
  scores = payload.get("trust_scores") if isinstance(payload, dict) else {}