open-brain
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@open-brain save a note that the staging server restarts at 2am"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
open-brain
A memory for AI coding agents: a small MCP server that saves notes to one local file and finds them again by keyword.
More of my work on erikhernal.com
The problem
A coding agent forgets everything when the session ends. Tomorrow it'll repeat the mistake you corrected today, or ask you again about something you already decided.
My own agents save what they learn to a memory like this one and search it at the start of every session. This repo is the small local version of that setup.
Related MCP server: agtmem-mcp
What it does
Six tools over MCP:
brain_save,brain_search,brain_recent,brain_stats,brain_update_project,brain_delete.Saves to one SQLite file on your machine. It needs no database server and no API key, and it never touches the network.
Keyword search ranked by BM25, with an exact-phrase match on top, so a pasted error string lands first.
SUPERSEDES <id>at the start of a note archives the note it replaces, so old answers stop coming back.A
state_key(likeconfig:theme) holds a current value. Saving a new value archives the old one.A note can carry a project name, and search can stay inside one project. Pass
globalas the project to get only the notes that have none.Refuses a second note with the same title inside 24 hours, so a retry can't save the same thing twice. That only covers a title you pass in: a note saved without one gets its title from its first line, and that one isn't checked.
Deletes by full id or a unique id prefix, and refuses a prefix that matches more than one note.
Search here matches the words you type (with simple stemming, so "deploying" finds "deploy"). It doesn't match by meaning: ask for "cache TTL" and you'll find the note that says "cache TTL", and miss one that only says "expiry time". The private version this came from adds vector search on Postgres for that.
Run it yourself
You need Node 22.13 or newer, because it uses Node's built-in SQLite.
git clone https://github.com/erikatagentic/open-brain.git
cd open-brain
npm install
npm run build
npm testThen add it to your MCP client. For Claude Code:
claude mcp add open-brain node /path/to/open-brain/dist/index.jsFor other clients, examples/mcp-config.json shows the usual JSON shape. There are two optional settings:
Setting | What it does | Default |
| Where the data file lives |
|
| Written to each note's source field |
|
To try it, ask your agent to "save a note that the staging server restarts at 2am". Then open a new session and ask it to search the brain for "staging restart".
node scripts/smoke.mjs starts the server the way a client would and runs a save and a search over stdio.
One real result
State keys keep one current value per key. The test at test/brain.test.mjs line 102 saves the theme as light, then as dark under the same key, and checks that search only returns dark. The test runs on a fixed clock, so this is the same sequence run by hand:
Saved: "Theme is light" (e663af49-c071-4cbd-8e5f-05dbb4cfd22c) at 2026-11-26T01:50:06.537Z
State key config:theme: first value
Saved: "Theme is dark" (ecd1a42b-f3fc-499b-bbcf-e6cc857bd79b) at 2026-11-26T01:50:06.541Z
State key config:theme: replaced 1 earlier value(s): e663af49-c071-4cbd-8e5f-05dbb4cfd22c
brain_search "app theme":
1. **Theme is dark** (thought, state:config:theme, global, exact phrase)
id: ecd1a42b-f3fc-499b-bbcf-e6cc857bd79b
The app theme is dark.
Tags: none | 2026-11-26The light note is still in the file, marked archived and pointing at the note that replaced it. It just doesn't come back in search.
How it's put together
File | What's in it |
The six MCP tools and their argument schemas | |
What each tool does, with no MCP or SQL in it | |
The | |
Query parsing, the phrase rule and the score | |
Reading the ids after |
The tools only talk to the Store interface, so a different backend only has to implement that.
Where it came from
Pulled out of a private repo on 2026-11-26. The history stays private because it holds client data. The sample data is made up.
Contact
License
MIT. See LICENSE.
Available Tools
6 toolsbrain_deleteDelete NoteA
Delete one note by its id or a unique id prefix (8+ characters). No undo. Refuses a prefix that matches more than one note. To replace a note instead, save the new one with SUPERSEDES .
Inputs: id (required).
brain_recentRecent NotesA
List the newest notes, optionally filtered by project or category. Use at session start for quick context.
Inputs: limit, project, category.
brain_saveSave to BrainA
Save a decision, bug fix, pattern, or lesson to a local knowledge base. Call this whenever you make a decision, fix a bug, learn something non-obvious, or the user corrects you. Write the content for a future agent with zero context about this session. Use state_key for current-value facts so a later save replaces the earlier value.
Inputs: content (required), tags, title, project, +3 more.
brain_searchSearch BrainA
Search the knowledge base by keyword. Matches exact words (with simple stemming), ranked by BM25, with an exact-phrase match on top. It does not match by meaning, so use the words the note probably contains: product, file, table, error-string and command names. Several guessed keywords in one query work well, because any word can match and notes with more of them rank higher. Use at session start to load context, and whenever a request may relate to earlier work.
Inputs: query (required), limit, project, category.
brain_statsBrain StatsC
Counts by project and category, notes added this week, and how many are archived.
Inputs: project.
brain_update_projectMove Notes to Another ProjectA
Move every note from one project to another (or to no project). Use dry_run to see how many would move first.
Inputs: to_project (required), from_project (required), dry_run.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool maps to a distinct operation on the knowledge base: write (brain_save), keyword lookup (brain_search), recency listing (brain_recent), aggregate counts (brain_stats), bulk project reassignment (brain_update_project), and removal (brain_delete). The descriptions explicitly differentiate the two read paths (keyword/BM25 vs. newest-first), leaving little room for misselection.
All tools share a predictable brain_ prefix and snake_case, with clear verb-based suffixes (save, search, update_project, delete). The only mild deviation is the use of noun/adjective forms in brain_recent and brain_stats, but the pattern remains readable and consistent.
Six tools is a tight, well-scoped surface for a personal knowledge base — write, two read paths, stats, bulk maintenance, and delete. Every tool earns its place with no redundant or speculative operations.
The lifecycle is largely covered: save (with SUPERSEDES for replacement), search, recent, stats, project migration, and delete. Minor gaps exist — there is no direct fetch-note-by-id and no true in-place edit (only supersede), but agents can work around both via search and re-save.
Maintenance
Related MCP Connectors
Persistent memory layer for AI tools. Save and recall notes across Claude and other MCP clients.
MCP-native notes and memory for ChatGPT, Claude, and other AI tools.
Linked markdown notes as memory for AI apps: search, read, save and link notes over MCP.
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Related MCP Servers
- AlicenseAqualityBmaintenanceProvides cross-session persistent memory for coding agents via MCP tools to store, retrieve, and manage notes with hybrid keyword/semantic search and automatic deduplication.8237 npmMIT
- AlicenseAqualityBmaintenanceEnables coding agents to store, search, and retrieve long-term memory as plain Markdown files with a disposable SQLite index, including note management, decision/bug tracking, and codebase symbol lookup via MCP.8MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to persistently save, search, retrieve, update, link, and forget project-scoped memories through MCP tools, using local SQLite FTS5 keyword search without cloud access or telemetry.18 npm14MIT
- AlicenseAqualityBmaintenanceGives every AI agent on a machine a shared, local-first long-term memory: 16 tools to save, search, edit and organize structured notes in one SQLite file, with attribution per client. Runs over stdio or localhost HTTP, so Claude Code, omp and any other MCP client recall the same facts, decisions and entities.162MIT