# The Phased Agentic Build Loop
<!--
ref: @knowledge/protocols/phased-agentic-build-loop
type: protocol
tags: [development, project management, agile, security, iteration]
triggers: [need to refine project ideas, planning a new feature, debugging a silent failure, preparing for deployment]
trigger_prompt: When you're in the midst of developing a project and need to ensure each phase is well-defined, secure, and ready for deployment.
version: 2
updated_at: 2026-10-18T05:41:54.592Z
-->

Structure baked into the workflow — not clever prompting — is what makes a coding agent's behavior repeatable.

*Synthesized from Sean Kochel, "Google's 7-Step Vibe Engineering Skill Is Incredible."*

Sean Kochel drove a Google-authored agent-skills library end-to-end on a real project and found its value came from simplicity plus human checkpoints between stages, not from orchestration complexity. The sequence below generalizes past any one tool.

Where this loop touches ground already covered elsewhere in the taxonomy, it cites rather than re-derives: `spec-driven-development` owns the case for writing the spec first, `skills-over-agents` owns composable domain skills as the unit of capability, and `ai-security-for-builders` owns the security posture. This protocol's contribution is the *sequencing and the gates between the beats*.

## The loop

1. **Refine the idea adversarially.** Before any spec exists, have the agent interrogate you instead of filling gaps with assumptions: frame the problem as "how might we," explore the existing codebase, then ask scoping questions — what triggers the action, who can do what to whose data, what nests inside what. Have it produce several competing system designs and converge on one. Kochel deliberately picked the *simplest* direction and deferred the multi-user variant so he wouldn't build access-control machinery he didn't yet need.

2. **Spec: turn the chosen direction into a PRD.** See `spec-driven-development` for why this beat exists at all. What this loop adds is the PRD's *boundary* section: objective, definition of success, acceptance criteria, technologies, and code conventions, plus explicit rails — what the agent must always do, what it must ask before doing, what it must never do (his example: never bypass row-level security). Treat the PRD as input to planning, not to implementation.

3. **Plan: clear the context window first.** Start the planning pass with a clean context. It should build a dependency graph and emit phased tasks, each carrying a *verifiable* acceptance criterion — lint passes and the app builds; this payload returns that response. A task with no verifiable exit condition is a task you cannot check the agent's work on.

4. **Build one phase per run.** Scope every build invocation to a single phase and clear context between phases. Kochel's blunt warning: an unscoped build command will try to execute the entire plan in one pass and destroy your context window. Two tactics live inside this beat:
   - *Name the skill you want.* Don't rely on auto-selection when the skill is load-bearing — call for the API-and-interface-design skill on backend phases, the frontend/UI skill on interface phases.
   - *Slice vertically, not horizontally.* Each phase should be a complete feature top-to-bottom. See `vertical-slicing-for-agent-builds`.

5. **Debug: hand over symptoms, not diagnoses.** When something silently fails, describe the observed behavior plainly and let a root-cause pass trace it. Volunteering your own theory anchors the agent to it. His bug turned out to be a null parent ID zeroing a count, plus a mismatched endpoint — neither of which was the first thing he'd have guessed.

6. **Review before you push — then re-plan the findings.** Run a review pass across correctness, readability, architectural fit, security, and performance. Then feed its output straight back through the planner as "build a plan to address all critical issues," converting findings into the same phased, verifiable task format the build step already consumes. The review's output is not a report you read; it is input to the next loop.

7. **Ship: generate the CI pipeline last.** Feature branches → a development branch where tests run → main, with lint, typecheck, test, and build gating the merge.

## Why the review gate is non-optional

The review pass caught a real security hole the coding agent itself had shipped: raw database queries with no ORM layer, leaving SQL-injection exposure. This is episode evidence for a claim the taxonomy already carries — see `ai-security-for-builders` and the fact `60-of-code-is-ai-generated-quality-is-the-crisis`. Kochel's framing is the operational takeaway: however capable these tools look, they make exactly this class of mistake. The review is a gate, not a nicety, and it belongs *before* the push rather than after the incident.

---

*Related: `@content/web/github/2026-11-29-convex-backend-skill-issue-64` · `@content/youtube/tiago-forte/i-connected-claude-to-everything-then-i-saw-the-gap` · `@content/youtube/indy-dev-dan/mac-mini-agents-openclaw-is-a-nightmare-use-these-skills-instead` · `@content/youtube/cole-medin/watch-this-if-your-coding-agent-is-ignoring-your-rules-you-need-hooks` · `@content/youtube/aie/the-one-thing-every-ai-agent-framework-agrees-on-mislav-ivanda-daytona`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*