rekal

Long-term memory for AI coding agents, stored in one SQLite file on your machine.
rekal is an MCP server. As your agent works, it stores durable facts in rekal, such as your preferences, decisions about the project, and things it took effort to find out. In later sessions, rekal recalls the facts that match the current task.
Session 1 You: I prefer Ruff over Black.
Agent: memory_store("User prefers Ruff over Black for linting and formatting")
Session 47 You: Set up linting for this repo.
rekal: recalls "User prefers Ruff over Black for linting and formatting"
Agent: sets up Ruff without asking.
Highlights
- rekal computes embeddings locally, so it needs no cloud service or API key. Its only network call is a one-time download of the embedding model.
- Each recall blends BM25 keyword match, vector similarity, and recency into one score, so exact identifiers and paraphrased questions both find the right memory.
- The MCP surface is three tools, which keeps tool schemas cheap in the agent's context. Admin tasks live in the CLI.
- Any MCP client works, including Claude Code, Codex CLI, OpenCode, and Cursor.
- In Claude Code, a plugin injects matching memories into every prompt and saves durable facts before compaction and at session end.
Install
uv tool install rekal # or: pip install rekal
rekal needs Python 3.11 or newer. It creates ~/.rekal/memory.db on first run, and downloads the embedding model (about 67 MB) into ~/.rekal/models the first time it embeds text.
Set up Claude Code
claude mcp add --scope user rekal -- rekal mcp # register the MCP server for all projects
claude plugin marketplace add janbjorge/rekal # add the plugin marketplace
claude plugin install rekal-skills@rekal # install the plugin's hooks and skills
Then add "autoMemoryEnabled": false to ~/.claude/settings.json and restart Claude Code:
{
"autoMemoryEnabled": false
}
Without --scope user, Claude Code registers the server in local scope, which loads it only in the project where you ran the command (MCP scopes).
The plugin's hooks run rekal through uvx, so uv must be on your PATH even if you installed rekal with pip.
Claude Code's built-in auto memory (settings) loads its own notes into the context (context window), and the agent tends to favor them over rekal. Those notes are a flat file that cannot be searched, deduplicated, or ranked. The plugin cannot turn this setting off for you, because a plugin's settings can only set agent and subagentStatusLine (plugins). If you leave it on, the plugin's PreToolUse hooks still steer the agent back to rekal, but every redirect costs a turn.
What the plugin does
| Hook | What it does |
|---|
SessionStart | Tells the agent that memory lives only in rekal. Injects no memories yet, because there is no prompt to match. |
UserPromptSubmit | Recalls memories that match your prompt and injects the best hits under ## rekal memory. |
PreCompact | Before an automatic compaction, runs an agent hook that saves durable facts from the conversation. |
SessionEnd | Starts a detached, headless claude -p that saves durable facts from the transcript. It runs with --restricted (no shell or web tools, file access limited to the project and the transcript folder, only memory_build_context and memory_store pre-approved), stops after 25 turns, and counts toward your Claude usage. |
PreToolUse | Denies reads and writes of MEMORY.md, MEMORIES.md, and their .txt variants, and points the agent to rekal instead. |
The hooks run the released rekal from PyPI with uvx --from rekal==<version>, pinned to the version the plugin was released with. uvx caches that environment after the first fetch (uv tools), so later runs need no network. A failed fetch, for example when you are offline on first use, never blocks the session; the hook tries again on the next event. If the database is missing or no memory clears the relevance floor, the hook injects only the directive.