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.1.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.1-py3-none-any.whl (106.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mengram_ai-2.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a2519101b0907d6451adbdc3d8d5ad8c7e052f8932d0f031f5608b5abfc0840f
MD5 c0d5f5c7c5d49675b242d3c268764fc4
BLAKE2b-256 8d0336c139fab216a95b4fa0803a325899065310e2ea1dee5ce0138804e7c37c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mengram_ai-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 106.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48452ee140239c404ca74bf7b26e64988713362611d2d4d179a3a1bf860da74e
MD5 2d411e72a147b71d487a36c60d774685
BLAKE2b-256 15a1161bbb5a4066c7d5d26ca13e6a117b0e44d5ef31d23910f8f99c4f65f47c

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