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

terminal
relay install                  # full setup
relay install --cc-only        # just the CC hook, skip launch-agent

relay 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 eventRelay event
PreToolUse / PostToolUsetool_used with the tool name
Stopstopped with the reason
Notificationrate_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

terminal
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 block

Uninstall

terminal
relay uninstall

Removes only the hook entries this adapter wrote (matched by a marker comment). Your other CC settings are untouched.

Source

src/agent_relay/adapters/claude_code.py