All writing

Building an ideal-option check for coding agents

This post goes over how one of my coding-agent skills changed between September and December, since almost every step it has now was added after a specific decision showed a gap in the version before. Two of those changes have their own posts, asking coding agents for the ideal version first for the premise check and making a coding agent read what each option changes for the step after it, so they get a paragraph each here, and most of this post is about the latest change, which has no post of its own.

Where it started

When an agent reaches a decision it lists two or three ways forward and recommends one, and the recommendation tends to be the option that is easiest to get done, with effort weighed as if a person had to do the work over weeks and platform behaviour quoted from memory. The question I started answering those lists with, and the one we can always ask back, was “If time and labor were not a consideration, what would the optimal version of this look like?”, and it grew into an ideal skill, where the agent quotes each option, scores it on axes that come from the problem with cost last, and gives one of three verdicts, which say that one option is closest to the ideal, that none of them match (and then it describes the ideal the options left out), or that two options win on different axes and we have to say which axis matters more.

In October the skill gained a step before any scoring, where the agent lists the facts each option’s score rests on, checks every one it can in the session and cites what it read, and puts the rest on a separate list as open, with the reason they can’t be checked there. In November that rule got wider after an agent made a claim about iCloud from memory, so every sentence of the answer now counts as a claim, and what a platform does at runtime is never stated without a source read in the session or a measurement. The first post has three decisions from a meeting-notes app that went through this version, one of which a later review overturned. By late October there was also a hook that hands the agent a short decision checklist when it puts a choice in front of me, with an item asking whether the ideal is among the options.

Three changes in November

The first came from a recommendation that won on an advantage which would only pay off if a certain event happened often, where the agent marked how often it happened as open, since only a run on a real device could tell, and missed a question it could have answered from the code, whether the event could reach that code path at all. So the premise step now lists the steps that have to happen for the leading option’s advantage to pay off and checks each one, and it splits an open fact into the code question it presupposes, which gets checked, and the part that really can’t be checked in the session.

The second took three turns to get right, in a merge where two store notices in my reading app both made every open window re-resolve which books are protected. The agent proposed merging the notices as “the ideal” without reading the two subscribers it would merge, and only an effort question made it open them and find that one waits 250 ms so a burst of saves folds into one trailing reread, while the other has to hide a newly protected book at once, so the merge would have broken one of them to save a rare duplicate read. The skill’s premise step now has a second half, where for every option that can reach the verdict the agent reads each component the option edits, removes, merges or newly relies on for its contract (what triggers it, who consumes it, its timing, how it fails and why it’s separate), and an option it invents during the pass goes back through the same check.

The third, a day later, came from a plan that a deepening pass had approved even though the repository already ruled it out, one part through a pre-commit gate and another through an accepted design record. Now, for any option that changes code, configuration or a documented contract, the agent finds the gates and design records that cover the files it touches, drops an option a gate forbids when no carve-out applies, and presents one that breaks an accepted design record as a proposal to amend it, which checking an agent’s plan against the project’s own gates goes through.

When the right option was missing

The latest change came from a layout decision in the same reading app, where an agent implementing a plan hit a stop condition because an eighth button didn’t fit in a header row on iPad. Eight 48pt buttons with seven 12pt gaps come to 468pt, and the row was capped at 420pt, where seven buttons take 408pt. The agent offered three placements for the eighth button in a plain chat message, all of them keeping the 420pt cap, and when I ran the skill on them it found the real answer missing, which was a row laid out by the available width that wraps when it runs out, since the cap’s only stated reason was to stop the controls stretching, and fixed-size buttons never do that.

A “none match” verdict means whatever produced the options left the ideal out, so I asked for the skill to also explain such misses and to use that to improve itself. My first guess at what to change was the premise step, since it only reads the reasons behind constraints that an option changes, so a constraint every option kept looked like it would never be questioned. A baseline run of the unedited skill on two options that both kept the cap traced the cap to its stated reason anyway and found the missing ideal, so I dropped that rule rather than ship one that hadn’t been shown to help, though one run only shows the old text can catch it, not that it always does. The cause turned out to be outside the skill, because the options had been posted as prose, and the checklist hook only fires when the agent asks through the question tool, hands over a decision at the end of a turn, or writes a brief for another session, so options written in an ordinary message never pass the checklist.

The skill now has a step that runs when the verdict is “none match”, when the winner is an option the pass added or reshaped, or when every option was dropped. It writes where the options came from and whether they went through a checked decision point, the constraint every option kept that the ideal drops (or what each one dropped, if they share none), and where a fix belongs, which is decided in order. A cause traced earlier in the session points back to that trace, while a cause that sits in something durable (a plan, a hook or the skill itself) or already has a memory or rule written against it gets a proposed fix at the highest level that works, and anything else counts as a one-off. A one-off ends with an offer to save it as a memory, since without some record a repeat of the same miss could never be recognised as one. Given a brief that said the options had come in an ordinary chat message, the edited skill named that as the cause and proposed something that catches options written in prose, above a one-off note. The follow-up tried a hook that runs when the agent finishes its reply and asks a small model whether the message offered options, but I took it out the same day, because one of its two real firings flagged a message that had already asked through the decision tool and the other flagged a status message. A hook at that point can only send the agent back after the user has read the options anyway, so options written in plain chat still aren’t covered.

Replaying the case

The skill is prose, so there’s no test suite for it, and what we can do instead is replay the decision that caused a change, which is how I tested the read-what-each-option-changes step and the miss trace. Read-only subagents get a brief that recreates the situation, with the old and the new skill text pinned to files, and for the store notices they read the two commits from before the merge. The header-row replay had five runs, a baseline, the edited text, a control where the right option was among the choices, and two runs told that an earlier pass had picked one of the placements. The control is there because a step that fires when it shouldn’t is a cost too, and it gave “closest to ideal” with no trace section. In the two runs with an earlier pick, the one where the width was given as measured reached “none match” and pointed its fix at the skill’s own verdict step, which so far is only a proposal, and the one where the narrow-window width was still open kept the earlier pick. Six of seven later runs of that case reached “none match”, so I read that answer as probably noise and not as how the skill behaves.

Both replays started as one run per arm on the decision the edit was written from, so on their own they show what the new text makes the agent write down on that case, not that it changes verdicts in general. The five header-row cases are now stored as eval cases with graders for the verdict and the trace, so a later edit can be run against them on the same model, three runs a side. The graders had to be checked the same way, since the first versions matched their words anywhere in the answer, and one passed a “closest” verdict whose flip check only mentioned “none match”. It’s still much better than reading the edited text and deciding it looks right, since a replay shows when the old text already handles the case, which is how the first guess above got dropped.

Summary

Each version of this skill looked complete until a real decision went through it and exposed a gap, and the gap was always somewhere we could point at, either a premise nobody listed because it sat in the code being changed rather than in the option’s claims, or options that never reached the check at all. For a prompt like this, the fix that held was writing the step that would have caught the miss into the text that let it through, and then replaying the same decision with and without that step, which also keeps out rules the old text didn’t need. A “none match” verdict is useful in its own right, because it means something upstream of the check framed the problem wrong, and that is where the fix belongs, whether it’s a hook, a plan or the skill itself.

Email address copied [email protected]