{"id":50722020,"url":"https://github.com/thameema/memnos","last_synced_at":"2026-06-10T01:01:36.560Z","repository":{"id":360776460,"uuid":"1246282941","full_name":"thameema/memnos","owner":"thameema","description":"Persistent memory for AI coding agents — MCP server, REST API \u0026 Python SDK. Works with Claude Code, Cursor, Windsurf and any LLM agent.","archived":false,"fork":false,"pushed_at":"2026-06-09T01:13:17.000Z","size":1816,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-09T01:24:27.840Z","etag":null,"topics":["agent-memory","ai-agent","arcadedb","claude-code","cursor-ai","knowledge-graph","langchain","llm-memory","mcp-server","memory-management","openai","persistent-memory","python","rag","vector-database"],"latest_commit_sha":null,"homepage":"https://memnos.net","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thameema.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":"docs/governance.html","roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-22T03:37:13.000Z","updated_at":"2026-06-03T00:40:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/thameema/memnos","commit_stats":null,"previous_names":["thameema/engram","thameema/memnos"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/thameema/memnos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thameema%2Fmemnos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thameema%2Fmemnos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thameema%2Fmemnos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thameema%2Fmemnos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thameema","download_url":"https://codeload.github.com/thameema/memnos/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thameema%2Fmemnos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34132030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-memory","ai-agent","arcadedb","claude-code","cursor-ai","knowledge-graph","langchain","llm-memory","mcp-server","memory-management","openai","persistent-memory","python","rag","vector-database"],"created_at":"2026-06-10T01:01:35.559Z","updated_at":"2026-06-10T01:01:36.549Z","avatar_url":"https://github.com/thameema.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memnos\n\n[![CI](https://github.com/thameema/memnos/actions/workflows/ci.yml/badge.svg)](https://github.com/thameema/memnos/actions/workflows/ci.yml)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)\n[![Engine: PostgreSQL + pgvector](https://img.shields.io/badge/engine-PostgreSQL%20%2B%20pgvector-336791.svg)](#)\n[![Query-time LLM: none](https://img.shields.io/badge/query--time%20LLM-none-success.svg)](#)\n[![LoCoMo](https://img.shields.io/badge/LoCoMo%20full--10-57–61%25-success.svg)](benchmarks/README.md)\n[![PyPI](https://img.shields.io/pypi/v/memnos.svg)](https://pypi.org/project/memnos/)\n\n**Self-hostable, governed, vendor-neutral memory for AI agents — on one PostgreSQL.**\n\nmemnos gives AI agents long-term memory that persists across sessions, with **governance\nbuilt in** (token auth, namespace ACL, audit, an encrypted secret vault) and **no vendor\nlock-in**. It runs on a single **PostgreSQL + pgvector** database — no second vector store,\nno graph database — and uses **no LLM at query time** (retrieval is hybrid search + a local\ncross-encoder reranker). Works with **Claude Code, Cursor, Windsurf** and any MCP client,\nplus a REST API and a cross-platform CLI.\n\n\u003e **Released — v0.1.0 on PyPI.** Apache-2.0 · self-hostable · single-org · local-first.\n\n```\nClaude Code ─┐\nCursor       ├─ MCP (stdio) ─┐\nWindsurf     ─┘              │\nhooks (auto) ───────────────┼─► memnos server ──► PostgreSQL + pgvector  (ONE engine)\nREST / CLI ─────────────────┘     ├─ hybrid retrieve: pgvector (HNSW) + BM25 (tsvector) → RRF\n                                   │   → cross-encoder rerank → quota + timeline + entity arms\n                                   │   (NO LLM at query time)\n                                   ├─ bi-temporal facts + belief-change supersession\n                                   ├─ governance: token auth · namespace ACL · audit · usage\n                                   └─ encrypted secret vault (AES-256-GCM) + ingest redaction\n```\n\n---\n\n## What makes memnos different\n\n- **One engine.** Everything lives in a single PostgreSQL + pgvector — no second vector\n  store, no graph database to run, scale, secure, or back up.\n- **Deterministic memory.** Conflicting facts are resolved by rule (bi-temporal,\n  single-valued supersession), not by asking an LLM at write time — so writes are predictable\n  and reproducible.\n- **No LLM at query time.** Recall is hybrid search (pgvector HNSW + BM25, RRF) → a local\n  cross-encoder rerank → quota / timeline / entity arms. Fast, cheap, and private.\n- **Governed by default.** Token auth, namespace ACL, audit log, usage/cost ledger, and an\n  encrypted secret vault with ingest redaction — in the open-source build.\n- **Vendor-neutral, self-hosted.** Apache-2.0, your Postgres, your data, your LLM keys (never\n  stored in plaintext).\n\nmemnos is a *governed memory engine*, not an agent runtime. A detailed, version-pinned\ncomparison with other memory systems lives at **[memnos.net/compare](https://memnos.net/compare.html)**.\n\n---\n\n## Quickstart (local)\n\n**Prerequisite:** PostgreSQL **13+** with the **pgvector ≥ 0.7** extension available. memnos does **not**\ninstall Postgres — it connects to yours. (For local dev: `docker compose -f\ndocker-compose.dev.yml up -d`.)\n\nInstall the `memnos` command into its **own isolated environment** (recommended — `uv` is\nfastest; `pipx` also works). **Don't `pip install` into your system Python** — a polluted or\nhalf-upgraded system interpreter will fail to load native deps like `psycopg`.\n\n```bash\nuv tool install memnos        # recommended  (no uv? `brew install uv`  or\n                              #  curl -LsSf https://astral.sh/uv/install.sh | sh)\n# or:  pipx install memnos\n# or run ./install.sh (macOS/Linux) / .\\install.ps1 (Windows) — picks uv→pipx for you\n\nmemnos setup                  # enter your Postgres connection → creates schema + admin token\nmemnos serve                  # start the server → open http://127.0.0.1:8900/admin\n```\n\n\u003e Inside your own virtualenv, plain `pip install memnos` is fine too —\n\u003e `python -m venv .venv \u0026\u0026 .venv/bin/pip install memnos`.\n\n`memnos --help` covers everything: `setup serve token grant principal namespace secret\nstats health whoami ns remember recall`. Config (DSN, vault key, port) lives in\n`~/.memnos/config.json`. Full walkthrough: [`QUICKSTART.md`](QUICKSTART.md).\n\nAn OpenAI key (in `.env` or `memnos secret set openai` → `OPENAI_API_KEY=secret://openai`)\nenables 1536-d embeddings + fact extraction. Without it, memnos runs in free **local 384-d**\nmode (embeddings only, no extraction). memnos **never holds your LLM key in plaintext** —\nit stays in `.env` or the encrypted vault.\n\n---\n\n## Integrations\n\nOne command wires memnos into your agent — no manual config editing:\n\n```bash\nmemnos claude-setup            # Claude Code: MCP + hooks (auto recall/save) + /memnos + CLAUDE.md\nmemnos agent-setup codex       # Codex CLI (MCP via ~/.codex/config.toml + AGENTS.md)\nmemnos agent-setup cursor      # Cursor\nmemnos agent-setup windsurf    # Windsurf\nmemnos agent-setup claude-desktop\n```\n\nEach mints a scoped token, is idempotent, and backs up edited files; `memnos setup` runs\n`claude-setup` automatically when it detects Claude Code. **Claude Code** is the only agent\nwith lifecycle **hooks** (auto-recall before each prompt, auto-save after); every other agent\ngets the memnos MCP **tools** (`recall`, `recall_wide`, `remember`, `reconcile_claim`, …).\n\n- **REST** — `POST /remember`, `POST /recall` (Bearer token, namespace-scoped).\n- **CLI / SDK** — `memnos remember/recall`, or `pip install memnos-sdk` (LangChain / LangGraph\n  / LlamaIndex adapters).\n- Full client guides: [`docs/guides/clients/`](docs/guides/clients/README.md).\n\nREST, MCP, hooks and the benchmark all run the **same engine** (`MemnosMemory`) — there is\none codebase, not a benchmarked copy and a shipped copy.\n\n---\n\n## Management console + governance\n\nA zero-build web console ships in the open-source build at **`/admin`** (create namespaces,\nmint/revoke tokens, manage grants, view the dashboard, store secrets). Every call is\ntoken-authenticated, namespace-ACL'd, and audited. (SSO/OIDC, advanced RBAC, multi-tenant\ncontrol plane, and the richer enterprise UI are the commercial layer.)\n\n```bash\nmemnos admin          # bootstrap an admin token → paste into /admin\n```\n\n---\n\n## Benchmarks — LoCoMo (and how we report it)\n\n**57–61% under the gpt-4o judge / 58% under an independent cross-provider judge** on the full\nLoCoMo benchmark (10 conversations, 1,542 QA). The gpt-4o-judge band is **reproduced from\nscratch** — `benchmarks/locomo_eval.py` on a fresh clone + DB scored 57%, 58% and 61% across\nindependent ingests (the spread is non-deterministic extraction, not the engine), with every\nprediction published under [`benchmarks/results/`](benchmarks/results/).\n\nWe care more about *credibility* than a big headline:\n\n- **Setup:** full 10 conversations. Ingest → bi-temporal SPO fact extraction (gpt-4o-mini) +\n  consolidation; retrieve via hybrid (pgvector + BM25, RRF) + cross-encoder rerank +\n  timeline / entity-guarantee arms — **no LLM at query time**; answer with the calling agent\n  (GPT-5-mini in our run); judge with an LLM.\n- **Independent judging:** most published numbers are *self-judged* (the same vendor's model\n  grades its own answers). We additionally score under an **independent provider's judge**\n  (Claude grading GPT answers) to remove self-preference bias.\n- **Judge transparency:** the score is judge-sensitive. On the *same answers* we measure a\n  **strict ~44% / standard 57-61% / lenient 85-88%** band — so you can see how much the\n  judge prompt moves any number.\n- **On comparisons:** headlines elsewhere (~66% Mem0, ~73% Mnemory, 90%+ others) are\n  typically self-judged and sometimes on a *different* benchmark (e.g. DMR, not LoCoMo). We\n  don't claim parity — we publish a reproducible harness.\n\n**Reproduce:** `python benchmarks/locomo_eval.py --sample-ids 0,1,2,3,4,5,6,7,8,9`\n(see [`benchmarks/`](benchmarks/README.md)).\n\n*We'd rather report a credible 58% under an independent judge than an inflated 85% under a\nlenient one.*\n\n---\n\n## How it works\n\n**Write** (LLM at ingest only): a message becomes a verbatim raw turn **and** structured\nbi-temporal SPO facts. Single-valued attributes (`lives_in`, `works_at`) supersede on\nchange; multi-valued ones (`did`, `visited`) accumulate. Secrets are redacted before\nstorage. An offline \"sleep\" pass consolidates facts into entity dossiers (multi-hop\npre-join).\n\n**Read** (no LLM): the query runs hybrid retrieval (pgvector HNSW + BM25 via tsvector, fused\nwith RRF), a cross-encoder reranks, and quota retrieval guarantees raw-turn + fact coverage.\nTemporal questions add a guaranteed entity **timeline**; entity questions add an\n**entity-guarantee** arm so list/aggregation answers are complete.\n\n---\n\n## Security \u0026 operations\n\n- **Auth:** opaque bearer tokens (SHA-256 hashed at rest; instantly revocable — not JWTs).\n- **ACL:** every read/write is clamped to the principal's namespace grants.\n- **Audit + usage ledger:** who/what/when + per-op LLM cost.\n- **Secret vault:** AES-256-GCM, value-refs (`secret://name`), key rotation.\n- **Redaction:** secret-shaped text is stripped from remembered messages before storage.\n- **Health heuristic:** `memnos health` turns metrics into actionable findings.\n\n\u003e Local-first: the server binds `127.0.0.1`. Put a TLS reverse proxy in front for remote use.\n\n---\n\n## License\n\nApache-2.0. The open-source build is the engine + single-org self-host + the basic\nmanagement console. SSO/advanced RBAC, encrypted-vault key management (KMS/HSM, rotation\npolicies), the multi-tenant control plane, the richer enterprise UI, and managed cloud are\nthe commercial layer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthameema%2Fmemnos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthameema%2Fmemnos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthameema%2Fmemnos/lists"}