Fork · replay · sdiff
Because resume is a replay of the JSONL, three operations come almost for free — and together they turn sessions into a comparison instrument no other CLI agent offers.
/fork — branch a conversation#
fork · pick a checkpoint
❯ now add tests seq 41 · user-turn
✓ design approved seq 28 · design-approved
⊟ context checkpoint seq 19 · compaction
❯ fix the auth bug seq 2 · user-turnThe JSONL prefix up to the chosen event is copied into a fresh session (envelope session ids are rewritten; seq, ids, and payloads are byte-preserved) and a sidecar records the lineage:
.khaelor/sessions/<project>/
01J8K2….jsonl
01J8Q7….jsonl # the fork
01J8Q7….meta.json # { "parent": "01J8K2…", "forkPoint": 41 }
KHAELOR opens the fork immediately. The original is untouched — explore the risky approach, keep the safe thread.
/replay — same questions, different run#
/replay <sessionId> extracts the user turns of a finished session and
re-runs them sequentially in a fresh session. Two properties matter:
- Tool calls re-execute for real — this is a genuine second run, not a tape playback; that is what makes the comparison meaningful.
- Sandboxed by construction: the replay runs inside a throwaway git worktree that is deleted afterwards — zero side effects on your working copy.
Switch models first (/model) to answer “what would haiku have done with the exact
same requests?”
/sdiff — diff the runs#
sdiff
01J8K2… (sonnet) 01J8K9… (haiku)
agent turns 12 17
tool calls 34 61
files modified 2 3
tokens (in/out) 145k / 12k 210k / 19k
cache reads 118k 96k
verify failures 0 2
outcome completed completed
files only in B: src/c.ts
files in both: src/a.ts, src/b.tsEvery number is folded from the two durable logs — real usage events, real diff attribution.
Combined with /replay, this is the cheapest honest model/prompt comparison you can
run: run it twice, diff the runs.
Lineage is queryable#
Forks record parent + forkPoint; replays record replayOf;
subtask children record their orchestrator. Your session directory is a family tree, not a pile.