Your AI coding agent forgets what it was building halfway through
The agent loses the plot on bigger tasks, rewrites working code, or drifts from the goal. Short answer: 5 steps. 1) Write a short project file the agent always reads; 2) Plan first, then build; 3) One task per session; 4) Commit after every working step; 5) Make it prove each step works.
Last updated:
How do I fix this?
Write a short project file the agent always reads
Claude Code reads CLAUDE.md, Codex and many others read AGENTS.md, Cursor uses project rules. Put the goal, stack, folder layout and "don't touch" rules there.
Plan first, then build
Ask for a numbered plan saved to a file (e.g. tasks.md) before any code. Approve or edit it. Spec-driven tools like OpenSpec formalize this.
One task per session
Work through the plan one item at a time and start a fresh session for big new items. Long chats fill the context window and older instructions get lost.
Commit after every working step
Use Git commits as save points. If the agent breaks things, you roll back in seconds instead of arguing with it.
Make it prove each step works
Ask it to run the app or tests and show the result before moving on. "Done" without a check is how drift starts.
Which tools can do this for me?
Claude Code
Anthropic's terminal coding agent; included with Claude subscriptions or billed via API.
Codex
OpenAI's coding agent (CLI, IDE and cloud); included with ChatGPT plans or via API.
Cursor
AI-first code editor with agent mode and a weekly usage pool.
GitHub Copilot
Completions, chat and agent inside VS Code/JetBrains/GitHub.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.