Now in beta

Audit and governance
for Claude Code

Capture every hook event. Enforce policies in real-time. Block dangerous tool calls before they execute.

prehook policy evaluation
// PreToolUse event received
{
  "hook_event_name": "PreToolUse",
  "tool_name": "Bash",
  "tool_input": { "command": "rm -rf /var/data" },
  "model": "claude-opus-4-6"
}

// Policy response →
{
  "decision": "deny",
  "reason": "rm commands are blocked by organization policy"
}

Control what your AI agent can do

Prehook gives your team the audit trail and governance controls needed to ship AI-assisted code with confidence.

Real-time policy enforcement

17 pre-loaded rules across 5 categories — destructive commands, git safety, file protection, network security, and permission escalation. Load them in one click, toggle individually, or create your own custom rules.

Full session timeline

Every SessionStart, PreToolUse, PostToolUse, and SessionEnd event captured with full payloads — Bash commands, file paths, tool inputs/outputs, success/failure, and model info.

Risk detection

Automatic risk scoring per session. Flags destructive rm commands, force pushes, sudo usage, sensitive file writes, bypass permission mode, and failed tool calls.

Hook-native integration

Uses Claude Code's built-in HTTP hooks — PreToolUse runs synchronously for policy enforcement, all other events are fire-and-forget. Fails open on timeout so your workflow is never blocked by an outage.

Structured API keys

Prefixed tokens (ph_live_...) with CRC32 checksums and SHA-256 hashing. Format-validated before any database hit. Multiple keys per user with labels for each machine.

Governance dashboard

Track sessions, event volumes, tool usage breakdown, policy enforcement stats, and blocked call counts — all from real data, no sampling.

Up and running in minutes

Four steps to full audit and policy coverage for your Claude Code usage.

1

Generate an API key

Sign up and create an API key in your dashboard. Label it for the machine or environment you're using.

2

Install the plugin

One command to install. The plugin hooks into Claude Code's lifecycle and streams events to your dashboard.

3

Define your policies

Load 17 recommended rules in one click — covering rm, sudo, force push, credential files, and more. Toggle individually or create custom rules.

4

Monitor everything

Every session is captured with full timelines. See tool usage, risk signals, blocked calls, and policy enforcement from your dashboard.

Quick setup

1Create ~/.prehook/config.json with your API key

config.json
{
  "api_url": "https://www.prehook.ai/api/v1/events",
  "api_key": "ph_live_..."
}

2Install the plugin in Claude Code

claude code
/plugin marketplace add myleshosford/prehook-plugin
/plugin install Prehook-AI@prehook-plugin
/reload-plugins

You'll be asked to approve the plugin hooks on first run.

3Verify it's working

terminal
# Start a Claude Code session, then check the logs
tail -f ~/.prehook/logs/events.log

You should see a SessionStart event when you begin a new session. Events will also appear in your Prehook dashboard.