@trac3er/oh-my-god 2.0.3 → 2.0.5

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 (259) hide show
  1. package/.agents/skills/omg/AGENTS.fragment.md +5 -0
  2. package/.agents/skills/omg/algorithms/SKILL.md +11 -0
  3. package/.agents/skills/omg/algorithms/openai.yaml +11 -0
  4. package/.agents/skills/omg/api-twin/SKILL.md +11 -0
  5. package/.agents/skills/omg/api-twin/openai.yaml +12 -0
  6. package/.agents/skills/omg/codex-mcp.toml +4 -0
  7. package/.agents/skills/omg/control-plane/SKILL.md +11 -0
  8. package/.agents/skills/omg/control-plane/openai.yaml +14 -0
  9. package/.agents/skills/omg/data-lineage/SKILL.md +11 -0
  10. package/.agents/skills/omg/data-lineage/openai.yaml +12 -0
  11. package/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
  12. package/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
  13. package/.agents/skills/omg/eval-gate/SKILL.md +11 -0
  14. package/.agents/skills/omg/eval-gate/openai.yaml +12 -0
  15. package/.agents/skills/omg/health/SKILL.md +11 -0
  16. package/.agents/skills/omg/health/openai.yaml +11 -0
  17. package/.agents/skills/omg/hook-governor/SKILL.md +11 -0
  18. package/.agents/skills/omg/hook-governor/openai.yaml +11 -0
  19. package/.agents/skills/omg/incident-replay/SKILL.md +11 -0
  20. package/.agents/skills/omg/incident-replay/openai.yaml +12 -0
  21. package/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
  22. package/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
  23. package/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
  24. package/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
  25. package/.agents/skills/omg/preflight/SKILL.md +11 -0
  26. package/.agents/skills/omg/preflight/openai.yaml +12 -0
  27. package/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
  28. package/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
  29. package/.agents/skills/omg/robotics/SKILL.md +11 -0
  30. package/.agents/skills/omg/robotics/openai.yaml +11 -0
  31. package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
  32. package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
  33. package/.agents/skills/omg/security-check/SKILL.md +11 -0
  34. package/.agents/skills/omg/security-check/openai.yaml +13 -0
  35. package/.agents/skills/omg/tracebank/SKILL.md +11 -0
  36. package/.agents/skills/omg/tracebank/openai.yaml +12 -0
  37. package/.agents/skills/omg/vision/SKILL.md +11 -0
  38. package/.agents/skills/omg/vision/openai.yaml +11 -0
  39. package/.claude-plugin/marketplace.json +3 -3
  40. package/.claude-plugin/plugin.json +1 -1
  41. package/.claude-plugin/scripts/uninstall.sh +2 -2
  42. package/.mcp.json +20 -4
  43. package/CHANGELOG.md +10 -0
  44. package/OMG-setup.sh +9 -3
  45. package/OMG_COMPAT_CONTRACT.md +92 -0
  46. package/README.md +24 -4
  47. package/SECURITY.md +6 -0
  48. package/commands/OMG:api-twin.md +22 -0
  49. package/commands/OMG:preflight.md +26 -0
  50. package/commands/OMG:security-check.md +28 -0
  51. package/commands/__init__.py +1 -0
  52. package/control_plane/__init__.py +2 -0
  53. package/control_plane/openapi.yaml +228 -0
  54. package/control_plane/server.py +123 -0
  55. package/control_plane/service.py +185 -0
  56. package/dist/enterprise/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
  57. package/dist/enterprise/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
  58. package/dist/enterprise/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
  59. package/dist/enterprise/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
  60. package/dist/enterprise/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
  61. package/dist/enterprise/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
  62. package/dist/enterprise/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
  63. package/dist/enterprise/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
  64. package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
  65. package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
  66. package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
  67. package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
  68. package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
  69. package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
  70. package/dist/enterprise/bundle/.agents/skills/omg/health/SKILL.md +11 -0
  71. package/dist/enterprise/bundle/.agents/skills/omg/health/openai.yaml +11 -0
  72. package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
  73. package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
  74. package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
  75. package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
  76. package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
  77. package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
  78. package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
  79. package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
  80. package/dist/enterprise/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
  81. package/dist/enterprise/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
  82. package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
  83. package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
  84. package/dist/enterprise/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
  85. package/dist/enterprise/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
  86. package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
  87. package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
  88. package/dist/enterprise/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
  89. package/dist/enterprise/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
  90. package/dist/enterprise/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
  91. package/dist/enterprise/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
  92. package/dist/enterprise/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
  93. package/dist/enterprise/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
  94. package/dist/enterprise/bundle/.claude-plugin/marketplace.json +36 -0
  95. package/dist/enterprise/bundle/.claude-plugin/plugin.json +23 -0
  96. package/dist/enterprise/bundle/.mcp.json +40 -0
  97. package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +92 -0
  98. package/dist/enterprise/bundle/registry/bundles/algorithms.yaml +45 -0
  99. package/dist/enterprise/bundle/registry/bundles/api-twin.yaml +48 -0
  100. package/dist/enterprise/bundle/registry/bundles/control-plane.yaml +61 -0
  101. package/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +47 -0
  102. package/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +47 -0
  103. package/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +47 -0
  104. package/dist/enterprise/bundle/registry/bundles/health.yaml +45 -0
  105. package/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +97 -0
  106. package/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +47 -0
  107. package/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +48 -0
  108. package/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +53 -0
  109. package/dist/enterprise/bundle/registry/bundles/preflight.yaml +48 -0
  110. package/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +49 -0
  111. package/dist/enterprise/bundle/registry/bundles/robotics.yaml +45 -0
  112. package/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
  113. package/dist/enterprise/bundle/registry/bundles/security-check.yaml +50 -0
  114. package/dist/enterprise/bundle/registry/bundles/tracebank.yaml +47 -0
  115. package/dist/enterprise/bundle/registry/bundles/vision.yaml +45 -0
  116. package/dist/enterprise/bundle/registry/omg-capability.schema.json +80 -0
  117. package/dist/enterprise/bundle/settings.json +381 -0
  118. package/dist/enterprise/manifest.json +255 -0
  119. package/dist/public/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
  120. package/dist/public/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
  121. package/dist/public/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
  122. package/dist/public/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
  123. package/dist/public/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
  124. package/dist/public/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
  125. package/dist/public/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
  126. package/dist/public/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
  127. package/dist/public/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
  128. package/dist/public/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
  129. package/dist/public/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
  130. package/dist/public/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
  131. package/dist/public/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
  132. package/dist/public/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
  133. package/dist/public/bundle/.agents/skills/omg/health/SKILL.md +11 -0
  134. package/dist/public/bundle/.agents/skills/omg/health/openai.yaml +11 -0
  135. package/dist/public/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
  136. package/dist/public/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
  137. package/dist/public/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
  138. package/dist/public/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
  139. package/dist/public/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
  140. package/dist/public/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
  141. package/dist/public/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
  142. package/dist/public/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
  143. package/dist/public/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
  144. package/dist/public/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
  145. package/dist/public/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
  146. package/dist/public/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
  147. package/dist/public/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
  148. package/dist/public/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
  149. package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
  150. package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
  151. package/dist/public/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
  152. package/dist/public/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
  153. package/dist/public/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
  154. package/dist/public/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
  155. package/dist/public/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
  156. package/dist/public/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
  157. package/dist/public/bundle/.claude-plugin/marketplace.json +36 -0
  158. package/dist/public/bundle/.claude-plugin/plugin.json +23 -0
  159. package/dist/public/bundle/.mcp.json +40 -0
  160. package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +92 -0
  161. package/dist/public/bundle/registry/bundles/algorithms.yaml +45 -0
  162. package/dist/public/bundle/registry/bundles/api-twin.yaml +48 -0
  163. package/dist/public/bundle/registry/bundles/control-plane.yaml +61 -0
  164. package/dist/public/bundle/registry/bundles/data-lineage.yaml +47 -0
  165. package/dist/public/bundle/registry/bundles/delta-classifier.yaml +47 -0
  166. package/dist/public/bundle/registry/bundles/eval-gate.yaml +47 -0
  167. package/dist/public/bundle/registry/bundles/health.yaml +45 -0
  168. package/dist/public/bundle/registry/bundles/hook-governor.yaml +97 -0
  169. package/dist/public/bundle/registry/bundles/incident-replay.yaml +47 -0
  170. package/dist/public/bundle/registry/bundles/lsp-pack.yaml +48 -0
  171. package/dist/public/bundle/registry/bundles/mcp-fabric.yaml +53 -0
  172. package/dist/public/bundle/registry/bundles/preflight.yaml +48 -0
  173. package/dist/public/bundle/registry/bundles/remote-supervisor.yaml +49 -0
  174. package/dist/public/bundle/registry/bundles/robotics.yaml +45 -0
  175. package/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
  176. package/dist/public/bundle/registry/bundles/security-check.yaml +50 -0
  177. package/dist/public/bundle/registry/bundles/tracebank.yaml +47 -0
  178. package/dist/public/bundle/registry/bundles/vision.yaml +45 -0
  179. package/dist/public/bundle/registry/omg-capability.schema.json +80 -0
  180. package/dist/public/bundle/settings.json +379 -0
  181. package/dist/public/manifest.json +255 -0
  182. package/docs/assets/omg-hud.svg +32 -0
  183. package/docs/install/claude-code.md +31 -0
  184. package/docs/install/codex.md +29 -0
  185. package/docs/migration/native-adoption.md +57 -0
  186. package/docs/proof.md +55 -0
  187. package/docs/release-checklist.md +38 -0
  188. package/docs/transcripts/crazy.md +17 -0
  189. package/docs/transcripts/setup.md +25 -0
  190. package/hooks/policy_engine.py +38 -7
  191. package/hooks/post-write.py +1 -1
  192. package/hooks/prompt-enhancer.py +1 -1
  193. package/hooks/security_validators.py +75 -0
  194. package/hooks/setup_wizard.py +43 -8
  195. package/hooks/shadow_manager.py +28 -2
  196. package/package.json +1 -1
  197. package/plugins/README.md +3 -1
  198. package/plugins/__init__.py +1 -0
  199. package/plugins/advanced/commands/OMG:deep-plan.md +1 -1
  200. package/plugins/advanced/commands/OMG:security-review.md +10 -113
  201. package/plugins/advanced/commands/OMG:ship.md +1 -1
  202. package/plugins/advanced/plugin.json +1 -10
  203. package/plugins/core/plugin.json +25 -2
  204. package/pyproject.toml +38 -2
  205. package/registry/__init__.py +1 -0
  206. package/registry/bundles/algorithms.yaml +45 -0
  207. package/registry/bundles/api-twin.yaml +48 -0
  208. package/registry/bundles/control-plane.yaml +61 -0
  209. package/registry/bundles/data-lineage.yaml +47 -0
  210. package/registry/bundles/delta-classifier.yaml +47 -0
  211. package/registry/bundles/eval-gate.yaml +47 -0
  212. package/registry/bundles/health.yaml +45 -0
  213. package/registry/bundles/hook-governor.yaml +97 -0
  214. package/registry/bundles/incident-replay.yaml +47 -0
  215. package/registry/bundles/lsp-pack.yaml +48 -0
  216. package/registry/bundles/mcp-fabric.yaml +53 -0
  217. package/registry/bundles/preflight.yaml +48 -0
  218. package/registry/bundles/remote-supervisor.yaml +49 -0
  219. package/registry/bundles/robotics.yaml +45 -0
  220. package/registry/bundles/secure-worktree-pipeline.yaml +54 -0
  221. package/registry/bundles/security-check.yaml +50 -0
  222. package/registry/bundles/tracebank.yaml +47 -0
  223. package/registry/bundles/vision.yaml +45 -0
  224. package/registry/omg-capability.schema.json +80 -0
  225. package/registry/verify_artifact.py +90 -0
  226. package/runtime/adapters/claude.py +3 -0
  227. package/runtime/adapters/gpt.py +3 -0
  228. package/runtime/adapters/local.py +3 -0
  229. package/runtime/adoption.py +1 -1
  230. package/runtime/api_twin.py +179 -0
  231. package/runtime/asset_loader.py +62 -0
  232. package/runtime/compat.py +24 -3
  233. package/runtime/contract_compiler.py +847 -0
  234. package/runtime/data_lineage.py +73 -0
  235. package/runtime/delta_classifier.py +81 -0
  236. package/runtime/domain_packs.py +46 -0
  237. package/runtime/ecosystem.py +1 -1
  238. package/runtime/eval_gate.py +50 -0
  239. package/runtime/guide_assert.py +45 -0
  240. package/runtime/incident_replay.py +47 -0
  241. package/runtime/mcp_config_writers.py +147 -30
  242. package/runtime/mcp_memory_server.py +1 -1
  243. package/runtime/omg_compat_contract_snapshot.json +9 -8
  244. package/runtime/omg_contract_snapshot.json +9 -8
  245. package/runtime/omg_mcp_server.py +207 -0
  246. package/runtime/preflight.py +73 -0
  247. package/runtime/providers/codex_provider.py +2 -12
  248. package/runtime/providers/gemini_provider.py +2 -21
  249. package/runtime/providers/kimi_provider.py +2 -21
  250. package/runtime/remote_supervisor.py +64 -0
  251. package/runtime/runtime_profile.py +61 -0
  252. package/runtime/security_check.py +464 -0
  253. package/runtime/subagent_dispatcher.py +117 -10
  254. package/runtime/team_router.py +3 -1
  255. package/runtime/tracebank.py +53 -0
  256. package/runtime/untrusted_content.py +102 -0
  257. package/scripts/omg.py +360 -2
  258. package/settings.json +81 -18
  259. package/tools/python_repl.py +33 -3
package/settings.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
- "_comment": "OMG 2.0.3 - project-level config with hook registrations, presets, and feature flags.",
3
+ "_comment": "OMG 2.0.5 - project-level config with hook registrations, presets, and feature flags.",
4
4
  "permissions": {
5
5
  "allow": [
6
6
  "Agent",
@@ -42,7 +42,6 @@
42
42
  "Bash(tree *)",
43
43
  "Bash(du *)",
44
44
  "Bash(df *)",
45
- "Bash(env *)",
46
45
  "Bash(type *)",
47
46
  "Bash(command *)",
48
47
  "Bash(test *)",
@@ -52,17 +51,12 @@
52
51
  "Bash(ln *)",
53
52
  "Bash(cp *)",
54
53
  "Bash(mv *)",
55
- "Bash(chmod *)",
56
- "Bash(chown *)",
57
54
  "Bash(git *)",
58
55
  "Bash(npm *)",
59
56
  "Bash(npx *)",
60
57
  "Bash(yarn *)",
61
58
  "Bash(pnpm *)",
62
59
  "Bash(bun *)",
63
- "Bash(node *)",
64
- "Bash(python *)",
65
- "Bash(python3 *)",
66
60
  "Bash(pip *)",
67
61
  "Bash(pip3 *)",
68
62
  "Bash(uv *)",
@@ -115,6 +109,12 @@
115
109
  "Bash(terraform apply *)",
116
110
  "Bash(terraform destroy *)",
117
111
  "Bash(terraform import *)",
112
+ "Bash(env *)",
113
+ "Bash(node *)",
114
+ "Bash(python *)",
115
+ "Bash(python3 *)",
116
+ "Bash(chmod *)",
117
+ "Bash(chown *)",
118
118
  "Bash(docker *)",
119
119
  "Bash(docker-compose *)",
120
120
  "Bash(kubectl get *)",
@@ -188,45 +188,66 @@
188
188
  }
189
189
  ],
190
190
  "PreToolUse": [
191
+ {
192
+ "hooks": [
193
+ {
194
+ "type": "command",
195
+ "command": "python3 \"$HOME/.claude/hooks/firewall.py\"",
196
+ "timeout": 10
197
+ }
198
+ ],
199
+ "matcher": "Bash"
200
+ },
201
+ {
202
+ "hooks": [
203
+ {
204
+ "type": "command",
205
+ "command": "python3 \"$HOME/.claude/hooks/secret-guard.py\"",
206
+ "timeout": 10
207
+ }
208
+ ],
209
+ "matcher": "Read|Write|Edit|MultiEdit"
210
+ },
191
211
  {
192
212
  "hooks": [
193
213
  {
194
214
  "type": "command",
195
215
  "command": "python3 \"$HOME/.claude/hooks/pre-tool-inject.py\""
196
216
  }
197
- ]
217
+ ],
218
+ "matcher": ""
198
219
  }
199
220
  ],
200
221
  "PostToolUse": [
201
222
  {
202
- "matcher": "Bash",
203
223
  "hooks": [
204
224
  {
205
225
  "type": "command",
206
226
  "command": "python3 \"$HOME/.claude/hooks/circuit-breaker.py\"",
207
227
  "timeout": 10
208
228
  }
209
- ]
229
+ ],
230
+ "matcher": "Bash"
210
231
  },
211
232
  {
212
- "matcher": "Write|Edit|MultiEdit",
213
233
  "hooks": [
214
234
  {
215
235
  "type": "command",
216
236
  "command": "python3 \"$HOME/.claude/hooks/tool-ledger.py\"",
217
237
  "timeout": 10
218
238
  }
219
- ]
239
+ ],
240
+ "matcher": "Write|Edit|MultiEdit"
220
241
  },
221
242
  {
222
- "matcher": "Write|Edit|MultiEdit",
223
243
  "hooks": [
224
244
  {
225
245
  "type": "command",
226
246
  "command": "python3 \"$HOME/.claude/hooks/test_generator_hook.py\"",
227
247
  "timeout": 10
228
248
  }
229
- ]
249
+ ],
250
+ "matcher": "Write|Edit|MultiEdit"
230
251
  },
231
252
  {
232
253
  "hooks": [
@@ -235,7 +256,8 @@
235
256
  "command": "python3 \"$HOME/.claude/hooks/budget_governor.py\"",
236
257
  "timeout": 10
237
258
  }
238
- ]
259
+ ],
260
+ "matcher": ""
239
261
  }
240
262
  ],
241
263
  "PostToolUseFailure": [
@@ -250,19 +272,19 @@
250
272
  ],
251
273
  "Stop": [
252
274
  {
253
- "matcher": "",
254
275
  "hooks": [
255
276
  {
256
277
  "type": "command",
257
278
  "command": "python3 \"$HOME/.claude/hooks/stop_dispatcher.py\"",
258
279
  "timeout": 90
259
280
  }
260
- ]
281
+ ],
282
+ "matcher": ""
261
283
  }
262
284
  ]
263
285
  },
264
286
  "_omg": {
265
- "_version": "2.0.3",
287
+ "_version": "2.0.5",
266
288
  "preset": "safe",
267
289
  "default_mode": "ulw+ralph",
268
290
  "vision_auto": true,
@@ -313,6 +335,47 @@
313
335
  "DEP_HEALTH": false,
314
336
  "CODEBASE_VIZ": false,
315
337
  "CONTEXT_MANAGER": false
338
+ },
339
+ "generated": {
340
+ "contract_version": "2.0.5",
341
+ "channel": "enterprise",
342
+ "required_bundles": [
343
+ "control-plane",
344
+ "hook-governor",
345
+ "mcp-fabric",
346
+ "lsp-pack",
347
+ "secure-worktree-pipeline",
348
+ "security-check",
349
+ "api-twin",
350
+ "preflight",
351
+ "robotics",
352
+ "vision",
353
+ "algorithms",
354
+ "health",
355
+ "tracebank",
356
+ "eval-gate",
357
+ "delta-classifier",
358
+ "incident-replay",
359
+ "data-lineage",
360
+ "remote-supervisor"
361
+ ],
362
+ "protected_paths": [
363
+ ".omg/**",
364
+ ".agents/**",
365
+ ".codex/**",
366
+ ".claude/**",
367
+ "registry/**",
368
+ "dist/**"
369
+ ],
370
+ "emulated_events": [
371
+ "PreCompact",
372
+ "ConfigChange",
373
+ "WorktreeCreate",
374
+ "WorktreeRemove",
375
+ "SubagentStart",
376
+ "SubagentStop",
377
+ "TaskCompleted"
378
+ ]
316
379
  }
317
380
  }
318
381
  }
@@ -25,11 +25,13 @@ from typing import Any, Dict, Generator, List, Optional, Union
25
25
 
26
26
  _get_feature_flag = None
27
27
  _atomic_json_write = None
28
+ _validate_opaque_identifier = None
29
+ _ensure_path_within_dir = None
28
30
 
29
31
 
30
32
  def _ensure_imports():
31
33
  """Lazy import feature flag and atomic write from hooks/_common.py."""
32
- global _get_feature_flag, _atomic_json_write
34
+ global _get_feature_flag, _atomic_json_write, _validate_opaque_identifier, _ensure_path_within_dir
33
35
  if _get_feature_flag is not None:
34
36
  return
35
37
  repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -38,8 +40,12 @@ def _ensure_imports():
38
40
  try:
39
41
  from hooks._common import get_feature_flag as _gff
40
42
  from hooks._common import atomic_json_write as _ajw
43
+ from hooks.security_validators import ensure_path_within_dir as _epwd
44
+ from hooks.security_validators import validate_opaque_identifier as _voi
41
45
  _get_feature_flag = _gff
42
46
  _atomic_json_write = _ajw
47
+ _validate_opaque_identifier = _voi
48
+ _ensure_path_within_dir = _epwd
43
49
  except ImportError:
44
50
  pass
45
51
 
@@ -217,6 +223,23 @@ def _now_iso() -> str:
217
223
  return datetime.now(timezone.utc).isoformat()
218
224
 
219
225
 
226
+ def _validate_session_id(session_id: str) -> str:
227
+ """Validate a caller-supplied session identifier."""
228
+ _ensure_imports()
229
+ if _validate_opaque_identifier is None:
230
+ raise ValueError("Invalid session_id: validator unavailable")
231
+ return _validate_opaque_identifier(session_id, "session_id")
232
+
233
+
234
+ def _resolve_session_path(session_id: str) -> str:
235
+ """Resolve the on-disk session path and reject directory escapes."""
236
+ _ensure_imports()
237
+ if _ensure_path_within_dir is None:
238
+ raise ValueError("Invalid session_id: path validator unavailable")
239
+ state_dir = os.path.abspath(_STATE_DIR)
240
+ return _ensure_path_within_dir(state_dir, os.path.join(state_dir, f"{session_id}.json"))
241
+
242
+
220
243
  def _persist_session(session_id: str) -> None:
221
244
  """Persist session metadata to disk (best-effort)."""
222
245
  if session_id not in _sessions:
@@ -232,10 +255,11 @@ def _persist_session(session_id: str) -> None:
232
255
  "exec_count": session["exec_count"],
233
256
  "backend": session.get("backend", "stdlib"),
234
257
  }
235
- path = os.path.join(_STATE_DIR, f"{session_id}.json")
236
258
  try:
259
+ safe_session_id = _validate_session_id(session_id)
260
+ path = _resolve_session_path(safe_session_id)
237
261
  _atomic_json_write(path, meta)
238
- except Exception:
262
+ except (OSError, ValueError):
239
263
  pass # best-effort
240
264
 
241
265
 
@@ -411,6 +435,12 @@ def start_repl_session(session_id: Optional[str] = None) -> Dict[str, Any]:
411
435
  if not _is_enabled():
412
436
  return {"error": _DISABLED_MSG}
413
437
 
438
+ if session_id is not None:
439
+ try:
440
+ session_id = _validate_session_id(session_id)
441
+ except ValueError as exc:
442
+ return {"error": str(exc)}
443
+
414
444
  # Resume existing session
415
445
  if session_id and session_id in _sessions:
416
446
  session = _sessions[session_id]