Boundary Guard Hooks: Pre-Execution File Access Enforcement
Overview
PreToolUse hooks in Claude Code settings that enforce file access boundaries before any tool execution. Uses boundaries.yaml for protected path definitions, ALLOWLIST.txt for dynamic path management, and hook-decisions.log for audit trails.
Architecture
boundaries.yaml
Declarative protected path definitions. Specifies which directories are read-only, which are writable, and which are completely off-limits to agent tooling.
ALLOWLIST.txt
Dynamic, session-specific file access allowlist using glob patterns. Integrates with context-prepare.sh to build per-session access lists.
hook-decisions.log
Immutable audit trail of every access decision (allow/deny) with timestamps, requested paths, and matching rules.
Enforcement Flow
- Agent requests tool execution (file read/write/edit)
- PreToolUse hook intercepts the request
- Requested path checked against boundaries.yaml + ALLOWLIST.txt
- Decision logged to hook-decisions.log
- Allow or deny execution
See Also
- mcp-security - MCP protocol security patterns (complementary)
- agent-scratchpad-workspace - Workspace where boundary guards operate
- pre-commit-secret-scanning - Related pre-execution security gate pattern