Expand description
llmtrim CLI/proxy — the user-facing surface over the llmtrim_core engine.
This crate owns everything the embeddable core deliberately excludes: the
command-line interface (main.rs), the MITM interceptor (serve), the local
daemon/autostart/setup machinery, the SQLite token ledger (tracking), the live
A/B benchmark + quality harness, and the terminal UI. The compression itself lives
in llmtrim_core and is called through its public compress* API.
Modules§
- autostart
- Run the interceptor at login.
- bench
- Benchmark harness (quality axis).
- breakdown
- Interactive cost-breakdown TUI.
- compact
- Claude Code compaction request detection and ordered model planning.
- daemon
- Background-daemon control for the interceptor: a pidfile under
~/.llmtrim, plus detached-spawn / liveness / stop. Pure std (no async, no GUI) — the rich CLI face of the always-on proxy.statusreads this plus the savings ledger. - discover
llmtrim discover— scan the before/after capture corpus and report WHERE compressible tokens are still escaping compression, so the next compression target is chosen from real traffic instead of guesswork.- doctor
llmtrim doctor— end-to-end install diagnosis (optionally repairs with--fix).- ensure
- Bring this install to the recommended current state — one verb for setup, update, and repair.
- guard
guard— a Claude CodeUserPromptSubmithook that stops the first turn of a resumed, cold-cache, large-context session so the user sees what it costs before paying it.- mcp
mcp— Model Context Protocol server over stdio.- monitor
- Terminal rendering for the
monitorcommand — savings snapshot, live dashboard, time-series reports, and machine-readable export. - quality
- Quality evaluation harness.
- recall
- Ephemeral recovery storage for future lossy first-arrival tool-output shaping.
- reroute
- Subscription reroute: send intercepted Anthropic
/v1/messagestraffic through CLIProxyAPI instead of Anthropic. - route_
agents - Claude Code custom agents for request-local subscription routing.
- serve
serve— MITM HTTPS interceptor (the universal integration), modeled on llm-interceptor but compressing instead of just logging.- setup
llmtrim setup— the one-command bootstrap. llmtrim is only a MITM proxy, so integration is purely at the environment level: it ensures the local CA, then setsHTTPS_PROXY+NODE_EXTRA_CA_CERTSfor the user (POSIX: a managed shell-profile block; Windows:HKCU\Environment) so newly-launched tools route through the interceptor and trust the CA — no IDE settings touched, no sudo — enables run-at-login, and starts the daemon. On POSIX the block wires the vars only while the daemon is up (gated onllmtrim _alive), so a shell opened afterstoproutes directly instead of at a dead proxy; Windows syncs the registry on daemon start/stop instead.- statusline
statusline— one elegant line for Claude Code’s custom status line.- tracking
- Re-exports the ledger data layer from
llmtrim-ledger. - transport
- Transport — send the compressed request to the LLM API and return the response.
- tray
- Launch the desktop tray app.
- ui
- Shared terminal UI — one visual voice for every human-facing command.
- update
- End-user updates: a channel-aware
updatecommand + an occasional, cached, opt-out “new release available” check. - window_
sub - Private, per-Claude-Code-window subscription overrides.
- wrap
llmtrim wrap <agent> [-- <args>]— thin convenience launcher.