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

  1. Agent requests tool execution (file read/write/edit)
  2. PreToolUse hook intercepts the request
  3. Requested path checked against boundaries.yaml + ALLOWLIST.txt
  4. Decision logged to hook-decisions.log
  5. Allow or deny execution

See Also