← writingmaclulich.com

Fewer tokens to ship: five changes to try in your AI coding agent workflow

INVOICE HISTORYBriefBuilderTestsReviewerDeliveredMERGEReturn belt
INVOICE HISTORYBriefBuilderTestsReviewerDeliveredMERGEReturn belt
0:21 / 0:21

One task, two coding attempts, one accepted change.

Five changes to test on your own AI coding agents

  1. Name the existing API in the briefAn audit of one project found two APIs doing the same job under different names.
  2. Check what the final code calls after a duplicate warning34 of the 39 duplicate-name warnings from my edit hook were false alarms.
  3. Tag each fix with its failing testOne disk cleanup was 21 fix commits across six files, or 29 fix-to-file touches.
  4. Give a redesigning agent the old reprosEight unattended runs produced no successful completed redesign.
  5. Test your reviewer on correct changes, then compare accepted workMine caught defects in all 12 reviews of broken code and wrongly blocked four of 12 reviews of correct code.
The numbers come from my own coding agents, and each chapter shows where its number comes from.

This series is for you if you run AI coding agents, since every retry adds to what a change costs. Follow one piece of work through the factory, then improve the parts that keep sending it back. You take away five changes to try on your own rig, a brief to copy and a scorecard for comparing accepted work.

Five chapters follow the same change, from the first brief to the final review.

Apply it to your rig ↓

Put the workflow on your own rig

  1. Record a baseline. For a comparable batch of tasks, record the starting commit, model, attempts, checks, reviewer verdict and landed commit. Include failed and abandoned tasks. Pick the source of rework you want to test first.
  2. Give the builder and reviewer the same brief. Search the current checkout before dispatch. When existing code fits, name the exact function or route and the file that owns it. Give both agents a way to verify the requested behaviour. Name the existing API in the brief before your coding agent starts
  3. Check what the final code calls. Start duplicate warnings as advice. Give each warning a candidate owner and enough evidence to inspect it. Record whether the change reused the owner, justified a separate implementation or still shipped a duplicate. Check whether your duplicate-code warning changes what your agent ships
  4. Track the failure through each retry. Attach the failing test or repro ID to the work record. Compare failures under that ID even when the edited files change. Use a repeat as a prompt to inspect the approach. Tag each agent fix with its failing test to spot patching loops across files
  5. Carry the repro into a redesign. Give the next agent the failing command, expected result and behaviours to preserve. Run independent checks for the original bug and the edge cases older patches protected before accepting the rewrite. Give your coding agent the old repros before it redesigns patched code
  6. Compare accepted work. Match tasks by kind and scope, keep the model and acceptance checks steady, and try one workflow change at a time. Include lookup, warnings, tests and review in the comparison. Keep the change if it improves the outcome you picked while preserving the quality bar. How to tell whether your coding agents are saving you work

Copy this into your next task

Use the same brief for the builder and reviewer. Add a row for each attempt or check, and link the final verdict and merge back to the work ID.

Work ID / starting commit:
Model / workflow version / task scope:
Requested behaviour:
Existing owner (symbol, file and reason it fits):
Acceptance check (command and expected result):
Attempt / verdict / evidence:
Repeat failure (test or repro ID, observed vs expected):
Usage (uncached input, cache writes, cache reads, output):
Started / finished / actual spend:
Accepted commit or reason the task stopped:

For example, a task to show invoice history can name the existing invoice endpoint and include a check that older invoices appear. If review sends it back for missing older invoices, carry that same repro to the next attempt. Keep both attempts in the usage record and count one accepted change once it lands.

Use one scorecard to compare every change

Record How to read it
First-pass acceptance Tasks accepted at their first review divided by tasks that reached review. Also report how many tasks started, reached review, landed or stopped.
Attempts per accepted change Total coding attempts divided by accepted changes. Count failed attempts in the total.
Tokens and spend per accepted change Total usage and actual spend across the batch divided by accepted changes. Keep the token categories separate and use a consistent price schedule if comparing across prices.
Time and quality Track elapsed time from brief to landing, including waits. Report false blocks, regressions, escapes and the number of accepted changes beside the cost.

Sum usage increments once and pool totals over work items before dividing. Show tokens per coding attempt alongside attempts per accepted change, with shared overhead included in the batch total. If nothing lands, report the attempts and spend. A per-delivery rate needs a delivery.

How far to trust it

The studies leave real-work savings, loop detection and safer redesigns open

  1. The reviewer and the tools need checks of their ownThe rename fixture caught defects in all 12 reviews of broken code and wrongly blocked four of 12 reviews of correct code. The warning census also found 34 false alarms in 39 warnings.
  2. Still openReal-work savings, cross-file loop detection and safer redesigns.
Evidence and limits are in chapter 5.