{"slug": "the-more-context-you-give-your-ai-coding-agent-the-worse-it-can-get", "title": "The More Context You Give Your AI Coding Agent, the Worse It Can Get", "summary": "A developer argues that giving AI coding agents more context can degrade their output, because stale, conflicting, or irrelevant files create competing sources of truth that agents resolve unpredictably. The post recommends \"minimum sufficient context\" and a progressive approach — start small, add relevant files, and let the agent inspect before expanding — rather than dumping an entire repository, logs, and prior session memory into the prompt.", "body_md": "We keep hearing the same advice:\n\n**Give the AI more context.**\n\nAdd the README.\n\nAdd `AGENTS.md`.\n\nAdd architecture docs.\n\nAdd logs.\n\nAdd previous decisions.\n\nAdd the whole repository.\n\nAdd memory from previous sessions.\n\nSounds reasonable.\n\nBut there is a problem:\n\n**More context does not always mean better understanding.**\n\nSometimes it means more noise.\n\nMore stale assumptions.\n\nMore conflicting instructions.\n\nMore irrelevant files.\n\nAnd more chances for the agent to focus on the wrong thing.\n\nThat is the part I think developers need to pay more attention to.\n\nIt makes sense at first.\n\nIf the agent knows more about the codebase, it should make better decisions.\n\nRight?\n\nSometimes.\n\nBut imagine giving a developer:\n\nand then asking:\n\n“Fix this bug.”\n\nThat is not automatically helpful.\n\nThat is a lot of information to sort through.\n\nThe same problem can happen with AI agents.\n\nNot all context is equally useful.\n\nSome context is:\n\n**Relevant**\n\nSome is:\n\n**Outdated**\n\n**Conflicting**\n\n**Wrong**\n\n**Technically correct but irrelevant to the current task**\n\nIf you give all of it equal weight, the agent has to figure out what matters.\n\nAnd that is where mistakes start.\n\nSuppose your current system uses:\n\n``` text id=\"ixn1f3\"\n\nController\n\n   ↓\n\nService\n\n   ↓\n\nRepository\n\n```\nBut an old architecture document still says:\n\n``` text id=\"8ylsl1\"\nController\n   ↓\nData Layer\n```\n\nYou ask the agent to add a feature.\n\nNow the agent has two sources of truth.\n\nWhich one should it trust?\n\nMaybe it follows the code.\n\nMaybe it follows the documentation.\n\nMaybe it blends both.\n\nAnd now you get a new pattern that never existed before.\n\nThe problem was not lack of context.\n\nThe problem was **bad context hygiene**.\n\nMissing context usually creates uncertainty.\n\nStale context can create confidence in the wrong direction.\n\nThat is more dangerous.\n\nFor example:\n\nThree months ago:\n\n“All payments go through Provider A.”\n\nToday:\n\nHalf the system has moved to Provider B.\n\nBut the agent still carries the old rule in memory.\n\nNow it confidently implements the wrong integration.\n\nThat is why persistent memory can be useful and dangerous at the same time.\n\nImagine the agent reads:\n\n``` text id=\"hp3on9\"\n\nAGENTS.md:\n\nUse service classes for all business logic.\n\n```\nThen another file says:\n\n``` text id=\"x68ti8\"\nREADME:\nKeep business logic inside route handlers.\n```\n\nThen an old task note says:\n\n``` text id=\"14479z\"\n\nAvoid adding new service layers.\n\n```\nAll three may have been correct at different times.\n\nNow they coexist.\n\nThe agent has to resolve the conflict.\n\nThat is not a safe default.\n\n---\n\n# More Tokens Do Not Mean More Attention\n\nThis is another important point.\n\nA bigger context window gives the agent access to more information.\n\nIt does not guarantee equal attention to every piece of information.\n\nIf you include:\n\n- hundreds of files\n- long logs\n- old discussions\n- huge docs\n\nthe important detail may become harder to surface.\n\nThe real problem becomes:\n\n> **Can the agent find the right context at the right moment?**\n\nThat is different from:\n\n> **Can the agent fit everything into the prompt?**\n\n---\n\n# The Goal Should Not Be Maximum Context\n\nI think the better goal is:\n\n> **Minimum sufficient context.**\n\nGive the agent enough information to make the right decision.\n\nNot everything you have.\n\nFor example, if the task is:\n\n> “Fix a validation bug in checkout.”\n\nThe agent probably needs:\n\n- checkout flow\n- validation rules\n- related tests\n- relevant data model\n- current architecture constraints\n\nIt probably does not need:\n\n- email service docs\n- analytics history\n- unrelated migration logs\n- old design discussions\n- every frontend component\n\nMore is not automatically better.\n\n---\n\n# Use Progressive Context\n\nA better pattern is:\n\n``` text id=\"k7ov9i\"\nStart small\n↓\nGive relevant files\n↓\nLet the agent inspect\n↓\nAdd more only when needed\n```\n\nInstead of:\n\n``` text id=\"dxypv0\"\n\nDump everything\n\n↓\n\nHope the agent finds what matters\n\n```\nThis is basically progressive disclosure for coding agents.\n\nLet the agent earn more context as the task requires it.\n\n---\n\n# Ask the Agent What It Needs\n\nThis is surprisingly useful.\n\nInstead of giving the whole repo immediately, ask:\n\n``` text id=\"wd8gzg\"\nBefore changing anything:\n\n1. What information do you need?\n2. Which files are likely relevant?\n3. What assumptions are you currently making?\n4. What context would reduce uncertainty?\n```\n\nNow the agent tells you what it is missing.\n\nThat is much better than blindly adding more.\n\nI think teams should split context into two categories.\n\nThings that should almost always be true:\n\nThings relevant only to the current job:\n\nMixing both into one giant blob makes reasoning harder.\n\nThis is important.\n\nYour agent instructions should not become a novel.\n\nIf your `AGENTS.md` is 5,000 lines long, developers probably do not read it carefully either.\n\nThe best permanent rules are usually simple.\n\n``` text id=\"w7h7wu\"\n\nClear.\n\nShort.\n\nHard to misinterpret.\n\nSome context should not live forever.\n\nIf the agent can remember something forever, someone needs to decide when that memory stops being valid.\n\nThis is why I think agent memory needs something humans already understand:\n\n**Lifecycle management.**\n\nContext should be:\n\n**created**\n\n**reviewed**\n\n**updated**\n\n**expired**\n\n**deleted**\n\nJust like code and documentation.\n\nAnother good habit:\n\nDo not let context appear as one anonymous blob.\n\nThe agent should know where information came from.\n\n``` text id=\"l6tqad\"\n\nSource: current code\n\nSource: AGENTS.md\n\nSource: architecture decision record\n\nSource: incident from June\n\nSource: previous agent memory\n\n```\nWhy?\n\nBecause source matters.\n\nCurrent production code should probably outweigh a two-year-old planning document.\n\nWithout provenance, everything can look equally trustworthy.\n\n---\n\n# Ask the Agent to Surface Conflicts\n\nBefore implementation, try:\n\n``` text id=\"gprxfr\"\nReview the available context.\n\nIdentify:\n\n- conflicting instructions\n- outdated assumptions\n- duplicated rules\n- unclear sources of truth\n- anything that may no longer be valid\n\nDo not change code yet.\n```\n\nThis is a very useful step for large codebases.\n\nYou want context conflicts visible before they become code.\n\nThis sounds backwards.\n\nBut imagine the agent sees 10 partial references to a system behavior.\n\nNone gives the complete picture.\n\nIt may combine them into a plausible explanation.\n\nThat explanation can sound very confident.\n\nAnd still be wrong.\n\nThe issue is not always missing information.\n\nSometimes it is **too many incomplete signals**.\n\nWe usually think architecture means:\n\nBut in AI-assisted development, context becomes part of the system too.\n\nBecause context influences:\n\nThat means context needs engineering discipline too.\n\nBefore giving an AI agent more information, ask:\n\nIf not, leave it out.\n\nIf you are not sure, verify it.\n\nResolve that first.\n\nPrefer the newer one.\n\nMaybe later is better.\n\nIf not, do not treat it as permanent memory.\n\n``` text id=\"5axqqf\"\n\nLoad entire repo\n\n↓\n\nLoad all docs\n\n↓\n\nLoad memory\n\n↓\n\nAsk agent to work\n\n```\nI prefer:\n\n``` text id=\"d6w46d\"\nDefine task\n↓\nGive core constraints\n↓\nAgent identifies needed context\n↓\nLoad only relevant files\n↓\nCheck for conflicts\n↓\nImplement\n↓\nVerify\n```\n\nThe difference is simple:\n\n**Context becomes intentional.**\n\nAI coding agents do not just need more information.\n\nThey need:\n\n**the right information**\n\n**from the right source**\n\n**at the right time**\n\nThat is a much harder problem.\n\nBut it is also where developers can add real value.\n\nWe keep trying to make AI coding agents smarter by giving them more context.\n\nSometimes that works.\n\nSometimes it makes things worse.\n\nBecause:\n\n**More context can mean more noise.**\n\n**More memory can mean more stale assumptions.**\n\n**More instructions can mean more conflicts.**\n\nThe goal should not be:\n\n**Give the agent everything.**\n\nThe goal should be:\n\n**Give the agent exactly what it needs to make the right decision.**\n\nBecause the best context window is not the biggest one.\n\nIt is the one with the **least irrelevant information and the clearest source of truth**.", "url": "https://wpnews.pro/news/the-more-context-you-give-your-ai-coding-agent-the-worse-it-can-get", "canonical_source": "https://dev.to/robertadam987_/the-more-context-you-give-your-ai-coding-agent-the-worse-it-can-get-4d40", "published_at": "2026-10-03 03:52:59+00:00", "updated_at": "2026-10-03 04:08:01.483466+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models"], "entities": [], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/the-more-context-you-give-your-ai-coding-agent-the-worse-it-can-get", "markdown": "https://wpnews.pro/news/the-more-context-you-give-your-ai-coding-agent-the-worse-it-can-get.md", "text": "https://wpnews.pro/news/the-more-context-you-give-your-ai-coding-agent-the-worse-it-can-get.txt", "jsonld": "https://wpnews.pro/news/the-more-context-you-give-your-ai-coding-agent-the-worse-it-can-get.jsonld"}}