Give Claude Code a long-term memory
Give Claude Code a memory that lasts between sessions: install memorinth, connect it with one command, and see what it saves as Markdown in your cortex.
On this page
To give Claude Code a long-term memory, install the memorinth command, run memorinth init and pick Claude Code, then start a new session. From then on every session opens with a briefing of what earlier sessions decided and learned, searches your cortex when it needs to know something, and saves what it learned as Markdown files on your disk.
| Step | Command | Takes |
|---|---|---|
| Install | curl -fsSL https://memorinth.app/install.sh | sh | A minute |
| Make a cortex and connect Claude Code | memorinth init | A few questions |
| Check it | memorinth doctor | Seconds |
| Use it | Start a new Claude Code session | Nothing more |
Install
-
Install the CLI. It puts
memorinthon your PATH, with the MCP server Claude Code runs and the engine behind it. If you have the desktop app, you already have it.Windows · PowerShell
> irm https://memorinth.app/install.ps1 | iexmacOS and Linux · Terminal
$ curl -fsSL https://memorinth.app/install.sh | sh -
Open a new terminal and check it’s there:
$ memorinth --version
Install the CLI has the supported systems and how updates work.
Connect Claude Code
$ memorinth initinit asks which folder to use as your cortex (~/Memorinth by default), which agents to connect, whether to install the skills and the hooks, and whether to download the search model now. Pick Claude Code, and say yes to the hooks: they give each session its briefing.
To connect Claude Code alone, without questions, make the cortex first and then connect it:
$ memorinth init ~/Memorinth --no-connect -y
$ memorinth setup claude-codeIn the app, Settings › Agents does the same: Connect, or Repair if something is missing. Set up your cortex covers every question init asks.
What setup changes
memorinth setup claude-code changes files in your home folder only, applies to every project, and turns agents on for the cortex you chose:
| Part | Where | What it does |
|---|---|---|
| MCP server | ~/.claude.json, added with claude mcp add | Gives Claude Code the memory tools: search_memory, write_memory, record_decision, add_fact and the rest |
| Hooks | ~/.claude/settings.json | A briefing at session start, and a reminder to save when a session changed files and saved nothing |
| Skills | Installed once in ~/.agents/skills, linked into ~/.claude/skills | /memorinth-save to save on demand, and memorinth-search for the search language |
memorinth setup claude-code --remove takes it all out again. Connect one agent lists what each agent gets.
Check it
$ memorinth doctordoctor shows the cortex agents use, what Claude Code has of Memorinth, and what to fix if something’s missing. Check with doctor explains each line.
The first session
Work as you normally would. The difference shows at three moments:
- At the start, before you type, the session-start hook hands Claude Code a briefing: current facts, accepted decisions, recent memories, facts due for a recheck and the tags in use.
- While it works, it calls
search_memorywhen it reaches something it doesn’t know, such as why a module is built the way it is. - At the end, it saves what’s worth keeping. If it changed files and saved nothing, the stop hook asks it to consider saving. Type
/memorinth-saveto save at any point.
A good test: fix something small, tell Claude Code why you chose one approach over another, and close the session. Open a new one and ask why that approach was chosen. Your first session walks through it.
What gets saved
Claude Code writes in three folders of the cortex, and only there. Your own notes are read and searched, never changed.
| Folder | What goes in it | Example |
|---|---|---|
memory/ | What it learned, what happened, your preferences, how-tos | “The login bug was a time zone mix-up” |
decisions/ | What you decided together, with the reason; replaced, never edited | “Store times in UTC” |
facts/ | One stable claim with a source, rechecked every 180 days | “The health check is at /health” |
Each note is a Markdown file marked source: agent:claude-code. Open them in the app or any editor, edit them, or put the cortex in git. To see how sessions used the memory:
$ memorinth usage --todayAnd CLAUDE.md?
Keep it. CLAUDE.md holds instructions, how to work in the project, and Claude Code loads it whole into every session. The cortex holds knowledge that grows as you work, and is searched rather than loaded whole. What goes where draws the line, with a few lines worth adding to your CLAUDE.md.
Claude Code also has its own auto memory, notes it keeps per repository on one machine. Both can run side by side. If you’d rather have one place for what Claude Code learns, turn auto memory off with /memory in Claude Code. Memorinth vs other agent memory compares the two.
Other agents
Codex, Cursor and Gemini CLI can share the same cortex, so what one session learns, the others know. See Memory for Cursor, Codex and other MCP clients.
Updated