Set up Respan
Set up Respan
- Sign up — Create an account at platform.respan.ai
- Create an API key — Generate one on the API keys page
- Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Use AI
Use AI
Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.

How It Works
Claude Code stores conversation transcripts as JSONL files. Our integration uses theStop hook to parse these transcripts and send structured traces to Respan.
Prerequisites
- Claude Code installed (
npm install -g @anthropic-ai/claude-code) - Respan API key
- Python 3.8+ with
requestslibrary
Installation
1. Set Environment Variables
Add these to your shell profile (.bashrc, .zshrc, or PowerShell $PROFILE):
2. Download the Hook Script
Download the hook script to your Claude Code hooks directory:3. Configure Claude Code Settings
Add the hook to your Claude Code settings at~/.claude/settings.json:
If
settings.json already exists, merge the hooks section with your existing configuration.4. Enable Per-Project (Optional)
To enable tracing for specific projects, create.claude/settings.local.json in your project directory:
Captured Data
The integration captures rich metadata from Claude Code transcripts:| Data | Description |
|---|---|
| User prompt | The user’s input text |
| Assistant response | Claude’s final response |
| Thinking blocks | Extended thinking content |
| Tool calls | Tool name, input, and output |
| Token usage | Input, output, and cache tokens |
| Timing | Start time, end time, latency |
| Model | Model name (e.g., claude-sonnet-4-20250514) |
Span Types
| Span | log_type | Description |
|---|---|---|
| Root | agent | The complete conversation turn |
| Thinking | generation | Extended thinking blocks |
| Tool | tool | Tool invocations (Read, Write, Bash, etc.) |
Trace Fields
| Field | Value | Description |
|---|---|---|
trace_unique_id | {session_id}_turn_{N} | Unique per turn |
span_workflow_name | claudecode_{session_id} | Groups all turns in session |
thread_identifier | claudecode_{session_id} | Links turns in Threads view |
prompt_tokens | From usage | Input token count |
completion_tokens | From usage | Output token count |
cache_creation_prompt_tokens | From usage | Cache creation tokens |
Debugging
Check the log file for issues:State File
The hook tracks processed turns in~/.claude/state/respan_state.json:
Common Issues
| Issue | Solution |
|---|---|
| No traces appearing | Check TRACE_TO_RESPAN=true is set |
| API errors | Verify RESPAN_API_KEY is correct |
| Missing thinking | Ensure extended thinking is enabled in Claude Code |
| Duplicate traces | Clear state file to reset |
Example Output
After setup, you’ll see traces in Respan with full hierarchy:Comparison with Cursor Integration
| Feature | Cursor | Claude Code |
|---|---|---|
| Hook type | Multiple real-time hooks | Single Stop hook |
| Data source | JSON via stdin | JSONL transcript files |
| Timing | Real-time | Post-hoc (after response) |
| Token usage | Not available | Full usage details |
| Cache info | Not available | Cache creation/read tokens |