Ship It With AI Mihai Cvasnievschi

The six-phase loop

12 min read

By the end you can cover the six functions of a sound change, choose how much process each needs, and name the gates that remain yours.

TL;DR


What is the six-phase loop?

Cover the functions; size the ceremony to the work.

The six phases are research, plan, execute, review, verify, ship. On a clear edit, one native-agent turn and the normal PR can cover them. On an unfamiliar banking feature, a note, a reviewed plan and separate checks make the work legible. A phase can be packaged as a skill; it need not be a separate skill, document or approval stop.

Superpowers, GitHub Spec Kit, BMAD and team-built collections package parts of this discipline differently. Superpowers is optional. Compare the installed version with the native agent on your tasks before adopting its extra process; old-version benchmarks do not establish the value of today's version on your model. Appendix B.10 gives the comparison, and Appendix D the evidence reviewed for this edition.

The six-phase loop: repair failed checks in Execute; replan when the approach changes 1Research 2Plan 3Execute 4Review 5Verify 6Ship approach changed? replan failed check? targeted repair
Figure: The six-phase loop. An implementation defect returns to Execute and the affected checks; a changed approach returns to Plan; missing evidence returns to Research.
Phase Evidence when needed Human decision Failure caught
Research Relevant facts and open questions Resolve material unknowns Missing context
Plan Approach, dependencies and checks Review uncertain or consequential choices Bad decomposition
Execute Diff and relevant check results None or light Implementation drift
Review Findings against intent and standards Normal owner or senior review Wrong or weak code
Verify Relevant test, build or behavior evidence Confirm enough evidence for the risk Behavioral failure
Ship PR with evidence trail Normal PR process Process violation

The loop stands on a well-defined expected outcome. The agent can build almost anything you describe, but it cannot know which thing you meant. Research surfaces what is undecided, you settle it, the plan turns it into checks, and verify measures the result against it. Skip that and "done" is whatever the agent decided.


The feature

Here is one feature, followed through every phase: add a priority field to a Wire record in a banking service. The narrative below is an author-reported example; its original code and run logs are not published. The Wire companion source and versioned runnable pack are a clearly labeled synthetic worked example for practice, not evidence of the original engagement. The small Python model makes the decisions inspectable without claiming to implement production banking infrastructure.

Priority is one of low / normal / high / urgent and defaults to normal. The urgent flag triggers a separate compliance-review queue. The companion settles missing and null priority, older clients, unavailable queues, audit contents and retry behavior in an acceptance table before code. Those are explicit teaching decisions, not claims about an undisclosed client's policy.


Research

Research produces a note, not code - and its open questions are yours to settle.

I asked the agent to read the codebase and write a research note. It named four files I would not have found in an hour of grepping:

It also raised an open question: should priority be an enum or free text? The regulator's spec uses free text in some documents and an enum in others. I picked enum. That was not a detail - it defined the target every later phase was checked against.

A research note is as short as the task allows. For unfamiliar work it covers:

Research grounds the approach in the real code instead of the agent's first guess. For a familiar edit, reading the relevant function may be enough; the banking example needed a durable note because the domain decisions had to survive hand-offs.

When a ticket already suggests a solution, separate the questions from the answers. Turn the ticket into questions about how the system works today, then have a fresh session answer them from the code and tests, with file-and-line references, without seeing the ticket or the proposed change. Dex Horthy of HumanLayer gives the reason: good research is facts, and a model told what you are building gives opinions. Review the questions too, since they can carry the ticket's assumptions. Appendix D describes HumanLayer's version and its limits.

If the task sits outside your own domain, run a blind spot pass first: ask the agent to help you find your unknown unknowns, and tell it plainly what you do not know. It calibrates to the expertise it infers from your vocabulary, so false fluency hides its assumptions.

Commit the note with the change. Six months later, when someone asks why the code is shaped this way, the answer is in the repository.


Plan

The plan is the gate where you matter most.

The agent turned the note into a six-task plan:

  1. Add the database column with a default.
  2. Update the Wire record class.
  3. Update the wire-builder service.
  4. Update the API contract.
  5. Update the compliance-routing logic to read the new field.
  6. Update the audit-log emitter.

Each task touched one file or one pair of files. Task five depended on task four's contract change; the order was right and the agent had flagged the dependency. Approved.

That list names the affected areas; the plan also needs to show how they will work together. When the approach is uncertain, start the plan review earlier: check a short design note and an outline before expanding the plan. The design note records current behavior, the intended result, patterns to follow with references to existing examples, decisions made and open questions. The outline names the slices of work, the interface changes and the checks; like a C header file, it shows the interfaces without the implementation. Where practical, slice the work vertically: each slice a small working path across the affected layers, checked before the next. Horthy reports that agents tend to group work by layer, as the list above does: database, services, then interface. Six small tasks can keep that order; a longer plan built the same way postpones checking the complete behavior until the end, even when individual layers can be tested earlier. The note and outline can be sections of one plan; create separate documents only when they justify the extra work.

A plan you can approve has three properties:

Where the task needs plan approval, read it before execute: challenge vague, oversized or wrongly ordered tasks, add what it missed and remove what is out of scope. Clear work already authorized by the request need not stop for a second permission ceremony.

The review takes a few minutes. It saves an afternoon when the plan was wrong and you would have found out during execute, where it is much harder to unwind.


Execute

Delegate independent work when the gain exceeds the coordination cost.

The original account reported six concurrent workers, despite the dependency between tasks four and five. Without a preserved handoff record, that account does not establish that the dependency was satisfied; it describes a coordination risk, not a schedule to copy. The companion makes the safe schedule visible: settle the priority/API/audit contracts first; implement independent areas against those contracts; integrate dependent routing and verify the whole behavior afterward. One implementer can follow the same waves without subagents.

The sixth, the audit-log emitter, also had a passing test - but the test was wrong. It asserted the old log format. Green, and wrong. Chapter 5 picks up how that got caught.

Each worker receives the context it needs, makes its scoped change, runs the relevant check and reports back. Fresh workers isolate exploration; forks can reuse established context. Neither removes the need to communicate shared contracts accurately.

Isolation is not a silver bullet. The rules that keep it working:

When a check fails, diagnose it before retrying. Repair a local implementation defect and rerun the affected checks; revise the plan if the approach or a dependency changed, and research again if evidence is missing. Ask the owner when a material domain decision or new authorization is needed. Repeating the same attempt without new evidence is not recovery.


Review and verify

Review checks the diff against the spec; verify checks the behavior against the outcome.

On the wire, review challenged the audit-log assertion and the migration's recovery plan. An absent down migration is a defect only if the project's recovery policy requires one; backward-compatible deployment, roll-forward repair or tested restoration can be valid alternatives. Verify then assesses the chosen behavior and recovery approach. Chapter 5 shows the inadequate assertion directly, and the companion lets you run the red and green stages.


Ship

Ship is a normal pull request. There is no AI lane.

The agent commits with a structured message, pushes the branch and opens a pull request whose description says what changed, why, how it was verified, what risks remain and who is tagged to review.

On the wire, the PR carried the research note, the plan, the per-task reports, both reviews and the test evidence. A senior reviewer spent eleven minutes on it and asked one question: should the urgent flag be observable in the metrics dashboard? I had not thought about it. Approved, merged.

That PR is an artifact the team knows how to review, but merge is not the end of delivery. Complete the production handoff through the existing release process:

Question Required handoff
How does it reach production? Deployment order, compatibility with existing data and clients, responsible release owner
What confirms success? Observable behavior or operational signal, including urgent routing and audit priority
What triggers intervention? A named failure condition and the person who receives it
How is recovery handled? The tested rollback, roll-forward or restore approach appropriate to this change
What follows release? A bounded observation window, its owner and the decision to close it

The companion fills these fields and distinguishes simulated checks from staging and production evidence. The agent feeds your delivery process; it does not replace its accountable owners.


What it costs in time

Budget agent time, investigation and human review separately.

In my experience with bounded tasks, a small feature can take twenty to thirty minutes through the loop, a medium one around an hour and a large one a few hours. These are planning examples, not delivery promises or a measured comparison with manual work. Unknowns, environment failures, test duration and review availability can dominate the time; measure them on your own tasks.

The wire feature took ninety minutes from "let's add a priority field" to merged code. The difference is the regulated context: a 3,400-test suite, a staging smoke test and a contract diff for the regulator. Small in scope is not small in ceremony.

If a small feature takes three hours, inspect where the time went and whether each step changed a decision or reduced a material risk. Some checks are necessary; others may be ceremony that no longer earns its cost.


When to run less of it

A function needs coverage, not necessarily a separate phase.

Chapter 3's test tells you when the loop pays at all; inside the loop the same accounting applies.

One team I watched ran for most of a year on what looked like half the loop: research was a comment thread, the plan was three bullets in the PR. It worked because the functions had moved into the team's walls - a small senior team that built the codebase, a strict CI suite and a serious PR culture. The lesson is to name what covers the function. Do not produce another document or agent review when the existing step already does the job.

For a contrasting small change, the companion illustrates a proportionate workflow for a help-text typo: find the string, confirm its scope, edit it, inspect the diff and displayed text, then use the normal PR and release process. Research, planning, execution, review, verification and shipping are covered in a brief interaction. No additional agent or plan file is needed to make that work inspectable.


When it breaks


Do this Monday


Go deeper