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 · Sources
What you already do
- Git commits
- Claude Code sessions
- Codex sessions
- Decisions you save or import
-
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 · Memory
In your repo’s
.code-butler/- Working context
- Candidates
- Durable memories
- Project brief
-
4 · Retrieval
Fast and offline
- SQLite full-text search
- Optional hybrid search with embeddings
- Falls back to exact full-text results
-
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.
| Type | What it records |
|---|---|
| Decision | We chose, because, instead of |
| Constraint | Requirement, applies when, why |
| Bug fix | Symptom, cause, fix |
| Rejected approach | Tried, 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 work | summarize_project_brief |
| Asks “where were we?” | summarize_active_context |
| Asks why code looks this way | explain_code_change, find_decisions |
| Checks for dead ends | find_memories, search_project_memory |
| Asks what changed lately | summarize_recent_activity |
| Is about to write, commit or touch secrets | get_applicable_rules |
| Is told “remember this” | remember_project_memory |
MCP Tools (34) · all 34 exposed tools, grouped
Start and resume
Why and history
Recent activity and health
Save and curate
Keep it fresh
Global rules
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
.envare ignored until you approve them on this computer. - The review shows
.envby key names only. Approval is stored as a hash, so any later change, even fromgit pull, needs approving again. - Even when approved, Butler reads only the keys that project’s models use and ignores names like
PATH,NODE_*andGIT_*.
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.
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.mdandAGENTS.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.