Terraphim Session Analyzer (tsa/cla)
A powerful Rust-based CLI tool for analyzing AI coding assistant session logs to identify agent usage patterns, tool chains, and development insights. Supports Claude Code, Cursor, Aider, Codex, and OpenCode.
Features
- Tool Usage Analysis: Track which tools are used most frequently across sessions
- Agent-Tool Correlation: Understand which AI agents use which tools
- Tool Chain Detection: Identify common sequences of tools used together
- Knowledge Graph Search: Semantic search across tool usage patterns
- Multiple Export Formats: JSON, CSV, Markdown, HTML, and terminal output
- Timeline Visualization: Interactive HTML timeline of tool usage
- Real-time Monitoring: Watch for new sessions as they're created
- Self-Analysis: Analyze how projects were built using Claude Code
Quick Start
Installation
# Install from crates.io
# Or build from source
# Build the release binary
# Run the demo
Basic Usage
# Analyze all sessions
# Show tool chains
# Show agent-tool correlation
# Filter by specific tool
# Export to JSON
# Generate timeline
# Watch for new sessions
Demo Script
Run the automated demonstration to see all features in action:
This will:
- Build the release binary (if needed)
- Analyze your Claude sessions
- Generate outputs in all supported formats
- Create an interactive timeline
- Show tool chains and correlations
- Save all results to
examples/directory
See DEMO.md for detailed information about the demo script.
Commands
analyze
Analyze sessions to identify agent usage patterns.
list
List all available Claude sessions.
summary
Show summary statistics across all sessions.
timeline
Generate an interactive HTML timeline visualization.
watch
Monitor for new sessions in real-time.
tools
Analyze tool usage patterns (most powerful command).
# Basic analysis
# Advanced analysis
# Sorting and filtering
# Export formats
# Analyze specific session
Output Formats
Terminal (Default)
Colorized, human-readable output with tables and statistics.
JSON
Machine-readable format for programmatic analysis:
CSV
Spreadsheet-compatible format:
Tool,Count,Percentage,Agents
Bash,1234,23.4,"code-editor,debugger"
Markdown
Documentation-friendly format with tables and summaries.
HTML
Interactive timeline with charts and filtering capabilities.
Configuration
Environment Variables
CLAUDE_SESSION_DIR: Override default session directory (default:~/.claude/projects)
Command-line Options
--verbose, -v: Enable verbose logging--no-color: Disable colored output--session-dir, -d: Specify custom session directory
Use Cases
1. Understanding Tool Usage Patterns
Identify which tools are commonly used together.
2. Agent Performance Analysis
See which agents are most effective with different tools.
3. Project Development Insights
Analyze how a specific project was built.
4. Deployment Pattern Discovery
Find all deployment-related tool usage.
5. Continuous Monitoring
Monitor Claude usage in real-time.
6. Reporting and Documentation
Generate reports for team sharing.
Technical Details
Session Storage
Claude Code stores sessions in ~/.claude/projects/, with each project having:
session.jsonl: Main session logartifacts/: Generated files- Other metadata files
Analysis Approach
The tool uses:
- Streaming JSON parsing for memory efficiency
- Pattern matching for tool chain detection
- Statistical analysis for correlation matrices
- Knowledge graph for semantic search (with
terraphimfeature)
Features
- terraphim: Enable knowledge graph capabilities (optional)
Build without knowledge graph:
Build with knowledge graph:
Development
Running Tests
Code Quality
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
License
See LICENSE for details.
Related Projects
- Terraphim: Knowledge graph integration (optional feature)
- See README_TERRAPHIM.md for details
Support
For issues and questions:
- GitHub Issues: https://github.com/zestic-ai/claude-log-analyzer/issues
- Documentation: See
DEMO.mdand inline--helpcommands
Acknowledgments
Built with:
- Rust - Systems programming language
- serde_json - JSON parsing
- clap - CLI argument parsing
- comfy-table - Terminal tables
- terraphim - Knowledge graph (optional)