Stop Hoarding Context. Why Forgetting Makes Coding Agents Smarter.

You’re three hours deep into a complex coding session with your AI agent. You’ve read dozens of files, run bash commands, fetched web pages. Suddenly, the agent starts acting drunk. It forgets your instructions, hallucinates APIs, and eventually hits the dreaded context window cap. You’re forced to start a new chat, losing all the nuanced context you’ve built up.

We’ve all been there. It’s the single most frustrating bottleneck in AI-assisted development today. We try to manage it with complex summarization techniques or expensive long-context models, but the underlying assumption is always the same: an agent needs to remember everything it has ever done to be effective.

But what if that assumption is completely wrong? What if the secret to a long, coherent AI coding session isn’t a bigger memory, but deliberate amnesia?

Enter Keen Code, a solo-built coding agent written in Go that challenges the industry’s hoarding instinct. It introduces a concept called Turn Memory, and it flips the script on how we manage agent context.

Hoarding past results doesn’t make an agent smarter; it just makes it bloated and prone to hallucination.

Here’s how it works: within a single agent loop, the agent sees the full results of its tool calls. But when it moves to the next turn in the conversation, Keen Code deletes the actual tool outputs, retaining only the traces of what it called. The context window suddenly drops from 20% full to 1%.

At first glance, this sounds disastrous. If the agent needs to refer to a file it read five minutes ago, it doesn’t have the output anymore. Isn’t that a massive failure? Not quite.

The developer behind Keen Code makes a brutally pragmatic observation: tool calls like read, bash, or web_fetch are cheap. If you need to refer to an earlier file, just read it again. In fact, if you watch Claude Code or OpenAI’s Codex closely, you’ll notice they frequently re-read the same files anyway, despite having them in context.

The cheapest way to solve a problem is often to just look at it again.

By forcing the agent to re-fetch data when it actually needs it, rather than carrying the weight of every past action just in case, Keen Code keeps its context window lean. This allows for uninterrupted, multi-turn conversations that don’t degrade in quality over time. It trades the illusion of perfect memory for the reality of sustained competence.

But the war on context bloat doesn’t stop at memory. Keen Code also tackles how we load tools. Most agents pre-load every single MCP (Model Context Protocol) server with all its tool schemas upfront. It’s like carrying your entire toolbox on your back while walking to the job site.

Keen Code’s Skill-Driven MCP approach only loads a minimal skill frontmatter. If the agent decides it needs a specific tool, it reads the schema file for that exact tool, right before invoking it. It’s on-demand tool loading.

Context window space is prime real estate; stop treating it like a storage unit.

This isn’t just a neat hack; it’s a philosophical shift. We’ve been treating LLMs like databases, trying to cram as much history into them as possible. Keen Code treats them like working minds—entities that should focus only on the task at hand and forget the clutter.

If you’re building or using coding agents and constantly fighting context limits, it’s time to question your instincts. Stop trying to remember everything. Embrace the clean slate.

FAQ

Q: Doesn't deleting tool outputs break the agent's coherence?

A: No, because the agent retains the traces of what it did. If it needs the actual data again, it just re-reads the file or re-runs the command. Tool calls are cheap; context space is precious.

Q: What's the practical implication for developers?

A: You can run significantly longer, multi-turn coding sessions without hitting context caps or experiencing the degradation in reasoning that comes from a bloated context window.

Q: Is on-demand tool loading actually faster?

A: It adds a microsecond delay for a file read, but it saves massive amounts of context space. The trade-off heavily favors keeping the agent's attention focused rather than loading tools it might never use.

📎 Source: View Source