Python 3.11+ Stdlib only 100% local SQLite

Flat context across 100+ turns.
Median −34% billed. Up to −89% on replay-heavy loops.

A local context and delta layer for stateless AI agents. Instead of re-sending the same files, web pages, and old tool results on every step, ToolRecall sends only what changed and tucks older reads away until needed, cutting typically 45–83%, up to −93% of prompt tokens across coding, browser, SQL, and research tasks.

pipx install toolrecall && toolrecall setup

Verify live token & dollar savings anytime: toolrecall top (live TUI) or toolrecall status

Live Playwright ERP · 20 tasks
−89.2%
real billed cost

−92.5% prompt tokens, 20/20 solved in 80 steps on a live 20-task Playwright Enterprise ERP run.

Django 5.1.4 · 60 bugs · Hermes
−51.6%
real billed cost

−59.0% prompt tokens, 0 cache busts on a 60-bug endurance run (DeepSeek V4.1 Flash).

Spider 2.0 dbt · SQL / analytics
−46.7%
prompt tokens

−19.2% real billed $ on Spider 2.0 dbt SQL/analytics tasks.

Who this is for · Measured workloads

Built for agents that own their message loop.

Real token savings come from multi-turn stateless agents that inspect large state.

30-second overview

See it in action.

The core problem

The “context snowball” kills long sessions.

LLM APIs re-transmit the entire message history on every turn. Re-reading the same file on turn 2, turn 9, and turn 14 bills you quadratically until context overflows.

Prompt context growth · turns 1 → 50
Naive O(N²) ToolRecall (−52%)
200k compaction / context ceiling 200k 150k 100k 50k Turn 1 Turn 15 Turn 30 Turn 50 💥 Crash @ turn 28 ✓ 90k tok (−53.4%)
Naive: +3,220 tok/turn ToolRecall: +120 tok/turn steady state
Turn 28

Where a naive loop hits the 200k context ceiling and compaction (or a crash) kicks in.

90k @ 50

ToolRecall's context at turn 50, still far below the ceiling: −53.4%.

+120 tok/turn

Steady-state growth with ToolRecall, versus +3,220 tok/turn naive.

How it works · Measured on stateless & Python agents

Cut live prompt bloat without changing agent behavior.

In stateless agent loops, every turn re-sends prior file reads and command outputs. ToolRecall caches them locally by content hash and tracks which clean reads can be safely dropped. Full per-decile charts and cross-domain evaluations live on Benchmarks.

01

Hash every read

Files, pages and tool outputs are cached locally in SQLite by content hash, with mtime/size checks so edits are always seen.

02

Send only what changed

Repeat reads come back as a short "unchanged" marker or a diff (files, accessibility trees) instead of the full payload again.

03

Tuck old reads away

Clean reads the agent no longer needs are evicted from the live context and stay recallable on demand, which delays compaction.

Honest scoping

Who should not install this for token savings.

So you don't waste time benchmarking the wrong workload.

Stateful coding CLIs & short conversational tool loops

ToolRecall only saves tokens when large, quasi-static state (files, AX-trees, long articles) is re-sent across turns.

~0%saving

Interactive coding CLIs

Claude Code, OpenCode, Cursor, Codex CLI: measured across 193 local Claude Code sessions and OpenCode SWE-bench runs. They already manage their own context.

−0.25%dedup

Short conversational APIs & one-off shell triage

−0.25% dedup on 278 tau2-bench support chats and 0.0% on 20 ITBench SRE bash runs: small, unique JSONs/commands don't repeat.

2.4×cost

Don't route file tools through MCP (cached_read)

Exposing redundant file tools alongside native read/bash/grep is either ignored or increases cost (up to 2.4× measured on Claude Code).

Quick answers

FAQ

Does this replace provider prefix caching?

No, it's additive. Provider prefix caching discounts repeated prefixes, while ToolRecall shrinks what stays in the context window and delays compaction.

What if a file changes on disk?

Every read checks mtime/size and content hash via keys.py. Any edit invalidates the entry immediately and serves fresh bytes.

Does anything leave my machine?

No. ToolRecall runs 100% locally on SQLite with zero runtime dependencies and no telemetry or cloud calls.

Get started

Install in one line. Runs fully local.

Pure Python 3.11+ standard library, local SQLite, no telemetry.

pipx install toolrecall && toolrecall setup

Verify live token & dollar savings anytime: toolrecall top (live TUI) or toolrecall status