← All reportsPublic report

rtk-ai/rtk

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies

77k stars Rust View on GitHubprofiled 11d ago
Try GitZoid
146PRs this week
14Contributors
0Deps scanned
0Issues found
01 · Repo overview

How rtk is put together

rtk (Rust Token Killer) is a single-binary Rust CLI proxy that sits between AI coding agents and the shell, rewriting agent Bash calls into `rtk <cmd>` invocations and filtering/compressing command output before it reaches LLM context. Commands are dispatched from a large clap-based router in src/main.rs to per-ecosystem handler modules under src/cmds/ (git, python, rust, js, jvm, ruby, php, scala, dotnet, system, cloud), with output shaping handled by src/parser and declarative TOML filter rules in src/filters/. Agent integration is done via shell hooks installed by src/hooks (Claude Code, Cursor, Windsurf, Codex, etc.) plus a thin TypeScript OpenClaw plugin that delegates all rewrite decisions to `rtk rewrite`. Local state includes a bundled-SQLite usage-tracking history, session analytics parsed from Claude Code JSONL logs, and an opt-in telemetry channel over HTTPS.

Languages

RustTypeScriptShell

Frameworks

clap (CLI arg parsing)serde/serde_json/TOML (serialization)rusqlite (bundled SQLite)ureq (HTTP client)regex

Datastores

SQLite (local tracking/history database via rusqlite bundled feature)

Infrastructure

GitHub Actions CI (Security Check workflow badge)Homebrew formula (Formula/rtk.rb)cargo-deb (.deb packaging)cargo-generate-rpm (.rpm packaging)release-please (release automation)semgrep (.semgrep.yml)curl-based install.sh

Major components

cmds

Per-tool output-filtering handlers grouped by ecosystem (git/gh/glab, rust/cargo, python/pytest/ruff, js/npm/vitest, jvm, php, scala/sbt, dotnet, cloud aws/docker/kubectl/psql/curl/wget, system ls/find/read/grep/json).

core

Shared engine: config.toml loading, FilterLevel file reading, child-process runner/streaming, truncation limits, tee capture, SQLite tracking, telemetry client, guardrails, and utility/display helpers.

hooks

Agent integration layer: installs per-agent hook configs (init.rs), rewrites commands (rewrite_cmd.rs) using an exit-code protocol (0 allow, 1 pass-through, 2 deny, 3 ask), verifies hook integrity (sha2-based integrity.rs), manages trust/permissions, and audits installed hooks.

discover

Parses Claude Code session JSONL files to extract executed commands, classifies coverage against a rewrite registry (lexer/rules/registry), and reports missed RTK adoption opportunities.

analytics

Savings dashboards and adoption reports (gain.rs, session_cmd.rs) plus Claude Code cost/usage economics parsing (cc_economics.rs, ccusage.rs).

parser

Output formatting primitives (types.rs, formatter.rs) shared by command handlers for compact/grouped representations.

learn

Detects recurring raw-command patterns from sessions and generates reports suggesting new RTK routing rules.

filters

Declarative per-tool noise-reduction rules as ~60 TOML files (terraform, pulumi, gradle, gcc, ssh, sops, helm, etc.) consumed by the generic filter runner.

Over the past five weeks the team steadily hardened rtk's core plumbing — fixing how git log flags and values are detected, making text output decoding reliable on Windows, and tightening file permissions for privacy. A major theme was smarter rewriting of multi-line Bash blocks so quoted strings and complex commands aren't broken, alongside broad Copilot hook support including a self-healing configuration. Later weeks shifted toward polish: deterministic benchmarks, documentation cleanups, and internal refactors like replacing lazy_static with LazyLock.

Week by week

2026-08-17A wave of fixes to how git log options are parsed kept values from being misread as flags, plus benchmark harness cleanup.latest5 changes

Fix

Git log flag detection overhauled

Options like --grep, --diff-algorithm, --max-parents, -U, and --unified no longer have their values mistaken for patch flags or separate arguments.

Fix

Raw log passthrough restored

git log --stat/--numstat and related formats correctly request raw output again.

Fix

Benchmark script no longer deletes its own files

benchmark.sh stopped wiping the tracked scripts directory it depends on.

Refactor

Cargo test summary cleaned up

The test-summary logic was extracted into its own function with tests guarding against regressions.

Fix

Safer benchmark server

The loopback test server no longer depends on one specific port, and cleanup handles errors gracefully.

2026-08-10Windows text-decoding problems were fixed across child-process handling, while git log parsing and stream filtering got reliability fixes.6 changes

Fix

Reliable text decoding everywhere

All child-process output now goes through one decoder that handles Windows OEM code pages line by line, fixing garbled output on non-English systems.

Fix

Windows drive-letter paths handled

Project discovery no longer chokes on Windows paths containing drive colons.

Fix

Tests insulated from machine settings

Rewrite tests now pass regardless of the computer's local permission configuration.

Fix

No dropped lines in streams

Stream filters keep incomplete lines when reading text that isn't valid UTF-8.

Fix

Signal diagnostics preserved

Capturing a child program's output no longer hides information about why it stopped.

Fix

Cargo tests guard quality

A 'never worse' guard was added to cargo test summaries, with shared fixtures reducing duplicated test setup.

2026-08-03New AI-assistant hook support landed for Mistral Vibe CLI, and Copilot hooks gained self-healing configuration repair.6 changes

Feature

Mistral Vibe hook support

rtk can now transparently work inside Mistral's Vibe command-line tool, complete with docs and telemetry.

Feature

Copilot config self-healing

Stale or outdated Copilot hook configurations are automatically repaired, but only rtk's own entries — user customizations are left alone.

Chore

End-to-end safety matrix

New tests verify the Copilot self-heal behavior across many scenarios.

Docs

Vibe documentation

A README for the Vibe hooks was added and linked from the project structure docs.

Chore

Security scan tuned

Semgrep warnings about intentional temp-file cleanup during uninstall were suppressed.

Feature

Multi-line block rewriting merged

Work began on rewriting each line of multi-line Bash blocks as a distinct command.

2026-07-27Privacy hardening locked down data files to owner-only access, and multi-line rewrite handling got much safer.6 changes

Fix

Private data files by default

History databases, tee logs, audit logs, and data directories are now created readable only by their owner instead of world-accessible.

Fix

Quoted multi-line strings stay whole

The rewriter keeps quoted multi-line strings together as one command instead of splitting them.

Refactor

Grep transparency fix narrowed

After review, the grep display fix was scoped precisely to where it belongs, with tests covering every scenario.

Refactor

Modernized Rust internals

lazy_static was replaced with the standard LazyLock, regex initialization simplified, and dependencies updated.

Fix

Windows path quoting fixed

Paths containing backslashes or spaces are now properly quoted when used in shell commands.

Fix

Release pipeline token fixed

CI now uses the correct git app token for publishing releases.

2026-07-20The busiest week: multi-line Bash rewriting shipped, Copilot IDE terminal support arrived, and permissions/deny-rule bypasses were closed.6 changes

Feature

Line-by-line rewrite of Bash blocks

Each line of a multi-line Bash block is now rewritten independently, with careful guards so tricky cases like pipelines and swallowed newlines fall back safely.

Fix

Copilot IDE terminal support

rtk hooks now recognize VS Code Copilot Chat's terminal tool on both Mac and Windows, without ever asserting permission decisions.

Fix

Whitespace can't evade deny rules

Extra whitespace in commands is normalized so permission deny rules can't be tricked.

Fix

Faithful grep line numbers

rtk grep now reports line numbers identical to plain grep, and streams piped output live.

Fix

Deterministic network benchmarks

Curl and wget benchmark responses come from stable local mock responses instead of unpredictable sources.

Docs

Honest cost-savings claims

Documentation now scopes savings figures to bash output, names metrics consistently, and drops unsourced numbers.

03 · Security check

Dependencies and code review

0 dependencies scanned

Dependency advisories

Security Watch

No known advisories across 0 scanned dependencies.

No known advisories in the scanned dependencies.

Code review

No concrete code-level issues confirmed.

Get this report every week for your repos.

GitZoid learns each repo, reports what changed, and flags what needs attention. One flat price for the whole team.

$19 a month, flat · First 10 outputs free · No card required