Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.49 KB

File metadata and controls

39 lines (27 loc) · 1.49 KB

Project Overview

Splitrail is a high-performance, cross-platform usage tracker for AI coding assistants (Claude Code, Copilot, Cline, Pi Agent, etc.). It analyzes local data files from these tools, aggregates usage statistics, and provides real-time TUI monitoring with optional cloud upload capabilities.

Architecture

Analyzer System

Pluggable architecture with the Analyzer trait. Registry in src/analyzer.rs, individual analyzers in src/analyzers/. Each analyzer discovers data sources, parses conversations, and normalizes to a common format.

Data Flow

  1. Discovery: Analyzers find data files using platform-specific paths (src/analyzers/)
  2. Parsing: Parse JSON/JSONL into normalized messages (src/types.rs)
  3. Deduplication: Hash-based dedup using global hash field
  4. Aggregation: Group by date, compute token counts, costs, file ops (src/utils.rs)
  5. Display: TUI renders daily stats + real-time updates (src/tui.rs, src/watcher.rs)

Code Style

  • Follow Rust 2024 edition conventions
  • Use anyhow::Result for error handling
  • Prefer async/await over raw futures
  • Use parking_lot locks over std::sync for performance

Post-Change Verification

Run after code changes:

cargo build --quiet
cargo test --quiet
cargo clippy --quiet -- -D warnings
cargo doc --quiet
cargo fmt --all --quiet

Additional Context

Skills provide task-specific guidance. Use the skill tool to load one when needed - available skills are listed in its description.