How to Govern System Invariants in an IOSM Cycle
A refactoring cycle is unsafe when “preserve behavior” exists only as an instruction to the agent. The phrase sounds precise, but it does not identify which behavior is protected, who can redefine it, or what evidence proves that it survived.
In IOSM, I want that boundary to be a versioned Invariant Catalog. The catalog is not another checklist beside the work. It is the logical baseline against which the Improve gate decides whether the system is still the same system in the ways that matter.
An invariant is stronger than a test name
A test is an executable observation. An invariant is a maintained claim about the system.
Consider two examples:
- a payment retry must not create a second successful charge;
- a public API remains backward compatible unless an approved waiver exists.
Many tests may support either claim. One test may later be replaced. The invariant should survive those implementation changes because it records the protected property, not a particular assertion in a particular file.
The IOSM v1.0 specification therefore treats the Invariant Catalog as a required artifact. Its canonical shape is deliberately small: identity, description, owner, status, source, and catalog version. The current IOSM CLI initializer also creates an initial catalog with build health, public-contract compatibility, and metric freshness as explicit entries. These generated entries are a bootstrap, not proof that the project’s real domain invariants have been discovered.
version: 7
system: billing-api
invariants:
- id: inv-payment-idempotency
description: "A payment retry must not create a duplicate successful charge."
owner: payments-team
status: active
source: contract-tests
That small object changes the engineering conversation. A failure no longer means vaguely that “some tests are red.” It means a named protected property has lost its evidence.
The catalog needs a lifecycle
A static YAML file will eventually become folklore. To govern change, I use four states:
| State | Meaning | Gate authority |
|---|---|---|
candidate |
Proposed property; owner and evidence are still under review | Informational |
active |
Accepted part of the current logic baseline | Blocking |
waived |
Temporarily non-conformant under an explicit, expiring waiver | Blocking for stabilization |
retired |
No longer part of the baseline, with a recorded successor or rationale | Historical |
The important distinction is between waived and retired. A waiver says the invariant still matters and the system currently fails or cannot prove it. Retirement says the protected property itself has been removed from the system contract through an approved decision. Treating those as the same state makes technical debt disappear by renaming it.
This connects naturally to the IOSM waiver register: expiry and compensating controls belong to the waiver, while the catalog preserves the invariant’s identity. It also connects to phase handoffs: an active or waived invariant must travel into the next phase as an obligation, not as background prose.
Baseline changes need their own gate
The dangerous operation is not adding an invariant. It is weakening, replacing, or retiring one while a cycle is in progress.
I would not allow a phase implementation to edit the logic baseline and then evaluate itself against the edited version. That is equivalent to moving the finish line after the run. Instead, every baseline change should produce a compact delta record:
{
"invariant_id": "inv-checkout-v1",
"from": "active",
"to": "retired",
"reason": "v1 endpoint removed after published deprecation window",
"successor": "inv-checkout-v2",
"decision": "ADR-0042",
"approved_by": "api-platform",
"effective_cycle": "2026-07-21-01"
}
The gate can then apply three deterministic rules:
- Freeze the input version. A cycle records the catalog version used at planning time.
- Evaluate against that version. Gate I cannot silently consume a later, weaker catalog.
- Apply an approved delta only at a boundary. The next phase or next cycle receives the new version together with its decision record.
This is not bureaucracy around refactoring. It prevents an agent, script, or hurried reviewer from resolving a regression by deleting the statement that made it visible.
Ownership is decision authority, not notification routing
owner: payments-team should not merely tell us whom to ping. Ownership defines who may clarify evidence, request a waiver, approve a successor, or participate in retirement. The owner does not get unilateral authority to hide a failure; the configured approval path still governs baseline changes.
Unassigned invariants are useful during /init, but they should be treated as incomplete setup. The IOSM CLI currently generates bootstrap entries with owner: unassigned and evidence tiers inferred from available project signals. That is honest automation: it exposes what the runtime can infer and leaves the domain decision to engineers.
A mature catalog should also answer:
- Which tests, traces, schemas, or monitors supply current evidence?
- Which services and public contracts are covered?
- When was the evidence last refreshed?
- Which waiver blocks stabilization?
- Which decision created, changed, or retired the invariant?
The catalog does not have to embed every answer. It needs stable references to the artifacts that do.
What this mechanism does not prove
A catalog cannot discover all business rules automatically. It cannot guarantee that the listed tests actually exercise the claim. It cannot resolve a disagreement about whether a product behavior should remain stable. Those are specification and ownership problems.
What it can do is stop those uncertainties from masquerading as a green quality gate. A missing owner, stale evidence, or unapproved baseline delta becomes an explicit control state. That is narrower than “the system is correct,” but far more useful than “the agent said the refactor passed.”
IOSM is strongest when its artifacts carry decision authority. Hypothesis Cards define what may improve. Regression budgets define what may degrade. The Invariant Catalog defines what must remain true. Once that catalog is versioned and governed, logical consistency becomes something the cycle can evaluate—not something we hope survived the diff.