Why AI Coding Agents Churn Out Slop After 20 Turns: Context Blindness

A developer on r/LocalLLaMA audited their API logs and prompt payloads after noticing token usage spiking and agent output degrading into slop after ~20 turns. Their conclusion: the models aren't getting lobotomized; they're suffocating on their own bloated context windows.
The Four Structural Blunders
After inspecting what Cursor and Claude Code actually do on a 10k+ line repo, the author identified four patterns:
- Blind exploration: The agent recursively greps and dumps ~40 different files into context just to find one utility function. Often it misses an existing component and hallucinates a duplicate from scratch.
- Raw ingestion: Dumping a 2,000-line file into the prompt to update a 5-line interface. Wastes vast context tokens.
- Tool diarrhea: Verbose test logs and massive MCP tool definitions consume ~30k tokens before the model generates a single token of code.
- Goldfish memory: Every session starts fresh — zero project awareness — so the same files get re-read repeatedly.
Tipping Point at 80% Context
Once the context hits ~80% capacity with noise, the model's attention mechanism degrades sharply. IQ visibly drops to room temperature, and it starts destroying the architecture. Standard chunking RAG doesn't fix this because it's garbage for logic — the agent remains blind to codebase structure until it burns tokens reading raw text.
Proposed Fix: AST or Graph DB
The author calls for an open-source agent that parses code into an AST or graph database before consuming context, so it understands structure without wasting tokens on raw text. This would prevent architectural spaghetti that costs 5 hours to fix for every 1 hour saved on typing.
Who This Is For
Developers using Cursor, Claude Code, or local LLM agents for real-world codebases who are frustrated by productivity paradoxes.
📖 Read the full source: r/LocalLLaMA
👀 See Also

How I built a 3D scroll website in 2 hours using Claude Code and Veo
A developer built a 3D scroll website in 2 hours using Claude Code, Veo video generation, and a custom 'video to website' skill. Full code and live demo shared.

Open-source Agent OS: Rust-based OS for AI agents with WASM sandboxing and Hands feature
An open-source operating system for AI agents has been released with 137k lines of Rust code under MIT license. The system runs agents in WASM sandboxes with 16 security layers and introduces 'Hands' for scheduled, autonomous agent operation.

CC-Ledger: Track Claude Code Costs Per Session and Per PR with Local SQLite
CC-Ledger is a Rust binary that hooks into Claude Code, logging each turn to local SQLite. Catch runaway sessions live and see per-PR cost without an API key. Includes macOS menu bar, web dashboard, and CLI views.

OpenIntel Iran: AI-Powered Conflict Dashboard Updates with Hourly Briefings
A developer's AI agent has overhauled the OpenIntel Iran dashboard, an auto-updating intelligence tool that scans Reuters, AP, BBC, and other major sources hourly to verify developments and publish structured briefings on the Iran-Israel-US conflict.