Skip to content
The AI Agent Factory

36.6 From reasoning to code

Approved by
Panaversity ·
8 min read

In everyday life. A new clerk thinks hard about every invoice. After a year, they have a checklist for the common ones, and think hard only about the strange ones. They are faster and make fewer mistakes, because they stopped thinking where thinking was not needed.

What you will learn. How a worker can learn that some work no longer needs a model, how that lesson becomes code, and what it is worth.

Why it matters. Most learning makes a worker better at reasoning. This kind makes reasoning unnecessary for part of the work. It is the one lesson that lowers both the error rate and the bill.

The idea

The paper puts it in one line:

An AI worker should become better not only at using intelligence, but also at recognizing when intelligence is unnecessary.

And the path:

experience → verified skill → approved procedure → code, where it fits.

At first the worker reasons about every Acme invoice. Over a month, experience records show that 180 of them came from one supplier, in one layout, with the PO number in the footer. The worker handled every one the same way. That is not judgement. It is a procedure. A typed tool can do it exactly, every time, for no model cost.

The steps

1. Dreaming notices. Step 5 of the dreaming Workflow (36.3) looks for repeated activities with the same inputs, the same steps and no corrections. It writes a candidate of a special kind: a procedure proposal. It describes the activity, the rule, the evidence (the 180 records) and the exceptions it saw.

2. A person decides whether it is worth building. Not every repeated activity is worth code. You look at the proposal: how often it happens, how stable the format is, how much reasoning it saves.

3. Claude Code builds it, from the proposal, as ordinary code. This is not the worker editing itself. It is you, using Claude Code, with the method of this whole part:

Step 6. Read the procedure proposal, candidate proc-acme-footer in the candidates table. Write a spec for a typed tool, extract_acme_footer_po, that reads Acme Supplies' invoice layout and returns the PO number, or "not this layout" for anything else. Write the tests first from the 180 evidence records and the exceptions listed. Then build the tool. It must not call a model.

4. It is evaluated like any candidate. The tool is added to a release candidate. The runner tests it on held-out Acme invoices, including ones in other layouts, and checks that the worker still reasons about the cases the tool refuses.

5. A person approves it, as code. It goes through code review and the release states of 36.5, and appears in the manifest as "tools": { "acme-footer-po": 1 }.

6. The worker uses it. It now calls the tool for that supplier's invoices and reasons only about the rest. It still interprets the assignment, notices exceptions and explains results. The tool handles the routine.

A tool or a Workflow?

If the procedure is one short step, it becomes a typed tool. If it has several steps, waits or retries, it becomes a Workflow, as in Chapter 34. Either way the worker keeps the decision of when to use it.

What it is worth

The paper's example, for a medium worker on economy models:

BeforeAfter
Model cost in ordinary work$2.76$1.11
Extra cost of the process and its checks$0.00$0.50
Change in the month's contribution+$1.16

The model saving is $1.66 a month per worker gross, and $1.16 net after the process costs. Small for one worker; the paper notes the gross saving is $16,578 a month at 10,000 workers. And the bigger value is often in quality: a typed tool does not misread the footer on a busy day.

Code is not automatically cheaper. A tool needs tests, review and maintenance. A Workflow has its own small costs. If Acme changes its layout, the tool must change too. Measure the saving, and retire procedures that no longer pay.

The invariant. When a repeated job no longer needs judgement, turn it into reviewed code, and keep the model for what does.

Check yourself. Dreaming proposes a procedure for a supplier whose last 40 invoices were handled the same way, but 6 of them were corrected by a person. Do you build the tool? (Not yet. A procedure is worth coding only when the work is stable and correct. Six corrections in 40 means the worker has not learned it yet; the corrections may point to a missing rule.)

  • Building Affordable, Self-Improving AI Workers (Panaversity, 29 November 2026), sections 12.2 and 21, and cost model model.ts
Owner
Panaversity