trs
Token-Reducing Shell · v0.5.9 · Rust · MIT
Terminal compression for AI agents. 68–99% smaller output, same signal.
● Also built-in: trs ingest — LLM-ready project digest →
6 MB single binary ~12 ms startup 9 AI tool hooks 30+ parsers zero Node overhead

Install

Pick whatever fits your stack. All five methods ship the same native binary — the install script is fastest.

curl -fsSL https://usetrs.dev/install.sh | sh

Downloads the right binary into ~/.trs/bin/trs. Zero runtime deps, no Node overhead, ~12ms startup.

irm https://usetrs.dev/install.ps1 | iex

PowerShell installer. Drops the binary into %USERPROFILE%\.trs\bin\trs.exe.

npm install -g @dpeluche/trs

Cross-platform. optionalDependencies installs only the matching platform binary. Shell launcher at runtime — no Node overhead.

cargo install trs-cli

From source via crates.io. Good if you already have the Rust toolchain.

Prebuilt binaries for Linux x64/arm64, macOS x64/arm64, Windows x64.

What it does

Prefix any command with trs (or let trs init wire it into your AI tool for you). The binary spawns your command, parses the output, and emits a compact version built for both humans and LLMs.

your command git status cargo test · ls -la · ... 1.4 KB raw · ~350 tok trs spawn · parse · reshape ~12 ms · native binary zero runtime deps compact output compact · JSON · agent CSV · TSV · raw 336 B · ~84 tok (-76%) every command logged ~/.trs/history.jsonl fuels  trs stats · savings dashboard

Raw command runs unchanged. Parsers only reshape what the user sees. No modification of the underlying tool, no custom wrappers to maintain, no context lost.

Why we built trs

Short origin note, for the curious.

Token pricing kept climbing. AI coding sessions were burning tens of thousands of tokens just rendering git status, cargo test, and ls -la into the agent's context, and the signal-to-noise ratio was painfully low. We started writing small tools — first for ourselves, then for the team — to reduce what the agent actually had to read.

Along the way we came across rtk (Rust Token Killer). By then our tools had been evolving on their own, so we faced the honest choice: migrate to rtk and drop what we'd built, or continue and publish our own take. We chose to continue — more options in this space means a better fit for more workflows. trs kept iterating and expanding as we learned more about where tokens actually burn.

The more we used it, the more we saw the opportunity was bigger than input hooks. trs output-saver installs rules into each agent's global config so replies come back shorter. trs audit-docs inspects CLAUDE.md / AGENTS.md for the bloat that loads on every session. trs ingest compresses whole projects into an LLM-ready context index. Still a single static binary, zero runtime deps — the story just got bigger than hooks.

Before / with trs

Raw output vs what trs emits. Token counts are rough (bytes / 4) but directionally accurate. Click any row to see the actual before/after.

git status
−76%
1.4 KB
~350 tokens raw
vs
336 B
~84 tokens trs
On branch main Your branch is ahead of 'origin/main' by 1 commit. Changes not staged for commit: (use "git add <file>..." to update) (use "git restore <file>..." to discard) modified: src/main.rs modified: src/lib.rs new file: src/new.rs no changes added to commit
main [ahead 1] unstaged (3): M src/main.rs M src/lib.rs A src/new.rs
cargo test
−99%
55 KB
~14k tokens raw
vs
58 B
~15 tokens trs
Compiling trs-cli v0.5.9 Finished test profile in 4.21s Running unittests src/main.rs running 2186 tests test config::tests::test_defaults ... ok test config::tests::test_parse ... ok ... (2175 more lines) ... test result: ok. 2186 passed; 0 failed Running tests/cli_flags.rs ... (70 more suites) ...
cargo test: 2186 passed (71 suites, 4.9s)
cargo clippy
−90%
55 KB
~14k tokens raw
vs
5.5 KB
~1.4k tokens trs
warning: unused import: `std::io::Read` --> src/main.rs:8:23 | 8 | use std::io::Read; | ^^^^ = note: `#[warn(unused_imports)]` ... (hundreds more lines) ...
lint: 102 issues in 39 files src/main.rs (3): W unused_import 8:23 W redundant_closure 44:30 W dead_code 112:8 ... grouped by file + rule
git log -10
−91%
7.6 KB
~1.9k tokens raw
vs
689 B
~172 tokens trs
commit 9c2231b... (HEAD -> main) Author: Antonio Martinez Quintero Date: Thu Apr 16 ... Merge pull request #9 commit 35b5f4f... ... full messages + headers ...
9c2231b Merge PR #9 init polish 35b5f4f feat(init): Antigravity/Windsurf rules ad55480 feat(init): smart JSON merge ... date + author collapsed

Numbers are representative; your repo and commands will vary. Want to reproduce or compare with other tools? See the internal calibration lab in docs/benchmarks/.

Project digest trs ingest

A separate superpower. Turns any codebase into an LLM-ready markdown digest: structure, key files, dependency graph, and compressed signatures.

codebase src/ · docs/ · Cargo.toml ~400 files · 600+ KB .gitignore respected raw source · too big for LLM trs ingest walk · parse · compress build dep graph budget + git aware --budget · --deps · --since-last digest.md structure · key deps signatures · changed files ready to Read by the agent 16 KB · fits in context sidecar metadata .trs/ingest · <repo>.json head_sha · tokens · file_count · timestamp fuels --fresh cache & stale detection
One command, digest in hand ingest
Budget-aware, git-aware, with stale detection. Spark, agents, CI pipelines — anyone can call it and get a cacheable artifact.
$ trs ingest --budget 128k # fit to token budget $ trs ingest --deps # dependency graph only (no file content) $ trs ingest --since-last # diff-mode from last ingest $ trs ingest --fresh # reuse cached digest if HEAD unchanged $ trs ingest --list # show stored digests with stale markers $ trs ingest -o ~/ctx.md # path on stdout, no shadow save
Budget-aware
Auto-fit to a token budget (32k, 128k, 1M). Signatures first, bodies second.
Git-aware
Only files changed since last ingest or since any ref. HEAD tracked per project.
Dependency graph
Who imports what, most-imported files, cross-language (Rust / TS / Python / Go).
Stale detection
Compares stored HEAD vs current. Says "3 commits behind" in --list.
Unix-style output
Writes to disk, prints the path on stdout. Agents Read on demand.
Ollama post-process
--ollama <model> runs the digest through a local LLM for an executive summary.
Curious about the numbers? Install trs in 10 seconds and see the compression on your own repo.
curl -fsSL https://usetrs.dev/install.sh | sh

Compression reference

Typical reductions on commands run dozens of times a day. Use these as rough expectations — not as a leaderboard.

CommandRawtrsReduction
cargo test8.1 KB58 B99%
cargo clippy55 KB5.5 KB90%
git log -107.6 KB689 B91%
git status1.4 KB336 B76%
git diff14.6 KB8.0 KB45%
gh pr list560 B348 B38%
env2.9 KB728 B75%
trs ingest (this repo)600+ KB raw source16 KB digest97%
~12ms
startup on macOS / Linux
0ms
Node overhead (shell launcher)
68–99%
output compression range
30+
dedicated parsers

Features

30+ dedicated parsers
git, cargo, go, npm, pnpm, docker, gh, pytest, jest, vitest, eslint, ruff, biome, golangci-lint, and more. Each parser understands the output format.
6 output formats
Compact, JSON, CSV, TSV, Agent, Raw. Every command supports all formats via --json, --csv, etc.
JSON query engine
Built-in jq-lite with trs json -q '.users[].name'. No dependency on jq.
Intelligent file reader
trs read -l aggressive extracts only function signatures. Minimal mode strips comments.
AI tool hooks & rules
trs init --all installs hooks for Claude, Gemini, Cursor, OpenCode, Kilo, Droid (programmatic) and rules for Codex, Antigravity, Windsurf. Smart-merge into existing settings.json — user config preserved. Pre-install collision check flags competing compressor hooks (rtk, token-optimizer) so you migrate cleanly with --replace instead of double-compressing.
Output saver (0.5.7+)
trs compresses what agents see; trs output-saver compresses what they emit. Installs a short anti-preamble / result-first / no-narration rules block into each agent's global config (AGENTS.md / CLAUDE.md / Cursor rules). Check-first by default; --install to commit, --remove to undo. 8 of 9 supported agents.
Docs auditor
trs audit-docs inspects CLAUDE.md / AGENTS.md / rules files for cross-file duplicates, embedded code/SQL/JSON blocks that belong elsewhere, dead @imports, and code fences whose declared symbols already live in src/. Paired with trs doctor which warns when agent docs exceed their token budget.
Chain-aware rewrite
cd X && git status or cargo fmt && cargo clippy get each rewritable segment wrapped with trs. Pipes and semicolons pass through untouched.
Token savings dashboard
trs stats shows cumulative compression, tokens saved per day, top commands. trs stats --by-agent breaks totals down by which AI agent fired each rewrite. JSON output for dashboards.
Agent attribution (0.5.9+)
trs rewrite and plugin templates inject TRS_AGENT=<label> into the rewritten command so history logs who fired the run — Claude, Gemini, Cursor, OpenCode, Kilo. Rules-only agents show as (untagged); we don't invent labels we can't verify.
Self-upgrade (0.5.9+)
trs upgrade detects your install channel (npm / curl|sh) and re-runs it. After a successful binary upgrade it also refreshes hook templates and re-installs the output-saver block where it was already present.
Fast find
trs find --gitignore uses a built-in walker respecting .gitignore. Fast on large repos.
Generic compression
Commands without a parser still get ANSI stripping, whitespace collapse, and repeated-line dedup. ~30-40% free.

Install

All options ship the same Rust binary. The install script is fastest — no Node overhead, single curl.

curl -fsSL https://usetrs.dev/install.sh | sh

Downloads the right binary for your platform into ~/.trs/bin/trs. Zero runtime dependencies, no Node overhead, ~12ms startup. Pin a version with TRS_VERSION=v0.5.9.

irm https://usetrs.dev/install.ps1 | iex

PowerShell installer. Drops the binary into %USERPROFILE%\.trs\bin\trs.exe and prints PATH instructions if needed.

npm install -g @dpeluche/trs

Uses optionalDependencies — npm only downloads the binary for your platform. A shell launcher execs the binary directly (no Node at runtime).

cargo install trs-cli

Builds from source. Good if you have the Rust toolchain and want the absolute latest commit (via --git).

Download from the GitHub Releases page.

Prebuilt binaries for Linux x64/arm64, macOS x64/arm64, and Windows x64. Drop into your $PATH, chmod +x, done.