braintrust-analyze
Scannednpx machina-cli add skill parcadei/Continuous-Claude-v3/braintrust-analyze --openclawBraintrust Analysis
Analyze your Claude Code sessions for patterns, issues, and insights using Braintrust tracing data.
When to Use
- After completing a complex task (retrospective)
- When debugging why something failed
- Weekly review of productivity patterns
- Finding opportunities to create new skills
- Understanding token usage trends
Commands
Run from the project directory:
# Analyze last session - summary with tool/agent/skill breakdown
uv run python -m runtime.harness scripts/braintrust_analyze.py --last-session
# List recent sessions
uv run python -m runtime.harness scripts/braintrust_analyze.py --sessions 5
# Agent usage statistics (last 7 days)
uv run python -m runtime.harness scripts/braintrust_analyze.py --agent-stats
# Skill usage statistics (last 7 days)
uv run python -m runtime.harness scripts/braintrust_analyze.py --skill-stats
# Detect loops - find repeated tool patterns (>5 same tool calls)
uv run python -m runtime.harness scripts/braintrust_analyze.py --detect-loops
# Replay specific session - show full sequence of actions
uv run python -m runtime.harness scripts/braintrust_analyze.py --replay <session-id>
# Weekly summary - daily activity breakdown
uv run python -m runtime.harness scripts/braintrust_analyze.py --weekly-summary
# Token trends - usage over time
uv run python -m runtime.harness scripts/braintrust_analyze.py --token-trends
Options
--project NAME- Braintrust project name (default: agentica)
What You'll Learn
Session Analysis
- Tool usage breakdown
- Agent spawns (plan-agent, debug-agent, etc.)
- Skill activations (/commit, /research, etc.)
- Token consumption estimates
Loop Detection
Find sessions where the same tool was called repeatedly, which may indicate:
- Stuck in a search loop
- Inefficient approach
- Opportunity for better tooling
Usage Patterns
- Which agents you use most
- Which skills get activated
- Daily/weekly activity trends
Examples
Quick Retrospective
# What happened in my last session?
uv run python -m runtime.harness scripts/braintrust_analyze.py --last-session
Output:
## Session Analysis
**ID:** `92940b91...`
**Started:** 2025-12-24T01:31:05Z
**Spans:** 14
### Tool Usage
- Read: 4
- Bash: 2
- Edit: 2
...
Find Loops
uv run python -m runtime.harness scripts/braintrust_analyze.py --detect-loops
Weekly Review
uv run python -m runtime.harness scripts/braintrust_analyze.py --weekly-summary
Requirements
- BRAINTRUST_API_KEY in ~/.claude/.env or project .env
- Braintrust tracing enabled (via braintrust-claude-plugin)
Source
git clone https://github.com/parcadei/Continuous-Claude-v3/blob/main/.claude/skills/braintrust-analyze/SKILL.mdView on GitHub Overview
Braintrust-analyze scans Claude Code sessions to surface patterns, issues, and insights from Braintrust tracing data. It supports retrospectives, debugging, weekly productivity reviews, and discovering opportunities to create new skills. By aggregating tool usage, agent activations, and token trends, it helps optimize workflows.
How This Skill Works
It ingests Braintrust tracing data from Claude Code sessions to produce structured analyses, including tool usage breakdowns, agent spawns, skill activations, and token estimates. You run predefined harness commands (e.g., --last-session, --weekly-summary, --token-trends) from the project directory to generate reports. The results help detect loops and uncover optimization opportunities.
When to Use It
- After completing a complex task (retrospective)
- When debugging why something failed
- Weekly review of productivity patterns
- Finding opportunities to create new skills
- Understanding token usage trends
Quick Start
- Step 1: Ensure BRAINTRUST_API_KEY is configured in ~/.claude/.env or project .env
- Step 2: Run a report, e.g., uv run python -m runtime.harness scripts/braintrust_analyze.py --last-session
- Step 3: Review the output to identify patterns and opportunities
Best Practices
- Ensure BRAINTRUST_API_KEY is configured in ~/.claude/.env or project .env
- Enable Braintrust tracing via braintrust-claude-plugin
- Start with --last-session for a quick read, then --weekly-summary for trends
- Use --detect-loops to identify repeated tool patterns
- Review outputs and map findings to concrete skill improvements
Example Use Cases
- Quick Retrospective: Analyze last session with --last-session to see a full session breakdown.
- Find Loops: Run --detect-loops to identify repetitive tool usage patterns.
- Weekly Review: Use --weekly-summary to track daily/weekly activity trends.
- Token Trends: Inspect --token-trends to visualize token usage over time.
- Replay a Session: Use --replay <session-id> to show the full sequence of actions.