Drift-Bombs and Token Burns
I'm just going to say it: managing context with AI is a terrible experience. I've built reasonably sized code bases for websites and apps in my career. The past 4 years, I've spent mostly managing a team, and it's been exhilarating getting back into code with the help of AI. From my previous adventures as a front-end dev, it was critical that I keep a good running knowledge of how my code all works. My brain is packed with nuanced fine details of patterns and areas of debt. Now that I've been handing a lot of the coding work off to the agent, I have come to appreciate how much information our human brains can retain and manage.
This journal entry shares my latest experiments in my quest to manage AI context. I'll talk about switching from Linear to using workflows in simple markdown files. I also share my initial reactions to Claude Code and whether it beats using Cursor, or complements it. Along the way I've learned that AI coding requires some zen rather than going at breakneck speeds. Here's my experience from the last couple weeks.
The Continued Frustration of AI Drift
As I wrote previously, when I'm working with an agent, it can be an awesome experience where everything moves fast. Until it doesn't. When the short-term memory of the agent (aka the context window) fills up, it's so painful, disruptive and deflating. Many smart engineers are trying to find ways to move forward while building an app that can be maintained and managed for the long term.
I wrote about using Linear as a form of long-term memory and it worked, kind of. The problem I found was adding a separate tool in the loop made things slower and added complexity that wasn't helpful. I wanted to have all my plans right there with me in Cursor. Even when my Linear connection did work well, recovery time post AI-belly-flop was still tedious to recover from.
I was moving so fast, generating huge amounts of work, but then the agent detonated a drift-bomb on my codebase. I would then spend hours trying to get a basic feature complete, yearning for the glory days of two hours ago. Speed meets mud, like you just drove your new Porsche into a bog. If this was going to work, I needed to be smart, not fast and furious.
Enter Workflows
I recently came across this Cursor Community thread called "A Simpler, More Autonomous AI Workflow for Cursor" and it got me excited about a simple approach for managing context and staying on track.
Workflows are processes where the AI can move through states and only move on based on meeting specific acceptance criteria. Some common workflows include:
Explore ↠ Plan ↠ Confirm ↠ Code ↠ Commit
Write Tests ↠ Commit ↠ Code ↠ Iterate ↠ Commit
Through effective short prompts, a path is created for the AI. In Kleosr's guide on the Cursor forum, he did two things: created a workflow and created a concise memory bank, aka "the brain." His workflow was similar to the first above:
Analyze ↠ Blueprint (plan) ↠ Construct ↠ Validate ↠ Iterate
As the agent went through this workflow, it updates a document that houses a list of tasks and progress logs. After an iteration completes, if there are more items in the list the workflow resets and the agent goes through the workflow again.
This worked really well, again, until it didn't. I found this approach provided much needed maturity and structure to staying on track. The agent responded really well to the steps and hitting the acceptance criteria along the way. It would stop when it hit the right markers. I would test the code and validate the outcome. I felt the vibes again, and started to set up long tasks and kick back and watch it go. It got to the point where I could multi-task and chat with ChatGPT in another window setting up the next bit of work.
AI Hates Rules?
Workflows was an improved experience but it wasn't the silver bullet. I bumped into another really interesting behavior working with AI—instructions and rules getting lost in a growing sea of context. If you're not disciplined, attention can still start to fade and the model starts skipping steps. The dreaded drift was back.
To combat this, I created a few simple Cursor rules that ran with every message. This wasn't a solve, but it did help, a little. Even these rules would eventually be ignored and I would resort to starting a new chat and resetting everything.
Amid confusion and feeling like I was close to a breakthrough I wondered if there was a way to know if you're walking too close to the edge of the context window? I asked Claude if it was possible to monitor drift and it said it couldn't identify if it was running out of context. ChatGPT did tell me that the worse my prompts were, the worse the drift and hallucinations would be. In my befuddlement, I created a rule that instructed the AI to ask questions when I gave it a bad prompt. That helped a little too.
It then dawned on me. The frustration that I felt when the AI drifted generally led me to give short, frustration-filled vague prompts—making the problem worse. In a way, I was the problem. I was hooked on the speed that AI provides when it's at its best. I started to repeat "garbage in, garbage out" to help remind me to mentally regroup.
Claude Code
After being sold on workflows, I watched a presentation from Boris Cherny who leads the development of Claude Code. His talk dug into workflows and shared some best practices and pro tips for using the tool. I put $10 into my Anthropic slot machine (the API) and gave Claude Code a swing.
When I opened it, I really didn't know what to do. So I just started talking to it about my project as Boris suggested. Now with a bit of workflow muscle built, I gave Claude Code a feature prompt. As the tool dug in, I saw that it made its own todo list and step by step started to execute it. It felt just like what I had experienced in Kleosr's workflow in Cursor, except with a fit and finish that abstracted away a bunch of the management. Watching the token counter ticking higher and higher as the tool worked gave me some anxiety. I knew with every increment it meant money gone.
With the idle time, I started to think about what I could do in parallel. I started up Cursor and began to validate and test the work as it came in. I eventually embedded Claude Code into Cursor and would start doing two things at once: one generating code, and one validating and planning the next feature. It was pretty magical.
I was burning through tokens like they were going out of style. The $10 lasted about an hour. It was pay to play. I now understood why Claude Max cost so much. Claude Code was doing a lot of the heavy lifting under the hood.
Claude Code wasn't immune to context issues, but it did emphasize that I needed to use the tool in a slower, more methodical and smart way. When I did, the quality and experience was just that much better. Garbage in, garbage out.
I Think I'm Getting This
After many days of frustrating lows, I felt like I needed a mental reboot. What I learned is that no matter how good the tools, I still needed to come at things smarter.
Here's what my zen workflow looks like now. I spend a few moments thinking about what I want, with some very specific details written down. I'll refine this idea through Claude or ChatGPT and ask it to generate me a summary prompt. I'll review and bat it back and forth until it sticks.
From there I'll bring it into Claude Code and unleash the machine on the idea. The better the prompt, the better the output. When I feel the urge to fire off a "that didn't work, fix it" type prompt, I catch myself and do some debugging and come back with a pointed prompt. This usually defuses any drift-bombs that are set to go off when I hit the enter key.
Additionally, since Claude Code comes with such a price tag and Cursor only has so many fast prompts, the time to think comes with a cost savings. The goal is to think through these challenges more to ensure those tokens aren't wasted on chasing my tail. I'm not going to say it'll never happen—I'm human after all.
Happy coding.