Skip to content

Context Window Management

One of the most practical agent skills is keeping the active context small enough that the model does not get noisy or forgetful.

  • reading entire directories when only one file matters
  • pasting long logs instead of the relevant error slice
  • keeping a debugging session alive long after the task changed
  • loading tools or MCP servers that are irrelevant to the current work
ProblemBetter move
Large repo explorationname the exact files or folders first
Noisy test outputcapture only the failing lines or summary
Mixed tasks in one threadstart a fresh session for the new goal
Research plus implementationisolate research in a subagent
  • generated files
  • lockfiles unless the task is dependency-related
  • raw screenshots when a short description will do
  • full build output when only one error matters
  • old prompt history that no longer affects the task
Read only these files first:
- src/auth/middleware.ts
- src/routes/admin.ts
Summarize what matters, then propose the smallest fix.

More context is not automatically better. Curated context usually beats maximal context.