Context Engineering · ~7 min
Long sessions drift. Two defenses, mirror images of each other: push the goal forward, keep the failures behind.
Earlier instructions sink into the low-attention middle (Lesson 02), and error cleanup throws away signal. Both cause drift. The fixes pull in opposite directions across the timeline.
Maintain a running todo.md and rewrite it after every step — check off what's done,
restate what remains. Each rewrite pushes the objective into the high-attention recency tail, right where the model
is about to generate.
It's the agent-initiated, continuous cousin of Critical Instruction Repetition (author-placed, static). One you write into the harness; the other you write into the prompt.
The instinct to clean up after an error — delete the stack trace, clear the failed call — is usually wrong. A failed action plus its error is a negative example: the model sees the dead end and updates away from it.
Cursor measured a 30% performance drop from stripping reasoning traces — lost subgoals, repeated re-derivation, doom loops. The permission-error you delete is the one the agent retries next turn.
Preserve novel failures and active recovery; compact once recovery succeeds, or when the same error repeats 3+ times (a doom loop — break it, change strategy). And anchor "is it fixed?" to deterministic signals — tests, linters, types — not the model's own say-so.
Telling a model to "preserve tokens, don't be wasteful" backfired: it refused ambitious tasks ("I'm not supposed to waste tokens… not worth continuing!"). It reads "be efficient" as "avoid anything that might fail" — the opposite of recovery behavior. Don't moralize tokens at the agent.
todo.md, rewrite it each step, lead with the imperative objective.Retrieval practice — recall, don't peek
Question 1Rewriting the todo each step pushes the objective into…
Question 2When an approach fails, you should usually…
Question 3Telling an agent "don't waste tokens" tends to make it…
Question 4The same error repeated 3+ times signals…
Question 5 · spaced recall from Lesson 11On-demand retrieval's hidden failure mode is…