Context Is Everything: Keeping AI Coding Agents From Losing the Plot
A few weeks ago I told one of my agents to go execute something. It stopped me. “Wait, are you sure? I never received this.” I said yes, you did, go check. It pushed back again: “No, wait — that’s another LLM’s job. Can you double-check with them first?”
Two agents, in two different repositories, going back and forth about who owed what to whom — instead of just taking my word for it. That’s not a party trick. That’s what happens when you stop treating context as an afterthought and start treating it as infrastructure.
This is a slice of a longer brain dump — the permission-modes stuff (bypass, auto-edit, planning) and the hallucination thread are their own articles, part of the same mini-series. This one is only about context: why saturating it quietly wrecks your output, and the system I built so agents stop losing the plot.
The Million-Token Window Is a Trap
By default I use Opus. I know I have Max 20x, and yeah, you can use Sonnet if you want — that’s really up to you, I don’t want to waste time arguing about it. It has a million-token context window, and you’d think that’s just good news. It is, but not always.
Here’s the part people skip: even 10% of that window is a lot. Ten percent is 10k tokens. That’s huge. Don’t think that because you have a bigger context now you can keep tweaking a conversation until you’re at 80%, 90% full. That’s not how it works.
So the first thing I tell anyone past the beginner stage: install GSD — get shit done, though the full framework with its phases and milestones is its own animal, another article. What you want it for here is just the sidebar. GSD gives you a context window progress bar, and that’s the first time most people actually see themselves saturating a conversation instead of just feeling it in the output quality.
Whenever I have a new task, I start with something clean. Every time.
Stop Compacting. Write It Down Instead.
The instinct when a conversation gets long is to compact it. Don’t. Please, do not compact — don’t do that shitty thing where you ask the model to summarize itself down. It’s not useful for when you actually need to restart from scratch.
Here’s why. Context is just a way to hand the LLM all your data — but you don’t actually know what’s in there. A long conversation accumulates stuff, and maybe some information got mixed up along the way, and you have no real visibility into it. Compacting doesn’t fix that; it just compresses the mess.
Instead, write files. Store part of your reasoning, part of the context, outside the conversation itself. Then when you do need to restart from scratch, the LLM isn’t rebuilding from nothing — it only needs to retrieve what’s useful, from files whose content you actually know. That’s the real advantage: you know what it’s going to retrieve. Sometimes restarting from scratch is genuinely better than pushing a stale conversation further, precisely because you’re restarting from a known context instead of a saturated, half-mixed one.
The Docs Folder Is the Agent’s Memory
This is where it turns into an actual system. Every one of my projects has a docs folder, and I continuously ask the LLM to structure the data and knowledge that lives in it. I want those documents there, always — whether I’m looking at them in that moment or not.
Some of what’s in there: the database structure, because that matters enough that whenever there’s a migration, I’ve hooked it into the skill itself — the skill instructs the agent that this file needs to be updated too. I also keep an automatic changelog. Whenever I say commit, push, or deploy, it summarizes what happened in plain human language and logs it there. That’s not busywork. That’s me building my own memory, in a form the agent — or me, weeks from now — can actually read back.
Backlog and Handover: How Multiple Agents Stay in Sync
On top of docs, I have a backlog folder. Think of it as the replacement for Jira, except it actually works for how I work. Because I’m running a multi-repo setup, it’s three folders — todo, working, done — plus one more: handover.
The mechanics are simple. I have a slash command to pick a file out of todo and start on it. The agent reasons through it — typically in auto-edit, it figures out on its own whether it actually needs to stop and plan first — does the work, and once it’s done, moves the file into done and rewrites it with everything that happened. That’s a memory of the work itself, not just the code that came out of it.
handover is the one that matters across repositories. When something in one repo depends on another repo doing its part, the agent writes a handover file — like a note left between colleagues. Between LLM colleagues, basically. The next repo has its own slash command to pick that file up and run with it: take this, please do XYZ.
And that’s the system behind the exchange I opened with. My project is complex enough — five, six microservices — that the agents are now checking these files against each other instead of just taking whatever I say in the moment at face value. I say “execute this,” and rather than blindly doing it, one of them comes back with: wait, I never actually received that handover, are you sure this is the other service’s job, can you confirm before I touch anything? They’re collaborating between themselves and exchanging information through the files. That’s super useful.
One more piece: rather than keep nagging an agent mid-conversation about something I want tracked, I have a command that just says, write this to the backlog — and it creates a ticket right there. In my ideal world those tickets eventually get picked up and worked autonomously. Not there yet. It doesn’t need to be, for this to already be worth it.
Closing
If I had to compress all of this into one line: the docs folder, plus the backlog folder, plus the handover file. That’s basically the whole system, and it’s honestly this easy. It sounds almost too simple to be the thing keeping six microservices from stepping on each other. But the model was never really the bottleneck.
What you let it keep, and what you make it forget, is.
I love feedback.
Did this help? One tap — that's it.
Thanks 🙏
Want to add anything — or get in touch? Totally optional.
Got it — thank you. 🙏