Project Agent Memory
A TypeScript MCP (Model Context Protocol) server that gives a coding agent persistent project memory - context, decisions, progress and patterns - backed by PostgreSQL with pgvector, reached through pREST.
Features
- 8 MCP tools:
memory_create, memory_read, memory_update, memory_delete, memory_context, memory_graph, memory_admin, code_graph
- PostgreSQL with pgvector: the server talks to Postgres through a pREST instance, not a direct DB connection - vectors travel over an
X-Vector header (registered pREST queries can't carry them as URL params without hitting HTTP 414). Run it locally in Docker or on a server shared by all your machines
- Hive memory: any agent can browse, search and write other projects' memory. Public by default, with entry-level and project-level
private; versioned writes, archived deletes. See Hive memory
- Local embeddings by default: ONNX CPU inference in-process via
@huggingface/transformers; no embedding service, no API key, nothing leaves the machine except the backend writes
- Configurable vector dimension:
VECTOR_DIM (default 768), Matryoshka-truncated and re-normalized
- Pluggable providers:
onnx, openai (any OpenAI-compatible endpoint - Ollama, LM Studio, vLLM, LiteLLM, OpenAI itself), gemini, openrouter
- No silent fallbacks: a failing provider fails the call rather than returning degraded vectors
- Runs via
npx: no global install, no long-running service
- Performance: connection pooling (
POOL_SIZE, shared across backends), LRU caches for embeddings and queries, cache invalidation on write
Requirements
- Node.js 18+
- Docker for the local store, or a reachable PostgreSQL instance with the
vector (pgvector) extension and a pREST instance in front of it
- Claude Code v2.1.271 or later
- No API key with the default
onnx provider
Install
Run one command in a terminal:
npx -y [email protected] setup
On Linux x64, prefix it with ONNXRUNTIME_NODE_INSTALL_CUDA=skip. PAM embeds on the CPU, and without the prefix onnxruntime-node tries to download a GPU add-on whose link is gone, so the install fails.
The wizard runs in four steps. Answer each question with its number, or Enter for the default. Nothing is changed until you confirm in step 3. PAM installs as a Claude Code plugin only, because its hooks need it.
-
Check this machine - Node.js 18+, the claude CLI and Docker. A missing claude CLI stops the wizard with how to fix it.
-
Storage - PostgreSQL with pgvector behind pREST:
- Local - hive for this machine only, needs Docker. Starts the stack from
~/mcp/project-agent-memory/stack/pgvector/ and generates its secrets.
- Cloud - hive for all your machines, self-hostable. Asks the pREST URL, the JWT key (masked while you type), the database (default
memory) and the admin name (default admin).
Local is the default when Docker is running, otherwise Cloud. If ~/mcp/project-agent-memory/config.json exists, you choose 1) replace or 2) cancel and exit.
-
Review - lists every file it will write and every command it will run. Answer 2) no to stop with nothing changed.
-
Install and verify - starts the local store if chosen, writes config.json, installs the plugin (claude plugin marketplace add and claude plugin install), removes old mcp-mode entries and hooks (with backups), and checks the store with a test read.
Restart Claude Code when it prints Done. Running npx -y project-agent-memory with no arguments in a terminal, with no config.json yet, also starts the wizard.
Flags skip the matching question. With --yes, every other question takes its default.
| Flag | Values |
|---|
--target | local or cloud |
--prest-url, --prest-jwt-key, --prest-database, --prest-admin | cloud pREST |
--replace-memory | replace an existing config.json without asking |
--modify | with one or more --prest-* flags: change only those keys in config.json (old copy kept as .bak) |
--yes | no prompts |
Manual install
Setup does all of this for you. Install by hand only if you cannot run it; you need a reachable store, see Setup below.
Claude Code plugin
Bundles the MCP server, the agent skill, and memory-first session hooks (detects git commit, nudges the agent to log it, hard-blocks Stop until it does) in one install.
The repo is its own marketplace (balaji-g42). Inside Claude Code:
/plugin marketplace add balaji-g42/project-agent-memory
/plugin install pam@balaji-g42
Installing from /plugin opens a dialog (needs Claude Code v2.1.271 or later):