- trace-claude-code: Traces Claude Code’s operations to show LLM calls, tool usage, and timing data. This can be useful for personal exploration or to monitor your team’s activity.
- braintrust: Brings context (docs, logs, experiments) from Braintrust into your programming environment. For example, query logs, access Braintrust docs, or fetch experiment results when writing evaluations.
Setup
Install both plugins from the Braintrust plugin marketplace and run the setup script to configure your API key and project settings.1
Prerequisites
Before installing the Braintrust plugins, ensure you have Claude Code and Install the
jq installed:Install Claude Code:jq JSON processor, which the tracing hooks use to parse Claude Code’s output:2
Install the plugins
Install the Braintrust plugin marketplace, the tracing plugin for automatic observability, and the operations plugin to enable Claude for querying logs and running evaluations:
3
Run the setup script
The setup script will prompt you for your Braintrust API key and project name:The script configures these environment variables in your Claude Code settings. You can customize them if needed:
BRAINTRUST_CC_PROJECT- Project name (default: “claude-code”)BRAINTRUST_CC_DEBUG- Set to “true” for verbose loggingTRACE_TO_BRAINTRUST- Set to “false” to temporarily disable tracing
The plugin directory path may vary depending on your Claude Code configuration. If the path above doesn’t exist, check your Claude Code settings for the plugins directory location.
Trace Claude Code
Thetrace-claude-code plugin captures every operation Claude Code performs, helping you:
- Debug issues by seeing exactly what tools Claude ran
- Monitor team usage and patterns
- Understand LLM call costs and performance
- Session root: The overall Claude Code session from start to finish
- Turns: Individual conversation exchanges (your input → Claude’s response)
- Tool calls: Operations like file reads, edits, terminal commands, and searches
- Session ID and workspace location
- Turn numbers and conversation content
- Tool names with inputs and outputs
- Span attributes indicating type (“task”, “llm”, “tool”)
Use Braintrust with Claude Code
Thebraintrust plugin brings Braintrust data and context directly into Claude Code.
Fetch experiment results
When writing evaluations, ask Claude to fetch experiment results so you can iterate on your evaluation logic:Query logs
Ask Claude to query your logs using natural language. Claude will use SQL to fetch the data:Log data
Ask Claude to log data to a Braintrust project:Update the integration
After initial setup, you can update the plugin configuration by editing the environment variables in your.claude/settings.local.json file. This file is located in your home directory at ~/.claude/settings.local.json.
Configuration changes take effect the next time you start a Claude Code session. Exit any running sessions and start a new one to apply your changes.
Change your project
To change which Braintrust project your traces are sent to:Change your API key
To change your Braintrust API key:Enable debug logging
To see detailed logging information for troubleshooting:~/.claude/state/braintrust_hook.log.
Disable the plugins
To temporarily stop sending traces to Braintrust without uninstalling the plugin, set theTRACE_TO_BRAINTRUST environment variable to false in your .claude/settings.local.json:
"true".
To completely remove the Braintrust plugins from Claude Code:
Troubleshooting
No traces appearing
No traces appearing
Check the hook logs for errors:Verify your environment variables are set correctly in
.claude/settings.local.json, and enable debug mode by setting BRAINTRUST_CC_DEBUG=true.Permission errors
Permission errors
Make sure the hook scripts are executable:
State issues
State issues
If traces seem corrupted or incomplete, try resetting the state file:Then start a new Claude Code session.
Next steps
Now that you have both plugins set up:- Explore your traces: Navigate to your project in Braintrust and explore the hierarchical trace structure.
- Run evaluations: Check out the evaluation guide to learn evaluation patterns.
- Browse examples: The braintrust-claude-plugin repository includes evaluation suites that demonstrate the plugin’s capabilities.