braintrust-tracing
Braintrust tracing for Claude Code - hook architecture, sub-agent correlation, debugging
npx skills add parcadei/Continuous-Claude-v3 --skill braintrust-tracing --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Braintrust Tracing for Claude Code Comprehensive guide to tracing Claude Code sessions in Braintrust, including sub-agent correlation. ## Architecture Overview ``` PARENT SESSION +---------------------+ | SessionStart | | (creates root) | +----------+----------+ | +----------v----------+ | UserPromptSubmit | | (creates Turn) | +----------+----------+ | +--------------------+--------------------+ | | | +---------v--------+ +--------v--------+ +--------v--------+ | PostToolUse | | PostToolUse | | PreToolUse | | (Read span) | | (Edit span) | | (Task - inject) | +------------------+ +-----------------+ +--------+--------+ | +----------v----------+ | SUB-AGENT | | SessionStart | | (NEW root_span_id)| +----------+----------+ | +----------v----------+ | SubagentStop | | (has session_id) | +---------------------+ ``` ## Hook Event Flow | Hook | Trigger | Creates | Key Fields | |------|---------|---------|------------| | **SessionStart** | Session begins | Root span | `session_id`, `root_span_id` | | **UserPromptSubmit** | User sends prompt | Turn span | `prompt`, `turn_number` | | **PreToolUse** | Before tool runs | (modifies Task prompts) | `tool_input.prompt` | | **PostToolUse** | Afte
- Architecture Overview
- Hook Event Flow
- Trace Hierarchy
- Sub-Agent Tracing: What Works and What Doesn't
- What Doesn't Work
- What DOES Work
- The Correlation Pattern
- State Management
- Per-Session State Files
- Global State
- Debugging Commands
- Check if Tracing is Active
- Query Braintrust Directly
- Debug Hook Execution
PreToolUse hook injects:
View hook logs in real-time
tail -f ~/.claude/state/braintrust_hook.log
Check if session has state
cat ~/.claude/state/braintrust_sessions/*.json | jq -s '.'
Verify environment
echo "TRACE_TO_BRAINTRUST=$TRACE_TO_BRAINTRUST"
echo "BRAINTRUST_API_KEY=${BRAINTRUST_API_KEY:+set}"
List recent sessions
uv run python -m runtime.harness scripts/braintrust_analyze.py --sessions 5What does the braintrust-tracing skill do?
Braintrust tracing for Claude Code - hook architecture, sub-agent correlation, debugging
How do I install it?
Run `npx skills add parcadei/Continuous-Claude-v3 --skill braintrust-tracing --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From parcadei/Continuous-Claude-v3, a repository with 3,879 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
