| 1 | { |
| 2 | "description": "tool_call_before: two hooks — one allows and rewrites the input, one asks for approval and adds context. Pins the fold: ask wins over allow, the last rewrite wins, contexts join in order.", |
| 3 | "event": "tool_call_before", |
| 4 | "model": "deepseek-v4-pro", |
| 5 | "tool": { |
| 6 | "name": "Bash", |
| 7 | "call_id": "call_hook_rewrite", |
| 8 | "input": { |
| 9 | "command": "cargo test" |
| 10 | } |
| 11 | }, |
| 12 | "hooks": [ |
| 13 | { |
| 14 | "event": "tool_call_before", |
| 15 | "name": "rewrite", |
| 16 | "command": "{{capture}} rewrite; printf '%s' '{\"decision\":\"allow\",\"updatedInput\":{\"command\":\"cargo test --locked\"},\"additionalContext\":\"lockfile enforced\"}'" |
| 17 | }, |
| 18 | { |
| 19 | "event": "tool_call_before", |
| 20 | "name": "ask", |
| 21 | "command": "{{capture}} ask; printf '%s' '{\"decision\":\"ask\",\"additionalContext\":\"CI is the gate\"}'" |
| 22 | } |
| 23 | ] |
| 24 | } |
| 25 |