Skip to main content

Zero-Knowledge Memory Layer for AI Agents — Cognitive Security Protocol with 4 proprietary seals. Giving Agents a Past. Giving Models a Soul.

Project description

Synapse Layer

Continuous Consciousness Infrastructure for AI Systems

Persistent. Secure. 1-line integration. 🧠


CI PyPI Smithery Docs License Tests Coverage



Website · Forge · Docs · PyPI · Smithery


⚡ 1-Line Integration

from synapse_memory import SynapseMemory, remember

memory = SynapseMemory(agent_id="my-agent")

@remember(memory)
async def answer(prompt: str) -> str:
    return llm.chat(prompt)  # auto recall + store

That's it. Encryption, PII redaction, differential privacy, intent validation, and trust scoring all happen under the hood.


🚀 Quick Start

Install

pip install synapse-layer

Store & Recall

from synapse_memory import SynapseMemory, SqliteBackend

# Zero-config persistent storage
memory = SynapseMemory(
    agent_id="my-agent",
    backend=SqliteBackend(),  # survives restarts
)

# Store a memory (full Cognitive Security pipeline runs automatically)
result = await memory.store(
    content="User prefers dark mode and concise answers",
    confidence=0.95,
)
print(result.trust_quotient)   # 0.89
print(result.sanitized)        # True
print(result.privacy_applied)  # True

# Recall with self-healing
recalls = await memory.recall("user preferences")
for r in recalls:
    print(f"{r.content} (TQ: {r.trust_quotient:.2f})")

Encrypt at Rest

from synapse_memory import SynapseCrypto

# Generate a key (or derive from password)
key = SynapseCrypto.generate_key()
crypto = SynapseCrypto(key)

# AES-256-GCM authenticated encryption
ciphertext = crypto.encrypt("sensitive memory content")
plaintext = crypto.decrypt(ciphertext)

# Or from environment variable
crypto = SynapseCrypto.from_env("SYNAPSE_ENCRYPTION_KEY")

MCP Connection

{
  "mcpServers": {
    "synapse-layer": {
      "url": "https://forge.synapselayer.org/api/mcp"
    }
  }
}

4 tools available:

Tool Description
save_to_synapse Structured memory persistence with full security pipeline
recall Semantic memory retrieval with TQ ranking
process_text Autonomous decision/milestone/alert detection
health_check System health, version, capability report

🧠 Why Synapse Layer?

AI agents are stateless by design. They forget everything between sessions, lose context when switching models, and reprocess the same information every call.

Synapse Layer is the missing memory primitive.

Without Memory With Synapse Layer
Session state Resets every turn Persistent across sessions
Token usage Reprocesses context Up to 70% reduction via recall
Model switching Context lost Signed handover (GPT-4 ↔ Claude)
Privacy Plaintext embeddings AES-256-GCM + PII redaction + DP noise
Recall quality Non-deterministic Deterministic, ranked by Trust Quotient™

🛡️ Security Architecture

Every memory passes through a non-bypassable 4-layer Cognitive Security Pipeline:

Agent → Sanitize (PII) → Validate Intent → Encrypt (AES-256-GCM) → DP Noise → Vault
Layer Name What It Does
1 Semantic Privacy Guard™ 15+ regex patterns for PII, secrets, credentials
2 Intelligent Intent Validation™ Two-step categorization with self-healing on recall
3 AES-256-GCM Encryption Authenticated encryption with PBKDF2 key derivation
4 Differential Privacy Calibrated Gaussian noise on embeddings

🔌 Integrations

Native adapters for every major framework:

Framework Import Status
LangChain from synapse_memory.integrations import SynapseChatMessageHistory
CrewAI from synapse_memory.integrations.crewai_memory import SynapseCrewStorage
AutoGen from synapse_memory.integrations import SynapseAutoGenMemory
LlamaIndex from synapse_memory.integrations.llamaindex import SynapseRetriever
Semantic Kernel from synapse_memory.integrations.semantic_kernel import SynapseChatHistory
MCP (Claude, etc.) Direct connection via forge.synapselayer.org/api/mcp

See full integration docs for each framework.


🏗️ Storage Backends

Pluggable persistence via the StorageBackend protocol:

from synapse_memory import SynapseMemory, SqliteBackend, MemoryBackend

# In-memory (default — for testing/demos)
memory = SynapseMemory(agent_id="test")

# SQLite (zero-config local persistence)
memory = SynapseMemory(agent_id="prod", backend=SqliteBackend())

# Custom backend (implement the StorageBackend protocol)
memory = SynapseMemory(agent_id="custom", backend=MyPostgresBackend())

🔍 Plugin Architecture

Clean OSS/PRO separation via the Strategy pattern:

from synapse_memory import AutoSaveEngine

# OSS mode (default)
engine = AutoSaveEngine(database=db, redactor=redact)

# PRO mode — auto-loads synapse-layer-pro if installed
engine = AutoSaveEngine(database=db, redactor=redact, mode="pro")

# Custom — bring your own strategies
engine = AutoSaveEngine(database=db, importance_scorer=MyScorer())

Interfaces: ImportanceScorer, ConflictResolver, DedupStrategy, RedactionStrategy


🏆 Competitive Comparison

Capability Synapse Layer Mem0 Zep pgvector
AES-256-GCM Encryption
PII Redaction (15+ patterns)
Differential Privacy
Intent Validation + Self-Healing
Cross-Model Handover (JWT) partial
Trust Quotient™ Scoring
Pluggable Storage Backends
MCP Native
Plugin Architecture
Zero-Knowledge Architecture

📊 v1.1.0 Numbers

  • 481 tests | 90% coverage
  • 5 framework integrations (LangChain, CrewAI, AutoGen, LlamaIndex, Semantic Kernel)
  • 4 MCP tools (real DB, not stubs)
  • 2 storage backends (Memory, SQLite) + custom protocol
  • AES-256-GCM with PBKDF2 key derivation (600k iterations)

🌐 Open Core Model

  • Community (Apache 2.0) — Full SDK, security pipeline, MCP integration, all backends, all integrations.
  • Enterprise — Advanced TQ calibration, multi-tenant vaults, production infrastructure.

The foundation is open. The intelligence layer scales with you.


🛣️ Roadmap

Version Status Highlights
v1.1.0 Stable SqliteBackend, AES-256-GCM crypto, @remember wrapper, real MCP tools, 481 tests
v1.2.0 🚧 Next Embedding model selection, vector similarity search, batch operations
v2.0.0 📋 Planned Multi-tenant vault, team memory spaces, RBAC

🤝 Contributing

git clone https://github.com/SynapseLayer/synapse-layer.git
cd synapse-layer
pip install -e ".[dev]"
python -m pytest tests/ -q  # 481 tests

See CONTRIBUTING.md for guidelines.


📎 Connect


License

Apache License 2.0 — see LICENSE.

Open-core model: SDK, MCP server, and security pipeline are fully open source. Trust Quotient™ weights, Neural Handover™ internals, and Synapse Forge are proprietary.


Star Synapse Layer — Give your agents a past.



Giving Agents a Past. Giving Models a Soul. ⚗️



Built by Ismael Marchi · @synapselayer

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

synapse_layer-1.1.0.tar.gz (90.0 kB view details)

Uploaded Source

Built Distribution

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

synapse_layer-1.1.0-py3-none-any.whl (81.8 kB view details)

Uploaded Python 3

File details

Details for the file synapse_layer-1.1.0.tar.gz.

File metadata

  • Download URL: synapse_layer-1.1.0.tar.gz
  • Upload date:
  • Size: 90.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for synapse_layer-1.1.0.tar.gz
Algorithm Hash digest
SHA256 783578e78419563421edd1a42dd80056fae83a203b50589efa0d619f66453758
MD5 de897ed9befda6e82aa59bee69ca2c48
BLAKE2b-256 fddad579091078f0065c870de4ae5d91d6020416306a215c067fb3b56ff6a156

See more details on using hashes here.

File details

Details for the file synapse_layer-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: synapse_layer-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 81.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for synapse_layer-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2708e6ce9da2e646746ff0e713b0d8e2ef0bf58b2161fa16c793a04b678e9d0f
MD5 7503c303d220409e67e015189fafeddb
BLAKE2b-256 4ed891c15d40404e324f581e561c7e3c91d8ea1c0f5b245d10855c17341593bf

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