Egor Urvanov

A reconcile loop for specsLike Kubernetes, with the spec as desired state and code as actual

A reconcile loop for specs works like a controller in Kubernetes: a person changes the desired state (the spec), the agent compares it with the actual state (the code) and brings the code in line, and tests measure the result. Green tests check only what is written into them, so every MUST needs its own check, and the agent’s environment needs code execution, tests, logs, data, services and a sandbox.

The same loop as in Kubernetes

Kubernetes is a system that runs services and keeps them working on many servers. Its main idea is simple: a person describes how things should be (“keep three copies of the service”), and a supervisor program, the controller, keeps comparing the description with what really exists and fixes the differences. That is the reconcile loop. For specs the same scheme works: a person sets the desired state, and an agent can bring the code to it.

The desired state here is the aggregate dictionary: one entry per concept, requirements marked MUST and SHOULD.

How to read the picture. The four columns are the four roles of the loop, the two rows are two systems, and the third row puts the terms into plain words. The desired state (filled in) is what a person changes. In Kubernetes that is the chart and the manifest: files that say which parts of a service must run and how many. In specs it is the aggregate dictionary with the words MUST (“required”) and SHOULD (“recommended”). The actor brings the actual state to the desired one: in Kubernetes the controller, in specs the agent. The actual state is what exists now: nodes (servers) and pods (the parts of a service running on them), or the code. The measure shows whether they match: probes (short automatic “are you working?” checks) and metrics, or tests and quality checks. The arrow down at the top means a person changes only the desired state. The loop arrow at the bottom means the measurement goes back to the actor, and so on until they match. Example: a person writes in the dictionary “a booking closes after 15 minutes”, the agent changes the code, tests check it, and a red test sends the agent back to the code.

The reconcile loop follows the Kubernetes docs on controllers.

Takeaway
In this exampleIn Kubernetes a human edits the chart and the controller brings the nodes to it. Here a human edits the dictionary and the agent brings the code to it and checks with tests.
In generalBoth systems keep the desired state apart from the actual one and reconcile them in a loop. The human in the loop changes only the desired state, so every edit immediately becomes work for the actor.
Next stepEdit the requirement in the dictionary instead of fixing code by hand, and run the agent with the task of bringing the code in line with the dictionary.

A check sees only what was put into it

A check shows only what was put into it. In Kubernetes a probe is a short automatic request to a service: “are you responding?”. If the service answers “200” (the success code), the probe is green even though the service may not be doing the main thing: say, the order queue is stuck. In specs it is the same with tests. If a requirement has no test, all the tests stay green and nobody notices the requirement is not met.

The example is the meeting room booking from Specs by aggregate: three MUST requirements and one SHOULD.

Kubernetes
the service answered “200: working”probe
orders are not being processednot checked
the probe is green, the service does not work
Specs
MUST · bookings of one room do not overlaphas a test
MUST · booking status moves only forwardhas a test
MUST · without confirmation a booking closes after 15 minutesno check
SHOULD · confirmation arrives in the same channela person looks
MUST covered2 / 3
tests are green, one MUST is unchecked
every MUST needs its own checka MUST without a check is a gapgreen does not mean correct

How to read the picture. On the left is Kubernetes: the probe got the answer “200: working” and is green, but orders are not being processed, so the probe did not check the main thing. On the right are specs, using a meeting-room booking: three MUST requirements and one SHOULD. Two MUSTs are covered by tests (bookings do not overlap, status moves only forward). The third, “without confirmation a booking closes after 15 minutes”, is checked by nobody. A person reviews the SHOULD about the channel. 2 of 3 MUSTs are covered, that is 67%. The three rules under the diagram: every MUST has its own check; a MUST without a check counts as a gap to close; a green result does not yet mean everything is correct.

Which probes exist and what they check: Kubernetes: probes.

Takeaway
In this exampleThe probe answers “200” while orders are stuck, and the booking tests are green while nobody checks the 15-minute rule.
In generalA check confirms only what is written into it and says nothing about the rest. So the aggregate card is compared against the checks: a MUST without a check is a gap, not a met requirement.
Next stepGo through the MUSTs in your dictionary and mark the ones without a test. Turn each into a task, or deliberately downgrade it to SHOULD.

The environment decides whether the loop closes

The loop closes only if the actor has everything needed for comparing. A Kubernetes controller works because the cluster gives it access to all it needs. For an agent this environment is called the harness: the surroundings it works in, with programs, permissions and checks.

Kubernetes clusterwhere the controller lives
≈
Harnesswhere the agent lives
Run codewithout it → the agent guesses how the program works
Testswithout it → nothing to check a MUST with
Logswithout it → cannot see what exactly broke
Test datawithout it → checks run on an empty database
Services via MCPwithout it → integrations are checked blind
Sandbox and permissionswithout it → too risky to let the agent act
Separate articleChoosing the environment: a harness comparisonClaude Code, Codex, Cursor, Hermes and chat on one map

The six capabilities in the picture are what an agent needs to close the loop, and what happens without each. Without code execution the agent guesses how the program works. Without tests a MUST cannot be checked. Without logs it is not visible what exactly broke. Without test data the check runs on an empty database and shows nothing. Without services through MCP, integrations are checked blind. Without a sandbox (an isolated place where it is safe to try and break things) it is scary to let the agent act. If some capability is missing, the loop is open at that point.

Takeaway
In this exampleThe Kubernetes controller works because the cluster gives it an API, nodes and probes. For the same loop the agent needs to run code, tests, logs, data, services and a sandbox.
In generalThe dictionary sets the desired state, but only someone who can run and measure the code can reconcile it with that state. Whatever the environment lacks, the agent cannot check, and the loop stays open at that point.
Next stepMark which of the six capabilities your agent has. For each missing one, decide whether to add it to the harness or switch harnesses.

Frequently asked questions

What is a reconcile loop for specs?

A loop where a person changes the desired state, the spec, the agent compares the code with it and brings the code in line, and tests measure the result. This is how a Kubernetes controller works.

Why are green tests not enough?

A test confirms only what is written in it. So every MUST requirement needs its own check.

What does the agent’s environment need for the loop to close?

Running the code, tests, logs, data, services and a sandbox. What the environment lacks, the agent cannot check.

What does the person change in this loop?

Only the desired state, the spec. Any edit becomes work for the agent right away.
The booking example is made up. Terms and approaches follow the sources linked under the diagrams.
© 2026 Egor Urvanov