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%
ZIP
NameLast commitUpdated
docs feat: KHAELOR v2 (0.2.0) — phase gates, native verify,... 3 h ago
prototypes feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
scripts feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
src feat: KHAELOR v2 (0.2.0) — phase gates, native verify,... 3 h ago
tests feat: KHAELOR v2 (0.2.0) — phase gates, native verify,... 3 h ago
website feat(website): legendary landing + 4x docs + modern light theme 3 h ago
.gitignore feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
CLAUDE.md feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
eslint.config.mjs feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
package-lock.json feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
package.json feat: KHAELOR v2 (0.2.0) — phase gates, native verify,... 3 h ago
README.md docs(readme): legendary README — badges, wordmark, session demo,... 3 h ago
tsconfig.json feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
vitest.config.ts feat: initial commit — KHAELOR terminal-native autonomous engineering... yesterday
README.md
text
██╗  ██╗██╗  ██╗ █████╗ ███████╗██╗      ██████╗ ██████╗
██║ ██╔╝██║  ██║██╔══██╗██╔════╝██║     ██╔═══██╗██╔══██╗
█████╔╝ ███████║███████║█████╗  ██║     ██║   ██║██████╔╝
██╔═██╗ ██╔══██║██╔══██║██╔══╝  ██║     ██║   ██║██╔══██╗
██║  ██╗██║  ██║██║  ██║███████╗███████╗╚██████╔╝██║  ██║
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═╝  ╚═╝

# The autonomous engineer whose every decision you can replay, fork, and diff.

version tests node powered by

terminal-native event-sourced phase gates verify always no invented numbers

Website · Docs · Cookbook · The daemon · Architecture


KHAELOR is not another coding-agent clone. It designs before it implements, verifies before it claims done, and writes every action — even the ones at 3 AM — into an append-only log you can audit. Autonomy without auditability is scary. KHAELOR ships auditable autonomy.

text
Understand first. Design second. Implement third. Verify always — even at 3 AM.

# ⚡ Install

sh
curl -fsSL https://www.khaelor.sh/install.sh | sh     # hosted installer
# or
npm install -g khaelor
sh
export ANTHROPIC_API_KEY=sk-ant-...
cd your-project
khaelor

# 🔥 What a session looks like

text
 KHAELOR ▸ my-project · main

 ❯ fix the memory leak in the renderer

 ├─ symbols "RenderBuffer" · 3 hits · 12ms
 ├─ refs appendLine · callers · 14 sites
 ╰─ read src/tui/render.ts · 240 lines

 ◑ design submitted · 2 files · replace growing buffer with a ring
 ✓ design auto-approved · 2 files

 ├─ edit src/tui/render.ts  +31 −12
 ╰─ edit src/tui/buffer.ts  +8 −3

 ⟳ verify   typecheck ✓ 1.2s · tests ✓ 4.1s · lint ✓
 ✓ verified 4.1s

 ● IMPLEMENT ─ main │ sonnet │ ▰▰▰▱▱▱▱▱ 38% │ in 45k · out 3.2k

# 🏛️ Six things no other CLI agent does together

Feature The point
◐◑● Phase gates "Understand → design → implement" is a runtime mechanism. Write tools stay locked until a design artifact is approved. --gate strict|auto|off
Native verification After each edit batch KHAELOR runs your typecheck/tests/lint itself and repairs failures in a bounded loop — before handing back
Fork · replay · sdiff /fork any checkpoint. /replay a run with another model in a throwaway worktree. /sdiff the two runs. Run it twice, diff the runs
Semantic index symbols finds definitions with signatures; refs maps callers/callees/importers before an edit. Skeletons instead of whole files
Memory with provenance The agent maintains .khaelor/MEMORY.md itself — every entry anchored to the exact session + event that produced it
Parallel worktrees /spawn subtasks in isolated git worktrees with attenuated capabilities. Supervised --no-ff merges. Your working copy is never touched

# 🌙 khaelord — the engineer that lives

A persistent daemon with structured, event-sourced goals — not a prose checklist:

sh
khaelord goal add "keep npm deps fresh without breaking changes" \
  --type maintain --schedule "0 6 * * 1" --budget 5 --escalation draft-pr
khaelord start
text
 03:12 ● goal deps-fresh check failed → run r7f2 in worktree khaelor/goal-r7f2
 03:14 ◑ design recorded · 3 files · in the log, replayable
 03:17 ✓ verified · typecheck ✓ tests ✓ · branch left for review
 03:17   spent today: $1.84 / $20 · runs 1/8

Every run: throwaway worktree → phase gates (even at night) → mandatory verification → hard budget ceilings → async approval queue (a suspended run costs zero). Every decision: one line in an event log you can replay the next morning. → The daemon

# 🧾 The honesty contract

Costs & tokens summed from real API usage metadata — never estimated, never invented
Test results your own commands, real exit codes, errors-first truncation
History append-only JSONL, torn-write recovery, byte-exact replay
Permissions capability-based, deny > ask > allow — silence is never consent
3 AM decisions one event log per goal run — Enter replays exactly what happened

# 🎛️ Inside the TUI

text
/phase /verify /fork /replay /sdiff /memory /spawn /tasks /merge /goals      ← v2
/model /config /permissions /context /sessions /resume /new /compact
/cost /status /diff /processes /help /quit
  • Ctrl+K universal palette · @ fuzzy file mentions · !cmd shell mode · Esc interrupt
  • Type while it works — steering messages queue and inject at a safe seam
  • Theme khaelis (obsidian + magma), OKLCH gradients, truecolor → 256 → 16 → mono ladder
  • khaelor --doctor-tui prints detected capabilities with reasons · --splash for the opening moment
🏗️ Architecture — a deliberately small kernel
text
                    KHAELOR TUI ──── khaelord (daemon)
                          │               │
                          ▼               ▼
                     Session Engine (JSONL event log)


                     Agent Kernel  ←  deriveNext(state) — a pure fold
          ┌───────────────┼───────────────────┐
          ▼               ▼                   ▼
    Context Engine   Tool Runtime        Model Runtime
     (tiers, cache,   (permissions,       (Anthropic SDK,
      compaction)      phase gate,         streaming)
          │            verify loop)
          ▼               ▼
    RepoGraph        Workspace ── the ONLY fs/process seam
    Memory                │
    Phases           Files · Processes · Git worktrees
  • 40 durable event types — everything is a fold over the log: the conversation, the costs, the diffs, the phases, even "what should happen next"
  • 11 tools — read · write · edit (9-strategy replacer) · grep · glob · bash · process · design · remember · symbols · refs
  • Custom ANSI renderer — print-once scrollback, bounded live region, 16 ms coalesced frames, sub-millisecond input latency
  • Design docs in docs/ · v2 notes in docs/V2_IMPLEMENTATION.md
🧪 Development
sh
npm install
npm run check              # typecheck + eslint + 698 tests + mandatory header check
npm run dev                # run from source
npx tsx src/tui/demo.ts    # TUI demo with mocked model events
node website/server.mjs    # the docs site, locally

V1/V2 are Anthropic-only by design. The model layer is isolated behind a single ModelClient interface — clean architecture, not a provider framework.


www.khaelor.shrun it twice, diff the runs.

Simon-Pierre Boucher · contact@spboucher.ai