Each call reads it all again
A session that has gathered 500,000 tokens pays to read all of them on every call: about $0.10 per call with Opus 5.5, before the model writes a word.
Open source · local · for Claude Code
Every call to the model sends the whole conversation again. arricurdAI reads your Claude Code transcripts on your machine, shows where the tokens go, and stops the most expensive habit of all: resuming a large session after its prompt cache expired.
The name comes from arricurdari, Sicilian for “to remember”.
> What should we do next?
⏺ UserPromptSubmit operation blocked by hook:
arricurdai: this session was idle for 19h 12m and its
prompt cache expired. Your prompt would write its
412,000 tokens of context to the cache again,
about $3.30, and every later call would read them.
Run /clear to start a new session: arricurdai will
give it a note on this one. Or send the prompt again.
> /clear
⏺ New session, with a note on the old one:
about 3,000 tokens instead of 412,000.
the input price, to read a token from the cache on Claude Opus 5.5 and Sonnet 5.5.
the input price, to write the whole context again once the one-hour cache expires.
cost of a new session with a note, against one long session, with a pause before each step.
network calls. It reads local files, sends no telemetry and uses no model.
Why sessions get expensive
A coding agent sends the model everything it has read and said so far, on every call. The prompt cache makes that cheaper, but not free, and it forgets after an hour.
A session that has gathered 500,000 tokens pays to read all of them on every call: about $0.10 per call with Opus 5.5, before the model writes a word.
After an hour away, the next prompt writes the whole context to the cache again, at twice the input price. That one call costs as much as reading the context forty times.
A new session starts from the system prompt and a short note on the old one. The agent reads files again only when it needs them, so every later call is cheaper too.
Try it
You come back to a session after more than an hour. This is what the next calls cost in context. Output and new content cost the same either way, so they are left out.
What it does
The profiler tells you where the tokens go. The hooks act on the biggest waste it finds, without changing how you work.
The cost of every session, weighted by price. Which blocks of context carry it. What compacting at other moments would have saved. Memory lines never used, and files read again.
arricurdai profile --project .When the cache of a session over 100,000 tokens has expired, it stops your first prompt once and shows what going on would cost. Send it again to go on.
arricurdai guard --min-tokens 100000After that /clear, it gives the new session a note built from the transcript, without a model: the last requests, the files changed, the open tasks and the last reply. It also tells every new session how to run recall, which searches past sessions. A tool that sends /clear itself, such as Forchetta, asks for the note first with handoff --prepare.
arricurdai handoffEvidence
Five steps of real work on go-chi/chi with Claude Code and Sonnet 5.5, under four ways of handling the context. Every variant passed hidden acceptance tests and the whole test suite.
The cost Claude Code reported, plus writing the prefix of each step to the cache again after more than an hour.
Without pauses, compacting cost more than it saved: a summary is paid at the output price, five times the input price. The whole experiment
Baseline
Five scripted Claude Code sessions on each repository, coming back to the same area of the code, then profiled. Costs are in price-weighted tokens, with the cache-read price before Claude 5 models (0.1).
| Repository | Area | Mean cost K | Rediscovery | S_max | Memory share | Unused memory lines |
|---|---|---|---|---|---|---|
| vitejs/vite | Hot module replacement | 58,012 | 5.8% | 1.2% | 3.4% | 20 / 34 |
| fastapi/fastapi | Dependency injection | 53,422 | 5.7% | 0.95% | 3.5% | 14 / 23 |
| gin-gonic/gin | Routing | 43,754 | 4.1% | 0.51% | 4.5% | 15 / 23 |
Start
It needs Node 20 or later.
npm install -g arricurdai
arricurdai profile --project /path/to/projectNew here? The guide explains every part of the report.
arricurdai setupIt shows the changes to your Claude Code settings and asks first. arricurdai setup --remove takes them out.
On any problem the hooks let the prompt through.
Roadmap
The price-weighted cost of every session, where it goes, and what other compaction policies would have saved.
No cache rewrite after a pause: a new session with a note, chosen by you.
arricurdai recall "<words>" searches past sessions, locally and without a model. The agent can keep a small context and still find what was decided. It reads each transcript once, so a search takes a fraction of a second.
arricurdai compare --since <date> compares the sessions before and after a change, and replays them to estimate what the auto-compact limit and the guard each did.
arricurdai status lists the sessions of the last hours: how large their context is, when their cache expires, and what today cost. Also in the macOS menu bar.
Forchetta, a control centre for sessions that run side by side, reads its numbers from arricurdAI. handoff --prepare writes the note before a /clear it sends, and status --json gives each session its part of the day.