Skip to main content

AI memory layer with autonomous agents. Open-source Mem0 alternative with memory agents, webhooks, and cognitive insights.

Project description

Mengram — AI Memory Layer with Autonomous Agents

Open-source memory layer for AI apps. Not just storage — Mengram has autonomous agents that clean, analyze, and find hidden patterns in your knowledge.

PyPI npm License: MIT Python 3.10+

Website · Dashboard · API Docs · PyPI · npm


Why Mengram?

Mengram Mem0
Memory Storage
Semantic Search
Knowledge Graph
Autonomous Agents ✅ Curator, Connector, Digest
Team Shared Memory ✅ Invite codes, privacy controls
AI Reflections ✅ Patterns, insights, behavioral analysis
Webhooks
MCP Server ✅ Claude Desktop, Cursor, Windsurf
Python SDK
JavaScript SDK
Async Mode ✅ Job tracking
Memory Categories ✅ user_id, agent_id, run_id, app_id
Self-hostable
Price Free $19-249/mo

Quick Start (60 seconds)

1. Get API key

Sign up at mengram.io — free, no credit card.

2. Install

pip install mengram-ai    # Python
npm install mengram-ai    # JavaScript / TypeScript

3. Connect to Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "mengram": {
      "command": "mengram",
      "args": ["server", "--cloud"],
      "env": {
        "MENGRAM_API_KEY": "your-key-here"
      }
    }
  }
}

Done. Claude now has persistent memory.

Python SDK

from mengram.cloud.client import CloudMemory

m = CloudMemory(api_key="mg-...")

# Add memories (async — returns immediately)
result = m.add([
    {"role": "user", "content": "I deployed Mengram on Railway with PostgreSQL 15"},
    {"role": "assistant", "content": "Great, noted the deployment setup."}
], user_id="ali", agent_id="devops-bot", app_id="infra")

# Track background job
job = m.wait_for_job(result["job_id"])

# Semantic search (filter by agent)
results = m.search("deployment setup", user_id="ali", agent_id="devops-bot")

# Run memory agents
m.run_agents(agent="all", auto_fix=True)

# Get AI insights
insights = m.insights()

# Team memory
team = m.create_team("Backend Team")
m.share_memory("Redis", team_id=team["id"])

# Webhooks
m.create_webhook(url="https://hooks.slack.com/...", name="Slack")

# Manage API keys
m.create_key(name="production")
keys = m.list_keys()

JavaScript / TypeScript SDK

const { MengramClient } = require('mengram-ai');

const m = new MengramClient('mg-...');

// Add memories with categories
const { job_id } = await m.add([
  { role: 'user', content: 'I prefer dark mode and use Vim' },
  { role: 'assistant', content: 'Noted your preferences!' }
], { userId: 'ali', agentId: 'support-bot', appId: 'helpdesk' });

// Wait for completion
const result = await m.waitForJob(job_id);

// Semantic search
const results = await m.search('editor preferences', { userId: 'ali' });

// Agents, teams, webhooks — all supported
await m.runAgents({ agent: 'curator', autoFix: true });
const teams = await m.listTeams();

Full TypeScript types included (index.d.ts).

Memory Categories

Separate memory by user, agent, session, and application:

# User's personal memory
m.add(messages, user_id="ali")

# Specific agent's memory
m.add(messages, user_id="ali", agent_id="support-bot")

# Session-scoped memory
m.add(messages, user_id="ali", run_id="session-123")

# Application-scoped memory
m.add(messages, user_id="ali", app_id="helpdesk")

# Search filters by category too
m.search("preferences", user_id="ali", agent_id="support-bot")

Memory Agents

Three autonomous agents that analyze your memory:

🧹 Curator — Finds contradictions, stale facts, duplicates. Auto-cleans with auto_fix=True.

🔗 Connector — Discovers hidden connections, behavioral patterns, skill clusters.

📰 Digest — Weekly summary with headlines, trends, and recommendations.

Team Shared Memory

Share knowledge across your team:

POST /v1/teams {"name": "Backend Team"}
POST /v1/teams/join {"invite_code": "xK9m2Qw5ab"}
POST /v1/teams/3/share {"entity": "Redis"}

Search automatically includes shared team knowledge.

API Endpoints

Endpoint Description
POST /v1/add Add memories (async, returns job_id)
GET /v1/jobs/{id} Check background job status
POST /v1/search Semantic search
POST /v1/agents/run Run memory agents
GET /v1/insights AI-generated insights
POST /v1/teams Create team
POST /v1/webhooks Create webhook
GET /v1/keys List API keys
POST /v1/keys Create new API key
GET /v1/graph Knowledge graph
GET /v1/timeline Temporal search
GET /v1/stats Usage statistics

Full docs: https://mengram.io/docs

Architecture

┌──────────────────────────────────────┐
│          Your AI Clients             │
│  Claude Desktop · Cursor · Windsurf  │
└──────────────┬───────────────────────┘
               │ MCP / REST API
┌──────────────▼───────────────────────┐
│        Mengram Cloud API             │
│  Extraction · Re-ranking · Search    │
├──────────────────────────────────────┤
│       Memory Agents Layer            │
│  🧹 Curator · 🔗 Connector · 📰 Digest│
├──────────────────────────────────────┤
│       Storage Layer                  │
│  PostgreSQL · pgvector · Teams       │
│  Webhooks · Reflections · Graph      │
└──────────────────────────────────────┘

License

MIT


Built by Ali Baizhanov

Project details


Download files

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

Source Distribution

mengram_ai-2.3.2.tar.gz (98.0 kB view details)

Uploaded Source

Built Distribution

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

mengram_ai-2.3.2-py3-none-any.whl (106.9 kB view details)

Uploaded Python 3

File details

Details for the file mengram_ai-2.3.2.tar.gz.

File metadata

  • Download URL: mengram_ai-2.3.2.tar.gz
  • Upload date:
  • Size: 98.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for mengram_ai-2.3.2.tar.gz
Algorithm Hash digest
SHA256 194305121524ccffa1e4f45d73450929c18880b69c3833d5853ec20215474211
MD5 6ebf5af766c42202495ad642e9c46894
BLAKE2b-256 2bac320ee6a3f627aff45a6760c23480751e26166c9428086aedf2b7b2a64e43

See more details on using hashes here.

File details

Details for the file mengram_ai-2.3.2-py3-none-any.whl.

File metadata

  • Download URL: mengram_ai-2.3.2-py3-none-any.whl
  • Upload date:
  • Size: 106.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for mengram_ai-2.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb591230e8f9d3f5c1ac92a8e47f5532888796c0bc15b6d7276b22d198abe23
MD5 7886da2f0c73ee858b2f0dd7c4dc200b
BLAKE2b-256 d6d9763fe2c9cf64a43f31f6cc3c482c3cbf6babb3dfe54cc6b5d588a4a9866a

See more details on using hashes here.

Supported by

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