ReTokenGitHub repository

ReToken

Shorten coding-agent logs. Recover the original lines when you need them.

ReToken is a local Rust proxy for Claude Code and a Model Context Protocol (MCP) server for tool-output retrieval. It compresses noisy history and places Anthropic prompt-cache breakpoints. The retrieval tool reads saved originals on your machine.

What does it save?

Across 36 short Claude Code runs, the direct API averaged $0.0425 per task. ReToken averaged $0.0329, or $0.0302 with terse replies enabled. All 36 runs produced a correct answer. The tasks and provider cache affect the result.

Benchmark conditions and results

How do I use ReToken in Codex?

Install the binary for your platform and put it on your PATH. Register the retrieval tool once, then open a new Codex session.

codex mcp add retoken -- retoken mcp

Run retoken exec -- cargo test to shorten a long test run. If you need omitted lines, give the agent the ccr: handle printed in the output. It can search for an error or read the surrounding lines.

retoken wrap codex also routes Codex CLI through the loopback proxy. The proxy currently forwards Codex Responses requests unchanged. The benchmark above used Claude Code.

Where does retrieved output go?

The stdio retrieval server reads the local ReToken store and returns the requested text to the calling MCP client. That client may send it to its model provider. The server requires no ReToken account. Stored originals can include source code and logs. ReToken’s cleanup removes stale entries after seven days of inactivity when it runs.

Storage and security details