Skip to content

feat: Add Crush provider support and message-count model insights#6

Open
aaditagrawal wants to merge 10 commits into
JeanMeijer:mainfrom
aaditagrawal:main
Open

feat: Add Crush provider support and message-count model insights#6
aaditagrawal wants to merge 10 commits into
JeanMeijer:mainfrom
aaditagrawal:main

Conversation

@aaditagrawal
Copy link
Copy Markdown

@aaditagrawal aaditagrawal commented Mar 11, 2026

Summary

Adds support for Charm’s Crush to slopmeter.

This wires Crush through the CLI, provider registry, heatmap rendering, JSON export, docs, and tests. Usage is read from local crush.db files, daily totals are aggregated from top-level sessions, and model insights are derived from assistant message counts when token-by-model data is not available.

What changed

  • Added a new crush provider across CLI/provider/export surfaces
  • Added --crush and included Crush in default auto-detection and --all
  • Implemented a Crush loader that:
    • reads session totals from local SQLite databases
    • snapshots WAL-backed databases before inspection
    • resolves explicit Crush locations first
    • falls back to discovering project-local .crush/crush.db files under HOME
  • Added a Crush heatmap theme in both CLI and registry renderers
  • Added graceful placeholder handling for providers without token-based model breakdowns
  • Added Crush model insights using assistant message count:
    • mostUsedModel
    • recentMostUsedModel
    • explicitly labeled as msgs
  • Updated docs and JSON export version
  • Added CLI/integration coverage for Crush detection, missing data, WAL snapshots, home-scan fallback, and message-count model insights

Notes

Crush does not persist reliable token usage by model in the local DB, so per-model token totals are not fabricated. Daily input/output totals still come from persisted session token totals, while model insights come from assistant message counts in messages.

Since there's no global db for Crush, results have to be parsed from subdirectories, which can be slow, so I would recommend having this as an optional flag; I only developed this since I had usage in Crush once upon a time and wanted to have that visualised.

Additional fix

Also hardens Cursor loading by switching the auth DB read path to lazy node:sqlite usage so default/all-provider scans are less brittle when better-sqlite3 is unavailable or ABI-mismatched.

Verification

  • bun run --cwd packages/cli test

  • bun run --cwd packages/registry registry:build

  • manual sample run:

    • node packages/cli/dist/cli.js --crush --format json --output /tmp/slopmeter-crush-sample.json

    Thanks for building this project out, it's super useful :)


Summary by cubic

Adds Crush and Google Antigravity providers to slopmeter, with message-count model insights and more resilient data loading. Also improves help/output behavior and fixes model/token dedup across providers.

  • New Features

    • New crush and antigravity providers across CLI (auto-detect, --crush, --antigravity, --all), registry, renderers, and JSON export.
    • Crush SQLite loader: reads session totals, snapshots WAL DBs, resolves explicit/global/project data dirs, and scans HOME for project .crush/crush.db (supports $CRUSH_GLOBAL_DATA).
    • Antigravity loader: parses local request logs and state DB (treats non-lock DB errors as warnings), normalizes Gemini model names, and aggregates daily totals.
    • UI/registry: themes for Crush and Antigravity, “msgs” unit for model insights with “Not tracked” placeholders when tokens aren’t available.
    • Combined graph title shortened to “All Providers”; “All” view and output suffixes now include Pi, Crush, and Antigravity. --help and READMEs updated.
  • Bug Fixes

    • Cursor: lazy node:sqlite auth loading with fail-soft availability probe to avoid better-sqlite3/ABI issues.
    • Codex: trim $CODEX_HOME and fix token usage deduplication.
    • Gemini: deduplicate on normalized model name and token totals.
    • Amp: log a warning when thread JSON read fails instead of silently skipping.
    • Crush: availability check uses full DB-path resolution; add .crush/ to .gitignore.

Written for commit 68e8a30. Summary will update on new commits.

Resolves merge conflicts to include both Pi Coding Agent and Crush
provider support. Removes accidentally committed .crush database files
and adds .crush/ to .gitignore. Fixes type errors in crush.ts for
Node.js Dirent compatibility.
@aaditagrawal
Copy link
Copy Markdown
Author

aaditagrawal commented Mar 11, 2026

Unrelated, but the Kilo CLI adapter can be supported the same way OpenCode is, since it's just a fork of OpenCode.

aaditagrawal and others added 7 commits March 12, 2026 10:45
Merge 15 upstream commits (Amp, Gemini CLI, output suffixes, config
fixes, concurrency bump) and add Google Antigravity provider support.
- cli.ts: build no-data message dynamically from providerIds
- graph.ts: shorten combined header title to "All Providers"
- codex.ts: use trimmed CODEX_HOME when resolving path
- amp.ts: log warning instead of silently swallowing read errors
- antigravity.ts: treat non-lock state DB errors as warnings
- cursor.ts: wrap availability probe in try/catch for fail-soft
- crush.ts: use full getCrushDatabasePaths() for availability check
- gemini.ts: deduplicate on normalized model name and token totals
- READMEs: document --amp, --antigravity flags and data locations
- output-path.test.ts: add antigravity suffix test
- cli.test.ts: isolate per-test HOME with mkdtempSync and XDG vars
- cli.ts: update --help default output path to reflect suffix behavior
- cli.ts: remove dead-end retry advice from no-data error message
- README.md: document SLOPMETER_MAX_JSONL_RECORD_BYTES applies to Gemini
- README.md: add Amp data location entry
Merge upstream + add Antigravity provider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant