How to Run Your First IOSM Cycle Without Fake Metrics
A first improvement cycle should produce a trustworthy comparison, not an impressive score.
That distinction matters because IOSM CLI can create the structure of an engineering cycle quickly: a baseline, hypotheses, four ordered phases, gates, evidence, and a final report. Structure is useful, but it cannot rescue weak measurements. If the baseline is vague, every delta built on it is vague too.
This is the smallest practical IOSM cycle I would trust.
1. Start with one bounded subsystem
Do not begin with “improve the repository.” Choose a boundary whose inputs, tests, and dependencies you can name. A parser package, authentication adapter, queue worker, or one CLI command is enough.
Before changing code, write down three things:
- the files and interfaces in scope;
- the behavior that must not change;
- the measurements you can reproduce locally.
IOSM CLI provides a dedicated profile and initializes the project workspace:
cd /path/to/project
iosm --profile iosm
Then, inside the session:
/init
The generated .iosm/ directory is not decoration. It becomes the local record of configuration, invariants, contracts, cycles, and decisions. Commit it only if that policy fits the repository; otherwise preserve it in controlled project storage. Either way, treat it as engineering state, not disposable chat history.
If you need the broader runtime model first, read IOSM CLI as an engineering runtime before starting the cycle.
2. Build a baseline you can rerun
A baseline is not “the code feels complicated.” It is a set of observations with commands, scope, and provenance.
For a TypeScript package, a small baseline might contain:
| Question | Reproducible observation |
|---|---|
| Is behavior preserved? | npm test -- parser |
| Does the package type-check? | npm run typecheck |
| How large is the boundary? | source files and lines under src/parser/ |
| Where is complexity concentrated? | named functions above an agreed complexity threshold |
| Are dependencies crossing the boundary? | import graph or an explicit dependency list |
Not every metric must be automatic. It must, however, have a stable definition. “Maintainability: 0.72” is useless unless the cycle records how that number was produced. A test command and its exit status may be stronger evidence than a polished composite score.
This is also why a missing metric is not zero. If performance was not measured under comparable conditions, record it as unknown. Do not let absence improve the aggregate. The detailed reason is covered in Why a Missing IOSM Metric Must Block the Score.
3. Turn the desired change into hypotheses
A task says what to do. A hypothesis says what should become observably better and what must remain stable.
Weak:
Refactor the parser.
Useful:
If token normalization is extracted from the parser state machine,
duplicate branches will decrease while parser fixtures and public types
remain unchanged.
A useful hypothesis has five parts:
- Target — the bounded subsystem.
- Intervention — the proposed change.
- Expected signal — what should improve.
- Guardrails — what may not regress.
- Stop condition — when to reject or revise the idea.
IOSM’s Hypothesis Cards exist to keep these fields attached to the work. Write them before implementation, while failure is still an acceptable answer. Once the patch exists, people become very good at redefining success around it.
The deeper pattern is explained in Before You Refactor, State the Hypothesis.
4. Run the phases as different questions
The order is fixed:
Improve → Optimize → Shrink → Modularize
Do not compress this into one “make it better” prompt. Each phase challenges the current state differently.
Improve
Remove defects, contradictions, and missing checks first. There is little value in optimizing behavior that is still wrong.
Gate the phase with the baseline tests and the hypothesis guardrails. If a previously passing fixture fails, the phase is not complete.
Optimize
Measure before and after under the same conditions. If you cannot establish comparable timing, memory, throughput, or resource data, do not publish a performance delta. You can still improve a known algorithmic path, but label the result as a code-level change rather than measured acceleration.
Shrink
Ask what can disappear without weakening behavior or evidence. Count deleted obligations, not only deleted lines: duplicate branches, redundant adapters, unnecessary configuration, or repeated validation paths.
A smaller diff is not automatically a simpler system. Re-run the tests and inspect whether complexity merely moved elsewhere.
Modularize
Move boundaries only after the behavior is correct and the surviving code is understood. Check import direction, public interfaces, ownership, and test seams. A new module that exports internals indiscriminately is a folder change, not modularity.
The gate after each phase should answer one concrete question: did this phase improve its target without spending a protected invariant?
5. Use the CLI, then inspect the artifacts
IOSM CLI exposes the cycle workflow directly:
iosm init
iosm cycle plan "Reduce parser branching" "Preserve fixtures and public types"
iosm cycle status
iosm cycle report
In the interactive IOSM profile, a full cycle can also be started with a target and bounded iteration count:
/iosm 0.95 --max-iterations 5
A target is an operating threshold, not a promise. The cycle may legitimately stop below it when a guardrail fails, evidence is missing, or further changes exceed the defined scope.
Inspect what appears under .iosm/cycles/<cycle-id>/:
baseline-report.json
hypotheses.json
phase-reports/
cycle-report.json
The canonical IOSM specification also defines metrics history, a decision log, an invariant catalog, a contract catalog, waivers, and a pattern library. The point is not to maximize artifact count. The point is to ensure that each consequential conclusion has an addressable source.
6. Close with four outcomes, not one score
At the end, I want four separate answers:
- Changed: what code or configuration moved?
- Preserved: which invariants were rerun and passed?
- Measured: which comparable signals changed, and by how much?
- Unknown: what was not measured or could not be concluded?
Only the third line may contain a measured improvement claim. Repository structure can prove that an artifact exists. Tests can support behavior preservation within their coverage. Neither proves production performance or broad adoption.
If a gate fails, preserve the attempt instead of overwriting it with the eventual green result. A failed attempt explains what the system rejected and why. How to Preserve Failed Gate Attempts describes that lifecycle in detail.
The minimal acceptance test
I consider a first IOSM cycle credible when another engineer can:
- check out the same code boundary;
- rerun the baseline commands;
- read the hypothesis without seeing the patch;
- trace each phase result to evidence;
- distinguish measured deltas from interpretation;
- reproduce the final gate decision.
That is enough for a first cycle. Do not chase a perfect IOSM Index on day one. Build a chain of evidence that survives the conversation that created it.