How to Run Your First IOSM CLI Cycle
An improvement cycle should begin with a falsifiable goal, not a request to “make the code better.” IOSM CLI gives that goal a workspace, an ordered process, and artifacts that survive the agent session.
This is the smallest practical path I recommend for a first cycle. It does not require adopting every IOSM mechanism at once. It requires one bounded goal, evidence you can actually collect, and the discipline to stop when a gate says the change is not ready.
1. Install the runtime and choose a real repository
IOSM CLI currently requires Node.js 20.6 or newer and at least one authenticated model provider for agent-powered work.
npm install -g iosm-cli
iosm --version
cd /path/to/your/project
Do not begin with the largest architectural migration in the backlog. Pick a goal that has a visible boundary and a validation signal. Good first-cycle goals look like this:
- reduce one API endpoint's p95 latency without changing its contract;
- remove duplication from one module while preserving its tests;
- split one unstable dependency boundary and keep the public interface intact.
“Improve performance” is not a cycle goal. “Reduce checkout p95 latency while preserving response semantics and error rate” can become one.
If you need the larger runtime model before touching the commands, start with IOSM CLI: AI Engineering Runtime. This tutorial is deliberately narrower: it is about operating one cycle, not explaining the whole platform.
2. Bootstrap the IOSM workspace
From the project root, run:
iosm init
The command creates iosm.yaml, an IOSM.md playbook, and a .iosm/ directory for cycle history, metrics, decisions, patterns, waivers, invariants, contracts, and per-cycle artifacts.
By default, initialization includes agent verification. If you need a deterministic scaffold before provider access is available, use:
iosm init --no-agent-verify
That distinction matters. init creates the control surface; it does not prove that your thresholds describe reality. Review iosm.yaml before the first cycle. A copied latency limit or confidence floor is still an assumption until your repository and measurement path support it.
I would edit only four areas at first:
iosm:
metadata:
system_name: checkout-api
criticality_profile: standard
cycle_capacity:
max_goals: 1
max_scope_items: 3
guardrails:
max_negative_delta:
logic: 0.00
performance: 0.03
evidence:
min_decision_confidence: 0.80
One goal and a small scope make attribution possible. A zero logic-regression allowance prevents a performance win from buying correctness debt. The confidence threshold prevents weak evidence from being promoted into a strong conclusion.
3. Plan one cycle
Create a named cycle with a concrete goal:
iosm cycle plan \
--id checkout-latency-001 \
"reduce checkout p95 latency without changing response semantics"
Planning creates a cycle scope, hypothesis cards, a baseline report, and phase-report scaffolds. Inspect them before asking an agent to modify code:
iosm cycle status checkout-latency-001
iosm cycle report checkout-latency-001
The report command emits JSON. That makes the cycle usable in shell automation and review tooling rather than trapping the result inside a terminal conversation.
A useful hypothesis has five parts:
| Field | Example |
|---|---|
| Change | remove redundant serialization on the cache-hit path |
| Expected effect | lower p95 latency |
| Protected invariant | response schema and error behavior remain unchanged |
| Evidence | benchmark fixture plus contract tests |
| Rollback trigger | contract failure or latency regression outside the budget |
This is where most “agentic improvement” fails. The model receives a task, but nobody defines what evidence could disprove the proposed change. IOSM makes the hypothesis an artifact before execution begins.
4. Execute in the required order
Enter the artifact-aware profile:
iosm --profile iosm
Inside the interactive runtime, the full cycle can be started with a target index and iteration bound:
/iosm 0.95 --max-iterations 5
The sequence is fixed:
PLAN → HYPOTHESIZE → IMPROVE → GATE_I
→ OPTIMIZE → GATE_O
→ SHRINK → GATE_S
→ MODULARIZE → GATE_M
→ SCORE → LEARN → DECIDE
The order is not decorative. Correctness and semantic clarity are checked before optimization. Complexity reduction happens after performance work, not during an uncontrolled rewrite. Modularization comes last because boundaries should be extracted from a system whose behavior and unnecessary surface have already been examined.
Do not treat every phase as permission to change code. A phase may conclude that no safe change is justified. “No change, evidence preserved” is better than manufacturing activity to satisfy the acronym.
5. Read gates as stop conditions
Use status while the cycle is active:
iosm cycle status checkout-latency-001
A failed gate is not a request to explain the failure away. It means the phase cannot close under the current evidence and guardrails. The valid next actions are narrow:
- repair the change and rerun the relevant checks;
- collect missing or stale evidence;
- roll back the phase;
- create an explicit waiver when governance permits it;
- stop the cycle.
This is why I separate phase gates from continuous constraints. A gate decides whether a phase may advance; a fitness function catches architectural drift on every merge. You usually need both. And if a threshold improves over time, the threshold ratchet explains why automation may tighten it but should not silently loosen it.
6. Close with a report, not a confident sentence
At the end, export the synchronized report:
iosm cycle report checkout-latency-001 \
> .iosm/cycles/checkout-latency-001/final-report.json
Review four things:
- the baseline and final values refer to the same scope and metric semantics;
- every claimed delta points to evidence;
- failed attempts and waivers remain visible;
- the decision says continue, stop, or fail for a concrete reason.
Then inspect the durable project memory: .iosm/metrics-history.jsonl, .iosm/decision-log.md, and .iosm/pattern-library.md. A cycle is incomplete if its useful learning exists only in the current chat transcript.
There is an important boundary here. IOSM CLI can create and synchronize the cycle structure, but it cannot make an invalid benchmark representative or turn a guessed threshold into production evidence. The quality of the conclusion remains bounded by the quality of the measurement path.
The minimal operating loop
For a first adoption, keep the loop small:
iosm init --no-agent-verify
iosm cycle plan --id first-cycle "one bounded, measurable goal"
iosm cycle status first-cycle
iosm --profile iosm
# run the work and satisfy each gate
iosm cycle report first-cycle > .iosm/cycles/first-cycle/final-report.json
That is enough to change the nature of the work. The agent no longer owns an open-ended refactoring prompt. The repository owns a goal, a hypothesis, a baseline, ordered gates, and a final decision artifact.
I do not use methodology to make engineering look formal. I use it so that a faster execution path cannot erase the question that matters: what changed, what proved it, and what should happen next?