Skip to content

Claude Code memory between sessions

Claude Code already loads your CLAUDE.md files and its own auto memory notes into every session. Hippo runs beside them and keeps what comes up as you work, such as a rule you stated, a tool call that failed or a fact that changed. On AI-PsychosisBench (opens in new tab), our test on 29 repositories, Claude Code with hippo added repeated a corrected mistake 11 times in 100, against 21 with built-in memory alone, at the same cost. We can't yet say how much of that the stored lessons carry.

Set it up

$ npm install -g hippo-memory
$ hippo init

hippo init adds a short block to the project's CLAUDE.md if it has one, adds nine hook entries to ~/.claude/settings.json, and schedules a daily run at 6:15am that stores lessons from the day's commits. hippo init --no-hooks --no-schedule skips both, and hippo doctor checks the install.

What each hook does

Claude Code hooks that hippo init installs
Hook What it does
SessionStart Prints the rules you've stated and what the last sleep did.
UserPromptSubmit Keeps pinned memories and the last 5 writes in context, and adds memories that match the prompt. An unchanged block is skipped.
PreCompact Saves a snapshot of the task before the transcript is summarised.
SessionStart (compact) Puts that snapshot back into context after compaction.
PostCompact Tells you what was saved.
PostToolUseFailure Stores a failed tool call as an error memory. It skips interrupts, declined permissions and empty searches, and stores a repeated failure once.
PostToolUse Imports a memory note within seconds when Claude Code writes one.
SessionEnd Runs hippo sleep, then hippo capture on the session transcript.

The Claude Code plugin (opens in new tab) is the alternative to these hooks. Use one, not both.

Rules and failures are kept for you

A rule you state to the agent is captured and printed back at the start of later sessions. In a replay of 16 sessions, agents followed those rules in all 16 with the session-start hook and in none with the per-prompt hook alone. Capture has been wrong before. An earlier version pinned 83 rows from 27 real sessions, "Don't worry about it" among them, and the fix pins 6.

$ hippo remember "billing uses pnpm; never run npm install here" --error
$ hippo outcome --bad
$ hippo supersede mem_a1b2c3 "billing moved to bun"
$ hippo failures

These add a lesson, mark the last recall wrong, replace a fact and list what the failure hook saw.

Memories you can read and commit

The store is SQLite, in .hippo/hippo.db in each project, plus ~/.hippo/ for lessons shared across projects. Hippo writes markdown mirrors beside it, so you can read, grep and commit what your agent has been told. Codex, Cursor and any MCP client read the same store.

MCP, and where CLAUDE.md fits

claude mcp add hippo-memory -- hippo mcp gives Claude Code hippo's memory tools over MCP. Keep CLAUDE.md for short standing rules. The CLAUDE.md vs memory page covers what goes where, and hippo import --claude CLAUDE.md turns notes that piled up there into memories.

Claude Code questions

All 14 questions

How do I give Claude Code memory between sessions?

Run npm install -g hippo-memory, then hippo init in the project. Init adds a short block to an existing CLAUDE.md and installs hooks that keep pinned memories in context, save your task before compaction, store failed tool calls and run hippo sleep when the session ends.