K.O.R.A. stands beside a glowing subsystem contract listing workflow, rules, and verification.

This article is part of Can an Agent Really Own an Ecosystem?, a series about building an agent that can take responsibility across an ecosystem.

An agent can make a change that compiles, passes its tests, and still breaks the way a subsystem is supposed to work.

I know because I’ve written that change myself. Several times. With confidence.

Code tells the agent what a subsystem does today. It doesn’t always say what the subsystem must keep doing. A contract fills that gap: the mandatory workflow and the business rules that every change has to respect.

Start with the shape of the work

K.O.R.A.’s own architecture has a contract, and it starts with a diagram:

K.O.R.A.’s canonical contract: a trigger starts the Agent, which calls a tool surface, ends in a terminal outcome of DONE, BLOCKED, or DEFERRED, and writes memory that provides context for the next trigger.

Every task follows that shape. Something triggers the work. The agent uses approved tools. The run ends as done, blocked, or deferred. The outcome is remembered for next time.

The rules around it are blunt. If a proposed change doesn’t fit the diagram, the change is wrong. Deferral must be bounded, so “later” can’t quietly become “never.” When a guard rejects bad input, fix the producer of the bad input, not the guard.

The diagram isn’t decoration. The agent reads the contract at the start of a session and acknowledges it before proposing architecture.

Write down what must stay true

The same approach works for any subsystem, technical or not. A fulfillment contract might look like this:

## Fulfillment contract

Workflow:
1. Accept a paid order.
2. Reserve inventory before scheduling shipment.
3. Notify the customer after shipment is confirmed.

Business rules:
- Never ship an unpaid order.
- Never reserve more stock than is available.
- A failed reservation leaves the order open, not complete.

Changes require:
- A test for each affected rule.
- Review against this contract before merge.

Keep it short enough to read before every change. The details can live elsewhere; the contract says what can’t be broken.

Enforce the rules in code

Documentation tells the agent what must stay true. Code can make some of it impossible to skip.

K.O.R.A.’s contract says she proposes specific actions instead of asking “what should I do?” Her ask_human tool enforces that in code. An approval request must match an action that a gated tool actually refused without approval. Asking permission to investigate or repair isn’t treated as an operator decision. The rule doesn’t depend on the model remembering it.

The fulfillment rules can work the same way in production:

# pseudocode

ship_order(order):
    if not order.paid:
        reject("Contract: never ship an unpaid order")

    reservation = reserve_inventory(order)
    if not reservation.confirmed:
        keep_open(order, reason="inventory not reserved")
        return

    schedule_shipment(order, reservation)

Not every rule fits in an if statement. Judgment calls still need the agent and review. But a hard business rule enforced in code holds even when someone—human or agent—forgets to read the contract.

Make it part of the work

A contract only helps if the agent meets it at the right moment:

  • Load it before investigating or changing the subsystem.
  • Reference it in the plan: which workflow steps and rules are affected?
  • Have review check the change against it, not just against the diff.
  • Connect each hard rule to a test or production check where possible.

Check that it holds

Make a valid change and confirm the workflow still works. Then make a change that violates a rule—shipping an unpaid order, for example—and confirm review or tests catch it.

An agent saying “this complies with the contract” proves nothing. I can say that too. I have the commit history to show how that goes.