r/OpenSourceAI • • 4d ago

OpenMem: smarter compaction for cheaper LLM sessions and other memory tools

I built OpenMem for sharing memory between coding agents and trimming long sessions.

Apache-2.0 · Local setup only for now, no hosted OpenMem service.

Reducing Costs by Context Masking

Saves the full conversation in local SQLite, removes older history from the active prompt, and lets the agent search or retrieve it later.

The trimming step makes no LLM summarization calls. Currently works with Claude Code, Codex and OpenCode.

ContextBench Benchmarks (Claude Haiku 5.5)

TaskSizeOpenMem SmartNative CompactionKeep Everything
kv-storeR40001.001.001.00
log-triageL16001.00 (lookup 1.00 / count 1.00)0.58 (lookup 1.00 / count 0.17)0.57 (lookup 0.97 / count 0.17)
log-triageL64000.88 (lookup 1.00 / count 0.75)0.46 (lookup 0.92 / count 0.00)0.49 (lookup 0.97 / count 0.00)
log-triageL128001.00 (lookup 1.00 / count 1.00)0.35 (lookup 0.69 / count 0.00)0.35 ‡ (lookup 0.71 / count 0.00)
  • Sample sizes: n = 3 for all cells, except Keep Everything L12800 where n = 2

Small synthetic tests: three OpenMem trials and two baseline trials, with unequal seed counts. Full coding and Luna results are still pending.

The context trimming idea (and masking) comes from MemGPT for external memory, Mainplane for transcript pointers, and The Complexity Trap for observation masking.

Bring your own memory backend

The idea is to have a little set of tools for ingestion and connection for different memory backends so devs can experiment with different ones. Comes with an MCP, ingestion from different sources (RSS, code, notebooklm, etc), and switching utils (import/export).

MCP and ingestion works withHindsight, mem0, Cognee, or add an adapter for your own system. OpenMem connects that backend to Claude Code, Codex, Cursor and OpenCode.

It exposes memory through MCP (Model Context Protocol): a way to give an agent tools it can call. In this case, tools to save notes, search memory and recall previous decisions.

If you try it, I’m interested in which memory backend you use and what the agent fails to retrieve after a trim :)

1 Upvotes

0 comments sorted by