Pretooluse Gate Guard

loom-builder-solsourcepython
Path: loom-builder-sol/.claude/hooks/pretooluse_gate_guard.pyRelative: .claude/hooks/pretooluse_gate_guard.pySubproject: loom-builder-solCategory: other
Lines: 105Bytes: 3,779Imports: 5Exports: 4

Content Preview

  1. #!/usr/bin/env python3
  2. """pretooluse_gate_guard.py — Claude Code PreToolUse hook enforcing N15.
  3. Blocks Edit/Write/MultiEdit/NotebookEdit targeting a MANIFESTED file under
  4. gates/v*/ , and Bash commands that would mutate one. New files in new version
  5. dirs are always allowed — that's the sanctioned flow.
  6. Mechanism: prints hookSpecificOutput.permissionDecision="deny" and exits 0.
  7. JSON deny is used instead of bare exit-2 because exit 2 has a known
  8. unreliability with Write/Edit blocking (anthropics/