README
¶
claude-memories
A small MCP server that gives Claude global, cross-project memory. It gives claude two stores - notes-to-self (what Claude learns about itself) and user memories (what it learns about you).
Until mid-2026 the user store lived in a separate repo, user-memories. If you're coming from the standalone user-memories, see Migrating from the standalone user-memories.
What it does
It lets claude learn cross-project lessons, gotcha's, debug tips, CLI flags that didn't work as expected, etc, etc. And also snippets about you so that it becomes a more personalised tool. All without you having to hand-maintain an ever-growing CLAUDE.md file.
The aim is to let claude get more done with less friction and work with you better. No more having to explain 'that thing' you worked through in that other golang project - claude can just discover the lesson itself.
It gives some broad guidelines on which store to use :
- Still true if a different user turned up tomorrow → the self store ("Livewire's loose typing hydrates boolean columns as strings - check the cast").
- Still true if a different model turned up tomorrow → that's a fact about the user ("prefers Lando for Laravel dev", "writes British English").
- Specific to one codebase → neither; that's what per-project memory and the local
CLAUDE.mdare for.
Each store exposes eight tools: remember, get, search, list, index, update, delete and dream.
The same binary doubles as a regular CLI.
Prerequisites
- Claude Code, or any other MCP-capable client
- Go 1.26 or newer - only needed for the
go installand build-from-source routes
Getting started
Use a prebuilt binary
Grab a stand-alone binary for your platform from the releases page.
On macOS or Linux, make it executable and stash it somewhere on your PATH:
chmod +x claude-memories-darwin-arm64
mv claude-memories-darwin-arm64 /usr/local/bin/claude-memories
The macOS binary isn't signed, so Gatekeeper will block it the first time you try to run it. You can do the Apple dance and open it once and dismiss the warning, then go to System Settings → Privacy & Security, scroll down to the Security section, and for a short while you'll be offered an "Open Anyway" for the binary you just tried. Or install with go install below and not have to deal with it.
On Windows, rename claude-memories-windows-amd64.exe to something friendlier like claude-memories.exe and drop it somewhere on your PATH.
Install with go install
If you have Go, go install compiles it on your own machine rather than fetching a binary:
go install github.com/ohnotnow/claude-memories@latest
That drops the binary at $(go env GOPATH)/bin/claude-memories, which is usually ~/go/bin/claude-memories.
Build from source
And if you'd rather build it yourself:
git clone https://github.com/ohnotnow/claude-memories.git
cd claude-memories
go build -o claude-memories .
Then put it wherever you keep your own tools:
install -m 755 claude-memories /usr/local/bin/claude-memories
If you're replacing an existing copy: use install or mv, not cp over the top of the old file to avoid any MacOS weirdness.
Wire it up with setup
Once the binary is installed, the wizard does the rest:
claude-memories setup
It comes in three shapes: wiring up just this machine (stdio MCP servers), turning a box into a memory server for your other machines (writes a filled-in systemd unit or launchd agent next to you and prints the install commands), or pointing a machine at a server elsewhere (it checks the server is actually reachable before touching anything). In each case it registers the MCP servers via claude mcp add and adds the SessionStart hooks to ~/.claude/settings.json itself - a timestamped backup is written first, and the edit is format-preserving. It reports what's already wired and skips it, so re-running is safe.
For the server shape it also has a nosey at your network interfaces and suggests the sensible ones first - Tailscale, then LAN.
Every question has a flag twin (--role, --addr, --binary, --db, --settings, --self-only, --yes), so an agent or a script can run it without a TTY - missing information is an error rather than a hang.
The sections below cover the same ground by hand, if you'd rather see exactly what changes.
Register with Claude Code
Once per store - the --store flag picks which one the server fronts:
claude mcp add -s user claude-memories -- /usr/local/bin/claude-memories --store self
claude mcp add -s user user-memories -- /usr/local/bin/claude-memories --store user
Swap /usr/local/bin/claude-memories for wherever yours actually lives - ~/go/bin/claude-memories if you used go install. Skip the second line if you only want the notes-to-self store (--store self is the default).
-s user registers them at user scope so every project gets them. Run /mcp inside Claude Code and you should see both listed, each with its eight tools.
Database location
Both stores live in one SQLite file in your OS's standard config directory:
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/claude-memories/memories.db |
| Linux | ~/.config/claude-memories/memories.db |
| Windows | %AppData%\claude-memories\memories.db |
Pass --db /path/to/custom.db if you'd like it somewhere else.
Migrating from the standalone user-memories
If you previously ran the separate user-memories binary, one command carries your data across:
claude-memories migrate
Tools
| Tool | Description |
|---|---|
remember(content) |
Store a new note-to-self. |
get(id) |
Fetch one memory in full by id. |
search(query, limit?) |
All-words match: every word in the query must appear in a memory, in any order (case-insensitive for ASCII). Newest first, default limit 20. |
list(limit?) |
List memories in full, newest first. Default limit 20. |
index() |
One line (id, date, gist) per memory across the whole store, newest first. |
update(id, content) |
Rewrite a memory in place, keeping its id and created_at. |
delete(id) |
Remove a memory by id. |
dream() |
Return instructions for Claude to tidy up the store (see Dream mode). |
CLI usage
The same binary that serves MCP over stdio also runs as a regular command-line tool. With no subcommand it stays in MCP mode; add a subcommand and it'll act on the store directly:
claude-memories setup # wizard: register MCP servers, wire hooks, generate a service file
claude-memories list # newest 20 notes-to-self
claude-memories list --store user # ... or user memories
claude-memories list --limit 100
claude-memories search livewire modal # all words must appear, any order
claude-memories index # one line per memory, whole store
claude-memories session-start # the index framed for a fresh session (see Session-start hook)
claude-memories show 42 # one memory in full
claude-memories remember "flux:modal inside flux:card doesn't fire - check ..."
claude-memories remember --store user "prefers uv over pip"
echo "piped content works too" | claude-memories remember
claude-memories delete 42
claude-memories dream # prints the dream-mode instructions
claude-memories migrate # import a standalone user-memories database
claude-memories serve --addr 100.64.0.10:8636 # serve both stores over HTTP (see Sharing one store between machines)
claude-memories sessions # this project's Claude Code sessions
claude-memories sessions --project ~/code/other-app
claude-memories extract 4a1b4c5f # one session as a compact markdown digest
claude-memories help
All store subcommands accept --store self|user (default self) and --db PATH if you want to point at a non-default file. list and search accept --limit N.
Session-start recce
The store is pull-based: memories only surface when Claude decides to read them. Left to chance that reliably fails. There are two ways to try and fix that.
Session-start hook
A Claude Code SessionStart hook takes the choice away from claude: the harness runs a command when a session starts and adds its stdout to Claude's context before the first prompt. (claude-memories setup wires this up for you; here's the by-hand version.)
The session-start subcommand prints the same one-line-per-memory lines as index, with a bit of explanation to the model what the store is and how it should use it. Unlike index it orders them warmest first: reading a memory in full (a get or a search hit) or writing one bumps its last_accessed_at, so the recce is the working set claude has actually been using, not simply the newest entries. The output is trimmed to fit Claude Code's cap on hook output, and what falls off the bottom is the coldest tail - still reachable via search, and the recce says so. A store can grow indefinitely without that being a problem; dream() stays for quality clean-ups (duplicates, contradictions, stale advice) rather than squeezing under a size bar.
Wire it up in ~/.claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume|clear",
"hooks": [
{
"type": "command",
"command": "/absolute/path/to/claude-memories session-start"
},
{
"type": "command",
"command": "/absolute/path/to/claude-memories --store user session-start"
}
]
}
]
}
}
Use the binary's absolute path - hooks don't reliably inherit your PATH. The example fires on new sessions, resumed ones, and /clear. Omit the matcher field and it also runs after compaction and on forked sessions. Run one command per store you use - drop the --store user line if you only keep notes-to-self.
The cost is the index itself landing in every session - roughly 2-3k tokens per 100 memories. You can also run the same command by hand mid-session: type ! claude-memories session-start and claude will see it as fresh context.
And/or using CLAUDE.md
The server advertises this workflow itself through the MCP instructions field, which Claude Code folds into the session automatically. But not every harness does the same - so it's worth putting the workflow in your global ~/.claude/CLAUDE.md too. (With the SessionStart hook wired up, the recce itself already happens mechanically - the block below then mostly earns its keep through the mid-session habits.)
## Claude memories (notes to self)
For lessons about your own behaviour and recurring technical rakes - things that would still be true with a different user (framework edge-cases, approaches that had to be backed out, your own failure modes) - use the claude-memories MCP. Facts about the user belong in the user-memories MCP (the same binary's user store) if it's registered - otherwise this global CLAUDE.md already does that job. Single-codebase context belongs in project memory.
It offers:
- `remember(content)` -- Store a note-to-self (gist-first; shape it symptom -> cause -> what to look at, with breadcrumbs)
- `get(id)` -- Fetch one memory in full by id
- `search(query, limit?)` -- Case-insensitive all-words search (every word must appear, any order)
- `list(limit?)` -- List memories in full, newest first
- `index()` -- One line per memory across the whole store, newest first
- `update(id, content)` -- Rewrite a memory in place (keeps its id and created_at)
- `delete(id)` -- Remove a memory
- `dream()` -- Fetch housekeeping instructions for tidying the store
At the start of a session, call `index()` once to skim every memory's gist, then `get()` or `search()` for the full text of anything relevant to the work at hand. When you hit a puzzling error or edge-case mid-session, `search()` for it before debugging from scratch - a previous you has probably already paid for this lesson.
Before calling remember, run a quick search for the topic - avoids writing a duplicate or a contradictory version of something already there. If a lesson is wrong or outdated, prefer `update()` over delete + re-remember: it keeps the memory's id and created_at.
Sharing one store between machines
If you run Claude on more than one machine, serve exposes both stores over HTTP. (claude-memories setup --role server on the always-on box and --role client on the others automates this whole section.) Run it on the box that's always on:
claude-memories serve --addr 100.64.0.10:8636 --db /path/to/memories.db
There's no auth and no TLS - the server trusts whatever network it's bound to. The default bind is 127.0.0.1:8636. Once you're sure it's working locally, restart and point --addr at an interface only your own machines can reach, such as the box's LAN or Tailscale IP.
On the other machines, register each store's endpoint in place of the stdio binary:
claude mcp add -s user --transport http claude-memories http://100.64.0.10:8636/self/mcp
claude mcp add -s user --transport http user-memories http://100.64.0.10:8636/user/mcp
The session-start hook has an HTTP twin too: /self/session-start and /user/session-start return exactly what the session-start subcommand prints, so a remote machine's hook entry becomes a curl:
{
"type": "command",
"command": "curl -fsS http://100.64.0.10:8636/self/session-start"
}
Moving an existing database
Don't just cp the SQLite file. The stores run in WAL mode, so recent writes sit in memories.db-wal - and while anything still has the database open (an MCP server in a live Claude session counts), a bare copy of memories.db hands you a stale snapshot that can be days old. Export a self-contained copy instead:
sqlite3 "$HOME/Library/Application Support/claude-memories/memories.db" \
"VACUUM INTO '/tmp/memories-copy.db'"
Copy the result across, and stop the remote serve before swapping the file in under it.
Running serve at boot
The scripts directory has a systemd unit for Linux and a launchd agent for macOS. Each has its install steps in a comment at the top; both bind 0.0.0.0:8636 and just need the paths pointing at your binary and database. claude-memories setup --role server generates the right one with your paths already filled in.
Dream mode
The dream feature returns a short set of housekeeping instructions asking Claude to:
indexthe whole store for a cheap one-line overview, then pull the full text of anything worth a closer look,- look for duplicates, contradictions, version-stale lessons, misfiled entries that belong in the other store or a project
CLAUDE.md, and likely looking PII or real infrastructure names that slipped in, - walk you through the plan one category at a time - quoting each memory's content - and only delete, merge or rewrite once you've signed off on that item.
From inside a Claude Code session you can kick it off with something like:
Run the claude-memories
dreamtool and then follow the instructions it returns.
Or from the terminal, if you'd rather pipe the prompt in yourself:
claude-memories dream | pbcopy
Transcript tooling: sessions and extract
These are some internal features which I've exposed as user-accessible tools via the cli as they're actually generally handy.
sessions lists a project's transcripts - id, time span, prompt count, size, and a gist of the opening prompt. It reads the current project from your working directory; --project ~/path/to/other-app lists another project's.
extract <session-id> renders one transcript as a compact markdown digest. The compression is deliberately lopsided: user prompts and Claude's own narration survive nearly whole, tool calls and successful results get squashed to a line each, but errors keep almost everything. Subagent traffic is omitted (and counted in the header), and your home directory is scrubbed to ~ in both plain and transcript-encoded forms to avoid leaking your username. A session id resolves across every project, and a full path to a .jsonl works too.
The guddle skill
Guddle (Scots): to fish by hand, feeling under stones in a burn. skill/guddle/SKILL.md is a Claude Code skill that drives the "lessons learned" process. Warm mode distils the session you're in at the end of a day's work; cold mode digs lessons out of past sessions via sessions + extract.
Install it by copying it into your personal skills folder:
cp -r skill/guddle ~/.claude/skills/
Then /guddle in any session - or just ask "anything worth remembering from this session?".
Contributing
git clone git@github.com:ohnotnow/claude-memories.git
cd claude-memories
go test ./...
Then edit, test, open a PR. The project is deliberately tiny, so small changes are very welcome. Please don't send me a PR that turns it into a platform.
Licence
MIT. See LICENSE.
Documentation
¶
There is no documentation for this package.