Skip to content

Claude Code Antileak HooksDual-Layer Guardrails & Git Signing Gates

Deterministic PreToolUse inspection and Git commit/push verification backed by one shared policy engine, split private lists, and fail-closed SSH signing checks.

Delivered Capabilities (How Far It Goes)

  • Intercepts unsafe file writes, credential reads, and guard tampering offline via 6 PreToolUse wrappers (passing calls exit 0 silently without emitting permissionDecision: "allow"), paired with SessionStart private list syncing.
  • Enforces R1–R7, 6h TTL caching, direct SSH signature verification (ssh-keygen -Y check-novalidate), and git ls-remote-anchored known_content resigning exemptions across 4 --net Git hooks.
  • Inspect every wrapper payload, policy/check.py flag, sync script, and doctor.py/scan-repo.py exit contract in API & Components.

Explicit Non-Goals & Hard Boundaries

  • Does not replace remote branch protections: R5 blocks pushes to 15 agent branch prefixes (claude/, codex/, etc.), while protected branches and force-push restrictions belong to GitHub rulesets / CNB branch settings.
  • Intentionally excludes Glob & privileged local bypasses: forbid-read-path.sh guards content-reading Read / Grep calls, and local shell hooks remain bypassable by a privileged root user; remote permissions and pre-push checks form the strong boundary.
  • Cannot run directly from a raw git clone: Source scripts embed /root/.claude/... templates that policy/bootstrap.sh must rewrite into $GUARD; keep product hooks strictly separate from contributor tools/repo_maintenance_guard.py.

Interactive Architecture Diagram ​

Claude Code Antileak Hooks Workflow (Interactive Archify diagram; pan / zoom / inspect)
Open Fullscreen ↗

Read-Only Installation Check ​

The source tree ships with template paths that must be rewritten by policy/bootstrap.sh into $GUARD (default $HOME/.claude/guardrails). Run the diagnostic script from any clone to inspect wiring without mutating system state:

bash
python3 policy/doctor.py
# Uninstalled clones report Overall: DEGRADED; a deployed environment reports Overall: PASS

Documentation Guide ​

Quick Navigation by Role & Goal