Context Engineering: Feed the Model the Right Things
A model can only reason about what is in its context window. Most failed agent runs are not reasoning failures, they are context failures: the agent never saw the file it needed, or it drowned in noise it did not. On a real codebase, deciding what enters the window is the skill that separates good results from frustrating ones.
The discipline is called context engineering: choosing what goes in, in what order, and when to clear it out. The goal is a small, high-signal context, not the biggest one you can stuff in.
Step 1: Point, do not paste
Instead of pasting a whole file, reference it. Modern agents read files on demand. In Cursor you mention a file with @, in Claude Code you name the path. This keeps the window lean and lets the agent pull exactly what it needs.
The bug is in @src/auth/session.ts. Tokens expire too early.
Read that file and the test in @src/auth/session.test.ts,
find the cause, fix it, and make the test pass.Step 2: Clear context between unrelated tasks
When you switch to a new task, old context becomes noise that can confuse the agent. In Claude Code, /clear wipes the conversation so the next task starts fresh. Treat a long, drifting session as a warning sign.
Step 3: Use compaction on long tasks
Some tasks are genuinely long. When the window fills up, agents can compact: summarize the work so far and keep going with the summary instead of the full history. Let it compact rather than starting over, so it does not lose the thread.