The plan-first workflow for long AI coding sessions
In short: agents lose the thread as context fills up. Write the plan to a file, do one feature per session, verify every step with real commands, and review the diff before committing.
The loop
- Plan.
/plan-featurewrites goals, steps and acceptance checks toPLAN.md. No code yet. - Build in small steps. Make one step at a time, then run lint, typecheck and tests. Fix the step before moving on.
- Review.
/review-changeschecks the diff against the plan and a review checklist. - Commit.
/commit-workruns only when you invoke it. It is never auto-triggered. - Reset. Start a fresh session for the next feature. PLAN.md carries the state forward.
Why it works
The plan lives outside the context window, verification catches mistakes while they are still cheap, and the human stays in the loop exactly where it matters.
Each step works best as a skill rather than a paragraph in CLAUDE.md. If yours don't fire when expected, read how to write a SKILL.md that actually triggers.
The free sampler includes the agent-workflow rule plus /plan-feature and /review-changes for every tool.
FAQ
Why do AI coding agents drift in long sessions?
They lose the thread as the context window fills up. Writing the plan to a file keeps it outside the context window.
What goes in PLAN.md?
Goals, steps and acceptance checks for the feature, written before any code by /plan-feature.
Should the agent commit automatically?
No. /commit-work runs only when you invoke it and is never auto-triggered, after /review-changes has checked the diff against the plan.
When should I start a new session?
After each feature. Do one feature per session and start fresh for the next one; PLAN.md carries the state forward.