Field note: the token tax of @-attaching a folder vs specific files in a multi-step run

Sharing a token-cost pattern I keep tripping over with agent mode, in case it saves someone a confusing bill.

When I @-attach a whole folder as context and then let the agent run a multi-step task (edit, run, read output, edit again), that folder gets pulled back into context on a lot of the turns — not just the first one. On a small folder it’s noise. On a folder with a few large files (generated clients, lockfiles, a fat types.ts), it stops being noise: the same tens-of-thousands of tokens ride along on turn after turn, and the run’s cost grows with the number of steps, not with how much the agent actually needed to look at.

What made it visible for me was boring: I started diffing “what did I attach” against “what did the model actually need to touch to finish.” Almost every time, the answer was 2–3 files, and the folder attachment was carrying a dozen more along for the ride the whole way.

Two things that helped, neither clever:

  • Pin the specific files instead of the folder once I know which ones matter. First exploratory turn can have the folder; after that, narrow it.
  • Keep the genuinely large, rarely-relevant files (generated code, lockfiles, big fixtures) out of the attached set entirely and let the agent ask for them if it needs them.

Rough magnitude in my case: a ~6-step task on a folder with one big generated file went from “why is this so expensive” to maybe a third of the tokens, same result, just by pinning the three files that actually changed.

Curious whether others have measured this — does folder-attach re-send on every step for you, or does it depend on how the task is phrased? And is there a cleaner way to say “explore this folder once, then stop re-sending it” that I’m missing?

Hi @reelwiselab Thank you for the forum post! When you mention a specific @ file or folder, Cursor takes it very seriously and folds it into the conversation context. It treats it as more deliberate, like you are directly drawing its attention to the folder than Cursor discovering it on its own and deciding whether or not it’s important. So if you have an important folder that you may need attached to the conversation context sometimes but not always, you may wish to incorporate that folder into your Cursor workspace, and then let the agent traverse and discover that folder naturally and pull it into the context when needed. This way Cursor has access to the folder, but it’s not “required” that it look at the folder each time.

Let me know if you have any follow-up questions!