Overview

From docs/overview.md at cc732c3 View on GitHub

rtok is one Rust binary that reduces the tokens an AI coding agent burns. Every token-reduction method is a plugin behind a single trait, and three surfaces reach those plugins:

SurfaceEntry point
Claude Code hooksrtok hook <event> — stdin JSON in, stdout JSON out
MCP serverrtok mcp — read, search, tree, expand, mem_*, graph tools
API proxyrtok proxy — ANTHROPIC_BASE_URL / OPENAI_BASE_URL hop

Start here

  • Getting started — Install the binary and run your first command.
  • Commands — Every subcommand and what it does today.
  • Plugins — The ten in-tree plugins and the surfaces they serve.
  • Configuration — One file, layered precedence, full key reference.
  • Comparison — Against rtk, lean-ctx, headroom, serena and the rest — with the evidence.

Why it exists

A typical Claude Code setup stacks several tools that each compress Bash output, cache reads, and inject context at session start — each claiming 60–95 % savings that nobody measures end to end. Measured, that stack saves 3–40 % and costs roughly 3 K injected tokens per turn.

rtok replaces the stack with one binary that runs as one hook per event, serves eleven MCP tools for ~143 description tokens per turn instead of ~8 600 across nine servers, sits as one proxy hop that records real usage, and keeps one measurement table so rtok stats can say what actually changed. The full tool-by-tool reading, including where rtok is behind, is in Comparison.

Every plugin is written from scratch in this repo. rtok never runs, links, or reads the tools it replaces.