spb/khaelor Public
KHAELOR — a terminal-native autonomous engineering agent powered by Anthropic.
TypeScript 82.9%
HTML 14.9%
CSS 1.1%
JavaScript 0.7%
1<!doctype html>2<!--3KHAELOR4File: website/public/docs/fork-replay.html5Description: Docs — Session lineage as an instrument: fork any checkpoint, replay user turns sandboxed, diff two runs structurally.6Author: Simon-Pierre Boucher7Contact: contact@spboucher.ai8-->9<html lang="en">10<head>11<meta charset="utf-8">12<meta name="viewport" content="width=device-width, initial-scale=1">13<title>Fork · replay · sdiff — KHAELOR docs</title>14<meta name="description" content="Session lineage as an instrument: fork any checkpoint, replay user turns sandboxed, diff two runs structurally.">15<link rel="stylesheet" href="/styles.css">16<script>17(function(){try{var t=localStorage.getItem("khaelor-theme");if(!t&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches)t="light";if(t==="light")document.documentElement.setAttribute("data-theme","light");}catch(e){}})();18</script>19<script defer src="/site.js"></script>20</head>21<body>2223<header class="site-header"><div class="inner">24 <a class="wordmark" href="/"><span class="glyph">❯</span><span class="g-ember">KHAELOR</span></a>25 <nav>26 <a href="/docs/getting-started.html">Docs</a>27 <a href="/#install">Install</a>28 <button id="theme-toggle" type="button" aria-label="Toggle color theme">light</button>29 </nav>30</div></header>3132<main class="page"><div class="docs-layout">3334<aside class="sidebar">35 <div class="group"><div class="group-title">Start</div>36 <a href="/docs/getting-started.html">Getting started</a>37 <a href="/docs/cookbook.html">Cookbook</a>38 </div>39 <div class="group"><div class="group-title">Using KHAELOR</div>40 <a href="/docs/usage.html">The TUI</a>41 <a href="/docs/commands.html">Commands & keyboard</a>42 <a href="/docs/tools.html">Tools</a>43 <a href="/docs/sessions.html">Sessions</a>44 </div>45 <div class="group"><div class="group-title">Autonomy</div>46 <a href="/docs/phases.html">Phase gates</a>47 <a href="/docs/verification.html">Verification</a>48 <a href="/docs/worktrees.html">Parallel worktrees</a>49 <a href="/docs/daemon.html">The daemon</a>50 </div>51 <div class="group"><div class="group-title">Intelligence</div>52 <a href="/docs/repograph.html">Semantic index</a>53 <a href="/docs/memory.html">Project memory</a>54 <a href="/docs/context.html">Context engine</a>55 <a href="/docs/fork-replay.html">Fork · replay · sdiff</a>56 </div>57 <div class="group"><div class="group-title">Control</div>58 <a href="/docs/permissions.html">Permissions</a>59 <a href="/docs/configuration.html">Configuration</a>60 <a href="/docs/cli.html">CLI reference</a>61 </div>62 <div class="group"><div class="group-title">Internals</div>63 <a href="/docs/architecture.html">Architecture</a>64 <a href="/docs/events.html">The event model</a>65 <a href="/docs/theming.html">Theming & terminal</a>66 </div>67 <div class="group"><div class="group-title">Help</div>68 <a href="/docs/faq.html">FAQ & troubleshooting</a>69 </div>70</aside>7172<article class="content">7374<h1>Fork · replay · sdiff</h1>75<p class="lead">Because resume is a replay of the JSONL, three operations come almost for free —76and together they turn sessions into a comparison instrument no other CLI agent offers.</p>7778<h2 id="fork">/fork — branch a conversation<a class="anchor" href="#fork">#</a></h2>79<div class="termwrap"><div class="termbar"><span class="dot r"></span><span class="dot y"></span><span class="dot g"></span><span class="title">/fork — checkpoint picker</span></div>80<pre class="term" data-no-copy><code> <span class="t-b">fork · pick a checkpoint</span>81 <span class="sel"> ❯ now add tests seq 41 · user-turn </span>82 ✓ design approved <span class="t-dim">seq 28 · design-approved</span>83 ⊟ context checkpoint <span class="t-dim">seq 19 · compaction</span>84 ❯ fix the auth bug <span class="t-dim">seq 2 · user-turn</span></code></pre></div>85<p>The JSONL prefix up to the chosen event is copied into a fresh session (envelope session ids are86rewritten; seq, ids, and payloads are byte-preserved) and a sidecar records the lineage:</p>87<pre><code>.khaelor/sessions/<project>/88 01J8K2….jsonl89 01J8Q7….jsonl # the fork90 01J8Q7….meta.json # { "parent": "01J8K2…", "forkPoint": 41 }</code></pre>91<p>KHAELOR opens the fork immediately. The original is untouched — explore the risky approach,92keep the safe thread.</p>9394<h2 id="replay">/replay — same questions, different run<a class="anchor" href="#replay">#</a></h2>95<p><code>/replay <sessionId></code> extracts the <em>user turns</em> of a finished session and96re-runs them sequentially in a fresh session. Two properties matter:</p>97<ul>98 <li><strong>Tool calls re-execute for real</strong> — this is a genuine second run, not a tape99 playback; that is what makes the comparison meaningful.</li>100 <li><strong>Sandboxed by construction</strong>: the replay runs inside a throwaway git worktree101 that is deleted afterwards — zero side effects on your working copy.</li>102</ul>103<p>Switch models first (<code>/model</code>) to answer “what would haiku have done with the exact104same requests?”</p>105106<h2 id="sdiff">/sdiff — diff the runs<a class="anchor" href="#sdiff">#</a></h2>107<div class="termwrap"><div class="termbar"><span class="dot r"></span><span class="dot y"></span><span class="dot g"></span><span class="title">/sdiff</span></div>108<pre class="term" data-no-copy><code> <span class="t-b">sdiff</span>109 <span class="t-dim">01J8K2… (sonnet)</span> <span class="t-dim">01J8K9… (haiku)</span>110 agent turns 12 17111 tool calls 34 61112 files modified 2 3113 tokens (in/out) 145k / 12k 210k / 19k114 cache reads 118k 96k115 verify failures <span class="t-ok">0</span> <span class="t-err">2</span>116 outcome <span class="t-ok">completed</span> <span class="t-ok">completed</span>117 <span class="t-dim">files only in B: src/c.ts</span>118 <span class="t-dim">files in both: src/a.ts, src/b.ts</span></code></pre></div>119<p>Every number is folded from the two durable logs — real usage events, real diff attribution.120Combined with <code>/replay</code>, this is the cheapest honest model/prompt comparison you can121run: <em>run it twice, diff the runs</em>.</p>122123<h2 id="lineage">Lineage is queryable<a class="anchor" href="#lineage">#</a></h2>124<p>Forks record <code>parent</code> + <code>forkPoint</code>; replays record <code>replayOf</code>;125subtask children record their orchestrator. Your session directory is a family tree, not a pile.</p>126127<div class="pager">128 <div><span class="label">Previous</span><a href="/docs/context.html">← Context engine</a></div>129 <div class="next"><span class="label">Next</span><a href="/docs/permissions.html">Permissions →</a></div>130</div>131132</article>133</div></main>134135<footer class="site-footer"><div class="inner">136 <span>KHAELOR — Simon-Pierre Boucher · <a href="mailto:contact@spboucher.ai">contact@spboucher.ai</a></span>137 <span>Anthropic-powered · terminal-native by design</span>138</div></footer>139140</body>141</html>142