A practical loop for reliable coding agents

A compact operating loop that helps a coding agent move from a vague request to a verified change without losing the plot.

The most useful coding-agent workflow is not especially exotic. It is a short loop with explicit evidence at each turn:

orient → inspect → change → verify → report

The loop is simple enough to remember and strong enough to expose most expensive mistakes.

1. Orient

Translate the request into an observable outcome. Find the repository’s local instructions, inspect the working tree, and name the surfaces likely to change.

Outcome: checkout accepts a valid discount and preserves tax calculation.
Likely surfaces: pricing service, checkout route, receipt rendering, tests.
Proof: focused unit tests plus one end-to-end purchase.

The goal is not a grand plan. It is enough shared orientation to keep local decisions coherent.

2. Inspect the path that already exists

Trace one representative request from entry point to result. Search for symbols, routes, configuration, tests, and peer implementations. Read the code around the match rather than editing from the search snippet.

This is where agents often save the most time: a feature that looks new may already exist behind a configuration flag, or an apparent local decision may be a platform-wide invariant.

3. Make the smallest complete change

“Smallest” does not mean incomplete. A complete slice includes the code, type or schema adjustment, tests, configuration, and documentation genuinely required for that behavior to survive deployment.

Avoid speculative abstractions. The second concrete use is a much better teacher than the first imagined one.

4. Verify in layers

Run the narrowest useful check first, then widen in proportion to risk:

LayerExample
Local invariantunit test for the price rule
Integrationcheckout API test
Product pathbrowser purchase flow
Packagingproduction build or image
Runtimecontent smoke test after rollout

Do not accept “command exited zero” as the only evidence. Assert on the content or state that matters.

5. Report the result, not the diary

The handoff should make three facts easy to find: what changed, how it was verified, and what remains intentionally deferred. A user should not have to reconstruct the outcome from a transcript of shell commands.

Then begin the loop again if verification revealed a real gap.