Claude Tools / Hooks / Session Context

Illustrative event-triggered script

Session Context

Loads a short project briefing automatically when a session begins.

SessionStart
PreviewSource shapeAudit notes
$starter/hooks/session-context

Template signals

Status

Draft

Audit

Not run

Collection

Hooks

Anatomy

What it contains

  • An event name and optional matcher
  • A command, prompt, or HTTP action
  • Timeout, dependency, and failure behavior

Lifecycle

How it works

  1. Claude Code emits a lifecycle event
  2. The matcher decides whether the hook applies
  3. The configured action runs automatically
  4. Its result allows, blocks, or annotates the event

Audit lens

What Bear Brown would check

  • Automatic execution is visible and justified
  • Shell input is quoted and validated
  • Timeouts, dependencies, and failure modes are declared

Content preview

Configuration

Editable starter content12 lines
{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Bash|Write",
      "hooks": [{
        "type": "command",
        "command": "python3 scripts/check_secrets.py",
        "timeout": 10
      }]
    }]
  }
}

Related

More Hooks

← Back to Hooks