Agent Anti-Patterns · ~6 min
The agent never stops working. It just quietly starts solving a slightly different problem — and every step after looks productive.
You give a clear task with a constraint. Dozens of tool calls later the context is compressed. The summary keeps the goal and drops the constraint. From there the agent builds, coherently and confidently, toward a target that is subtly wrong.
Task: "Refactor UserService to use dependency injection. Do not change any public method
signatures." After compaction the prose summary retains "refactor UserService for DI" but loses the signature
constraint. The agent renames get_user_by_id to find_user — perfectly coherent with the
refactor goal, and a direct violation of the original instruction.
Summarisation favours high-frequency content. A constraint stated once looks like noise next to a goal that recurs across dozens of messages, so it gets discarded. A second trigger is instruction fade-out: models deprioritise initial instructions as history grows, even when those instructions are still present in context.
Write intent into a structured file before the agent starts, and re-read it at decision points. A named field survives compression better than prose, and the system prompt anchors it:
Reinforce with event-driven reminders (re-inject the objective at decision points) and bounded tasks — a loop that re-reads the original spec from disk on each restart can't accumulate drift.
Short sessions that never reach compaction don't need a session_intent.json — it's pure overhead.
Exploratory tasks suffer under strict anchoring, which blocks legitimate mid-session course corrections. And
structured summaries only help if your compressor actually preserves named fields — many paraphrase them away anyway.
Retrieval practice — recall, don't peek
Question 1Objective drift typically becomes visible when…
Question 2Summarisation drops a once-stated constraint because it…
Question 3A named session_intent field helps because it…
Question 4Strict intent anchoring backfires on…
Question 5 · spaced recall from Lesson 04The yes-man fix adds…