Guides · measured July 2026 · 7 min read
How to stop your AI agent from re-reading the same files.
Watch an agent work for an hour and you'll catch it opening the same file three, four, five times: re-listing the same folders, re-grepping for the same function, re-reading a file it already read two turns ago. You pay for every trip. It happens because the agent has no fast way to find things and no memory that survives between turns, so it rediscovers your machine from scratch, over and over.
On a real 4.47-million-file machine we measured the bill. Left to its own tools, Claude Code spent 6 minutes and 57 seconds and 71 tool calls hunting for one file. About 58% of the session's tokens went to finding, not thinking. With a live index underneath it: 16 milliseconds, one call. A bigger plan like Claude Max buys a smarter model; it does not stop the re-reading. This guide shows what does.
TL;DR · the 60-second version
- 01
The re-read tax is the tokens and wall-clock an agent burns re-finding and re-opening files it already saw this session, because it has no fast index to locate them and no memory that survives between turns. You pay for every repeat.
- 02
It gets worse on long sessions: as the context window fills, older reads get compacted away, so the model re-reads to recover what it just forgot.
- 03
Measured on a 4.47-million-file machine, one file-hunt cost Claude Code 6 minutes 57 seconds and 71 tool calls; the same lookup against a live index took 16 milliseconds and one call, end to end roughly 7,200,000× lighter.
- 04
The fix has two halves: fast retrieval so re-finding is one ~85 µs lookup instead of a disk walk, and persistent memory(a terse note pinned to the file, fed back automatically), so what was learned once isn't re-derived.
- 05
Interlinked Files is that index plus the knowledge vault: keyed to the file's identity in the operating system, shared by every agent, offline, no model in the box.
The re-read tax, defined
Name the problem first. Then it's fixable.
The re-read tax is the tokens and wall-clock an AI agent spends re-finding and re-opening files it already saw earlier in the same session, because it has no persistent index to locate them quickly and no durable memory to recall what it learned. It is not a bug in the model; it is a gap in the layer underneath it, the slowest, most token-expensive layer every agent stands on.
Four things drive it. The first two are why the agent forgets; the last two are why re-remembering is expensive.
No memory between turns.
A language model is stateless: each turn it knows only what is in the context window right now. A file it read is just text sitting in that window; once it scrolls out, the knowledge is gone and the file has to be opened again.
The window fills, and old reads get dropped.
On a long session the harness compacts or summarizes earlier turns to make room. File contents are the first thing to go, so the model re-opens them to recover what it had a few turns ago. This is a big part of why your agent forgets.
No fast way to find things.
When it does need a file again, it has no index to ask, so it re-lists directories and re-greps the disk, the same slow walk as the first time. That is how Claude Code finds files today, and why re-finding one can cost minutes.
Nothing survives the session.
Close the window and every relationship it worked out (which files change together, what a folder actually is) is gone. Tomorrow it re-derives all of it from zero.
You can blunt the tax yourself: scope the agent to a specific path so it walks less, checkpoint or compact a long session on purpose before the window fills, and hand it explicit file paths instead of “go find the auth guard.” All of it helps at the margin, and all of it fights the symptom. The cause is the two missing pieces underneath: a fast index and a memory that lasts.
One file, one session
Read once, or read it five times.
Here is the same file across one working session, drawn two ways. On the left the agent has no index and no memory, so it opens auth.ts again and again and re-greps to re-find it: four full reads of one file. On the right, one indexed lookup and a note pinned to the file carry the rest of the session for almost nothing.
Six minutes and fifty-seven seconds (long enough to make a coffee) spent finding a file the agent had already opened once. Sixteen milliseconds is about a third of the time it takes to blink. Fold time, tool calls and tokens together and that one workflow came in roughly 7,200,000× lighter. And more than half the bill on a $200/month plan went to reads the model would forget one turn later. That is exactly where your tokens go.
Same machine · same drive · same queries
Four repeats, one fix.
| The repeated step | Today's fallback | Today's cost | With index + vault |
|---|---|---|---|
| Re-find a file it saw earlier | re-list dirs, re-grep the disk | 35 s to 93.8 s | 85 µs to 16 ms |
| Re-open a file to recall it | re-ingest the whole file | full tokens, again | a pinned note, a few tokens |
| Re-derive the repo layout | re-walk every repo | every session | read once · 1.7 s seed |
| Recall last session's decision | nothing stores it | lost, re-derived | a note, fed back automatically |
Methodology: Ryzen 9 9950X3D · 64 GB DDR5 · NVMe · Windows 11 · 4,470,000 files. Single-file lookups run a median 85 µs (best case 2 µs; 139 µs across 20 whole-drive queries). The content row is one hard query timed both ways: 93.8 s walking the disk, 16 ms indexed, a 58,625× median speedup across the content set. The seed row is the vault reading a fresh machine's git history: 12 of 12 repos in 1.7 s. Full per-tool methodology in the ripgrep comparison and the 412,000× VS Code write-up. Notice the pattern: every row is the agent trying to find or remember something it already had.
Anchor · Claude Max
A bigger plan buys a smarter model. Not a shorter memory.
It is tempting to answer a slow, forgetful agent by upgrading the plan. Claude Max raises your usage ceiling and keeps the strongest model in the loop, and for hard reasoning it is often worth every dollar. But the retrieval floor is identical on Free, Pro and Max: the same directory walk, the same grep, the same short memory that drops your files first when the window fills.
So a bigger plan does not shrink the re-read loop: it just runs the same loop on a more expensive model. Keep Max for the thinking; fix the floor for the speed. They are different layers, and the index is the neutral one every plan plugs into.
What Max changes
Model quality in the loop
Higher usage limits
Deeper reasoning per turn
What it doesn't
How files are found
The grep-the-disk floor
The re-read tax
The fix, both halves
Find it once. Remember it for good.
Half one is speed. Interlinked keeps an always-fresh index of every file on the machine (names and contents, every repo, the git-ignored files a cwd grep never sees, documents included) and exposes it to any agent over MCP. Re-finding a file is one lookup at about 85 µs (139 µs median across 20 queries), content in 7 to 9 ms, and a save is searchable in about a millisecond, under 30 ms worst case. The re-find loop stops costing minutes because it stops costing anything.
Half two is memory. The same index carries a knowledge vault that rides along on the searches the agent already runs: notes any agent pins to a file are fed back to the next agent automatically, so it reads a one-line summary instead of re-ingesting the whole file, and it recalls last session's decision instead of re-deriving it. Keyed to the file's identity in the operating system, so it survives renames, which is why your agent's memory dies on rename today, and doesn't have to.
SPEED ENDS THE RE-FIND. MEMORY ENDS THE RE-DERIVE. THE AGENT STOPS REDISCOVERING YOUR MACHINE.
Questions people ask
The honest FAQ.
Why does my AI agent keep re-reading the same files?
Because it is stateless and has no fast memory. Each turn the model only knows what is in its context window; when earlier turns get compacted to make room, the file contents drop out first, so it re-opens them. And when it needs to locate a file again, it has no index: it re-lists directories and re-greps the disk exactly as it did the first time. Speed and memory are the two missing pieces.
Does a bigger plan like Claude Max fix it?
No. Claude Max raises your usage ceiling and keeps the strongest model in the loop, which makes the thinking better, but every plan uses the same retrieval floor underneath: the same find, grep and glob, and the same short memory. A bigger plan buys a smarter model, not a shorter re-read loop. You end up paying premium rates for the model to re-read directory listings it will forget one turn later.
An index just makes finding faster. Doesn't the model still re-read the file?
Fair point, and it is the honest nuance. An index removes the re-find cost (the archaeology dig to locate the file), but re-reading a file's contents back into context still costs tokens. That is exactly why the second half matters: the knowledge vault lets the agent pull a terse pinned note about a file instead of re-ingesting the whole thing, and it recalls prior decisions instead of re-deriving them. Index kills the re-find; the vault shrinks the re-read.
Is Interlinked Files an AI, or a memory feature bolted on?
Neither. There is no model inside it. It is the retrieval layer underneath any agent, handing it instant whole-machine search and a knowledge vault through one MCP server. The memory lives on the files themselves, keyed to their identity in the operating system, so it survives renames and is shared by every agent on the machine. Nothing leaves the machine.
How much faster is it, really, and what does it cost?
On the benchmark machine, one file among 4.47M returns in about 85 microseconds (139 µs median across 20 whole-drive queries) versus 35 seconds in VS Code and about 67 in Windows Search; a content query that took ripgrep 93.8 seconds returned in 16 milliseconds. A save is searchable in about a millisecond. Everything local is free, forever: the app, whole-machine search, MCP. Hosting starts at $5.99/mo. See also how to make Claude Code faster.
Do this today
End the re-read loop in one install.
Install once. One signed installer auto-configures 19 AI clients: Claude Code, Cursor, Copilot, Codex, Windsurf, Zed, Cline and the rest. No JSON editing, no keys.
Let it index. Filename search works immediately; content fills in behind it. At rest the whole engine sits around 44 MB (less than a browser tab), and the index is under 1% of the drive.
Let the agent ask the index. Re-finding a file becomes one call that returns in microseconds instead of a re-list-and-re-grep dig. Whole-machine when you don't know where something lives; scoped to a folder when you do.
Let the vault remember. Notes pinned to a file come back on the next search automatically, so the agent recalls instead of re-reads. Day one it knows your git history; every week it knows your machine better.
Everything local is free, forever: the app, whole-machine search, MCP. Hosting starts at $5.99/mo. Download for Windows and stop paying your agent to rediscover the same files.