Use AI to build deterministic tools
Sunil Pai's one document, two hands describes a rule I use and share with the team at ikko: models handle ambiguous intent; deterministic code handles defined steps.
When a repetitive workflow requires consistent output, use a model to write a program instead of running an agent each time. The resulting code is predictable, testable, and cheap to run.
Why not an agent
An agent reconstructs context and plans on every run, consuming tokens and potentially producing different results. Most of the workflow may not require judgment: staging files, filtering noise, collecting repository context, and shaping a prompt are deterministic steps. Put those steps in code and reserve the model for the parts that require interpretation.
A measured example
Our code reviewer @weareikko/code-review filters and stages files, collects repository and pull request context, and configures the relevant skills before the model reviews the diff. We arrived at this design after comparing deterministic prompt construction with an agent that discovered its own context through read-only Git tools.
A controlled test used synthetic diffs with bugs at known locations, making recall measurable. One fixture was about 269,000 characters—2.7 times the 100,000-character inline budget—with bugs in small files that inline mode dropped first.
| mode | recall | cost |
|---|---|---|
inline (diff in the prompt) |
80–83% | ~$0.09 |
commits (agent explores with Git tools) |
100% | ~$0.19–0.24 |
commits recovered every planted bug but cost two to three times as much as inline, largely because of git_show output. Deterministic disk staging also reached 100% recall without asking the agent to find its own context. Its cost varied substantially, so this does not show that staging is always cheaper. The bugs were also synthetic; treat the result as directional evidence that autonomy did not improve recall over deterministic staging, not as a benchmark.
When an agent is worth it
Agents remain useful for open-ended tasks such as interpreting vague requests or comparing designs. For repetitive mechanical tasks, write code instead.