SPB Git

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%
9.2 KB · 168 lines html
Raw Blame History
1<!doctype html>2<!--3KHAELOR4File: website/public/docs/sessions.html5Description: Sessions — persistence, resume, the event log, context compaction, and cost tracking.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>Sessions — KHAELOR</title>14<meta name="description" content="KHAELOR sessions: event-sourced persistence, resume, cost tracking, and context compaction.">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">&#10095;</span>KHAELOR</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  </div>38  <div class="group"><div class="group-title">Using KHAELOR</div>39    <a href="/docs/usage.html">The TUI</a>40    <a href="/docs/commands.html">Commands &amp; keyboard</a>41    <a href="/docs/tools.html">Tools</a>42    <a href="/docs/sessions.html">Sessions</a>43  </div>44  <div class="group"><div class="group-title">Control</div>45    <a href="/docs/permissions.html">Permissions</a>46    <a href="/docs/configuration.html">Configuration</a>47  </div>48  <div class="group"><div class="group-title">Help</div>49    <a href="/docs/faq.html">FAQ &amp; troubleshooting</a>50  </div>51</aside>5253<article class="content">5455<h1>Sessions</h1>56<p class="lead">Every KHAELOR session is an append-only event log. Nothing is "saved" as an57afterthought — the log <em>is</em> the session, and resume is simply replay.</p>5859<h2 id="event-log">The event log<a class="anchor" href="#event-log">#</a></h2>60<p>Everything that happens flows through a typed event bus and is journaled to a JSONL file as61it happens: your messages, model responses, every tool request, every permission decision,62every file read and modification, process starts and exits, compaction checkpoints. This63design buys you:</p>64<ul>65  <li><strong>Crash safety</strong> — there is no unsaved state to lose; the journal is written66  event by event, atomically.</li>67  <li><strong>Faithful resume</strong> — replaying the log reconstructs the transcript, the68  cost accounting, and the agent's file-state tracking (which files it has read, and whether69  they changed externally since).</li>70  <li><strong>A real audit trail</strong> — for any action KHAELOR ever took, you can71  reconstruct what was requested, which permission rule matched, and who granted it.</li>72  <li><strong>Durable prompts</strong> — a permission request that was pending when you quit73  reappears when you resume. Silence is never treated as consent, even across restarts.</li>74</ul>7576<h2 id="metadata">Session metadata<a class="anchor" href="#metadata">#</a></h2>77<p>Each session carries: id, title (auto-derived from your first request, or set with78<code>/rename</code>), project, created/updated timestamps, model, token usage, cost, git79branch, and working directory. All of it is real recorded data — the costs in the session80picker are the actual API-metered costs.</p>8182<h2 id="managing">Managing sessions<a class="anchor" href="#managing">#</a></h2>83<table>84  <tr><th>Command</th><th>Action</th></tr>85  <tr><td><code>/sessions</code></td><td class="wrap">Browse this project's sessions; <kbd>Enter</kbd> resume, <kbd>n</kbd> new, <kbd>r</kbd> rename, <kbd>x</kbd> delete, <kbd>/</kbd> filter</td></tr>86  <tr><td><code>/resume</code></td><td class="wrap">Resume the most recent session</td></tr>87  <tr><td><code>/new</code></td><td class="wrap">Start a fresh session in the same project</td></tr>88  <tr><td><code>/rename</code></td><td class="wrap">Rename the current session</td></tr>89  <tr><td><code>/clear</code></td><td class="wrap">Clear the conversation and working context</td></tr>90</table>91<pre class="term" data-no-copy><code> &#9484;&#9472; sessions &middot; ~/dev/my-project &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;92  <span class="t-accent">&#10095;</span> retry logic in session store      <span class="t-dim">12m ago   $0.42  main</span>93    context compaction checkpoint      <span class="t-dim">2h ago    $1.13  main</span>94    initial TUI scaffolding            <span class="t-dim">1d ago    $2.87  tui/shell</span>95 &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;96   <span class="t-dim">&uarr;&darr; select &middot; Enter resume &middot; n new &middot; r rename &middot; x delete &middot; / filter &middot; Esc</span></code></pre>97<p>Starting <code>khaelor</code> in a project with an interrupted session adds exactly one98quiet line under the banner — <code>Interrupted session from 12 min ago &middot; /resume to99continue</code> — never an auto-resume, never a modal.</p>100101<h2 id="context">Context management and compaction<a class="anchor" href="#context">#</a></h2>102<p>Long sessions eventually press against the model's context window. KHAELOR watches real103token pressure (the status bar's <code>context 31%</code> segment) and, before the window104becomes dangerous, distills the older conversation into a <strong>structured105checkpoint</strong>:</p>106<pre><code>objective: ...107completed: [...]108current_state: ...109important_files:110  - path: ...111    reason: ...112failed_attempts: [...]113decisions: [...]114running_processes: [...]115next_steps: [...]</code></pre>116<p>Raw evidence that would be destroyed by summarization — exact error messages, key diffs —117is preserved alongside. Compaction is designed to be invisible unless you look:118<code>/context</code> shows the checkpoint and the full token budget breakdown;119<code>/compact</code> triggers it on your schedule. At &ge;80% utilization the status bar120nudges you toward <code>/compact</code>; at &ge;90% it turns urgent.</p>121122<h2 id="cost">Cost tracking<a class="anchor" href="#cost">#</a></h2>123<p>Every model response's usage metadata — input tokens, output tokens, cache writes, cache124reads — is recorded in the event log as it arrives. <code>/cost</code> aggregates it;125the status bar shows the running total. Two honesty rules:</p>126<ul>127  <li>Numbers come only from actual API usage metadata. KHAELOR never estimates token counts.</li>128  <li>If pricing for your configured model is unknown, you get real token counts and an honest129  <code>n/a</code> in the dollar column — never an invented figure.</li>130</ul>131<p>Cache reads are shown with their hit rate, because prompt-cache health is where most of132your money goes: KHAELOR keeps its prompts byte-stable specifically to maximize cache hits.</p>133134<h2 id="git">Git awareness and protecting your work<a class="anchor" href="#git">#</a></h2>135<ul>136  <li>KHAELOR records the git baseline when the session starts, so <code>/diff</code> shows137  <em>only what KHAELOR changed</em> — your pre-existing uncommitted work is never mixed in or138  attributed to the agent.</li>139  <li>It never auto-commits. Git mutations (<code>commit</code>, <code>push</code>,140  <code>reset</code>, &hellip;) go through <a href="/docs/permissions.html">permissions</a> and141  default to <code>ask</code>.</li>142  <li>Files you edit outside KHAELOR while a session runs are protected by143  external-modification detection — the agent must re-read before touching them.</li>144</ul>145146<h2 id="storage">Where sessions live<a class="anchor" href="#storage">#</a></h2>147<p>Session logs are stored under <code>~/.khaelor/sessions/</code> as plain JSONL — one event148per line, inspectable with standard tools. Associated artifacts (spilled tool output, process149logs) live beside them under <code>~/.khaelor/tool-output/</code> and150<code>~/.khaelor/process-logs/</code>, garbage-collected when sessions are deleted and capped151in total size. Deleting a session from <code>/sessions</code> removes its log and artifacts.</p>152153<div class="pager">154  <div><span class="label">Previous</span><a href="/docs/configuration.html">&larr; Configuration</a></div>155  <div class="next"><span class="label">Next</span><a href="/docs/faq.html">FAQ &rarr;</a></div>156</div>157158</article>159</div></main>160161<footer class="site-footer"><div class="inner">162  <span>KHAELOR — Simon-Pierre Boucher &middot; <a href="mailto:contact@spboucher.ai">contact@spboucher.ai</a></span>163  <span>Anthropic-powered &middot; terminal-native by design</span>164</div></footer>165166</body>167</html>168