How to Compare Two Engineering Approaches with IOSM Session Branches
Most engineering choices should not be made inside one long AI conversation. Once a session commits to an approach, every later message inherits its assumptions. The alternative becomes a sentence in the history instead of a path that can be tested.
IOSM CLI session branches give me a cleaner mechanism: preserve the common investigation, fork before the decision, explore each approach independently, and compare artifacts at the same boundary. The branch is not the decision. It is a controlled place to produce evidence for one.
This is useful when both options are plausible: rewrite or incremental refactor, cache or query optimization, local abstraction or shared service. It is wasteful when one option is already ruled out by a hard constraint.
1. Build a shared trunk before the fork
Start in a repository and ask for facts, not a preferred solution:
iosm --profile plan
In the session, define the problem and collect the invariant set:
Analyze the authentication module. Record current public behavior,
test commands, dependency boundaries, and rollback constraints.
Do not propose an implementation yet.
Plan mode restricts the agent to read-only work. This matters because the trunk must remain neutral. If the first pass edits files, the second approach no longer starts from the same state.
I want the trunk to end with four things:
| Artifact | Question it answers |
|---|---|
| invariant list | What must not change? |
| baseline commands | How do we test both paths? |
| decision criteria | What would make one path better? |
| unknowns | What evidence is still missing? |
This complements the baseline and hypothesis discipline in the first IOSM cycle guide. A cycle measures an improvement. A branch comparison decides which candidate deserves that cycle.
2. Fork at the decision boundary
Name the session, then fork from the message immediately before implementation begins:
/name auth-migration-comparison
/fork
Use the first branch for Approach A:
Approach A: keep the current module boundary and refactor incrementally.
Produce a patch plan, affected-file set, migration sequence, and failure modes.
Evaluate it against the shared invariants. Do not modify files.
Return to the shared point with /tree, create another fork, and run the same contract for Approach B:
Approach B: replace the module behind a compatibility adapter.
Produce a patch plan, affected-file set, migration sequence, and failure modes.
Evaluate it against the shared invariants. Do not modify files.
The prompt structure should stay symmetrical. If one branch gets a detailed acceptance contract and the other gets “try the rewrite,” the comparison measures prompt quality, not architecture.
3. Compare outputs, not eloquence
Do not ask which branch “feels better.” Reduce both branches to the same decision record:
approach: incremental-refactor
invariants_preserved:
- public API
- token validation behavior
changed_boundaries:
- auth/service.ts
migration_steps: 3
rollback_boundary: commit
required_evidence:
- unit suite
- integration suite
unresolved:
- legacy token fixture coverage
The exact schema is yours. The important property is symmetry: identical fields, identical baseline, identical stopping conditions.
Then compare concrete differences:
- Which approach crosses fewer ownership boundaries?
- Which one has a smaller reversible first step?
- Which unknown can be resolved cheaply before implementation?
- Which failure can escape the available tests?
- What artifact would falsify the preferred choice?
A branch that produces a persuasive explanation but cannot name its rollback boundary is not ready to win.
4. Preserve the evidence, then start fresh
IOSM CLI persists interactive sessions as JSONL under ~/.iosm/agent/sessions/. It also supports /tree, /fork, and /name for branch navigation. Preserve the comparison session, but do not continue implementation inside the winning branch forever.
Start the actual change from a clean execution contract:
iosm --profile iosm
Initialize the workspace if needed and create a bounded cycle:
iosm init
iosm cycle plan "Implement the selected auth migration path"
Carry forward only the selected invariants, baseline commands, decision record, and unresolved risks. Conversation history is useful evidence, but it is a poor substitute for a compact contract. This is the same reason I treat IOSM as the improvement layer rather than another agent framework.
5. Know where branching stops helping
Session branching does not create independent experimental evidence by itself. Both branches may use the same model, misunderstand the same code, or repeat the same hidden assumption. It also does not isolate filesystem changes: for a write experiment, use separate Git worktrees or disposable copies and rerun the same deterministic checks.
Branching is strongest during analysis and design, where the shared trunk saves repeated discovery and the fork prevents one proposal from absorbing the other. For consequential implementation choices, pair it with:
- isolated working trees;
- the same test and benchmark commands;
- a bounded diff for each candidate;
- an explicit rollback point;
- human selection based on recorded evidence.
The mechanism is simple, but the distinction matters. A conversation branch preserves an alternative. An IOSM cycle verifies a chosen improvement. Git preserves the code states. Tests decide whether either state satisfies the contract.
I do not want an agent to collapse uncertainty into confidence too early. I want it to keep plausible paths separate until the engineering evidence earns a merge.