Explore-Plan-Code-Verify

loop pattern · maturity: established · risk: low

A four-phase task loop that front-loads codebase exploration before planning: understand what exists, plan against reality, implement, verify on evidence.

When to use

Agent work in unfamiliar or large codebases, where plans made before exploration are plans made about an imaginary system.

Steps

StepWhat happensVerification
ExploreRead the relevant code, conventions, and constraints before forming opinions.Exploration notes cite actual files; claims about the codebase are checkable.
PlanWrite the implementation plan against what exploration found.Plan references real files and functions, not assumed ones.
CodeImplement one plan step at a time.Per-step checks as in plan-execute-verify.
VerifyRun the real verification: tests, build, or the running app.Evidence captured; the claim 'done' is backed by output.

Specification

Verification methodFinal phase runs the actual system; intermediate phases produce checkable artifacts.
Recovery behaviorbacktrack-to-plan-on-structural-surprise
ObservabilityPhase artifacts (notes, plan, diffs, outputs).
InputsTask, Codebase access
OutputsLanded change, Exploration and plan artifacts
Risk level / maturitylow / established

Failure modes

  • Exploration skipped under time pressure, reintroducing the imaginary-system problem
  • Exploration without a budget becomes procrastination

Assessment

The de facto standard workflow taught by every serious agent-coding guide, named here so it can be referenced. The explore phase is what separates it from PEV: plans grounded in read code fail less.

Go deeper