@raindrop-ai/claude-code package instruments
Claude Code CLI using its native
hooks system. No wrapper or proxy
needed — your workflow stays exactly the same.
What gets tracked:
- Every prompt turn as a separate event, grouped by session
- Tool calls (Bash, Edit, Write, Read, etc.) with inputs, outputs, and real durations
- Token usage per turn and per session (input, output, cache read, cache creation)
- Model name and service tier
- CLAUDE.md and rules file contents (captured via
InstructionsLoaded) --append-system-promptand--append-system-prompt-filecontent (best-effort)- Self-diagnostics — agent-reported issues (capability gaps, broken tools, etc.) via MCP tool, with custom signal categories
- Subagent spawns and completions with duration
- Permission denials (tool calls blocked by auto-mode)
- Context compaction events
- Claude’s final responses
- Errors and failures
- Nested trace view — tool calls appear under the root span, subagent tools nest under the subagent
Installation
There are two ways to install: as a Claude Code plugin (recommended) or via npm.Option A: Plugin (recommended)
Install as a Claude Code plugin for clean enable/disable/uninstall without modifyingsettings.json:
setup command needed:
.claude/settings.json:
Option B: npm + setup
Install the package globally and run the setup command:~/.config/raindrop/config.json and adds hook entries to ~/.claude/settings.json.
Per-Project Setup
By default, hooks are installed globally (~/.claude/settings.json). To scope hooks to a single project instead, use --scope=project — this writes to .claude/settings.json in the current directory:
The setup merges hooks into your existing settings file — it won’t overwrite your other hooks or settings.
How It Works
Claude Code’s hooks system fires shell commands at lifecycle points (session start, prompt submit, tool use, etc.). The setup command registersraindrop-claude-code hook as a synchronous command hook for each event type.
When a hook fires, Claude Code pipes a JSON payload to stdin. The handler parses it, maps it to
Raindrop’s event and trace format, and POSTs to the Raindrop API.
Hooks are synchronous by default so they complete before Claude Code exits — this is essential for
headless/one-shot usage (claude -p). For interactive use cases where you prefer non-blocking hooks,
pass --async during setup:
Events Captured
All events within a session share the same
convoId (derived from Claude Code’s session_id),
so they appear grouped in the Raindrop dashboard.
Some events (
InstructionsLoaded, StopFailure, PostCompact, PermissionDenied) require a minimum Claude Code version. Setup auto-detects your installed version and only registers supported hooks.Enriched Properties at Stop
When a turn completes (Stop or StopFailure), the transcript JSONL file is parsed to extract data that hooks alone can’t provide:
A dedicated LLM span with
gen_ai.* attributes is also created for backend token accounting.
append_system_prompt is captured best-effort by inspecting the parent process’s command-line arguments. On Linux this is exact; on macOS positional args may be appended. If you use --append-system-prompt-file, the file contents are read directly.Configuration
Environment Variables
Custom Properties
To tag events with a product name, team, or any custom metadata, setRAINDROP_PROPERTIES as a JSON object:
.claude/settings.json:
Config File
The setup command creates~/.config/raindrop/config.json:
event_name, custom_properties, and project_id in this file:
Projects
If your org has multiple projects, route this agent’s events to a specific one by setting its slug viaRAINDROP_PROJECT_ID or the project_id config-file key:
X-Raindrop-Project-Id header on every event. Omit it (or pass default) to use your org’s default Production project, which is the existing behavior. Single-project orgs need nothing new.
Custom Self-Diagnostics Signals
By default, the self-diagnostics MCP server exposes 5 signal categories (missing_context, repeatedly_broken_tool, capability_gap, complete_task_failure, noteworthy). You can replace these with your own domain-specific categories.
In the config file:
noteworthy catch-all is always appended automatically. sentiment is optional ("POSITIVE" or "NEGATIVE"). guidance adds additional instructions to the tool description. toolName overrides the default tool name (__raindrop_report).
Self Diagnostics
Self Diagnostics lets your agent proactively report issues — capability gaps, missing context, broken tools, task failures — back to your team as signals in Raindrop. It’s delivered as an MCP server that’s registered automatically duringsetup. Claude Code can call the __raindrop_report tool to flag issues, and each signal is attached to the current event in your dashboard.
How it works
The setup command registers araindrop-diagnostics MCP server with Claude Code. When Claude detects an issue during a session, it calls the tool with a category and detail. The signal appears on the corresponding event in Raindrop’s Signals dashboard.
Categories
Verifying
raindrop-diagnostics in the list. Signals appear in the Raindrop dashboard under the event they’re attached to.
Uninstalling
Plugin users:Debugging
To see exactly what each hook sends, enable debug logging:/tmp/raindrop-hooks.log. Run a Claude Code session, then inspect the log:
Troubleshooting
Events not appearing
- Check your write key — run
raindrop-claude-code setupagain or verify~/.config/raindrop/config.json - Verify hooks are installed — run
/hooksinside Claude Code to list active hooks - Enable debug logging — run
raindrop-claude-code debug-onand check/tmp/raindrop-hooks.log - Check binary is in PATH — run
which raindrop-claude-code - Headless mode — re-run
raindrop-claude-code setupto ensure hooks are sync (the default since v0.0.7)
Hook errors
Hook errors are logged to/tmp/raindrop-hooks.log when debug is enabled. Run:
That’s it! Ping us on Slack or email us if you need help.