Skip to main content
Claude Code agent tracing visualization
Claude Code is Anthropic’s agentic coding tool that lives in your terminal. With Keywords AI integration, you get hierarchical traces of every conversation including thinking blocks, tool calls, and token usage.

How It Works

Claude Code stores conversation transcripts as JSONL files. Our integration uses the Stop hook to parse these transcripts and send structured traces to Keywords AI.
For details on trace structure and span types, see the Observability Data Model.

Prerequisites

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:

Span Types

Trace Fields

Debugging

Check the log file for issues:

State File

The hook tracks processed turns in ~/.claude/state/keywordsai_state.json:
Delete this file to reprocess all turns.

Common Issues

Example Output

After setup, you’ll see traces in Keywords AI with full hierarchy:

Comparison with Cursor Integration

Source Code

The full source code is available on GitHub: Keywords-AI/keywordsai-example-projects/claude_code

References