- 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.
- 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.
Setup
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: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:
It’s not required to install both plugins. Install only the ones you need.
Braintrust plugin
Thebraintrust plugin brings Braintrust data and context directly into Claude Code by connecting to Braintrust’s MCP server.
You can fetch experiment results, query logs, log data, and more. See MCP documentation for details.
Trace Claude Code plugin
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”)
Embed traces in parent traces
You can embed Claude Code traces inside a parent trace when using Claude Code as part of a larger workflow. This enables better observability by showing Claude Code’s execution context within your broader application traces. To attach a Claude Code session to an existing Braintrust trace, pass theCC_PARENT_SPAN_ID environment variable:
CC_ROOT_SPAN_ID to maintain proper trace relationships:
Update config
After initial setup, you can update the plugin configuration by editing the variables in your project’s.claude/settings.local.json file or global claude code config in ~/.claude/settings.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.
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.