← All articles

Tutorials

How to Stop Claude Code Rereading the Same File, and Why You Won't

Your agent reads the same file four times and you pay for every copy. The fix takes minutes. The part worth reading is why you skip it.

How to Stop Claude Code Rereading the Same File, and Why You Won't

Three hours into a five-hour Claude Code window, the agent rereads the same 900-line file for the fourth time. You asked for one line of change. You are paying for the file, for the summary of the file, for the apology about rereading the file, and for three paragraphs on what it is about to do next.

The usual diagnosis is that the model is lazy, and the usual fix is a stern line in your instructions file about being concise, which the agent agrees with and then ignores at the next tool call. I have watched this loop enough times to be blunt about it: the reread is not a character flaw. It is what happens when a capable system is handed no boundary and no bill. Your window has no opinion about your intentions, only about what got sent and how many times.

So here is the working version, the kind you can set up before lunch, plus the bit most tutorials skip: why you will install half of it and call it done. For the configuration side, the existing guide to cutting token usage in a Claude Code setup is the place to start. This one is about a narrower and more expensive habit, the fourth read.

A terminal window where the same source file is opened four times in one Claude Code session and the token counter keeps climbing.

How to stop Claude Code from rereading files, in four steps

The reflex is to upgrade, and upgrading does nothing, because the loop lives inside your session and not inside your plan. What you want is a boundary where the money actually leaves: at the second read of a file that has not changed, at the throat-clearing before an answer, at a cheap task handed to an expensive model.

  1. Measure before you believe anything. Deep Scan reads the transcripts already saved on your machine and shows, conversation by conversation, where the context went. No login, no email, no plan. The Deep Scan walkthrough on real transcripts shows what the output looks like.
  2. Deny the second read of an unchanged file. Delta Read hands the agent the difference instead of the whole file again. The edit is the same; the payload is not, and the saving repeats in every later round because the file is no longer sitting in the window four times over.
  3. Starve the preamble. Response Diet asks for the direct answer and cuts oversized output before it enters the context. Every "Sure, I'll help you with that" gets paid once when written and again on every turn that follows, since it stays in the window.
  4. Move the grunt work off the expensive model. Cheap Swarm routes 26 task classes, search, lint, tests, build, docs, to the cheapest model that can handle them. The thinking stays where it belongs. Only the lint moves.

These are switches in a panel, not a rewrite of your workflow: keys one to eight turn them on, Z undoes everything, and any of the 200+ keys can be reversed with a click. I care about that more than I care about percentages, because a saving you cannot undo is a hostage situation. HarnessUp's local suite for Claude Code and Codex runs the whole thing on your machine, 132+ tools, nothing leaving it.

You can verify any of it without trusting a dashboard. Take one task you run every week, do it once with the switches off and once with them on, and compare the context per round rather than the final invoice. The invoice moves for a dozen reasons. The context line does not lie about what got sent.

Now the honest part. Step four is the one that sits unused, because sending lint to a smaller model feels like a confession that the task was small. You will do the first two steps tonight. The third survives until the agent sounds curt in front of someone whose opinion you care about. Keep that in mind, because the tools are not where this usually fails.

Why does Claude Code reread a file it just read?

Because the window is rebuilt and re-sent on every turn, and the agent trusts the file more than its own summary of it. A reread feels safer than a wrong edit. Nobody charges the model for caution, so caution is what you get, and the harness bills you for it on every following turn.

Look at the arithmetic. One avoided read does not save one file. It saves that file multiplied by the rounds left in the session, plus its summary, plus the sentence explaining why it was read. That is why the fourth read feels like a rounding error and lands like a second invoice, and why the third turn of a long session is where the money quietly goes, as this breakdown of what the third turn of a Claude Code session costs lays out.

A large window is not a memory. It is a bill with a delay.

There is an irony in the fix most people reach for first. The 400-line instruction file you maintain to keep the agent disciplined is itself read on every turn, which makes it the most expensive document in the session, and the rules about not rereading get reread more often than the files they were meant to protect. Discipline written into the prompt is paid for in perpetuity. Discipline installed as a boundary is paid for once.

Delegation multiplies the same mistake while looking efficient. Every subagent opens its own window, and a window that starts empty has to be filled before it can help, so the same files get read again in three places at once. Split a task five ways and the parts feel cheaper while the total climbs. Cheap Swarm earns its place here for a boring reason: the alternative was three copies of your repository sitting in three contexts.

Two years of marketing have sold bigger windows as the cure for exactly this, and the bigger window made it worse. With more room, nobody summarizes, and with no summarizing every round carries the whole afternoon. Prompt caching softens the price of the repeated prefix, then quietly invites more repetition, which is why the order of the prompt under prompt caching matters more than most teams realize: change one early line and you have repriced everything behind it.

Who benefits from the loop? Not you. The model would be just as useful with the delta. A loop like this is what you get from a tool priced per token and tuned to be agreeable, and I am not accusing anyone of malice. I am pointing at an incentive and asking why your setup carries no counterweight.

Who wins when the meter ends the session?

The least clever tool in the panel is the one that changes behavior fastest. Stop Loss puts a five-dollar ceiling on a session and stops it there. Hand an afternoon a price and watch the planning appear: tasks get split, prompts get written before the agent starts, and the vague "let's see what it does" block disappears because it now has a number attached.

What the ceiling does not do is buy you a longer window. Nothing buys that. The clock is the clock, and the only honest promise a tool can make is that the same afternoon fits inside it with room left, which is a claim you can test on a Thursday rather than one you have to believe.

The second-order effect is the part I did not expect to care about. When a session stops at the ceiling, you find out which task was expensive, and it is rarely the one you were dreading. The refactor was two dollars. The quick test fix that turned into a tour of the repository ate the cap before lunch.

Savings you cannot explain are savings you will not keep.

The vendor pitch is up to 3x more work on the same plan, up to 78% of work tokens saved, and I would treat both as ceilings rather than forecasts. Those figures describe the biggest windows measured, which is precisely what "up to" is for. What you can trust is the meter in front of you, moving when you flip a switch, and the knowledge that turning it off costs one keystroke.

That is where your own measurement earns its keep. The number that should matter is computed from your transcripts, on your screen, end to end, ready for a counter-check, not lifted from a landing page. Be suspicious of any tool that hands you a percentage it will not let you recompute. Be just as suspicious of yourself: the first week of savings usually comes from the cap, and the second week is where the habit either exists or does not.

Which brings me back to the half-installation. Steps one and two go in tonight. Step three gets switched on and then switched off the first time a colleague reads a terse reply over your shoulder. Step four waits indefinitely, because routing work to a cheap model still sounds like an apology. Fine. Do the two you will keep, and put the ceiling on the third, because the cap does not require you to believe anything.

Start with the free scan, no login and no card, on the conversations already sitting on your disk, then install with one command, npm install -g harnessup, on Windows, macOS or Linux. If a tool makes your agent unbearable, press Z and the whole panel goes back to the way it was. If it annoys you more than it saves, remove it entirely; everything ran locally, so there is no account to cancel and no data to chase.

Then run one afternoon with the ceiling in place and count how many times a file gets opened. Somewhere today a file is being read for the fourth time. The only open question is whether anyone decided it should be.

This article was drafted with AI assistance in HarnessUp Publish and approved by the HarnessUp team before publishing.