Recipes
Branching Memory (What-If Simulations)
Use checkpoints and core session branches for reversible what-if exploration without polluting the main execution path.
When one task has multiple candidate strategies, preserve the main path and branch only the temporary exploratory state.
Current MuBit supports this with two complementary tools:
checkpoint()on the control plane for the durable main-path snapshot- core session create / commit / drop for reversible what-if branches
Decision model
| Requirement | Primitive |
|---|---|
| Preserve the current durable task state before compaction or divergence | checkpoint() |
| Try a temporary branch against the hosted API and discard it later | core.create_session, core.drop_session |
| Merge a branch back into its parent | core.commit_session |
| Persist a session to disk on a self-hosted node (server-side filesystem path) | core.snapshot_session, core.load_session |
ℹ️Note
snapshot_session and load_session are disk-persistence operations that take a server-side filesystem path — they are only meaningful on a self-hosted node, not against the hosted API. Reversible in-memory what-if branching against https://api.mubit.ai is create_session + drop_session, with commit_session to merge a branch into its parent.
Minimal implementation example
Failure modes and troubleshooting
| Symptom | Root cause | Fix |
|---|---|---|
| Main path gets overwritten by experimentation | No durable checkpoint before branching | Always checkpoint the primary path first |
| Scratch changes vanish too early | Branch was dropped before review | Snapshot or commit only after inspection |
| Compaction loses the decision context | Branching happened without checkpointing | Save a checkpoint before diverging |
Next steps
- Apply the durable path in Sessions and branching.
- Combine branching with planner state at Lane-scoped memory.