Forks & Exploration
What a Fork Is
A Fork is a parallel timeline branched from a specific point in history. It shares the history up to that point but maintains its own subsequent reality.
const main = createTimeline('main')
main.action({ type: 'init' })
const fork = main.fork() // Creates a branch
fork.action({ type: 'experiment' })
// Main timeline is unaffected
Fork vs. Snapshot
- Snapshot: A frozen moment. You can restore it, but you can’t “act” on it directly without restoring.
- Fork: A living, independent timeline. You can record new intents on it.
What-if Exploration
Forks are perfect for “What-if” scenarios:
- User is about to perform a destructive action.
- Fork the timeline.
- Simulate the action on the fork.
- Check the result (Reality).
- If safe, apply to main. If not, discard the fork.
WARNING: When NOT to Fork
Do not fork for every single user interaction. Forks consume memory. Use them for exploration and simulation, not for basic state updates.