Language models have no memory between turns. Every time you send a message to Claude Code, Cursor, or Copilot Chat, the tool resends everything to the model: the system prompt, the tool definitions, your project context file, and the entire conversation history [1][2]. Your new message is a small piece at the very end.
That means the cost of a session depends on what travels with every turn, not on your latest question. A 2,000-line file you pasted at the start of a session gets sent again on the second turn, the third, and every turn after that until you close the session. Claude Code's own docs put it plainly: a one-line question in a session that has been open all day still draws usage for the whole conversation [2].
Prompt caching makes the repeated part cheaper [3], but those tokens still take up the context window [1]. And a fuller window is a worse window: accuracy and recall degrade as the token count grows, which Anthropic calls context rot [1][4]. Models also tend to miss information buried in the middle of a long input [5]. Once the window fills, the tool compacts the history into a summary [2], and details you cared about can get lost along the way.
Here are five habits I changed because of that.
1. One task, one session
A session you used for debugging, then refactoring, then a deployment question carries the history of all three into every turn. Once a task is done, I start fresh (/clear in Claude Code) [2]. If the old session produced an important decision, I write it down in a sentence or two and paste it at the start of the new one.
2. Keep your project context file short
CLAUDE.md loads at the start of every session [6], and Cursor puts always-applied rules at the start of the model context [7]. You pay for each line in them on every turn. I keep only rules that change how the model behaves: build commands, conventions it keeps breaking, traps that have caused errors before. Anthropic suggests keeping CLAUDE.md under 200 lines and moving workflow-specific instructions into skills that load only when needed [2].
3. Turn off MCP servers you don't use
Tool definitions count toward the context window like everything else [1]. Claude Code now defers MCP tool definitions by default, so only tool names and server instructions enter context until Claude actually uses a tool [2][8]. That helps, but it isn't zero, and setups without tool search (a custom ANTHROPIC_BASE_URL, for example) still send full definitions [8]. I disable servers I'm not using for the current project, and when a CLI like gh does the job, I let the model call the CLI instead [2].
4. Point to the file instead of asking it to search
"Why is login failing?" sends the agent exploring the repo: grepping here and there, reading files that turn out to be irrelevant, and all of it lands in the history. "Check refreshToken in AuthRepository.kt and tell me why it returns null when the token expires" goes straight to the target. Vague requests trigger broad scanning; specific ones need far fewer file reads [2].
5. Filter output before you paste it
An 800-line build log or a full test run is rarely needed in full. The model needs the error message and a few lines of stack trace around it. I trim it first, or rerun only the failing tests. In Claude Code you can automate this with a hook that filters test output down to failures, or hand noisy work to a subagent so only its summary comes back [2].
Check it yourself
Run /context in Claude Code at the start of a session, before you type anything [2]. The number you see there is the fixed cost you pay on every turn, and it's usually bigger than you'd expect.
References
- Anthropic. Context windows. Claude Platform Docs. https://platform.claude.com/docs/en/build-with-claude/context-windows
- Anthropic. Manage costs effectively. Claude Code Docs. https://code.claude.com/docs/en/costs
- Anthropic. Prompt caching. Claude Platform Docs. https://platform.claude.com/docs/en/build-with-claude/prompt-caching
- Anthropic Engineering. Effective context engineering for AI agents. September 29, 2025. https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., and Liang, P. Lost in the Middle: How Language Models Use Long Contexts. arXiv:2307.03172, 2023. https://arxiv.org/abs/2307.03172
- Anthropic. How Claude remembers your project. Claude Code Docs. https://code.claude.com/docs/en/memory
- Cursor. Rules. Cursor Docs. https://cursor.com/docs/context/rules
- Anthropic. MCP, section "Scale with MCP tool search". Claude Code Docs. https://code.claude.com/docs/en/mcp#scale-with-mcp-tool-search
