Skip to main content

A neuro-inspired memory architecture for AI agents โ€” combines a Semantic Palace graph, capacity-bounded Working Memory, and asynchronous consolidation.

Project description

SMRITI Memcore

Enterprise-grade, privacy-first Long-Term Memory (LTM) engine for LLM agents, multi-agent frameworks, and MCP clients.

๐ŸŒ www.smriti-memcore.com

PyPI Python 3.9+ License: MIT Website


๐Ÿ’ก What is SMRITI?

SMRITI is a high-performance, neuro-inspired long-term memory layer designed to give AI agents persistent, adaptive recall without blocking their real-time execution loop.

Inspired by human Dual-Process cognitive theory, SMRITI splits memory operations into:

  1. System 1 (Immediate Heuristics): Decoupled, millisecond-level ingestion of raw interactions into an append-only Episode Buffer.
  2. System 2 (Async Consolidation): Background LLM-driven consolidation that extracts knowledge graphs, resolves contradictions, identifies skills, and decays weak memories.

โš”๏ธ SMRITI vs. Naive RAG & Vector Databases

Feature Naive RAG / Vector DBs SMRITI Memory Engine
Latency Scales linearly with context size; blocks agent loops Sub-5ms ingestion (System 1); System 2 is asynchronous
Context Window Stuffs raw logs, leading to prompt bloat and distraction Miller's Law (7 ยฑ 2 slots) capacity-bounded Working Memory
Data Evolution Static embeddings; struggles with contradictions/corrections Automatic conflict resolution, abstraction, and temporal decay
Relationships Flat vector search; no concept of entity links Semantic Palace Graph showing structured Room/Topic associations
Privacy & Sync All-or-nothing storage; complex namespace routing Private Rooms and private=True tags natively isolating user syncs

๐Ÿš€ Key Capabilities

  • ๐Ÿง  Dual-Process Performance: Zero-blocking real-time loops. Write immediately, analyze when idle.
  • ๐Ÿ”’ Privacy-First (Private Rooms): Create local semantic rooms whose memories are automatically excluded from shared/team-wide sync.
  • ๐Ÿ”Œ Model Context Protocol (MCP): Native MCP server integration with Claude Code, Claude Desktop, Gemini Antigravity, and Codex.
  • ๐Ÿ“ฆ AMP v1.0 Spec Compliant: Drop-in compatibility with any agent framework conforming to the Agent Memory Protocol.
  • ๐Ÿ“Š Visual Graph Explorer: Clean D3.js-based visualization interface with Prometheus metrics monitoring.
  • ๐Ÿ“‚ Obsidian Vault Integration: Automatically syncs your agent's memory graph into an Obsidian vault for human curation.
  • ๐Ÿงฉ Framework Agnostic: Integrates natively with LangChain, LlamaIndex, CrewAI, and AutoGen.

๐Ÿง  Core Architecture

                           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                           โ”‚    Asynchronous Consolidation   โ”‚
                           โ”‚      (8 Background Processes)   โ”‚
                           โ”‚  โ€ข Chunking      โ€ข Cross-Ref.   โ”‚
                           โ”‚  โ€ข Conflict Res. โ€ข Skill Ext.   โ”‚
                           โ”‚  โ€ข Forgetting    โ€ข Spaced Rep.  โ”‚
                           โ”‚  โ€ข Reflection    โ€ข Defragment.  โ”‚
                           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                            โ”‚ background
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  Input   โ”‚โ”€โ”€โ–ถโ”‚ Attention โ”‚โ”€โ”€โ–ถโ”‚   Episode Buffer    โ”‚โ”€โ”€โ–ถโ”‚ Semantic โ”‚
  โ”‚  Text    โ”‚   โ”‚   Gate    โ”‚   โ”‚  (append-only log)  โ”‚   โ”‚  Palace  โ”‚
  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚ (salience โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚  Graph   โ”‚
  โ”‚              โ”‚  filter)  โ”‚                              โ”‚ G=(V,E)  โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                              โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
                                                                โ”‚
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”‚
  โ”‚  Query   โ”‚โ”€โ”€โ–ถโ”‚ Retrievalโ”‚โ”€โ”€โ–ถโ”‚  Working Memory   โ”‚โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โ”‚          โ”‚   โ”‚  Engine  โ”‚   โ”‚   (7 ยฑ 2 slots)   โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚ Q(v) =   โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚ ฮฒโ‚cos +  โ”‚
                 โ”‚ ฮฒโ‚‚decay+ โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚ ฮฒโ‚ƒfreq + โ”‚โ”€โ”€โ–ถโ”‚    Meta-Memory    โ”‚
                 โ”‚ ฮฒโ‚„sal    โ”‚   โ”‚ (confidence map)  โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ Quick Start

1. Unified MCP Server (Claude Code, Gemini, Codex)

SMRITI can be used as a global, persistent memory layer across all your MCP-enabled developer clients.

Method A: One-Line Installer (Recommended)

Run the setup script directly in your terminal:

bash <(curl -s https://raw.githubusercontent.com/smriti-memcore/smriti-memcore/main/install_smriti_mcp.sh)

Method B: Via PyPI

Install the package and run the setup CLI:

pip3 install smriti-memcore
smriti_install

2. Python SDK

For application developers building custom agent loops.

pip install smriti-memcore[faiss] # FAISS is recommended for accelerated vector search
from smriti import SMRITI, SmritiConfig

# Initialize memory engine with OpenAI
config = SmritiConfig(
    storage_path="./my_agent_memory",
    llm_model="gpt-4o",
    openai_api_key="your-api-key-here"
)
memory = SMRITI(config=config)

# Ingest observations
memory.encode("User prefers using PyTorch for neural networks.")
memory.encode("User is allergic to shellfish.", context="medical")

# Recall relevant context using multi-factor retrieval
results = memory.recall("What framework does the user prefer?")
for mem in results:
    print(f"[{mem.strength:.2f}] {mem.content}")

# Manually trigger System 2 background consolidation
memory.consolidate()
memory.save()

๐Ÿ› ๏ธ MCP Tool Reference

SMRITI exposes 19 tools (13 native + 6 AMP aliases) for clients:

Core Tools

Tool Name Description
smriti_encode Ingests a new memory. Accept private=True to exclude from team syncs.
smriti_recall Retrieves memories using semantic and graph-based retrieval.
smriti_get_context Helper to inject the current active working memory slots into the context window.
smriti_how_well_do_i_know Performs a meta-memory confidence check on a given topic.
smriti_knowledge_gaps Identifies topics the agent has identified it needs more information on.
smriti_pin Marks a memory as permanent (protects it from strength decay).
smriti_forget Soft-deletes/archives a memory, leaving a cryptographic tombstone.
smriti_consolidate Triggers a background System 2 consolidation run.
smriti_stats Returns system-wide statistics (total memories, rooms, private counts).
smriti_create_private_room Spawns a private room. All memories inside this room are visibility-isolated.
smriti_open_ui Launches the interactive visual D3.js memory graph in your default browser.
smriti_sync_obsidian Exports the Semantic Palace graph structures to markdown files in an Obsidian Vault.

AMP v1.0 Alias Tools

These endpoints ensure complete conformance with the standard Agent Memory Protocol specification:

AMP Tool Native Mapping Return Format
amp.encode smriti_encode AMP standard JSON response
amp.recall smriti_recall Array of {id, content, score, timestamp, status}
amp.forget smriti_forget {status: "forgotten" | "not_found"}
amp.stats smriti_stats {memory_count, ...}
amp.pin smriti_pin {status: "pinned" | "not_found"}
amp.consolidate smriti_consolidate {status: "ok", memories_processed: int}

๐Ÿ”Œ Framework Integrations

LangChain Integration

Use SmritiLangChainMemory as a drop-in replacement for default chat buffers. It limits active context using Working Memory and offloads the conversational history to the Semantic Palace graph in the background.

from langchain.chains import ConversationChain
from smriti.integrations.langchain_memory import SmritiLangChainMemory
from smriti import SMRITI

smriti_engine = SMRITI(storage_path="./langchain_smriti_db")
smriti_memory = SmritiLangChainMemory(smriti_client=smriti_engine, top_k=3)

conversation = ConversationChain(
    llm=my_llm,
    memory=smriti_memory,
)
conversation.predict(input="I prefer backend APIs in Python.")

๐Ÿ“Š Benchmarks & Performance

1. LoCoMo (Multi-System Context Retrieval)

Tested against four architectures on the LoCoMo long-context dialogue dataset (28 turns, 15 evaluation questions):

System F1 Score Latency Tokens/Query Consolidation
FullContext 0.345 1147ms 550 โ€”
MemGPT-style 0.334 1397ms 478 โ€”
NaiveRAG 0.312 1387ms 145 โ€”
SMRITI 0.279 1317ms 146 41.2s (async)
Mem0-style 0.235 1088ms 106 โ€”

SMRITI retains high recall while drastically reducing query context size. Consolidation runs in the background and does not block client interactions.

2. LongMemEval (Long-Term Chat Sessions)

Evaluated over 50+ chat sessions using the LongMemEval harness:

System Configuration Exact Match Accuracy Average Query Latency
Baseline (Full Context) 100.0% 11.98s
SMRITI Dual-Process 80.0% 0.98s (12ร— latency reduction)

โš™๏ธ Configuration Parameters

Initialize SmritiConfig with custom parameters to tune the cognitive weights:

from smriti import SmritiConfig

config = SmritiConfig(
    working_memory_slots=7,          # Capacity limit (Miller's Law)
    
    # Retrieval scoring weights (sum to 1.0)
    recency_weight=0.2,
    relevance_weight=0.4,
    strength_weight=0.2,
    salience_weight=0.2,

    # Forgetting & Temporal Decay
    decay_rate=0.99,                 # Strength multiplier per day
    strength_hard_threshold=0.05,    # Memories dropping below this are forgotten
    
    # Palace Graph
    room_merge_threshold=0.85,       # Cosine similarity for auto-merging semantic rooms
)

๐Ÿ“„ Citation

If you use SMRITI in your research, please cite our technical paper:

@article{tyagi2025smriti,
  title={SMRITI: A Scalable, Neuro-Inspired Architecture for Long-Term Event Memory in LLM Agents},
  author={Tyagi, Shivam},
  year={2025},
  doi={10.13140/RG.2.2.25477.82407}
}

๐Ÿ“„ License

SMRITI is licensed under the MIT License. See LICENSE for details.

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

smriti_memcore-1.4.15.tar.gz (93.7 kB view details)

Uploaded Source

Built Distribution

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

smriti_memcore-1.4.15-py3-none-any.whl (80.3 kB view details)

Uploaded Python 3

File details

Details for the file smriti_memcore-1.4.15.tar.gz.

File metadata

  • Download URL: smriti_memcore-1.4.15.tar.gz
  • Upload date:
  • Size: 93.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smriti_memcore-1.4.15.tar.gz
Algorithm Hash digest
SHA256 e4594e68a31b7ff759c7b7ae492244c0a58345b0537e8686cea820151b7da7af
MD5 ca4e7f38b97be1ae8bb8166c0006eec9
BLAKE2b-256 44eee614372884c6e24ab84f5ec54203b47518919314aab490c2d592a8876a05

See more details on using hashes here.

Provenance

The following attestation bundles were made for smriti_memcore-1.4.15.tar.gz:

Publisher: publish-mcp.yml on smriti-memcore/smriti-memcore

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smriti_memcore-1.4.15-py3-none-any.whl.

File metadata

File hashes

Hashes for smriti_memcore-1.4.15-py3-none-any.whl
Algorithm Hash digest
SHA256 f179b38921b8533e9c05f10faf2ac00a69eadf09ffed95362b3120319365a029
MD5 dab68fda847aeeee6c93af567c685a7b
BLAKE2b-256 e84db9f9243e8ef9ff1f5d9f27a9560bbf887b88a9b6e8ca023aeda7a4d4ee37

See more details on using hashes here.

Provenance

The following attestation bundles were made for smriti_memcore-1.4.15-py3-none-any.whl:

Publisher: publish-mcp.yml on smriti-memcore/smriti-memcore

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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