Agent-first coding: optimise code and workflow for the next agent, not a human reader. -18% billed cost on Claude Opus 5.5 and -23% on Gemini 4 Neon XHigh (16/16 SWE-Bench Pro, zero security loss).
Agent-written code is increasingly read only by agents. Comments, padding, narration, and extra round-trips serve a human reader who is not there, and every following agent pays for them. Optimise for the next agent: fewest billed tokens per correct, secure result. Readability is optional. Validation, auth, escaping, bounds checks, and error handling are not.
Rules
#
Principle
Operational Rule
01
Fewer calls
Batch independent tool calls; read targeted ranges once; one edit per file; verify once; check every requirement against the diff before replying.
02
Cut ephemeral output, never the contract
No narration, recap, or re-printed code; minimal diffs; reuse before writing. Keep exact spec names and every required case — smallest diff never means smallest behaviour.
03
Keep what the next agent needs
Typed signatures (codebase convention); a one-line comment only for a non-obvious invariant or security reason; at most one compact test.
An agent run is $N$ model calls. Call 1 pays for the fixed prefix $P$ ($u$ cache-write misses); each subsequent call re-reads $P$ plus every accumulated delta $\Delta_i$ (tool results, edits, prior turns) and emits visible output $o_i$ and thinking $h_i$. In units of one fresh input token (cache write $w_c$, cache read $r_c$, output $w_o$):
Both Claude Opus 5.5 (1 / 1.25 cw / 0.05 cr / 5 out) and Gemini 4 Neon ($3 / $0.15 / $15 per 1M, implicit caching: 1 / 0.05 cr / 5 out, $w_c = 1$) share $r_c = 0.05$ and $w_o = 5$. This is exact accounting (matches every run bill to 0.00% across all 96 SWE-Bench Pro runs):