technical breakdown

The same ideas, with their real names

This page covers what the rest of the site says in plain words, with the terms, mechanisms, and tradeoffs. Under this page, the source of truth is the repo.

the machinery

What ships, precisely

ingest boundary

After every WebFetch, WebSearch, and MCP result, keel appends a note marking the content as untrusted data, never instructions. That makes indirect prompt injection harder. It doesn't prevent it.

  • It's advisory context, not enforcement.
  • Content fetched with plain curl through Bash isn't covered.
  • It flags zero-width characters and bidirectional overrides.
  • It only reads. It never blocks a call or changes a result.

security guard

A PreToolUse hook. It blocks commands that do irreversible damage, and it returns the documented permissionDecision: "ask" before commands shaped like exfiltration.

  • Text versus code. A Dockerfile in a heredoc that mentions rm -rf is text. The same text piped into bash is code, and the guard tells them apart.
  • Fails closed. If the policy is broken, every mutating tool (Bash, Edit, Write) is blocked. Reads stay open.
  • Your policy wins. ~/.config/keel/policy.json can add rules, or exempt shipped ones with bash.allow and paths.allow.
  • Private keys are off limits to the file tools. That covers the usual names: id_*, *.pem, *.key, and ~/.aws/credentials. A key with an unusual name, like a bare deploykey, needs a line in paths.zeroAccess. paths.confirmRead turns the block into a prompt, and the block message says how.
  • Aliases don't get around it. For covered paths, the file tool check follows symlinks and matches hardlinks by inode. Running ln on a key prompts in Bash before the link exists.
  • Bash is the backup net. Shell reads such as cat, cp, openssl, and tar ~/.ssh prompt. So do node, python, ruby, and perl when they name a key. An unusual enough command can still get through. The file tool check is the guarantee.
  • Edits to the policy file prompt. The file tools prompt at whatever path KEEL_POLICY_FILE names. Shell and interpreter writes prompt too: a redirect, sed -i, node -e, ruby -e. This check runs before the policy's own allow list, so a policy that allows everything still can't approve its own rewrite. A shell path hidden behind a variable can get through. The file tool check catches it.
  • Off switch. KEEL_GUARD_OFF=1 turns all of it off.
  • Not a sandbox. Claude Code has its own OS-level Bash sandbox, off until /sandbox or sandbox.enabled turns it on. keel neither installs nor enables it. It limits the writes and network hosts of Bash, PowerShell, and Monitor commands and their child processes, using Seatbelt on macOS and bubblewrap plus socat on Linux and WSL2. Read, Edit, and Write go through permissions instead, and hooks and MCP servers run outside it. By default it still lets commands read ~/.ssh and ~/.aws/credentials. The guard is a separate layer, a PreToolUse hook on Bash, Read, Edit, and Write.

commit hygiene

Blocks unwanted attribution trailers in commit messages. The list lives in KEEL_BLOCKED_TRAILERS, and KEEL_TRAILERS_OFF=1 turns it off. It fails open on any internal error. It only inspects real git commit invocations, so git log --grep still works.

activity log

An append-only monthly JSONL file under the config directory. It's written from documented hook payloads (UserPromptSubmit, Stop) and never by parsing transcripts. File names include the device, so two machines never write to the same file. It makes no model calls. Hooks capture, and skills interpret. KEEL_ACTIVITY_OFF=1 turns it off, and KEEL_ACTIVITY_DIR moves it.

query recall

A UserPromptSubmit hook that scores the fact files under <config dir>/projects/*/memory/ against your prompt. Rare words count for more than common ones, stemming is crude, and there's a relevance floor. It adds up to three matches, each citing its file, inside a <keel-memory> block marked as data. It only reads local files, has a 1.2 second budget, and adds nothing to most prompts on purpose. keel recall "…" shows what a prompt would get, and KEEL_RECALL_OFF=1 turns it off.

memory wiring

Third-party memory engines plug in as bridge plugins that declare MCP servers in .mcp.json, which Claude Code documents. keel ships no vector store, no LLM call, and no daemon. keel doctor checks the wiring, down to whether the engine's project mapping points at the store you configured.

the cli

keel status · log · recall · search · retain-id · doctor · setup · settings · update · migrate · link

Mostly read-only and flags first. Its writes are idempotent and go only to the KEEL_* keys it owns, plus, with your explicit consent, the permissions rules keel settings --yes appends. It backs up the previous state before its first write. It's on the Bash tool's PATH, not your shell's, so in practice Claude runs it for you. keel update checks the commit SHA and ignores the version string. keel search sends one query to a Hindsight bank's recall endpoint and prints the facts, fenced as data, for the reflect skill to reason over in the session. It logs each search's latency to <config dir>/keel/search.jsonl; --stats reads it back. The bank is KEEL_HINDSIGHT_URL and KEEL_HINDSIGHT_BANK, which keel setup writes. A search waits KEEL_SEARCH_TIMEOUT_MS for an answer (60 seconds by default), and keel doctor's Hindsight checks wait KEEL_HINDSIGHT_TIMEOUT_MS (4 seconds). The CLI reads its KEEL_* keys from settings.json's env block as well as the shell, and the block wins.

the constitution

Three rules that can say no

01

Own your config, buy your capabilities

Sync, guardrails, and setup are configuration. They're personal, nobody else can ship them, and they're a few hundred lines. Memory, recall, and reflection are capabilities. They're general, useful to strangers, and people who work on them full time already build them better. During design, "should I build this?" turned into "someone already did" six separate times. What was left to own is small and unglamorous.

02

Documented surfaces only

Claude Code once shipped about 20 releases in a single week. A layer under it survives only by depending on what Anthropic documents and treats as a contract. The system keel replaced parsed session transcripts, an undocumented format. It worked, and one format change would have broken it without a sound. If it isn't in the docs, keel doesn't read, write, or parse it. The exceptions are repairs, listed with their blast radius and how keel stops needing them. An exception you state is a debt. An exception you deny is a lie.

03

Admission by felt need

Prose gets in freely, because removing it is rm. A test gets in when it catches a kind of failure that already happened in this repo. Runtime code, meaning hooks, subcommands, and anything a session executes, needs a real user to have felt the need at least once, on a real machine. "Another harness found it useful" is an argument from someone else's life. Anything that would fail silently when removed ships with the check that would notice.

The full text is in the repo as short ADRs and a glossary.

memory

Engines are swappable. Files stay.

Lots of teams are building agent memory, and Claude Code hasn't picked a winner. keel's bet is to own the interface and the files, and treat engines as swappable. The files are markdown you control. The interface is Claude Code's documented hooks. An engine turns experience into facts. You can replace it, and remembering never depends on it.

Recall is local file reads. Retain is remote LLM work. Never swap them. If you do, your memory stops working whenever your homelab reboots. That's a dependency, not a memory system.

Knowledge is sorted by who can prove it wrong. If grep can, the fact is derivable. keel looks it up live and never stores it, so it can't go stale. If only you can, it's decided, and the notes store keeps it as a pointer plus the reason. If a test suite can, it's logic, and it belongs in a package. Code that both projects import beats notes that describe code.

The full architecture →

deliberately not included

What's missing is on purpose

  • Parsing transcripts, history files, or any undocumented format
  • A memory engine, vector store, or LLM call of its own
  • A daemon, web UI, or background service
  • Credential management
  • A second way to share anything an adapter already shares

Every guard has an off switch: KEEL_GUARD_OFF, KEEL_ACTIVITY_OFF, KEEL_TRAILERS_OFF, KEEL_INGEST_OFF, KEEL_RECALL_OFF. Every write has a backup and an undo. A guard that breaks your workflow is a guard you'll eventually turn off. So the ingest boundary never blocks, the log never calls a model, and the whole layer comes out in two commands.