The Respan Claude Code integration enables hierarchical traces of every conversation including thinking blocks, tool calls, and token usage. The integration leverages Claude Code's JSONL transcript storage to capture complete conversation flows.
A Stop hook parses transcripts and sends structured spans to the Respan API, capturing user prompts, assistant responses, extended thinking blocks, tool invocations (Read, Write, Bash), token usage (input, output, cache), and timing information.
Set KEYWORDSAI_API_KEY and TRACE_TO_KEYWORDSAI=true as environment variables in your shell profile.
Download the Python hook to ~/.claude/hooks/ and configure the Stop hook in ~/.claude/settings.json. Optionally enable per-project tracing via .claude/settings.local.json.
Traces use hierarchical span types: root spans (agent) for complete conversation turns, thinking spans (generation) for extended thinking content, and tool spans (tool) for tool invocations.