Before You Refactor, State the Hypothesis
One of the ideas in IOSM that matters most to me is simple: before a serious refactor starts, the team should state what it expects to improve and what it is not allowed to break.
That is what I mean by a Hypothesis Card. It turns “make this better” into a testable engineering bet.
The short version is:
Change is a hypothesis, not a mood.
This sounds obvious until you look at how engineering work usually happens.
Someone says the code is messy. Someone says the service is slow. Someone says the architecture should be more modular. Someone says the agent can probably clean it up. Then a refactor starts.
A week later, the system is different.
But is it better?
That question is often harder to answer than it should be.
IOSM exists because I do not want improvement work to depend on taste, confidence, or aesthetic momentum alone. Taste matters. Senior judgment matters. But serious engineering change needs a falsifiable shape.
It needs a hypothesis.
The problem with vague improvement
Vague improvement is dangerous because it feels responsible.
“Clean up this module.”
“Optimize the API.”
“Make the architecture simpler.”
“Split this into services.”
“Let the agent refactor it.”
None of these are wrong goals. The problem is that they are incomplete. They describe activity, not expected evidence.
If the API became faster but harder to understand, did we win?
If the code became smaller but the public contract became more fragile, did we win?
If the module count increased while coupling also increased, did we modularize or just move complexity around?
If an AI agent rewrote a subsystem and all tests passed, do we actually know the change is safe?
Without a hypothesis, the team can always retrofit a story after the fact.
That is not engineering.
That is narrative management.
What a Hypothesis Card does
In IOSM, every selected goal should become a Hypothesis Card before execution.
It is a small pre-change record that prevents a refactor from being judged only by taste after the fact.
A Hypothesis Card says:
- what change we intend to make;
- which metric should improve;
- how much improvement we expect;
- which metrics are not allowed to regress;
- what business or user signal validates the change;
- how long we observe the result;
- what triggers rollback;
- how confident we are before starting.
The important part is not the document format.
The important part is the commitment.
Before the change, we write down what would make the change true.
That small move changes the psychology of engineering work. It makes improvement measurable before ego gets involved.
Guardrails are where maturity starts
A weak engineering culture optimizes one thing and ignores the damage elsewhere.
A strong one asks: what are we not allowed to break while improving this?
This is why IOSM uses guardrails.
A performance hypothesis can target latency, but it must declare allowed negative deltas for semantic clarity, logic, simplicity, modularity, and flow.
A simplification hypothesis can reduce API surface, but it must not break contracts or usability.
A modularization hypothesis can split components, but it must not increase coupling in disguise.
This is the part I care about most: an improvement is only real if it survives contact with the rest of the system.
Local improvement with hidden global damage is not improvement.
It is debt movement.
Why this matters even more with AI agents
AI agents make this problem sharper.
A human refactor is already easy to rationalize. An AI-generated refactor is even easier to over-trust because it arrives fast, confidently, and often with a clean-looking diff.
But speed does not create validity.
A model can produce a plausible change without understanding the economic reason for the change. It can reduce code while increasing conceptual load. It can pass tests while weakening an invariant that tests never captured. It can optimize a path while damaging a future extension point.
That does not mean agents are bad.
It means agents need a stronger execution frame.
A Hypothesis Card gives the agent a target and a boundary.
Not “make this better”.
Instead:
Improve p95 latency by at least 5%, allow zero logical regression, preserve public contracts, observe production signal for seven days, and roll back if change failure rate rises.
That is a different kind of instruction: it gives the agent a measurable target, a safety boundary, and a rollback condition.
It turns an agent from a clever editor into an actor inside a governed engineering cycle.
IOSM is not anti-creativity
Some people hear “hypothesis”, “gate”, “evidence”, and “guardrail” and assume the process is bureaucratic.
I see it differently.
IOSM does not remove engineering creativity. It protects it from becoming unaccountable.
The creative part is still there: deciding what to improve, seeing the hidden structure, forming the bet, finding the simpler architecture, discovering the leverage point.
But the bet must be stated.
The evidence must be collected.
The rollback trigger must exist.
The system must remember what happened.
This is the difference between a clever change and a learnable change.
A clever change may work once.
A learnable change improves the organization.
The line between refactoring and gambling
Refactoring without a hypothesis is often gambling with better vocabulary.
You may be right.
You may have taste.
You may improve the system.
But the organization cannot reliably learn from it, because the expected outcome was never declared.
IOSM forces the question earlier:
What would convince us that this change was worth doing?
If we cannot answer that, we are not ready to execute.
We may be ready to investigate. We may be ready to spike. We may be ready to collect baseline evidence.
But execution should wait until the change has a falsifiable shape.
Why I like this part of IOSM
I like Hypothesis Cards because they are small but brutal.
They expose weak thinking quickly.
They make vague work uncomfortable.
They stop optimization from becoming aesthetic.
They make AI agents easier to trust because trust is no longer based on charm, but on boundaries and evidence.
Most importantly, they change the emotional center of engineering work.
The question stops being:
Did I make a beautiful change?
It becomes:
Did the system improve in the way I claimed, without breaking the things I promised to protect?
That is the kind of engineering culture I want.
Not slower.
Not more bureaucratic.
More honest.
Because in real software, every change is a bet.
IOSM just makes the bet explicit before the system pays for it.