AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
터미널 출력에 사용되는 토큰을 약 70% 절감하는 Rust CLI
Rust CLI that cuts ~70% of the tokens AI agents spend on terminal output. Single 7-10 MB binary, ~4 ms startup, zero Node overhead. Hooks for Claude Code, Gemini, Cursor, OpenCode, Kilo, Pi, Droid, Co
개발 도구Rust · ShellGitHub @dPeluChe온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
Token-Reducing Shell — terminal output compression for AI coding agents
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
trs : T oken- R educing S hell · terminal compression for AI agents
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.
Commands without a dedicated parser get whitespace and ANSI cleanup, which saves little on its own (2-16% on real traffic); trs stats --coverage shows which commands deserve a parser.
Single native binary: macOS (arm64/x64), Linux (arm64/x64), Windows (x64).README 전문 보기 ↗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.
$ trs git status
main [ahead 1]
unstaged (3):
M src/main.rs
M src/lib.rs
A src/new.rs
# 1.4 KB → 336 B (76% reduction)
$ trs cargo test
cargo test: ok (2548 passed, 3 ignored, 98 suites, 13.83s)
# 164 KB → 127 B (99% reduction)
$ trs cargo clippy
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
# 55 KB → 5.5 KB (90% reduction)
Commands without a dedicated parser get whitespace and ANSI cleanup, which saves little on its own (2-16% on real traffic); trs stats --coverage shows which commands deserve a parser.
Single native binary: macOS (arm64/x64), Linux (arm64/x64), Windows (x64).
# macOS / Linux
curl -fsSL https://usetrs.dev/install.sh | sh
# npm (all platforms)
npm install -g @dpeluche/trs
# cargo (builds from source)
cargo install trs-cli
# Windows (PowerShell)
irm https://usetrs.dev/install.ps1 | iex
Full install options: prebuilt binaries, version pinning, custom install dirs, troubleshooting →
trs upgrade --check # show what would run (auto-detects channel)
trs upgrade # upgrade binary + refresh hooks
trs doctor # verify the install is healthy
See docs/features/upgrade.md and docs/features/doctor.md.
# 1. Wire hooks into every detected AI agent (the main path)
trs init --all --global
trs init --all --global --dry-run # preview without writing
# 2. See your savings
trs stats # dashboard
trs stats --by-agent # breakdown per AI agent
trs stats -n 30 # custom row limit
# 3. Walk back when you want: symmetric removal
trs uninstall # interactive
trs uninstall --all --yes # scripted
Full trs uninstall reference →
Sixteen agents supported end-to-end. Programmatic hook for Claude Code, Gemini CLI, Cursor, OpenCode, Kilo Code, Pi Coding Agent, Factory Droid, VS Code Copilot and Copilot CLI (one shared hook), Devin CLI, and Codex CLI (≥ 0.134, rules fallback below); plugin template for OpenClaw and Hermes. Rules file only for Antigravity IDE, Antigravity CLI, Devin Desktop (ex-Windsurf), and Zed (Agent Panel).
| Agent | Install method | Input hook | Output-saver | Attribution |
|---|---|---|---|---|
| Claude Code · Gemini · Cursor | programmatic hook | ✓ | ✓ | claude / gemini / cursor |
| OpenCode · Kilo Code | plugin template | ✓ | ✓ | opencode / kilo |
| Pi Coding Agent | programmatic hook (extension) | ✓ | — | pi |
| Factory Droid | programmatic hook | ✓ | ✓ | droid |
| VS Code Copilot / Copilot CLI | programmatic hook | ✓ | ✓ | vscode / copilot-cli |
| OpenClaw · Hermes | plugin template | ✓ | — | openclaw / hermes |
| Codex CLI | programmatic hook (≥ 0.134), rules fallback | ✓ | ✓ | codex (fallback (untagged)) |
Antigravity IDE · Antigravity CLI (agy) | rules file (see notes) | — | ✓ | antigravity (env fallback) |
| Devin Desktop (ex-Windsurf) | rules file only | — | ✓ | (untagged) |
| Devin CLI | programmatic hook | ✓ | — | devin-cli |
| Zed (Agent Panel) | rules file only (AGENTS.md) | — | — | (untagged); ACP external agents show their own label |
Full compatibility matrix, caveats, and per-agent config paths →
You can also call trs directly without the hooks wired: handy for scripts, CI, or trying it out before committing to the init flow:
trs git status
trs cargo test
trs git status --json # structured JSON
trs --json git status # flags work anywhere
git status | trs parse git-status # pipe syntax too
| Category | Tools with dedicated parsers |
|---|---|
| VCS | git (status, diff, log, branch, push, pull, fetch, show, stash, grep) |
| Rust | cargo (build, check, test, clippy, fmt, install) |
| JS/TS | npm, pnpm, yarn, bun, npx, pnpm dlx |
| Python | pytest, pip, uv, python3 -m <mod> routing |
| Go | go (test, build, mod) |
| Tests | pytest, jest, vitest (full runner parsing) |
| Linters | eslint, biome, ruff, pylint, golangci-lint, cargo clippy, tsc |
| Files | ls (+ eza, lsd, exa), find (+ fd), grep (+ rg, ag, ack), tree, tail, cat, head, sed -n X,Yp |
| Containers | docker (ps, logs, build) |
| GitHub | gh (pr list, pr view, issue list, run list + gh api) |
| System | ps, env, wc, brew, curl, wget |
Plus chain-aware rewrite (cd X && cargo test), env-prefix preservation (RUSTFLAGS=x cargo build), and pipe syntax (cmd | trs parse …).
Full command reference with subcommands and examples →
Native commands: no external binary behind them.
trs json # jq-lite query engine (-q '.users[].name')
trs read # file reader (-l minimal / -l aggressive)
trs search # ripgrep-powered content search
trs replace # ripgrep-powered replace (--dry-run)
trs err # error filter (only errors/warnings)
trs tail # log tail with --errors
trs clean # ANSI / whitespace / dedup cleanup
trs html2md # HTML → Markdown
trs find # gitignore-aware walker
trs is-clean # repo clean check (exit code)
trs raw # passthrough, still tracked in stats
trs stats # savings dashboard
trs debug-info # bundle version + doctor + logs for bug reports
trs ingest walks a repo and emits a compact Markdown digest (structure + key files + signatures), ready to paste into any AI agent's context. Budget-aware, staleness-aware, incremental.
trs ingest # writes digest, prints path
trs ingest --budget 128k # fit to token budget (signatures first)
trs ingest --changed # only uncommitted files
trs ingest --since-last # incremental since last ingest
trs ingest --deps # dependency graph only
trs ingest --fresh # reuse cached digest if HEAD unchanged
trs ingest --list # saved digests + HEAD sha + stale markers
Full trs ingest reference → · Live example: trs ingesting itself →
trs compresses what agents see via trs rewrite. trs output-saver closes the symmetric gap: installs a compact rules block into each agent's global config to compress what agents emit: no preambles, no narration, result-first, structured output where appropriate, no hallucinated paths.
trs output-saver # read-only scan
trs output-saver --install # install on detected agents
trs uninstall --output-saver # remove the block from every agent
All ten agents supported (Antigravity IDE + CLI share Gemini's ~/.gemini/GEMINI.md import). Full trs output-saver reference →
Every command supports six output formats:
trs git status # compact (default, humans + agents)
trs git status --json # structured JSON
trs git status --csv # CSV with headers
trs git status --tsv # tab-separated
trs git status --agent # AI-optimized markdown
trs git status --raw # unprocessed passthrough
Full format reference with side-by-side examples →
Token pricing kept climbing. Every git status, cargo test, and ls -la the agent rendered into its context cost real money, and the signal-to-noise ratio on those commands was painfully low. We started writing small tools at Iteris 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. The story grew into four complementary tools:
trs rewrite: input compression on every AI-agent tool call.trs output-saver: rules block that shortens replies coming back from the agent.trs audit-docs: finds bloat, duplicates, and dead imports in the instruction files every session re-loads.trs ingest: budget-aware, LLM-ready digest of a whole repo.Prefer the prebuilt install paths above unless you're contributing. For a source checkout:
git clone https://github.com/dPeluChe/trs.git
cd trs
# Build + install into ~/.cargo/bin/
cargo install --path .
# Dev loop
cargo test
cargo clippy -- -D warnings
cargo fmt -- --check
cargo run -- git status # run locally against the workspace
| Link | Topic |
|---|---|
| Contributing guide → | Code style, review process, PR checklist |
| Architecture overview → | File map and module responsibilities |
| Development internals → | Agent wire formats, benchmarks, safety guarantees |
| Roadmap → | Active items and planned work |
| Codebase digest → | Auto-generated project map for agents |
MIT