Skip to content
forked from rtk-ai/rtk

About

Compresses command output before your coding agent reads it to save tokens.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

3,045 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PascalsLetter. Command output, compressed before your agent reads it. Pixel art of a funnel catching lines of text beside the PascalsLetter wordmark in slab-serif block letters.

PascalsLetter is yungSNAT's distribution of RTK, the Rust Token Killer. RTK filters and compresses command output before it reaches your coding agent's context: one Rust binary, more than 100 supported commands. PascalsLetter is based on upstream RTK as of 12 November 2026 and adds fixes where compression lost or mangled output an agent needed, several of them on Windows. It installs a binary named rtk, so hooks, agent configuration and every rtk command work unchanged.

Install

On Linux or macOS, install the latest release with its SHA-256 checksum checked:

curl -fsSL https://raw.githubusercontent.com/yungSNAT/PascalsLetter/develop/install.sh | sh

On Windows, in PowerShell 5.1 or 7, install.ps1 installs the same release for the current user, without administrator rights, and leaves PATH unchanged. It downloads through the system proxy settings, refuses to follow a redirect away from HTTPS, and always checks the archive's SHA-256 against the release's checksums.txt (install.sh lets RTK_SKIP_CHECKSUM=1 skip it). As with install.sh, the checksum comes from the same release, so it catches a corrupted or partial download, not a release changed by someone able to publish one:

irm https://raw.githubusercontent.com/yungSNAT/PascalsLetter/develop/install.ps1 | iex

On 32-bit Windows it stops with an error, as releases hold only an x86_64 build. CI installs the published release on Windows 11 on Arm, where that build runs under x64 emulation, and through a TLS-inspecting proxy whose certificate authority Windows trusts. Behind a proxy that asks for a user name and password, set them for the session first, so both irm and the installer send them:

[Net.WebRequest]::DefaultWebProxy.Credentials = (Get-Credential).GetNetworkCredential()
irm https://raw.githubusercontent.com/yungSNAT/PascalsLetter/develop/install.ps1 | iex

Releases hold the Apache-2.0 edition (upstream calls it rtk-oss), which leaves out the BUSL-1.1 compression engine; Windows users can download its zip from the same page. For the full edition, build from source with Rust:

cargo install --git https://github.com/yungSNAT/PascalsLetter rtk --locked
rtk --version   # rtk 1.2.0+pascalsletter.2

PascalsLetter and upstream RTK both install rtk, so uninstall any Homebrew, winget or upstream install.sh copy of RTK first. Add --no-default-features to build the Apache-2.0 edition instead. Both editions install rtk. Then set up your agent with rtk init as in Quick Start. The rtk-proxy daemon is a separate package that this command does not install; build it with cargo build --release --manifest-path proxy/Cargo.toml.

Use

Run rtk init -g to set up Claude Code; add --copilot for GitHub Copilot in VS Code. Inherited from RTK covers the commands and other agents.

When it helps

rtk changes only what your agent's shell tool returns, and does most for test runs, git and search (What RTK Does). Output from Claude Code's Read, Grep and Glob tools never reaches the hook, and agents set up through a rules file (Windsurf, Cline, Kilo Code and Kimi AI) use rtk only when they type rtk themselves. rtk session reports Bash's share of all tool output in your last 10 Claude Code sessions, which is the most rtk can reduce. Less output is not a smaller bill: see How Savings Work.

When you need a command's exact output, run it through rtk bypass (Escape hatches), or list it under [hooks] exclude_commands in config.toml so the hook never rewrites it. Output that ends [full output: rtk recall <hash>] can be read back in full with that command.

Set it beside your agent's output limit

Each agent cuts a command's output at its own limit, and rtk keeps a copy of that limit: agent_output_max_chars in the [limits] table of config.toml, 30,000 characters by default. A git diff up to that size is shown whole and a larger one is compacted with an rtk recall line. grep and rg output is grouped by file when that saves a third, or when only the grouped form fits under the limit.

Set it to your agent's limit or a little under. rtk counts the characters a command prints, whilst an agent may count bytes or tokens and add stderr or its own headers. If rtk's figure is the larger, a diff between the 2 sizes reaches the agent whole and the agent cuts it, losing the compact form and its recall line: Claude Code, for example, hands over a file path and a 2,000-character preview instead. If you raise your agent's limit, raise rtk's with it.

Agent Setting Default
Claude Code bashOutputMaxChars in settings.json 30,000 characters
Codex tool_output_token_limit in ~/.codex/config.toml set per model: 10,000 tokens, about 40,000 bytes
Gemini CLI tools.truncateToolOutputThreshold in ~/.gemini/settings.json 40,000 characters
OpenCode tool_output.max_bytes in opencode.json 51,200 bytes
Hermes tool_output.max_bytes in ~/.hermes/config.yaml 50,000 characters
Mistral Vibe max_output_bytes under [tools.bash] in Vibe's config.toml 16,000 bytes

Checked on 8 November 2026; agents change these between releases. Vibe's figure comes from its source code, as its documentation does not list the key. No documented setting was found for the other agents rtk supports.

For mostly ASCII output, rtk's default fits every agent above at its default except Mistral Vibe; other scripts take more than one byte per character. For Vibe, or after lowering your agent's limit, set it in rtk's config.toml; rtk config prints the file's path and the values in force. rtk config --create writes a file of defaults when there is none; then edit it by hand.

[limits]
agent_output_max_chars = 15000

Check that rewriting happened

Restart your agent after rtk init, ask it to run git status, then run:

rtk gain --history        # ends with the last 10 commands rtk ran, newest first
rtk init --show           # show installed hooks
rtk init --show --codex
rtk discover              # Claude Code: commands rtk handles that ran without it

If the hook rewrote the command, rtk gain --history lists rtk git status under Recent Commands, with the time, a marker for the size of the cut, the share removed and the estimated tokens saved. rtk discover reads Claude Code's session logs and the hook's record of each decision: 'Already using RTK' counts the commands rtk handled, and a command under 'MISSED SAVINGS' ran without it, which usually means the hook was not active in that session.

rtk session cannot confirm the hook: its Adoption column counts every command rtk could handle, rewritten or not.

What PascalsLetter changes

CI runs tools/fork-proof weekly and on every pull request. It checks the Upstream column: each row's tests must pass here and fail on upstream RTK, so the job fails once upstream fixes the bug too. It runs on Linux, so the 2 rows whose bug shows only on Windows are not proved.

Area Upstream Change
Windows arguments Not proved: Windows only Arguments passed through MSYS keep their exact text: #\[ignore, *.rs, {a,b}, ~ and don't are no longer rewritten (rtk-ai/rtk#4737).
cargo test Not in upstream Compiler warnings on a passing run are shown, and the summary ends [N compiler warnings]; they were dropped, and with exit 0 no copy was kept. Cargo's own warnings about a Cargo.toml, which it repeats on every command, are still dropped. Ported from CryptoKrad/rtk (Apache-2.0; rtk-ai/rtk#2877).
cargo clippy Not in upstream An error leaves out its 'for further information visit' link when its note already names the lint, such as clippy::never_loop; the link is that lint's documentation page.
cargo build and cargo check Not in upstream A lint of a Cargo.toml, which cargo repeats on every command, keeps its headline, location, note and help but not the snippet of the manifest it points to; compiler warnings keep theirs.
rtk rg on Windows Not proved: Windows only A pathless rtk rg foo with no piped or redirected stdin keeps every filename, following ripgrep's own stdin rule.
grep and rg Not in upstream Output is capped only when that saves at least a third or is the only form under [limits] agent_output_max_chars. Long lines are clipped around the match, located in the engine's own pattern dialect. grep_max_results is honoured, and a partial [limits] table no longer drops the whole config. The capped form names each file once, whole, above its matches, instead of a shortened path on every line.
git diff Not in upstream Shown verbatim up to agent_output_max_chars. Above it, a compacted diff or show ends with [full output: rtk recall <hash>], or [full diff: rtk git diff --no-compact] when recall cannot store it.
Progress output Not in upstream Filters see what a terminal shows: a lone \r or \b redraw is collapsed before they parse, so a progress bar reads as its last state. Raw output, the tee and rtk recall keep the exact bytes. Adapted from ftlpickleball/rtk (Apache-2.0), which reworks rtk-ai/rtk#2581 by YOMXXX.
rtk read Not in upstream Exact line ranges, and a missing-file error worded as cat words it.
gh api Not in upstream GitHub API *_url links are dropped, with the whole response kept for rtk recall. Anything left unfiltered is written back byte for byte, and --jq and --template are untouched.
yadm Not in upstream Removed from the git rewrite rule, which would run git on the current project instead of yadm's dotfiles repository. It goes through rtk yadm, and rtk discover lists it as unhandled, as it does jq and other commands with only a TOML filter. From kylehgc/rtk by RawNuke (Apache-2.0); see rtk-ai/rtk#3408.
git add Not in upstream A bare rtk git add stages nothing, as git add does; it ran git add ., which staged every change (from kylehgc/rtk by RawNuke, Apache-2.0; see rtk-ai/rtk#3408). Only a call that names paths, or uses -A (--all) or -u (--update), gets rtk's one-line summary; any other, such as git add -- or a dry run, passes on git's own answer instead of a summary that includes changes staged earlier. So does -v (--verbose), whose list of added files the summary dropped, and a warning git prints, such as a line-ending conversion, is kept beside the summary.
git add summary Not in upstream rtk's one-line git add summary counts only what that call staged. It counted every change staged since the last commit, so re-adding a staged file looked like new work.
rtk init -g Not in upstream Says the Claude Code hook is registered only once settings.json holds it. When the patch is declined it says the hook is not registered, which is what rtk init --show then reports; it said 'RTK hook registered' either way.
Permission gate Not in upstream Deny and ask rules see every command bash or zsh would run: a quote inside a # comment no longer hides the next line (rtk-ai/rtk#4029), zsh's &! no longer hides the command after it (rtk-ai/rtk#4968), a rule's text after a * matches when it is quoted or a comment follows it, and a word made by brace expansion, such as --force{,}, counts. Allow rules match as Claude Code reads them: one without * covers only the whole command, and a * in the middle needs text after the part that follows it. A double-quoted ${...} that holds quotes of its own is never approved without asking.
Line continuations Not in upstream A line continuation inside a word joins it, as bash does: git sta and tus on a continued line become rtk git status, not rtk git sta tus.
PHP tool paths Not in upstream A tool path the shell expands or that holds shell syntax, such as $ROOT/vendor/bin/phpunit or ~/x/vendor/bin/pint, is no longer cut down to the bare tool, which ran the current project's copy instead of the one the path names. Found by the rewrite fuzz target.
Unusual whitespace Not in upstream A command holding whitespace Bash does not split words at, such as a vertical tab or a no-break space, runs as written. The rewriter split there, which could turn >&2 into a redirect of another descriptor. Found by the rewrite fuzz target.
Hermes backends Not in upstream The Hermes plugin rewrites commands only on the terminal backends RTK_HERMES_BACKENDS names, local by default, so a Docker, SSH or other remote backend without rtk runs the command as written. It rewrote on every backend, and the command failed where rtk was missing.
rtk-proxy key lending Not in upstream The relayed provider key is lent only to a keyless request carrying the x-rtk-proxy header (which rtk <task> sends) with a localhost or IP Host, so a web page, including a DNS-rebound one, cannot spend it.
rtk-proxy configuration Not in upstream Direct starts and service installation read rtk-proxy.toml from rtk's per-user llm-proxy configuration directory, with a system fallback on Unix. Select a project file explicitly with RTK_PROXY_CONFIG. The rtk llm-proxy wrapper resolves a relative override from the shell's directory.
rtk-proxy stop Not in upstream rtk-proxy stop and rtk-proxy status, and rtk llm-proxy stop, which passes it on, first check that what answers on the port says it is rtk-proxy. stop no longer sends a shutdown request to another server there, such as a dev server on the default port 8080, and status no longer calls one the proxy.
rtk-proxy launch-directory databases Not in upstream rtk-proxy start leaves an rtk-proxy.db or rtk-proxy-memory.db in the shell's directory where it is; it used to move one into its own data directory on first start. One committed to a cloned project could carry stored settings, such as the upstream the provider key is sent to, which would then apply to every later start.
rtk gain Not in upstream The summary, per-command and daily, weekly and monthly tables count an oversized row at a fixed 7,500-token cap, and the headline figure is net.
rtk session Not in upstream Ends with Bash's share of all tool output in recent sessions, the denominator rtk gain lacks, and says what the figure leaves out. Then shows where the tokens go over 30 days: tool output by tool, and Bash output by program beside what RTK saved on that program. Calls and bytes are measured from the logs; tokens are estimated as bytes / 4 (details).
rtk cc-economics Not in upstream Without a global ccusage, the npx fallback runs the exact ccusage release pinned in src/analytics/ccusage-pin/package.json, which Dependabot bumps, instead of whatever npm serves as latest.
rtk config --create Not in upstream Leaves an existing config.toml unchanged and exits 1. It replaced the file with defaults, losing the user's settings.
Claude Code worktrees Not in upstream In a worktree where Claude Code isolates a session, a command whose rewrite would put a git-named word after rtk, such as grep -n git README.md or a quoted "git push", runs as written. Claude Code refused the rewritten command (rtk-ai/rtk#4591).
rtk llm-proxy without the daemon Not in upstream Says to build rtk-proxy from source, which PascalsLetter's releases leave out, instead of pointing to a release archive of it.

These fixes are not currently offered upstream. None falls under the examples upstream's CONTRIBUTING.md gives of RTK Pro features it will not accept: secret redaction, PII masking and blocking dangerous commands. Past contributions to RTK are listed in FORKS.md.

Inherited from RTK

Everything below describes RTK as PascalsLetter inherits it. Guide links go to this repository's copy of the RTK guide; its install commands install upstream RTK, not PascalsLetter.

rtk filters and compresses command outputs before they reach your LLM context. Single Rust binary, 100+ supported commands, <10ms overhead.

Angular builds are supported with rtk ng build: compact build tables with every bundle and diagnostic retained.

What RTK Does

RTK intercepts shell commands and compresses their output before your agent reads it.

Operation What RTK does to the output
ls / tree Tree format with file counts instead of one line per entry
cat / read Smart file reading: signatures and structure over full bodies
grep / rg Truncates long lines, groups matches by file
ast-grep Groups structural matches by file, caps overflow
git status Compact stat format, grouped by state
git diff Verbatim up to the output cap; above it, a stat summary and reduced context, headers stripped
git log Hash, author and subject only
git add/commit/push Confirmation line instead of full progress output
cargo test / npm test Failures only, passing tests collapsed to a count
ruff check Grouped by rule and file
sqlfluff lint Grouped by rule and file
pytest Failures only, traceback trimmed
go test NDJSON parsed, failures only
docker ps Essential fields only

How Savings Work

RTK reduces the bash output your agent reads. That is what RTK measures, and it is not the same as cutting your bill by the same amount.

Bash output is one contributor to input tokens, alongside your prompt, the system prompt and conversation history. Input tokens are in turn only part of the bill, which also counts output tokens. The reduction dilutes at every step.

The token counts RTK reports are estimated as bytes / 4: RTK ships no tokenizer, so the percentages are reliable but the absolute token numbers are approximate.

Full explanation: How RTK Savings Work

In PascalsLetter's own words: rtk gain estimates the bytes removed from the commands RTK filtered; it is not a measure of billed tokens. JetBrains' billed trial of RTK v0.43.0 (claude-sonnet-5 in Claude Code, 86 SkillsBench tasks, 20 July 2026) found tasks cost 7.6% more at low reasoning effort (p = 0.004) and the same at high effort, with quality unchanged in both, whilst rtk gain reported 96.2 million tokens saved. Claude Code's Read and Grep tools bypass the Bash hook, so much of what an agent reads is never filtered. PascalsLetter's fixes target output that RTK lost or mangled.

Billed sessions, 17 November 2026: bench/end-to-end ran 8 of THOL's tasks without web access whose control cost varies least, 10 times each with no tool, rtk 1.2.0 and PascalsLetter (claude-sonnet-4-6 in Claude Code 2.1.206; all 240 runs succeeded). PascalsLetter showed no measurable cost difference from no tool (1.01×, 95% interval 0.96 to 1.05) or from rtk 1.2.0 (0.96×, 0.91 to 1.004); rtk 1.2.0 cost about 5% more than no tool (1.05×, 1.004 to 1.10). In 165 short sessions that each ask the model to run one command and answer a question about its output (claude-haiku-5-5), replies were right in 49 of 55 with no tool, 53 with rtk 1.2.0 and 54 with PascalsLetter. Results: THOL, answers.

Measured command output, 16 November 2026: bench/output-tokens counts the tokens an agent reads from 20 common commands (git, grep, rg, find, ls, cat, cargo build, clippy and test, pytest) on ripgrep 14.1.1 and click 8.1.7, pinned to commits, with OpenAI's o200k_base vocabulary offline. It measures command output only, not billed sessions, so it does not answer the trial above. Without a model, 18 of the 20 commands also list facts taken from their raw output that an answer needs (a chosen set, such as each match line or file name, not all an answer could use), and the benchmark counts how many each tool's output still holds.

Tool Tokens Saved against raw Listed facts kept
Raw output 55,867 981 of 981
RTK 1.2.0 13,408 76.0% 713
PascalsLetter (develop) 12,738 77.2% 713
Tokenade 2.0.9 15,967 71.4% 619
snip 0.26.0 12,915 76.9% 628
Chisle 3.12.1 17,150 69.3% 548
context-mode 2.2.0 39,109 30.0% 195
token-optimizer-mcp 7.11.0 45,968 17.7% 489

PascalsLetter uses 670 tokens fewer than RTK although it shows git diff whole (211 tokens more; see git diff under What PascalsLetter changes): its capped rg search names each file once (1,349 tokens against 2,179), and cargo clippy leaves out a lint link its note already names. snip cuts more in places: it shows git diff as a diffstat without the patch, and it loses facts in 8 commands, 3 of them with no hint on how to get them back; RTK and PascalsLetter lose facts in 3 capped lists (rg, grep and find), each with an rtk recall hint for the rest. context-mode and token-optimizer-mcp run as Claude Code plugins: context-mode replaces 6 large outputs with their last lines and a pointer to its search tool, and a hook cannot replace the output of a failing command, so both leave cargo clippy (29,120 of the raw tokens) and cargo test --workspace whole. Cargo 1.100 lints ripgrep's manifests on every cargo command, so these figures are not comparable with earlier runs. Per-command counts, versions and the control run: results; each tool's lost facts: facts.

Quick Start

Run your agent's rtk init line from Supported AI Tools (rtk init -g for Claude Code), restart the agent, then have it run git status: the hook rewrites it to rtk git status, so the agent gets compact output without calling rtk itself.

Per-agent setup, --dry-run, and uninstall: Quick Start · Supported Agents

How It Works

  Without rtk:                                    With rtk:

  Claude  --git status-->  shell  -->  git         Claude  --git status-->  RTK  -->  git
    ^                                   |            ^                      |          |
    |         full raw output           |            |  compact output      | filter   |
    +-----------------------------------+            +------- (filtered) ---+----------+

Four strategies applied per command type:

  1. Smart Filtering - Removes noise (comments, whitespace, boilerplate)
  2. Grouping - Aggregates similar items (files by directory, errors by type)
  3. Truncation - Keeps relevant context, cuts redundancy
  4. Deduplication - Collapses repeated log lines with counts

Does RTK break Claude's prompt cache? No. RTK filters output once per command. The result is stored in history and cached normally on subsequent API calls, so the cache keeps working as expected. Smaller outputs also mean cheaper cache writes and reads. See Troubleshooting for details.

Supported AI Tools

Each integration rewrites shell commands to rtk equivalents, reducing the bash output the agent reads where the agent supports command interception.

Tool Install Method
Claude Code rtk init -g PreToolUse hook (native binary)
Codex rtk init -g --codex PreToolUse hook (updatedInput) + AGENTS.md
Google Antigravity rtk init --agent antigravity / rtk init -g --agent antigravity .agents/plugins/rtk/ (project) or ~/.gemini/config/plugins/rtk/ (global): plugin.json, hooks.json, rules/AGENTS.md
Hermes Agent rtk init --agent hermes Python plugin adapter (terminal command mutation via rtk rewrite)
GitHub Copilot (VS Code) rtk init -g --copilot PreToolUse hook, transparent rewrite
GitHub Copilot CLI rtk init -g --copilot PreToolUse deny-with-suggestion (CLI limitation)
Gemini CLI rtk init -g --gemini BeforeTool hook
Windsurf rtk init -g --agent windsurf .windsurfrules (project-scoped)
Cline / Roo Code rtk init --agent cline .clinerules (project-scoped)
OpenCode rtk init -g --opencode Plugin TS (execute.before / tool.execute.before), needs 1.18.29 or newer
OpenClaw openclaw plugins install ./openclaw Plugin TS (before_tool_call)
Pi rtk init -g --agent pi (global) TypeScript extension (tool_call)
Oh My Pi (OMP) rtk init -g --agent omp (global) / rtk init --agent omp (project) TypeScript extension (tool_call, shared with Pi)
Mistral Vibe rtk init -g --agent vibe pre_tool hook (hooks.toml)
Kilo Code rtk init --agent kilocode .kilocode/rules/rtk-rules.md (project-scoped)
Kimi AI rtk init --agent kimi AGENTS.md (project-scoped)
Factory Droid rtk init -g --agent droid (or per-project) PreToolUse hook in ~/.factory/hooks.json (matcher Execute)
Trae rtk init --agent trae Native PreToolUse hook in .trae/hooks.json (RunCommand)
Trae (global) rtk init -g --agent trae ~/.trae/hooks.json, plus ~/.trae-cn/hooks.json when that directory exists

For per-agent setup details, override controls, and graceful degradation, see the Supported Agents guide. The Hermes plugin source and tests live in hooks/hermes/; installed Hermes runtime files still live under ~/.hermes/plugins/rtk-rewrite/.

What RTK Covers

100+ commands across Git, GitHub CLI, Cargo/Rust, JavaScript (npm, pnpm, vitest, jest, tsc, Next.js, Playwright, Prisma), Python (ruff, pytest, mypy, pip), Go (go test, golangci-lint), Ruby, .NET, JVM (Gradle, Maven), PHP, Docker, Kubernetes, AWS, Terraform, and the file/search builtins.

-v, --verbose          # increase verbosity (-v, -vv, -vvv)
rtk bypass <cmd>       # run one command unfiltered, still tracked

Every command and its filter: What RTK Optimizes

Escape hatches

rtk filters command output by default. When a result looks wrong, bypass the filter for one command to see the raw output and tell a filter bug apart from the real thing:

rtk bypass git log --oneline -20        # full git log, no truncation
rtk bypass npm install express          # raw npm output, no filtering
rtk bypass curl https://api.example.com/data
  • What it does: runs one command unfiltered and still tracks it: bypassed commands appear in rtk gain --history with 0% bash output reduction.
  • When to use it: an output looks off and you need to know whether the filter or the command produced it, when debugging a filter, or for an edge case a filter mishandles.
  • rtk proxy <cmd> is a deprecated alias of rtk bypass <cmd>.

Not the same thing as rtk llm-proxy. rtk bypass runs one local command unfiltered. rtk llm-proxy manages the rtk-proxy daemon, which compresses your agent's provider-API traffic. See RTK Proxy.

Measure It

rtk gain                        # Summary stats
rtk gain --graph                # ASCII graph (last 30 days)
rtk gain --history              # Recent command history
rtk gain --daily                # Day-by-day breakdown
rtk gain --all --format json    # JSON export for dashboards

rtk discover                    # Find missed savings opportunities
rtk discover --all --since 7    # All projects, last 7 days

rtk session                     # Show RTK adoption across recent sessions

Attribution, the live dashboard and export formats: Token Savings Analytics

RTK Proxy (optional)

rtk optimizes command output before your agent reads it. The rtk-proxy daemon extends the same engine to your agent's provider-API traffic: a local background process that sits between your agent and the provider and runs the pipeline on the traffic itself: it compresses payloads, strips bytes no model ever needed before forwarding, and carries the calls your pipeline routes to cheaper models, so they borrow the credential your agent already sends and show up in rtk gain. It can also align prompt-cache breakpoints where the agent leaves them open (opt-in).

rtk claude              # start the daemon if needed, then launch Claude through it
rtk llm-proxy status    # is it up
rtk gain                # savings, command-filtering and proxy side by side

Two independent ways in, because not every harness has a session hook:

What it does
rtk init -g Offers to set it up once: writes the base URL and the rtk:proxy pipeline, then asks how the daemon should come back after a reboot: SessionStart hook, background service, or neither.
rtk <harness> No configuration at all. Starts the daemon, points the harness at it, then execs it. Needs no hook system, which is why it covers harnesses that have none.

rtk <harness> resolving is itself the signal that traffic really goes through the daemon: the subcommand exists only where redirection is verified. Today that is rtk claude. A harness without one is never silently unproxied: it falls through to plain passthrough, and rtk llm-proxy setup lists what can be launched.

It is a separate binary under a separate licence (BUSL-1.1), built on its own from proxy/; rtk never links it.

Setup and subcommands: RTK Proxy · what it compresses: What the Proxy Compresses · settings and endpoints: Proxy Configuration

The Engine (pipeline.toml)

Everything RTK does (which commands get rewritten, what happens to a tool's output, what the proxy compresses) is expressed in one composable file. The engine (engine/, crate rtk-engine, BUSL-1.1) reads it, so the levers are configurable instead of hard-coded.

Upgrading changes nothing. With no pipeline file you are on rtk:default: the same PreToolUse rewrite, the same awareness file, your filters.toml, your config.toml. Everything beyond that is opt-in, one line at a time:

# ~/.config/rtk/pipeline.toml
[pipeline]
extends = ["rtk:posthook", "rtk:proxy"]

The tour: Pipelines · the reference: Writing a Pipeline, Conditions and Judges, Methods, Tasks and Upstreams · the commands: Pipeline Commands · write your own method: Plugins

Documentation

The full user guide starts at docs/guide.

Installation every install method, Windows, WSL, uninstall
Quick Start per-agent init, --dry-run, first savings
Supported Agents setup detail, override controls, degradation
Agent Coverage what each agent's hook API lets RTK do
What RTK Optimizes every command and its filter
Configuration config.toml, env vars, recall recovery
Token Savings Analytics rtk gain in full
Pipelines the engine: pipeline.toml, rules, judges, tasks, sharing
RTK Proxy the daemon: setup, what it compresses, settings
Editions and Licensing what each download contains
Telemetry & Privacy what is collected, how to opt in, your GDPR rights
Troubleshooting common issues, prompt-cache questions

Repository references: engine/README.md · proxy/README.md · ARCHITECTURE.md · CONTRIBUTING.md · SECURITY.md

RTK collects no command content and no file contents. Telemetry is anonymous and off by default: it sends nothing until you opt in with explicit consent (GDPR Art. 6 & 7) via rtk telemetry enable, and documented in Telemetry & Privacy.

Development

CONTRIBUTING.md covers the tests a change needs, and ARCHITECTURE.md covers how the code fits together.

Credits

PascalsLetter is built on RTK by rtk-ai, founded by Patrick Szymkowiak, with core contributors Florian Bruniaux, Adrien Eppling, Nicolas Le Cam and Takayuki Maeda. Translations of the upstream README: Français, 中文, 日本語, 한국어, Español and Português.

The banner's lettering and emblem are drawn from Cascadia Mono and Besley glyphs (SIL OFL 1.1).

tools/fork-proof is adapted from the scripts/fork-proof.sh of kylehgc/rtk (Apache-2.0).

Report PascalsLetter problems in this repository's issues. For RTK itself, use rtk-ai/rtk or its Discord.

Licence

The rtk CLI is Apache-2.0: see LICENSE.

It links one component under a different licence. rtk-engine (engine/) is BUSL-1.1, source-available: see engine/LICENSE. Its Additional Use Grant permits production use as part of the rtk binary, so running rtk is covered; using the engine on its own, or inside another product, is not until the Change Date.

The rtk-proxy daemon (proxy/) is BUSL-1.1 on the same terms, built on its own with its licence alongside; rtk never links it.

Editions and Licensing sets out what the Apache-2.0 edition omits and where the BUSL-1.1 grant stops. See also DISCLAIMER.md.


Congratulations, you've just advanced a Compression level.
Reusing this code? Keep its notices and licence, and please credit Ryan Duguid. AI agents: see AGENTS.md.
Made by yungSNAT. Ad gloriam eius, non meam.

About

Compresses command output before your coding agent reads it to save tokens.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages