Code Butler ← Back to home

Architecture · v2.0

How Code Butler works

Code Butler turns what you already produce, your commits and your Claude Code and Codex sessions, into a project memory that agents read over MCP before they edit. It runs on your machine, and the memory lives in your repo’s .code-butler/ folder.

  • 4 evidence sources
  • 3 memory layers
  • 4 memory types
  • 34 MCP tools
  • Works offline by default

The big picture

From commits and chats to answers your agent can use.

A background watcher picks up new evidence as you work. Nothing needs to be written down by hand.

  1. 1 · Sources

    What you already do

    • Git commits
    • Claude Code sessions
    • Codex sessions
    • Decisions you save or import
  2. 2 · Capture

    Background watcher

    • Imports only what’s new
    • Redacts secrets before storing
    • Built-in triggers catch explicit decisions, no model needed
    • Optional extraction by a model you pick
  3. 3 · Memory

    In your repo’s .code-butler/

    • Working context
    • Candidates
    • Durable memories
    • Project brief
  4. 4 · Retrieval

    Fast and offline

    • SQLite full-text search
    • Optional hybrid search with embeddings
    • Falls back to exact full-text results
  5. 5 · Agents

    Over MCP

    • Claude Code
    • Codex
    • Any MCP client
    • Desktop app and CLI for you

Memory

Three layers, from today’s work to settled decisions.

Memories move up as their evidence holds and drop out when nobody uses them, so search doesn’t fill with stale notes.

Working now

The active task, open questions and recent attempts. This is what answers “where were we?”.

Lasts 24 hours, up to 3 days while in use. Stays on this computer.

Candidates

Statements pulled from commits and conversations. Searchable right away and promoted automatically when the evidence holds up.

Unused candidates expire after 30 active days.

Durable

Accepted project knowledge. When a newer decision replaces one, the old one is marked superseded instead of silently lingering.

Current, superseded or retracted. You can mark any one human-verified.

TypeWhat it records
DecisionWe chose, because, instead of
ConstraintRequirement, applies when, why
Bug fixSymptom, cause, fix
Rejected approachTried, dropped because, revisit if

Every memory has sources

Each one links to the commits and conversations it came from, so an agent can check the evidence instead of trusting a summary.

Duplicates merge

When the same fact turns up again, its new evidence joins the existing memory instead of creating a copy.

Optional daily review

With a reviewer model set, an AI review checks up to 100 memories a day. Its changes are recorded and can be undone.

Agents

One MCP server for every repo and every agent.

You register Code Butler once. It works out which repo the agent is in, and writes short CLAUDE.md and AGENTS.md files that tell agents when to ask it.

When the agent…It calls
Starts worksummarize_project_brief
Asks “where were we?”summarize_active_context
Asks why code looks this wayexplain_code_change, find_decisions
Checks for dead endsfind_memories, search_project_memory
Asks what changed latelysummarize_recent_activity
Is about to write, commit or touch secretsget_applicable_rules
Is told “remember this”remember_project_memory
MCP Tools (34) · all 34 exposed tools, grouped

Start and resume

summarize_project_brief
Read the project brief with freshness details.
summarize_active_context
Active task, open questions, tests, files and session instructions.
search_temporary_memory
Search current working context, current session first.
cleanup_temporary_memory
Delete expired working context, or all of it on request.
current_project
Show which project and memory folder this server is using.

Why and history

explain_code_change
Explain why a file changed, from memory evidence.
investigate_project_history
Multi-step local investigation of a plain-language question.
find_decisions
Find saved and promoted decisions.
find_memories
Find durable memories and candidates, with lifecycle filters.
search_project_memory
Search memories together with raw source matches.
find_related_commits
Search imported commits by text or file path.
get_memory_history
A memory’s replacements, corrections and withdrawals.
read_memory_source
Read the stored source behind a memory.

Recent activity and health

summarize_recent_activity
Conversations and commits from the last 3 days by default.
summarize_project_state
Counts and sync status.
summarize_memory_movement
What was promoted, shared, replaced or withdrawn this week.
summarize_memory_health
Memory quality and review reasons.
read_project_handbook
Read confirmed memory topics, or one topic page.
list_source_failures
Sources that failed to import, and whether they are fixed.
run_doctor
Read-only setup and health checks.

Save and curate

remember_project_memory
Save a memory the user asked for, optionally replacing an old one.
update_memory_status
Mark a memory current, superseded or retracted.
update_memory_scope
Correct where a memory’s advice applies.
update_memory_layer
Move a memory between shared, branch and device layers.
resolve_memory_review
Record a person’s Verify, Correct or Discard decision.
suggest_memory_layer_promotions
Suggest memories ready to be shared project-wide.
suggest_branch_memory_triage
Sort branch memories by their branch’s state. Read-only.
resolve_branch_memory_triage
Promote, discard or keep a reviewed branch memory.

Keep it fresh

sync_project_memory
Import new evidence now and wait for it to be searchable.
refresh_project_summary
Refresh the project brief without touching agent files.
explain_memory_promotions
What automatic promotion would do now, and what it did. Read-only.
explain_layer_retention
What retention would archive now, and what it archived. Read-only.

Global rules

get_applicable_rules
Rules that apply to the planned action, paths and environment. Read-only.
record_rule_attestation
Record a verified rule check so it isn’t repeated.

Security and secrets

Built to sit next to your secrets.

A memory tool reads your commits, your chats and your config. Code Butler is designed so none of that turns into a leak.

Secrets never reach memory

  • API keys, bearer tokens, AWS credentials, private keys, credential URLs and major provider token formats are redacted before anything is stored. You can add your own patterns.
  • The project brief skips environment and credential files.
  • Global rules reject recognized secrets. They record where a secret lives, never its value.

Models see only what you allow

  • Nothing goes to a model until you pick a provider. A key that just sits in your shell doesn’t count.
  • Local models such as Ollama or LM Studio need no opt-in. Remote providers only ever get redacted text.
  • Model keys saved in the desktop app can live in the macOS Keychain or Windows Credential Manager only.

A cloned repo can’t take over

  • A repo’s own model connections, endpoints, source paths, privacy switches and .env are ignored until you approve them on this computer.
  • The review shows .env by key names only. Approval is stored as a hash, so any later change, even from git pull, needs approving again.
  • Even when approved, Butler reads only the keys that project’s models use and ignores names like PATH, NODE_* and GIT_*.

Agents get read access, not admin

  • Agents read global rules but can’t create, edit or delete them.
  • Unredacted export and destructive privacy commands are CLI-only, never available over MCP.
  • The MCP server never prompts for sign-ins or approvals.
Early access · macOS and Windows

Optional: end-to-end encrypted sync.

Off unless you turn it on. It keeps memory, global rules and, if you choose, a project’s secrets/ folder in step across your computers. Public sign-up opens once the release checks pass.

The service sees ciphertext

Only encrypted data and operational metadata leave your computer, never readable file names or contents.

Private keys stay in the macOS Keychain or Windows credential storage, with no plaintext fallback.

Your computers, your approval

A new computer joins after you compare a fingerprint with one you already use. Removing a computer rotates the memory, rules and secrets keys.

ChaCha20-Poly1305 encryption, Ed25519 device signatures and hybrid X25519 + ML-KEM-768 key delivery.

secrets/ sync, kept out of Git

Files stay plain on disk for your tools. Butler refuses files Git already tracks and adds /secrets/ to .gitignore first.

Conflicting edits wait for you to keep the local or cloud version. Secret values never enter memory.

What’s installed

Four parts, one installer, and a few files.

Desktop app

Where you browse and review memory, set global rules, choose AI models and manage sync.

CLI

code-butler for setup, sync, search, privacy tools and scripting.

MCP server

code-butler mcp, registered once and shared by every agent and repo.

Background watcher

Imports new commits and sessions, waiting until a session goes quiet.

  • .code-butler/memory.sqliteThe project memory. Ignored by Git.
  • .code-butler/project-summary.mdThe project brief, and the only Butler file Git tracks.
  • CLAUDE.md and AGENTS.mdShort pointers that tell agents to ask Butler. They hold no memory.
  • .code-butler-project.jsonOptional sync identity, a random ID with no account data. You commit it.
  • ~/.config/code-butler/Global settings, global rules and your project approvals.

Built with TypeScript on Node 24 and its built-in SQLite. The desktop app uses Tauri, and the encryption helper is written in Rust.