Skip to main content
Hooks fire shell commands at lifecycle events β€” before/after tool calls, on session start/stop, around compaction. Wire-compatible with Claude Code, so your existing .claude/settings.json hooks work as-is.

Quick example

Auto-format every TypeScript file the agent edits:
.soulforge/config.json
/hooks inside SoulForge lists active hooks and toggles them per session.

Events

Rule schema

The if field narrows by first string arg: Bash(rm *), Edit(*.ts), etc. * matches any sequence, ? one char. Tool names use Claude Code conventions (Bash, Edit, Write, Read, Grep, Glob, WebSearch, Agent). SoulForge maps its internal names automatically.

Config sources (merged in order)

  1. ~/.claude/settings.json
  2. .claude/settings.json
  3. .claude/settings.local.json
  4. ~/.soulforge/config.json
  5. .soulforge/config.json
Set "disableAllHooks": true in any file to kill all hooks.

Recipes

Goes under PreToolUse. Exit code 2 denies the call.
Goes under PreToolUse. No matcher = all tools.
Goes under Stop.

Protocol

Hooks read JSON from stdin, optionally write JSON to stdout. Exit code 0 = success, 2 = block, anything else = log warning. stdin
stdout (optional β€” PreToolUse can deny, modify input, inject context)
PostToolUse can inject additionalContext β€” no deny.

Safety

  • Hooks die on Ctrl+X along with the agent.
  • Default timeout 10s β€” hooks should be fast.
  • Non-blocking errors (non-zero exit β‰  2) log a warning, don’t stop the agent.