tools / agent-memory

Persistent memory for stateless agents.

Agent Memory is a local-first Python CLI: persistent hybrid search (vector embeddings plus keyword), code navigation by meaning, deterministic session snapshots, and a personal knowledge base — all offline in a single SQLite file.

Python 3.10+ CLI v0.1.1 Local-first

The problem

AI agents are stateless across sessions. Each task starts from scratch: no memory of what the agent learned before, no accumulated context, no durable record of decisions. When agents are valuable because they learn and grow, statelessness is a liability.

What Agent Memory does

Agent Memory stores everything an agent needs to remember in a single local SQLite database. Hybrid search layer combines dense vector embeddings (powered by a local 67MB embedding model) with sparse BM25 keyword matching, retrieving relevant facts in milliseconds with zero network calls. Tree-sitter-powered code navigator learns the shape of your codebase by meaning, not just regex. Sessions captured deterministically — every Claude Code turn is recorded with secrets redacted and stored for recall without re-running or paying LLM costs.

Build a personal knowledge base where every raw note becomes a wiki entry with automatic backlink graphs. Your codebase becomes queryable by intent, not just syntax.

What makes it different

  • Everything stays local. No API calls at the core: embeddings run on your machine, search happens offline, history lives on your disk. Optional commands can reach out to Codex or Claude, but the memory itself never leaves.
  • Hybrid retrieval by design. Vector search alone misses exact matches; keyword search alone drowns in noise. Combining both — 70% semantic weight, 30% keyword weight — retrieves what you need reliably.
  • Code as a navigable tree. Tree-sitter parses 165+ languages into an AST. Navigate your codebase by semantic meaning: "find the middleware that validates JWT" returns the right function, not every file with "token" in it.
  • Deterministic session capture. Every Claude Code session is logged to a daily index with PII and secrets redacted — no re-running, no LLM cost, just raw recall.
  • 25 architecture decision records. The codebase documents every major design choice: why hybrid search, why tree-sitter, why SQLite. Written for agents to read and extend.

Install

Install via pipx, then download the embedding model:

pipx install agent-memory
agent-memory install

The install step downloads the ~67MB local embedding model (BAAI/bge-small-en-v1.5) to your machine — runs once, cached indefinitely. After that, all searches and indexing happen offline.