amem · agent memory, anchored to your code

Technical fact sheet

amem: architecture and token savings

A local-first SQLite + MCP memory layer for AI coding agents. Every number here is reproducible: run npm run bench, amem bootstrap --json or the MCP tools/list call yourself.

Productamem · npm @iamem/amem · sslugic/amem
CategoryLocal-first SQLite + Model Context Protocol (MCP) memory layer for AI coding agents
StorageOne SQLite file, ~/.amem/graph.db (skills as Markdown in ~/.amem/skills). No daemons, no cloud, no API keys.
RuntimeNode 20+, one dependency (better-sqlite3). MCP over stdio (amem mcp) or HTTP on 127.0.0.1:7843.
LicenseMIT

1. What amem does

File-anchored facts

Rules and decisions tied to the files they describe, such as “Stripe webhooks must be verified with the raw body” → src/webhooks/stripe.ts. Each fact stores a content hash of its files; when a file changes, the fact is flagged stale until re-confirmed.

On-demand skills

Multi-step procedures (release, deploy, migration) live outside the system prompt as SKILL.md. Agents see a one-line index entry and load the body with amem_skill_view only when it applies.

Cross-agent task board

A persistent backlog → next → doing → blocked → done board per project. A task started in Cursor shows its state to Claude Code or Codex next session.

Every client

Claude Code, Cursor, Codex, Windsurf, Copilot, Gemini CLI, Zed and any MCP client (amem platforms lists 30+). Hooks inject a ranked packet automatically; agents can also call the tools.

2. How it works

SQLite FTS5 + BM25

  • Facts in claims_fts, skills and tasks in amem_fts (porter tokenizer), synced on every write.
  • amem_search ranks by bm25() plus recency, usage, pins and status; filters: types, scope, status, tags.
  • Small synonym groups: “auth flow” finds “JWT login middleware”.
  • amem_context adds a 256-dimension in-process n-gram encoder: no download, no Ollama, no Python.
  • No FTS5 in the SQLite build? Falls back to keyword scoring.

Scope and amem_bootstrap

  • global rules reach every project; project:<path> facts stay with their repo; private facts never reach work.
  • One startup call returns global rules, key facts, active tasks (doing first) and skill hints.
  • Capped at max_tokens: default 350, measured 313 on a 3,400-fact memory.

Token budgets (max_tokens)

  • On amem_context and amem_search; about 4 characters per token, deterministic.
  • Packed in rank order, never cut mid-item; the best fact always stays.
  • Reports truncated and omitted so the agent knows what it left out.

Skill trigger hints

  • Frontmatter files: ["*.swift", "Package.swift"] and keywords: [deploy, migration].
  • Matching files or text return a one-line hint (name, what matched, summary).
  • The body loads only through amem_skill_view.

Supersession and TTL

  • supersedes: [ids] or amem_supersede marks old facts superseded with superseded_by; they stay as history.
  • ttl_days or expires_at: expired facts leave recall at once and are kept as expired.

UI, import, export

  • amem ui: a localhost dashboard to search, edit, pin, retire and delete facts, review drafts, run the task board and watch live activity.
  • amem import: CLAUDE.md, AGENTS.md, .cursorrules, .mdc, Markdown, JSON; content ids mean no duplicates.
  • amem export --format json|md keeps lineage, TTL and pins; both formats re-import.
Retrieval benchmark (npm run bench, enforced in CI)Right firstTop 3Vague prompts given memory
Prompt hook (automatic)88%97%0%
amem_context (agent asks)81%94%n/a

3. Cost and token economics

amemCloud memory SaaSMem0, Supermemory, ZepSession-capture pluginsclaude-memLocal note toolsBasic Memory
Hosting cost$0: local SQLiteFree tiers; paid plans from about $19/mo$0: local$0 locally; optional paid sync
Background LLM extractionNone: no model callsYes: an LLM extracts or updates memories on writeYes: sessions summarized with Claude, on your tokensNone: the agent writes notes
Tool-schema overhead18 MCP tools ≈ 2,800 tokens (fixed, cacheable)Varies by serverVariesVaries by server
Per-call payloadRanked packet; max_tokens cap; bootstrap ≤ 350 by default; skills as one-line hintsTop-K memories from vector searchSummaries injected at session startWhole notes read on request
Outdated rulesFile-hash staleness, supersession, TTLLLM update and merge; not tied to filesAccumulate; not tied to filesEdited by hand

1 · Fewer uncached input tokens

Tool results are new content on every call, so caching never discounts them. max_tokens caps the packet, and skills arrive as one-line hints, not procedures.

2 · Fewer startup round-trips

One ~350-token amem_bootstrap replaces separate lookups for rules, facts, tasks and skills; BM25 plus synonyms raises first-pass recall.

3 · Fewer wasted output tokens

Output costs several times more than input and is never cache-discounted. Superseded, expired and stale facts are filtered or marked before they steer a wrong edit.

4 · A stable, cacheable tool prefix

The MCP tool list is fixed per version, and amem ui/import/export are CLI-only. Memory arrives after that prefix as hook output or tool results. Fixed cost: the ~2,800-token schema, billed in full once, then at the cache-read rate where providers cache.

Measure it on your own machine: amem stats for hit rate and estimated savings; amem_usage_report to turn the estimate into a measurement from the files the agent did not need to open. Sources, checked November 2026: Mem0, Supermemory, Zep, claude-mem, Basic Memory. Markdown version: docs/FACT_SHEET.md.

Try it in one command

Free. Everything stays on your machine.

npx @iamem/amem setup
npm i -g @iamem/amem && amem setup

Node 20+. Then run amem ui. Source on GitHub.