Long AI coding sessions have a failure mode nobody talks about: you're 45 minutes into a multi-step refactor, the context window fills up, and the model loses the thread. Everything after that point is confused, contradictory, or wrong.
The fix is dead simple: checkpoints.
How It Works
After every significant milestone, ask the AI to write a checkpoint:
We just finished migrating the auth module from callbacks to async/await.
Write a checkpoint summary that includes:
1. What we changed (files + functions)
2. What's working now
3. What's left to do
4. Any decisions we made and why
The model responds with a structured summary. You save it.
The Checkpoint File
I keep a CHECKPOINT.md in my project root:
# Checkpoint — Auth Migration
Updated: 2026-04-04 10:30
## Completed
- [x] auth/login.js — converted to async/await
- [x] auth/register.js — converted, added error boundaries
- [x] auth/middleware.js — converted, updated Express error handler
## Decisions
- Kept bcrypt.compare callback (library doesn't support promises natively)
- Added try/catch at route level, not function level
## Next Steps
- [ ] auth/oauth.js — most complex, has 3 nested callbacks
- [ ] Update tests in auth/__tests__/
- [ ] Run integration suite
Why This Beats "Just Use Git"
Git saves code state. Checkpoints save decision state.
When you start a new session, you can paste the checkpoint into the context:
Here's where we left off. Read this checkpoint and continue from "Next Steps."
[paste CHECKPOINT.md]
The model picks up exactly where you stopped — not just the code, but the reasoning behind it.
The Recovery Pattern
When a session goes sideways mid-refactor:
- Don't keep prompting. Stop.
- Open your last checkpoint.
-
git stasheverything after the checkpoint. - Start a new session with the checkpoint as context.
- Resume from the last known-good state.
This has saved me from at least a dozen "the AI got confused and now nothing works" spirals.
Automate It
I trigger a checkpoint prompt every 20 minutes during long sessions:
# checkpoint-reminder.sh
while true; do
sleep 1200
notify-send "🔖 Time for a checkpoint" \\
"Ask your AI to summarize progress"
done
Low-tech, but it works. The best checkpoint is the one you actually write.
Try it: Next time you start a multi-step AI task, set a 20-minute timer. When it rings, ask for a checkpoint. You'll be surprised how much clarity a forced summary creates.
Top comments (0)