Skip to main content

AI agent memory infrastructure โ€” persistent memory, A2A sharing, reasoning engine

Project description

๐Ÿง  LogicMem โ€” AI Agent Memory Infrastructure

Persistent memory, A2A sharing, reasoning engine, and immutable audit trail for AI agents via the Model Context Protocol.

Python 3.11+ License: MIT MCP Compatible


The Problem

AI agents are stateless by design. Every session starts from scratch:

Session 1                              Session 2
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€                             โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
User: "I'm building a SaaS"     โ†’     User: "How's my SaaS coming?"
Agent: "Tell me more..."              Agent: "I don't know anything
...                                   about your SaaS"
[Session ends]                        
                                      Agent forgot EVERYTHING.

This is fine for demos. It's catastrophic for production AI workflows.

The Solution

LogicMem gives your AI agent persistent memory โ€” connect any MCP client and get:

  • ๐Ÿ” Persistent Memory โ€” Store and search memories across sessions
  • ๐Ÿง  Reasoning Engine โ€” Multi-step reasoning that consults memory
  • ๐Ÿ”— A2A Memory Sharing โ€” Agents share context in real-time
  • ๐Ÿ“‹ Immutable Audit Trail โ€” Cryptographically verifiable history
  • ๐ŸŽ™๏ธ Voice Memory โ€” Caller history for VAPI, Retell AI, Bland AI

Open Core Model

This repo is the LogicMem SDK โ€” the open-source client for connecting AI agents to the LogicMem memory fabric. The SDK is fully open (MIT licensed). The reasoning engine and audit chain run on LogicMem's private server.

Open Source (This Repo) LogicMem Pro / Enterprise
SDK / Client โœ… Fully open (MIT) โœ… Included
Persistent Memory โœ… Up to 1,000 ops/mo (free tier) โœ… Unlimited
A2A Memory Sharing โœ… Basic โœ… Advanced governance + cross-org
Reasoning Engine โœ… API call (server-powered) โœ… Deep / Exhaustive modes
Audit Trail โœ… API call (server-verified) โœ… Tamper-evident ledger + CNSA 2.0
Voice Agent Memory โœ… โœ…
Deployment Cloud (logicmem.io) Cloud, on-prem, or air-gap
Support Community Dedicated + SLA

Why this model? The SDK gives developers the steering wheel. The LogicMem server is the engine. You get a great developer experience โ€” and your AI gets production-grade memory infrastructure without building it yourself.


Install

# Install the Python SDK (library only)
pip install --break-system-packages git+https://github.com/LogicMem/LogicMem-mcp-.git

# Install with CLI tools (includes logicmem-server for OpenClaw MCP):
pip install --break-system-packages "logicmem[cli] @ git+https://github.com/LogicMem/LogicMem-mcp-.git"

# Linux/Ubuntu (no flag needed):
pip install "logicmem[cli] @ git+https://github.com/LogicMem/LogicMem-mcp-.git"

Quick Start (< 5 minutes)

1. Get an API Key

Sign up at logicmem.io โ†’ Settings โ†’ API Keys โ†’ Create Key.

Free tier: 1,000 memory operations/month.

โš ๏ธ macOS users: If you see a PEP 668 error during install, rerun with --break-system-packages flag (see Install section above).

2. Use the Python SDK

from logicmem import LogicMem

# Initialize the client
memory = LogicMem(api_key="lm_your_api_key")

# Store a memory
memory.log(
    text="User prefers urgent messages via Telegram, not email.",
    category="preference",
    importance=8,
)

# Search memories
results = memory.recall(query="user communication preferences")
print(results[0]["text"])
# โ†’ "User prefers urgent messages via Telegram, not email."

# Store a task with context
memory.log(
    text="Review Q3 proposal by Friday. Priority: cost breakdown first, then timeline.",
    category="task",
    importance=9,
)

# Session briefing โ€” full context at start of session
brief = memory.session(client_id="ed_creed")
print(brief["confidence"])   # How confident is the agent about this user?
print(brief["relationship_trend"])  # improving / declining / stable

3. Reasoning Engine

# Multi-step reasoning with memory at each step
answer = memory.reason(
    question="Should we prioritize the mobile app or web dashboard first?",
    context="User is a solo founder with limited engineering bandwidth.",
    mode="deep",  # fast / deep / exhaustive
)
print(answer["answer"])
print(answer["confidence"])

# Verify a claim against stored facts
verdict = memory.verify("User has a budget of $50k for this project")
print(verdict["verdict"])   # supported / contradicted / inconclusive
print(verdict["evidence"])  # supporting entries

# Self-critique before committing to an answer
review = memory.reflect(
    draft_answer="You should build the web dashboard first.",
    question="What should we prioritize first?",
    memory_query="user preferences priorities",
)
print(review["score"])      # 0-100
print(review["gaps"])       # weaknesses in the answer

4. Agent-to-Agent (A2A) Memory Sharing

from logicmem.a2a import A2AClient

# Agent A: Share a memory with Agent B
a2a = A2AClient(api_key="lm_agent_a_key", agent_id="agent-researcher")

# Register this agent
a2a.register(name="Researcher Agent", agent_type="agent", client_id="team-alpha")

# Share context with another agent
a2a.share_memory(
    target_agent_id="agent-executor",
    memory={"text": "User needs Q3 report by Friday. High priority."},
    category="task",
    importance=9,
)

# Check for new shared memories from other agents
shared = a2a.sync()
for entry in shared:
    print(f"From {entry['from_agent_id']}: {entry['text']}")

5. Verify Audit Chain

from logicmem.audit import AuditChain

audit = AuditChain(memory)  # pass LogicMem client

# Verify the audit chain has not been tampered with
result = audit.verify()
print(result["valid"])  # True if chain integrity is intact

# Log a correction (improves the model)
audit.log_correction(
    original="The user prefers email for urgent messages.",
    corrected="The user prefers Telegram for urgent messages, not email.",
    reason="User explicitly stated Telegram in call on 2026-06-10.",
)

# Check DPO training pipeline stats
stats = audit.dpo_stats()
print(f"Correction pairs ready: {stats['ready_count']}")

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      Your AI Agent                           โ”‚
โ”‚              (Claude, GPT, Any MCP Client)                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ MCP
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   LogicMem MCP Server                        โ”‚
โ”‚                 api.logicmem.io                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚   Memory    โ”‚ โ”‚  Reasoning โ”‚ โ”‚    A2A     โ”‚ โ”‚ Audit  โ”‚ โ”‚
โ”‚  โ”‚   Tools     โ”‚ โ”‚   Engine   โ”‚ โ”‚   Relay    โ”‚ โ”‚ Chain  โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ–ผ                 โ–ผ                 โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Memory    โ”‚   โ”‚   Memory   โ”‚   โ”‚   Audit   โ”‚
    โ”‚  Storage   โ”‚   โ”‚   Index    โ”‚   โ”‚   Ledger  โ”‚
    โ”‚(Supabase)  โ”‚   โ”‚ (Qdrant)   โ”‚   โ”‚(Hash Chain)โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

OpenClaw Integration

OpenClaw is the fastest-growing open-source AI agent framework (300K+ GitHub stars). LogicMem is fully compatible with OpenClaw.

Option A โ€” Direct MCP Server URL (Simplest, 1 line of config)

Add LogicMem as a streamable-http MCP server in your OpenClaw config (~/.openclaw/openclaw.json):

{
  "mcp": {
    "servers": {
      "logicmem": {
        "transport": "streamable-http",
        "url": "https://mcp.logicmem.io/mcp",
        "headers": {
          "Authorization": "Bearer lm_YOUR_API_KEY"
        }
      }
    }
  }
}

Note: The streamable-http transport is the modern MCP standard (2024-11-05). The server at mcp.logicmem.io supports both streamable-http and legacy sse.

Option B โ€” Local stdio Server (For power users with multiple MCP servers)

Some OpenClaw users have multiple MCP servers configured โ€” a mix of stdio (local programs) and HTTP/SSE (remote servers). OpenClaw has a known limitation where it can't freely mix stdio and SSE servers in the same config.

The fix: Use our local stdio server as a bridge. Install it via pip:

pip install --break-system-packages \
  "logicmem[cli] @ git+https://github.com/LogicMem/LogicMem-mcp-.git"

Then configure OpenClaw to use the local stdio command:

{
  "mcp": {
    "servers": {
      "logicmem": {
        "command": "logicmem-server",
        "env": {
          "LOGICMEM_API_KEY": "lm_YOUR_API_KEY",
          "LOGICMEM_CLIENT_ID": "your-client-id"
        }
      }
    }
  }
}

This approach:

  • Works alongside any other MCP server (stdio or HTTP)
  • No SSE/stdio mixing conflict
  • Installs in seconds via pip

Quick Test โ€” Verify Your Setup

After configuring, test that LogicMem is connected:

# Check if the MCP server is recognized
openclaw mcp list

# Or test directly in a conversation with your agent:
# "What is my name?" (should recall from memory if previously stored)

For Specific OpenClaw Agents

Agent Recommended Setup Config Type
Themis (any OpenClaw agent) Direct URL streamable-http config
Hermes Direct URL or stdio pip Same as above
Claude Code Direct URL streamable-http in Claude Code config
Custom OpenClaw agents Direct URL Same as above

Environment Variables

Variable Default Description
LOGICMEM_API_KEY โ€” Your API key (lm_xxx) from logicmem.io/settings
LOGICMEM_SERVER_URL https://api.logicmem.io Point to self-hosted server if using logicmem-open
LOGICMEM_CLIENT_ID default Default client_id for memory operations
LOGICMEM_TIMEOUT 30 HTTP request timeout in seconds

MCP Protocol Reference

The server accepts JSON-RPC 2.0 requests over HTTPS.

Base URL: https://api.logicmem.io

Authentication: Authorization: Bearer <api_key> header.

Core Tools

Tool Description
logicmem_memory_log Store a new memory with category, importance, tags
logicmem_memory_recall Search memories with natural language
logicmem_memory_session Get full context briefing for current session
logicmem_reason Multi-step reasoning with memory consultation
logicmem_verify Verify a claim against stored facts
logicmem_reflect Self-critique โ€” evaluate draft against memory
logicmem_audit_verify Verify integrity of the audit chain
logicmem_a2a_share Share memory with another agent
logicmem_a2a_receive Receive shared memory from another agent

See MCP-PROTOCOL.md for the full protocol reference.


Comparison

Feature LogicMem Mem0 Letta Zep
MCP-native โœ… Full โš ๏ธ โœ… โš ๏ธ
Reasoning engine โœ… โŒ โš ๏ธ โŒ
A2A memory sharing โœ… โŒ โš ๏ธ โŒ
Immutable audit trail โœ… โŒ โŒ โš ๏ธ
DPO training pipeline โœ… โŒ โŒ โŒ
Voice agent memory โœ… โŒ โš ๏ธ โŒ
Federated memory โœ… โŒ โŒ โŒ

Security

  • Encryption: AES-256-GCM at rest, TLS 1.3 in transit
  • Compliance: CNSA 2.0 cryptography for defense/government workloads
  • Audit: Every operation logged to immutable hash-linked chain
  • API Keys: Per-agent keys with fine-grained permissions

See SECURITY.md for the full security model.


Documentation

All documentation lives in the docs/ folder right here in this repo:

Doc What You Need
๐Ÿ“– Start Here Install + first 10 lines of code
๐Ÿ”Œ MCP Protocol Full protocol reference
๐Ÿ”— A2A Sharing Agent-to-agent memory
๐Ÿ”’ Security Encryption, CNSA 2.0, audit
๐Ÿ’ป Code Examples All examples in one place

Links


Contributing

Contributions welcome. Please see CONTRIBUTING.md.

We especially welcome:

  • MCP client examples (more clients โ†’ more adoption)
  • Framework integrations (LangChain, AutoGPT, CrewAI, etc.)
  • A2A protocol extensions
  • SDK implementations in other languages

License

MIT License. See LICENSE.

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

logicmem-0.1.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

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

logicmem-0.1.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file logicmem-0.1.0.tar.gz.

File metadata

  • Download URL: logicmem-0.1.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for logicmem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dfe2950f5040dd4b2d520d7beedf28204119a6fe158455ad306dbd52b5260931
MD5 8e900cc4fc164feb84589b311900db3d
BLAKE2b-256 c5140f1f3f30bfceec997d04cda3e377ff22d7e6678079dc634b223c9b957bd5

See more details on using hashes here.

File details

Details for the file logicmem-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: logicmem-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for logicmem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f359e6c744c411d2ad5e2c69757a6ead4294001d0c604406512f7e3f0c27ca5
MD5 fa219d203892b3650fc300a9f40f7052
BLAKE2b-256 7e5dbe9f7f4ac17e8c5b22d95d9d128d7d95c97d5d73cc03aeb2f9ea56f192c1

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