Zengram logo

Zengram

Organization
ZenSystemAI

A Multi Agent Memory MCP That Connect Agents Across Systems and Machines

PublisherZenSystemAI
RepositoryZengram
LanguageJavaScript
Forks
10
Stars
60
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Zengram exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    60 stars and 10 forks from the linked repository.

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.


The Problem

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.

How It Works

Typed Memory

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.

Unified Storage

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.

Multi-Path Search

Search runs up to three retrieval paths in parallel, fused with weighted Reciprocal Rank Fusion:

  1. Vector search — Cosine similarity via pgvector (HNSW, with iterative index scans on pgvector 0.8+ so tenant-scoped queries don't lose recall)
  2. Full-text search — Postgres tsvector (websearch_to_tsquery + ts_rank_cd), with an opt-in accent-folding config for mixed-language corpora (BM25_TSCONFIG=zengram_multi)
  3. Entity graph (opt-in) — entities in the query expand one hop over the co-occurrence graph the write path already maintains, pulling in associatively-related memories (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.

Built for Multi-Agent

  • Cross-agent briefings — "What happened since I was last here?" returns updates from all other agents
  • Cross-agent corroboration — when a second agent independently stores the same fact, it's recorded as an observation (observed_by), not dropped as a duplicate
  • Credential scrubbing — API keys, JWTs, passwords, cloud/service tokens automatically redacted before storage
  • Entity extraction — Regex + alias cache at write time
  • LLM consolidation — Periodic background process merges duplicates, resolves contradictions, discovers connections

Benchmarks

Evaluated 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.

How It Compares

FeatureZengramMem0LettaZepHindsight
Cross-machine by designYesCloud onlyNoCloud onlyNo
Typed memory (event/fact/status/decision)YesNoNoNoNo
Multi-path search (vector+full-text)YesVector onlyVector onlyHybridYes
Session briefingsYesNoNoNoNo
Credential scrubbingYesNoNoNoNo
Entity extraction + linkingYesGraph (Pro)NoYesNo
LLM consolidationYesInlineSelf-managedNoReflect
Temporal validityYesNoNoYesNo
MCP server includedYesCommunityNoNoYes
Self-hostable (fully open)YesCommunity ed.YesGraphiti onlyYes

Quick Start

bash
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"
  }'

Adapters

MCP Server (Claude Code, Cursor, Windsurf)

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.

json
{
  "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

Claude Code Skills

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.

Bash CLI

  • Bash: ./adapters/bash/brain.sh store --type fact --content "Server migrated"
  • Any HTTP client: Plain REST — full reference

Documentation

DocDescription
API ReferenceEvery endpoint with request/response examples
ArchitectureSystem design, data flows, component inventory
ConfigurationAll environment variables
Data ModelMemory types, decay, dedup, supersedes logic
MCP ToolsThe 13 MCP tools agents use
OperationsDeployment, monitoring, failure modes
BenchmarksFull LongMemEval methodology and results
Examplescurl demo, Python client

Roadmap

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

Contributing

Contributions welcome! See CONTRIBUTING.md.

See Also

License

MIT — see LICENSE.


Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "zensystemai-zengram": {
      "command": "",
      "args": []
    }
  }
}

Use Zengram MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Zengram is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Zengram as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Zengram MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "zensystemai-zengram": {
      "command": "npx",
      "args": [
        "-y",
        "Zengram"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Zengram MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Zengram MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Zengram to help me with this task?
Zengram
Sure. I read it.
Here is what I found using Zengram.

Option 2: Add an MCP server URL

Use this when Zengram is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for Zengram.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Zengram connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Zengram tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Zengram tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Zengram to help me with this task?
Zengram
Sure. I read it.
Here is what I found using Zengram.

Frequently asked questions

What is the Zengram MCP server used for?

Zengram is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Zengram MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Zengram with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Zengram MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Zengram connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Zengram MCP to TypingMind?

Zengram can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Zengram MCP provide in TypingMind?

Zengram exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Zengram MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Zengram requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇