The Dirty Secret of Coding Agents

3 min read Original article ↗

Vlad Shumlin

Your agents aren’t failing because they’re “dumb”. They’re failing because their context is dirty. Human engineers are built to filter that; coding agents aren’t.

Press enter or click to view image in full size

Every engineering leader has seen it: the AI agent that seemed brilliant in a demo but collapses in a real codebase.

Why? Because coding agents reason only with the information they’re given. That includes every outdated design doc, every contradictory comment, every forgotten convention. They don’t know what’s current, what’s deprecated, or what’s noise. They just absorb it all.

Sometimes you get lucky. More often, you get hallucinations, plausible but wrong reasoning that resists correction.

Research shows that irrelevant context can increase error rates by up to 300%¹, and longer inputs degrade performance further². No surprise, then, that Google and others now treat context engineering as a discipline on par with testing or CI/CD¹⁰ ¹¹.

Why Context Breaks

The failure modes are consistent and painfully familiar³:

  1. Context Poisoning
    A single hallucinated detail, once introduced, becomes irreversible. Agents keep reusing it. There’s no structured identification and rollback mechanism.
  2. Natural Drift
    Yesterday’s sound decisions become today’s liabilities. Old architectural notes and specs reappear through agents, reviving patterns that should have stayed dead.
  3. Contradictions
    When specs, code, and comments disagree, agents invent reconciliations that look coherent but are unstable or inconsistent.
  4. Signal Loss
    The more context they ingest, the weaker their focus. Irrelevant noise dilutes important signals, cutting accuracy by 40–60% in multi-turn tasks¹².

💡 Your agent isn’t getting dumber. Its memory is getting dirtier.⁵

Why Developers Should Care

  1. Code review noise
    Pull requests bloated with fixes for style, outdated conventions, or half-truths. Harness’s 2025 survey found 67% of developers spend more time debugging AI code than it saves¹³.
  2. Regression risk
    Agents revive deprecated patterns and stale specs, re-introducing bugs and known vulnerabilities. Nearly 60% of teams report AI tools cause deployment errors at least half the time¹³.
  3. Slow adoption
    AI pilots stall when agents add review overhead instead of reducing it.
  4. Trust loss
    Leadership hesitates to invest further when agents can’t be relied on for critical paths.
  5. New attack surface
    Hallucinated dependencies aren’t just bad code — they’re a security hole. “Slopsquatting” attacks⁶ have already compromised over 1M GitHub repos⁷. Nvidia researchers call the attack surface “basically infinite”⁸.

💡 Context failure doesn’t show up as abstract “hallucination” , it lands in your workflow.

Treat Context Like Infrastructure

Managing context isn’t optional anymore. Like CI/CD or testing, it must be engineered, enforced, and continuous:

  1. Filter out noise
    Curate aggressively. Remove irrelevant duplication. Techniques like context purification cut hallucinations by up to 73%¹².
  2. Detect and adapt
    Monitor context quality continuously. Surface contradictions before they cascade into regressions.
  3. Stay current
    Expire and replace stale knowledge automatically. Audit trails keep the system clean.
  4. Align across agents
    Give every tool and agent the same unified source of truth. Stop silos before they start.
  5. Tailor to teams
    Adapt context to coding dialects, libraries, and practices. Agents should mirror your team, not generic GitHub.