[ ← BLOG ]
2026-05-09

The Three-Phase Loop That Keeps You in the Driver's Seat with AI Coding

The Three-Phase Loop That Keeps You in the Driver's Seat with AI Coding

Most AI coding advice skips the part where you control the output. A model writes code. You accept it or reject it. Nothing about that is a system.

There is a better structure. Three phases: ideate, implement, evolve. Each phase produces a concrete artifact that feeds the next. Your coding agent does the typing; you do the thinking. That distinction matters more than any framework name trending on GitHub this week.

Phase 1: Ideate Until You Have a Document

Open Claude Code and dump your brain. No structure yet. Say what you want to build, what is broken, what the next sprint covers. Speak into a speech-to-text tool if typing slows you down. Be specific about tech stack if you know it. Stay high-level on features if you do not.

The most powerful move in this stage is having the agent ask you questions, one at a time. Every question it asks is an assumption it would otherwise bake silently into your code. A clarifying question about how real-time updates should work, answered up front, is worth an hour of debugging later. Work through 20 minutes of questions. More if the scope is large.

Then run a command. Not a manual prompt you typed from scratch: a saved, reusable procedure that converts the conversation into a product requirements document. Every PRD should carry the same structure: executive summary, scope, target users, features in and out. You define that structure once in the command. The agent follows it every time. Your team gets consistent artifacts without anyone enforcing a template manually.

After the PRD is done, review it yourself before creating tickets. The agent can get 90% right and still miss one assumption that will cost a developer two days. Ten minutes of reading saves that. Once satisfied, run the stories command: give it the PRD path, your Jira project ID, and your epic ID. Claude Code can use the Model Context Protocol to read design docs in Google Drive, update tickets in Jira, and pull data from Slack, which means the agent creates every ticket in the right epic, writes the description and acceptance criteria, and posts technical notes as comments. You never open a Jira creation form.

The AI agent framework space has a noise problem. Every few weeks, a new GitHub repo rockets to a few hundred stars and developers rearchitect their entire workflow around it. BMAD, GSD, SpecKit, Cloudflow: each one packages a planning-to-implementation loop similar to this. Some of the patterns are genuinely useful. Most people adopt them without fully understanding the tradeoffs and end up with more complexity than they started with. The goal here is not to hand you another off-the-shelf framework. It is to give you the underlying logic so you can build commands that fit your actual codebase and your team's existing conventions.

Phase 2: Plan Twice, Implement Once

Pick a ticket. Open a fresh Claude Code session: no prior context, no accumulated bias from the ideation conversation. Run a prime command that reads the Jira issue via the Atlassian MCP server, scans recent git commits, and maps the relevant files. Git history is long-term memory for a coding agent. The patterns from your last five commits tell it more about how you write code than any style guide you could paste.

After priming, explore the solution before planning it. Ask the agent what it sees. Have it spin up sub-agents to research the codebase in parallel. Each sub-agent can read tens of thousands of tokens of files, then return a summary of a few hundred tokens to the main session. Claude Code runs in your terminal with full codebase access and can parallelize that kind of research. The cost of skipping this step is that your main agent's context window gets bloated with raw file content and performance degrades. A 1-million-token context limit is not an invitation to fill it.

Once exploration is done, run the plan command. The output is a single markdown file: summary of the work, decisions locked, files to create or modify, task order, and a self-validation checklist covering type checks, linting, unit tests, and maybe an end-to-end browser automation run. This file is the entire input to the next step.

Start another fresh session. Run the implement command with the plan's file path as the argument. The agent reads the plan, cuts a git branch, writes the code, runs the validation checklist, updates the Jira ticket, and posts a comment with implementation details. You review the diff. You do manual testing. You merge or you do not. The agent handles the administrative work because your implement command tells it to.

You wrote the plan. You reviewed the PRD. You answered the clarifying questions. The agent did the typing and the bookkeeping. Those are different jobs.

Phase 3: Fix the System, Not Just the Bug

When the agent produces something wrong, you have two choices. Fix the bug and move on. Or fix the system that let the bug through.

The second choice compounds. If a new front-end component shipped without matching the styles of the rest of the application, something in your global rules is too vague on styling conventions. Update the rules file. If the agent keeps missing a validation step, add that step to the relevant command. Check those changes into source control alongside the codebase. Any developer on the team picks up the updated command on the next git pull.

Four things are worth improving across every loop: global rules, reusable commands and skills, your PRD and plan templates, and any context documents you load at session start. Each improvement makes every future ticket cheaper to execute. A sharper validation command might save each developer an hour per week. Across a team of five, that is material over a quarter.

The inner loop is when everything works: prime, plan, implement, review, next ticket. The outer loop is when something breaks: stop, identify what in the system allowed it, update the artifact, return to the inner loop. You do not have to run the outer loop after every ticket. Every time you skip it, you leave a tax on your future self.

Build the system once, mold it to your codebase, and every ticket after that costs less than the one before.