Skip to main content
oneMEM Logo

oneMEM

One memory. Every AI. You own it.

Local, structured memory for AI agents — in one SQLite file on your machine.

PyPI Python License: MIT Downloads Tests MCP Claude


oneMEM gives AI tools a shared local memory. It distills useful context into compact atomic facts and surfaces the minimum memory sufficient for a query. Every connected agent reads and writes the same SQLite file.

AI agents ───┐
Code editors ┼── MCP ── oneMEM ── ~/.onemem/onemem.db
Local tools ─┘

✨ Why oneMEM?

🔒 Local & private One SQLite file. No server, no cloud, no account. Back it up by copying a file.
🧠 Deterministic retrieval No LLM in the read path. Same query → same result, always. Inspectable with SQL.
🔗 Append-only Events are never overwritten. Facts are only ever added. Corrections = new events.
🤖 MCP-native Two tools (onemem_recall + onemem_log) — works with Claude Code, Codex, Cursor, Windsurf.
🌐 BYOLLM OpenRouter, OpenAI, Anthropic, Gemini, Groq, xAI, Hugging Face, Ollama, or any OpenAI-compatible endpoint.
Local embeddings bge-base-en-v1.5 (768-d) runs locally. No embedding API, no extra key, no latency.

🚀 Quick Start

Requires Python 3.11+ and an API key for any LLM provider. Embeddings run locally.

# Install
uv tool install "onemem[all]"

# Setup (walks you through provider, key, model, capture, MCP wiring)
onemem init

# Try it
onemem add "Chose SQLite because it needs zero operations and one-file backups."
onemem ask "What storage did I choose, and why?"

📐 How oneMEM Works

oneMEM Command Flow

oneMEM receives unstructured text (chat turns, notes, imported files), distills it into atomic facts, stores everything append-only in one SQLite file, and makes it retrievable through a deterministic hybrid search — no LLM in the read path. Any MCP-capable agent reads and writes the same memory.

Write Path

Step What happens
① Ingest Content is chunked, deduplicated by content hash, and stored as raw events
② Extract An LLM reads each event and produces atomic facts + named entities
③ Reconcile Entities are normalized, deduplicated, and linked to facts via edges
④ Embed Each fact is embedded locally with bge-base-en-v1.5 (768-d vectors)
⑤ Store Facts, embeddings, and FTS5 indexes are written to SQLite

Read Path (Deterministic — No LLM)

Step What happens
Query User question or agent request
Three doors Vector (cosine similarity) + Keyword (FTS5 BM25) + Entity (fact edges)
Fusion fused = 1 − (1−v)(1−f)(1−e) — magnitude noisy-OR
Adaptive cut Keep facts scoring ≥ 50% of the top score, bounded to [10, limit]
Source collapse If facts cost ≥ raw event tokens, return the raw event instead

📋 Commands

Command Purpose Path
onemem init Interactive setup wizard
onemem add "text" Store a note directly ✍️ write
onemem ask "question" Retrieve + synthesize an answer 📖 read
onemem import <path> Bulk-import .txt / .md files ✍️ write
onemem process Process pending events ✍️ write
onemem watch Capture Claude Code / Codex sessions ✍️ write
onemem watch --start Start background capture service ✍️ write
onemem watch --stop Stop background capture service ✍️ write
onemem status Event / fact / entity counts 📖 read
onemem doctor Health check (DB, sqlite-vec, LLM) 📖 read
onemem list events Browse events (--since, --until, --source) 📖 read
onemem show event N Full event detail + extraction provenance 📖 read
onemem sql "SELECT..." Read-only SQL query 📖 read
onemem tables List DB tables with row counts 📖 read
onemem config set Change provider, API key, model ⚙️ config
onemem config show Show active config safely 📖 read

🔌 MCP Setup

oneMEM works with any MCP client that supports local stdio servers.

# Claude Code
claude mcp add --scope user onemem -- "$(command -v onemem-mcp)"

# Codex
codex mcp add onemem -- "$(command -v onemem-mcp)"

onemem init automatically detects and wires Claude Code and Codex during setup.

MCP Tools

Tool Purpose
onemem_recall The ONE read entry point — topic search, time window, session reconstruction, or raw source lookup
onemem_log Invisible background write — silently logs conversations. No announcement, no permission, no waiting.

🏗️ Supported Providers

Provider Key Env Var Notes
OpenRouter OPENROUTER_API_KEY One key, hundreds of models
OpenAI OPENAI_API_KEY Direct GPT access
Anthropic ANTHROPIC_API_KEY Native Claude API
Google Gemini GEMINI_API_KEY Direct Gemini access
Groq GROQ_API_KEY Fast inference, open-weight models
xAI XAI_API_KEY Grok access
Hugging Face HF_TOKEN Open-weight models via Inference Providers
Ollama no key needed Free, runs locally
Custom base_url + api_key_env Any OpenAI-compatible endpoint

Embeddings always use bge-base-en-v1.5 (768-d) running locally — no API key needed.


📊 Benchmarks

Measured on a 100-instance stratified sample of LongMemEval-S:

Metric Result
Retrieval recall 0.89
Context reduction 99.1%
End-to-end answer accuracy 72%

⚙️ Configuration

Edit ~/.onemem/config.toml (or use onemem config set):

[model]
provider = "openrouter"
model = "google/gemini-3.5-flash-lite"

[spend]
max_run_cost_usd = 20.0    # hard ceiling per batch import

[retrieval]
default_limit = 30         # max facts returned per recall
neighbour_max = 20         # neighbour facts gathered around a match

[ingestion]
concurrency = 20           # parallel LLM workers during bulk import

Where data lives

Path Contents
~/.onemem/onemem.db Events, facts, entities, embeddings — back this up
~/.onemem/config.toml Active provider, model, runtime settings
~/.onemem/.env Provider API keys

🛠️ Development

git clone https://github.com/shashank-tomar0/onemem.git
cd onemem
uv sync --all-extras
uv run pytest -q                    # 144 passing
./scripts/dev-onemem doctor         # run with isolated dev home

📁 Project Structure

onemem/
├── cli/                  # Click CLI (init, add, ask, watch, ...)
├── api/                  # FastAPI HTTP API
├── providers/            # LLM + embedding implementations
├── mcp_server.py         # MCP server (onemem_recall + onemem_log)
├── fact_retrieval.py     # Deterministic hybrid search
├── pipeline.py           # Ingest + process orchestration
├── entity_extractor.py   # LLM-based entity + fact extraction
├── schema.sql            # SQLite schema
└── config.py             # All tunable settings

📜 License

MIT — Based on Meniscus by magic_bubblez.


oneMEM — Your memory, your machine, your AI.

Get Started → · Report Bug · View Design · PyPI

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onemem-0.1.4.tar.gz (12.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onemem-0.1.4-py3-none-any.whl (71.2 kB view details)

Uploaded Python 3

File details

Details for the file onemem-0.1.4.tar.gz.

File metadata

  • Download URL: onemem-0.1.4.tar.gz
  • Upload date:
  • Size: 12.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for onemem-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d36b7afef8fe548547f3fb453e1cb824dc71d6bae5fdbfd3923f2c80d2b13ad8
MD5 e0ef09a68da2b2a189f126dc88ee5357
BLAKE2b-256 76fc927e7aea699b11a214419960193e7d844363630182a8d89d9f9f75ca4332

See more details on using hashes here.

File details

Details for the file onemem-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: onemem-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 71.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for onemem-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d81e0eab72081aad99a4c69b48c332e07319039dedfa7479c37361d70a0eb4b7
MD5 2ffc8e333afe3abdbf7dedcf092ef0a3
BLAKE2b-256 9a6a33b773a4724e3da7b23221648bad6700c824e283f925a2874d4d54718042

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

1 file

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page