AI Coding Agents and the Doom Loop — The Real Cost of Poor Context
Sometimes, when we give an AI coding agent a task, it does not deliver the result we expect. We prompt again. The code changes. The problem remains.
This cycle of repeatedly circling the same problem is called a doom loop.
One major cause is poor context.
Suppose our project’s architecture has changed, but the agent is still using old documentation. Even if it writes good code, the implementation may not match the actual requirements.
Wrong context → Wrong implementation → Re-prompting → Rework → Higher token use and development cost.
Is more context the solution?
Not necessarily.
Connecting every document, data source and MCP server in a project does not guarantee better results.
As the amount of information grows, identifying the right information can become harder, especially when sources are outdated, irrelevant or contradictory.
Having access to information and identifying the right information are two different things.
What is the solution?
This is where context engineering and the idea of a context engine become useful.
We should focus on:
- Relevant context — Supply the information needed for the task.
- Up-to-date context — Use accurate, current sources rather than outdated documentation.
- Smart retrieval — Identify relationships between GitHub PRs, tickets, logs and documentation to retrieve what is needed.
- Conflict resolution — Identify contradictory requirements and decisions, then confirm which information is correct.
- Validation and feedback — Check whether the agent’s results match the real requirements.
Adding AGENTS.md, rules files or MCP servers can help. The information they provide must also be accurate, relevant and trustworthy.
What should software engineers focus on?
We need to engineer a way to provide the right context, at the right time, in the right amount.
This can reduce doom loops and unnecessary rework, optimize token use and development cost, and improve software quality and development efficiency.
The model’s capabilities matter. To use those capabilities effectively, the quality of the context it receives matters just as much.
Have you experienced a doom loop while working with AI coding agents? Share your experience.
In the next article, we will discuss code reviews and the “review tax” in the agentic AI era.