Skip to main content
Glama

Every time you start a new session, your coding agent has forgotten what you decided yesterday. You explain the same rules again, and it reopens questions you already settled. RecallKeep fixes this. It keeps your decisions, facts and past conversations in a Postgres database on your machine. It gives the relevant ones back to the agent at the start of each session and with each prompt you send.

It works with any agent that supports MCP (Model Context Protocol, the standard way agents connect to tools). It has ready-made hooks for pi, Claude Code, OpenAI Codex CLI and Google Antigravity CLI. Several agents can share one memory, so a decision made in Claude Code is known in Codex too.

Status: early (v0.1.0), and in daily use by its author since April 2026. Install it from this repo. It is not published to npm.

Why

Related MCP server: apex-memory

Features

  • Context at session start. The agent gets your standing rules (for every project), the locked decisions for this project, and its newest facts.

  • Recall for each prompt. Before the agent reads your prompt, RecallKeep adds the stored facts that best match it.

  • Agent tools. memory_search, memory_save, memory_context, memory_list and memory_forget work in any MCP client.

  • Hybrid search. Full-text search and semantic (vector) search are combined. Results are ranked by relevance, recency, tier and confidence.

  • Projects without setup. The project comes from the folder you work in. ~/Projects/my-app/src is my-app.

  • Conversation capture. Each turn is logged. pi sessions are captured in full, including tool calls.

  • Secrets removed. Captured conversations go through betterleaks or gitleaks plus a pattern check before they are stored.

  • Decisions layer. An LLM pass picks out settled decisions from pi transcripts, so they are not reopened later.

  • Maintenance. Session summaries, lesson extraction, promotion from short-term to long-term, conflict detection, export and backup.

  • Your choice of model. OpenAI, Gemini, a local server such as Ollama, or no LLM at all.

  • Safe defaults. The API listens on 127.0.0.1 only, rejects browser requests, and takes an optional bearer token.

Before you start

You need:

  • Bun 1.2 or newer.

  • Postgres 16 or newer with the vector and pg_trgm extensions. The quickstart runs it with Docker. To use your own Postgres instead, see Without Docker.

  • Optional: an OpenAI or Gemini API key, or Ollama, for semantic search and summaries. Without one, RecallKeep still works, and search uses full text and project tags.

Quickstart

This setup uses no API key and makes no external calls. It takes about five minutes.

git clone https://github.com/theBlackEndDev/recallkeep.git
cd recallkeep
bun install
cp .env.example .env
echo 'RECALLKEEP_LLM_PROVIDER="none"' >> .env   # no LLM; change this later, see below

docker compose up -d                     # Postgres + pgvector on 127.0.0.1:5433
bunx prisma migrate deploy               # create the tables
bun run memory-api                       # the API on http://127.0.0.1:7775

Leave that running, and open a second terminal to check that it works:

curl -s http://127.0.0.1:7775/health
# {"status":"ok","backend":"recallkeep","port":7775}

curl -s -X POST http://127.0.0.1:7775/memory \
  -H 'Content-Type: application/json' \
  -d '{"content":"We deploy with blue-green releases.","project":"my-app","tags":["decision"]}'

bun run src/cli.ts recall --query "how do we deploy"

Next, connect your agent. To start RecallKeep at login, see Run it in the background.

Choose an LLM provider

The LLM computes embeddings for semantic search, and it writes summaries. Set RECALLKEEP_LLM_PROVIDER in .env:

Provider

What you need

What leaves your machine

none

Nothing

Nothing. Search uses full text and project tags

local

Ollama or LM Studio on localhost:11434 (ollama pull nomic-embed-text and ollama pull llama3.2)

Nothing

openai (default)

OPENAI_API_KEY

Text sent for embeddings and summaries

gemini

GEMINI_API_KEY

Text sent for embeddings and summaries

Choose the embedding model before you store much data. Vectors from different models cannot be compared. To fill in embeddings later, run bun run src/cli.ts backfill. Details: docs/configuration.md.

Connect your agent

Each agent gets two things:

  1. The MCP server for the tools. The agent starts it with bun /PATH/TO/recallkeep/src/cli.ts mcp. The server talks to the API you started above.

  2. Hooks for automatic memory: context at session start, recall on each prompt, and turn logging. Hooks fail open. If RecallKeep is down, the agent runs as normal.

In the commands below, replace /PATH/TO/recallkeep with the full path to your clone (run pwd inside it). The MCP tools are the same in every agent:

Tool

What it does

memory_search

Searches facts and past conversations. Defaults to the current project. project: "all" searches everything.

memory_save

Saves a fact. Tag it decision to show it at every session start. project: "global" makes it a rule for every project.

memory_context

Returns the session-start block on request, for clients without hooks.

memory_list

Lists a project's newest facts with their ids.

memory_forget

Archives a fact by id. Archived facts are kept but no longer recalled.

Claude Code

Verified with Claude Code 2.1.327.

claude mcp add recallkeep -s user -- bun /PATH/TO/recallkeep/src/cli.ts mcp

Copy the hooks block from integrations/claude-code/settings.json into ~/.claude/settings.json for all projects, or into .claude/settings.json for one project.

OpenAI Codex CLI

Verified with Codex CLI 0.167.1.

Add integrations/codex/config.toml to ~/.codex/config.toml. Codex asks you to trust new hooks: open /hooks in Codex and approve the three RecallKeep hooks. In testing, Codex did not load hooks from a project's .codex/hooks.json, but it did load the inline [hooks] tables in config.toml.

Google Antigravity CLI

Verified with agy 1.5.13. Antigravity CLI replaced Gemini CLI.

agy mcp add recallkeep bun /PATH/TO/recallkeep/src/cli.ts mcp

Copy integrations/antigravity/hooks.json to .agents/hooks.json in your workspace, or to ~/.gemini/config/hooks.json for all workspaces. agy has no prompt-submit event, so the recall hook runs on PreInvocation. RecallKeep looks up memory once per turn and reuses the result for the other model calls in that turn.

pi

pi gets a full extension. It injects context at session start, syncs the complete transcript (including tool calls) after each turn, writes a handoff note when you quit, and adds the memory_search and memory_save tools plus the /memory and /handoff commands.

mkdir -p ~/.pi/agent/extensions
cp -R /PATH/TO/recallkeep/integrations/pi ~/.pi/agent/extensions/memory

See integrations/pi/README.md. For the tools only, use pi mcp add recallkeep -- bun /PATH/TO/recallkeep/src/cli.ts mcp instead.

Any other MCP client

Cursor, Windsurf, Cline, VS Code and others can start the same server. Use command bun with arguments /PATH/TO/recallkeep/src/cli.ts mcp. They get the tools but no hooks, so paste integrations/AGENTS.md into your agent instructions. It tells the agent to call memory_context at the start and to save decisions.

Run it in the background

scripts/start.sh starts Postgres with Docker (or, without Docker, waits for your own Postgres), applies migrations and runs the API. Service templates call it:

Each file explains in its header how to install it. To update later, run bun run update. It pulls, installs, migrates and restarts the service.

Without Docker

RecallKeep only needs a Postgres it can reach through RECALLKEEP_DATABASE_URL. A native install, a server on your network or a managed database all work. The database must be Postgres 16 or newer with the pgvector extension installed. pg_trgm ships with Postgres.

  1. Create a user and a database, then create the two extensions as a superuser. vector is not a trusted extension, so the migrations can't create it with an ordinary user:

    CREATE ROLE recallkeep LOGIN PASSWORD 'choose-a-password';
    CREATE DATABASE recallkeep OWNER recallkeep;
    \c recallkeep
    CREATE EXTENSION vector;
    CREATE EXTENSION pg_trgm;
  2. Point .env at it. Percent-encode special characters in the password (@ is %40, : is %3A, / is %2F):

    RECALLKEEP_DATABASE_URL="postgresql://recallkeep:choose-a-password@localhost:5432/recallkeep"
  3. Skip docker compose up -d in the quickstart. Run the rest as written.

scripts/start.sh decides whether to use Docker from the URL. It uses Docker only when the URL points at this machine on the port docker-compose.yml publishes (RECALLKEEP_DB_PORT, default 5433). Otherwise it waits until your database accepts connections. Set RECALLKEEP_USE_DOCKER=0 or 1 to decide it yourself.

backup and restore then run pg_dump and psql on this machine, so install the PostgreSQL client tools (macOS: brew install libpq, Debian and Ubuntu: apt install postgresql-client). Their version must be the same as the server's or newer. If they aren't on PATH, set RECALLKEEP_PG_DUMP and RECALLKEEP_PSQL to their full paths.

How it works

 your agent ──hooks──▶ bun src/cli.ts hook ─┐
     │                                       ├──HTTP──▶ API server :7775 ──▶ Postgres + pgvector
     └──MCP────────▶ bun src/cli.ts mcp ────┘              │
                                                           └──▶ LLM provider (optional): embeddings, summaries
  • Facts are short, curated statements: a decision, a rule, a finding. You or the agent save them.

  • Messages are conversation turns captured by hooks. Long ones are split into chunks for search.

  • Recall runs full-text and vector search, then ranks the results by relevance (60%), recency (15%), tier (15%) and confidence (10%). Facts from the current project get a boost.

  • Maintenance (bun run src/cli.ts maintain, or scripts/cron-maintain.sh) moves short-term facts that were saved on purpose or have high confidence up to DAILY and then LONG_TERM. It archives the low-confidence short-term ones after 48 hours.

Full details: docs/how-it-works.md.

Words you'll see

Word

Meaning

Fact

One saved piece of knowledge, such as "We deploy with blue-green releases."

Decision

A fact tagged decision. It is shown at the start of every session in its project.

Standing rule

A fact saved under the project global. It is shown at the start of every session in every project.

Project slug

The project name, taken from your folder. ~/Projects/my-app/src becomes my-app.

Recall

Finding the facts most relevant to a question and ranking them.

Embedding

A list of numbers that represents the meaning of a text. Texts with similar meanings get similar numbers.

pgvector

The Postgres extension that stores embeddings and finds similar ones.

MCP

Model Context Protocol, the standard way agents connect to tools. RecallKeep runs as an MCP server over stdio.

Hook

A command your agent runs at set moments, such as session start or prompt submit.

Tier

How long a fact lives: SHORT_TERM, DAILY or LONG_TERM.

Security and privacy

  • The API listens on 127.0.0.1 only. To expose it on another address you must set RECALLKEEP_API_TOKEN, and clients then send Authorization: Bearer <token>.

  • Browser requests are rejected, so a web page you visit cannot read your memory. To allow a specific origin, set RECALLKEEP_CORS_ORIGINS.

  • Postgres is published on 127.0.0.1 only. Change RECALLKEEP_DB_PASSWORD before the first docker compose up if other people use your machine.

  • Logged turns and pi transcripts are redacted before they are stored. Facts saved with memory_save are not redacted, so do not save secrets.

More: docs/privacy.md.

Docs

Document

Covers

Configuration

Providers, embeddings, every environment variable

CLI

Every command: recall, store, summarize, export, backup, mcp, hook and more

HTTP API

Every endpoint, with parameters and headers

Capture

How Claude Code, Codex, Antigravity and pi sessions are recorded

How it works

Architecture, ranking, projects, decisions, summaries, tiers

Privacy

What is stored, what is redacted, what leaves the machine

Migration and updates

Importing file-based memory, updating, backup and restore

Development

Repo layout, programmatic API, tests, CI

Working on RecallKeep

bun install
bun run typecheck
bun test                 # unit tests; database tests are skipped

To run the database tests and the API contract smoke test, create a throwaway database. Never use the one that holds your memory.

docker compose exec db createdb -U recallkeep recallkeep_test
export RECALLKEEP_TEST_DATABASE_URL="postgresql://recallkeep:<password>@localhost:5433/recallkeep_test"
RECALLKEEP_DATABASE_URL="$RECALLKEEP_TEST_DATABASE_URL" bunx prisma migrate deploy
bun test
SMOKE_DATABASE_URL="$RECALLKEEP_TEST_DATABASE_URL" bun run smoke

CI runs the same steps on every pull request. See docs/development.md.

License

Apache-2.0. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A self-hosted MCP server that provides AI assistants with a shared, persistent SQLite-backed memory for storing and retrieving project context, decisions, and discoveries. It enables cross-session continuity and team-wide knowledge sharing to keep AI coding tools aligned and informed.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Persistent memory for AI coding agents. Enables agents to save and recall decisions, patterns, bugs, and context across sessions via an MCP server with local SQLite storage.
      9 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP memory server for AI coding agents to remember decisions, patterns, and bugs between sessions. Provides persistent memory with 37 MCP tools, multi-session coordination, and token-efficient recall.
      95 npm
      12
      MIT