Claude Code adapter
A tiny shell-line hook in ~/.claude/settings.json that fires on every
Claude Code PreToolUse / PostToolUse / Stop / Notification and
appends one JSON event to the relay log.
Install
relay install # full setup
relay install --cc-only # just the CC hook, skip launch-agentrelay install writes the hook block idempotently. Re-running is safe;
existing entries from other tools (or your own hand-edits) are preserved.
What gets captured
| Hook event | Relay event |
|---|---|
PreToolUse / PostToolUse | tool_used with the tool name |
Stop | stopped with the reason |
Notification | rate_limited (CC surfaces 429s here) |
Default redaction applies — tool argument values are dropped, names kept. See Privacy for the exact rules.
How the hook is wired
The hook is a portable POSIX shell line that pipes Claude Code's
stdin-JSON payload into a small Python one-liner. That writes one JSONL
entry per fire to ~/.relay/events/$SESSION.jsonl.
No daemon is required at capture time. If the daemon's running it picks
the lines up via its tailer; if not, they wait on disk for relay handoff or the next daemon boot.
Inspect
relay doctor # confirms the hook is installed
relay daemon tail --session <session-id> # live stream from one session
cat ~/.claude/settings.json # the written hooks blockUninstall
relay uninstallRemoves only the hook entries this adapter wrote (matched by a marker comment). Your other CC settings are untouched.