<strong>Shared memory for multi-agent AI systems.</strong>
<a href="#quick-start">Quick Start</a> •
<a href="#how-it-works">How It Works</a> •
<a href="#benchmarks">Benchmarks</a> •
<a href="#adapters">Adapters</a> •
<a href="https://github.com/ZenSystemAI/Zengram/raw/v4.5.0/docs/api-reference.md">API Docs</a> •
<a href="https://github.com/ZenSystemAI/Zengram/raw/v4.5.0/docs/configuration.md">Config</a>
<a href="https://github.com/ZenSystemAI/Zengram/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/ZenSystemAI/Zengram/actions/workflows/ci.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@zensystemai/zengram-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@zensystemai/zengram-mcp.svg" /></a>
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg" />
<img alt="Node 20+" src="https://img.shields.io/badge/node-20%2B-green.svg" />
<img alt="Docker" src="https://img.shields.io/badge/docker-ready-blue.svg" />
<img alt="MCP" src="https://img.shields.io/badge/MCP-compatible-purple.svg" />
<a href="https://github.com/ZenSystemAI/Zengram/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/ZenSystemAI/Zengram?style=social" /></a>

Store a fact from Claude Code on your laptop, recall it from an autonomous agent on your server, get a briefing from another session — all through the same memory system. Born from a production setup where nothing existed that let multiple AI agents share memory across separate machines.

You run multiple AI agents — Claude Code for development, autonomous agents for tasks. They each maintain their own context and forget everything between sessions. When one agent discovers something important, the others never learn about it.

Events are immutable history. Facts upsert by key — new facts supersede old ones. Statuses track current state. Decisions record choices and reasoning. Each type has its own lifecycle, decay rules, and mutation semantics.

Every memory lives in a single Postgres database: pgvector (HNSW) for semantic vector search and structured tables for queries, entities, and full-text search. Get both "find memories similar to X" and "give me all facts with key Y" from the same system — one container, no separate vector service.
Search runs up to three retrieval paths in parallel, fused with weighted Reciprocal Rank Fusion:
websearch_to_tsquery + ts_rank_cd), with an opt-in accent-folding config for mixed-language corpora (BM25_TSCONFIG=zengram_multi)GRAPH_RETRIEVAL_ENABLED)An optional cross-encoder reranker (RERANK_ENABLED) then re-scores the fused pool by reading query and document together — the highest-leverage precision upgrade in the stack (on our private bilingual production corpus it roughly doubled MRR; measure yours with the eval harness). Works with any TEI / Infinity / vLLM / Jina / Cohere-style /rerank endpoint and degrades gracefully to fused order on outage.
Final ranking blends the fused RRF signal with vector similarity (or the rerank score when enabled), then weights confidence decay, access frequency (capped), temporal proximity, and importance — items found by multiple paths genuinely rank higher. 98.4% retrieval accuracy on LongMemEval.
observed_by), not dropped as a duplicateEvaluated on LongMemEval, the academic benchmark for long-term conversational memory:
| Score | |
|---|---|
| Retrieval accuracy (finding the right memories) | 98.4% |
| QA accuracy (GPT-4o answering from retrieved context) | 76.0% |
| Full-context GPT-4o (entire history in prompt, no retrieval) | 72.4% |
The benchmark uses cosine similarity only — none of the API's multi-path features (keyword full-text, temporal boost) were used. Full methodology and per-category breakdown.
LongMemEval tests single-agent chat recall. Zengram is built for multi-agent coordination — features like cross-agent briefings, typed memory, entity extraction, and credential scrubbing aren't measured by this benchmark but are core to production use.
| Feature | Zengram | Mem0 | Letta | Zep | Hindsight |
|---|---|---|---|---|---|
| Cross-machine by design | Yes | Cloud only | No | Cloud only | No |
| Typed memory (event/fact/status/decision) | Yes | No | No | No | No |
| Multi-path search (vector+full-text) | Yes | Vector only | Vector only | Hybrid | Yes |
| Session briefings | Yes | No | No | No | No |
| Credential scrubbing | Yes | No | No | No | No |
| Entity extraction + linking | Yes | Graph (Pro) | No | Yes | No |
| LLM consolidation | Yes | Inline | Self-managed | No | Reflect |
| Temporal validity | Yes | No | No | Yes | No |
| MCP server included | Yes | Community | No | No | Yes |
| Self-hostable (fully open) | Yes | Community ed. | Yes | Graphiti only | Yes |
git clone https://github.com/ZenSystemAI/Zengram.git
cd Zengram
cp .env.example .env
# Edit .env — set BRAIN_API_KEY and your embedding provider key
docker compose up -d
# Verify
curl http://localhost:8084/health
# Store your first memory
curl -X POST http://localhost:8084/memory \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_KEY" \
-d '{
"type": "fact",
"content": "The API uses port 8084 by default",
"source_agent": "my-agent",
"key": "api-default-port"
}'
13 tools: brain_store, brain_search, brain_briefing, brain_query, brain_stats, brain_consolidate, brain_entities, brain_delete, brain_update, brain_export, brain_import, brain_reflect, brain_research.
{
"mcpServers": {
"zengram": {
"command": "node",
"args": ["/path/to/zengram/mcp-server/src/index.js"],
"env": {
"BRAIN_API_URL": "http://localhost:8084",
"BRAIN_API_KEY": "your-key"
}
}
}
}
Or install via npm: npm install -g @zensystemai/zengram-mcp
Copy adapters/claude-code/sessionend/ to your project's .claude/skills/ to get the /sessionend ritual — structured session reflections stored directly to Zengram. Full guide.
./adapters/bash/brain.sh store --type fact --content "Server migrated"| Doc | Description |
|---|---|
| API Reference | Every endpoint with request/response examples |
| Architecture | System design, data flows, component inventory |
| Configuration | All environment variables |
| Data Model | Memory types, decay, dedup, supersedes logic |
| MCP Tools | The 13 MCP tools agents use |
| Operations | Deployment, monitoring, failure modes |
| Benchmarks | Full LongMemEval methodology and results |
| Examples | curl demo, Python client |
Recently shipped: cross-encoder reranking stage, entity-graph retrieval path, weighted RRF, self-hosted encoder support (local endpoints + instruction prefixes + in-place re-embed), agentic iterate-until-sufficient retrieval (brain_research) with grounded [mem:<id>] citations, pgvector migration (single-Postgres storage), multi-collection support, on-demand LLM reflection, temporal validity — full changelog
Coming next: Automatic memory capture, hosted docs, LangChain/LlamaIndex integration
Contributions welcome! See CONTRIBUTING.md.
MIT — see LICENSE.
Built by ZenSystem AI
$ claude mcp add Zengram \
-- python -m otcore.mcp_server <graph>