🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

smriti-memcore

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smriti-memcore

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

pipPyPI
Version
1.4.15
Weekly downloads
321
Maintainers
1

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:

  • System 1 (Immediate Heuristics): Decoupled, millisecond-level ingestion of raw interactions into an append-only Episode Buffer.
  • 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

FeatureNaive RAG / Vector DBsSMRITI Memory Engine
LatencyScales linearly with context size; blocks agent loopsSub-5ms ingestion (System 1); System 2 is asynchronous
Context WindowStuffs raw logs, leading to prompt bloat and distractionMiller's Law (7 ± 2 slots) capacity-bounded Working Memory
Data EvolutionStatic embeddings; struggles with contradictions/correctionsAutomatic conflict resolution, abstraction, and temporal decay
RelationshipsFlat vector search; no concept of entity linksSemantic Palace Graph showing structured Room/Topic associations
Privacy & SyncAll-or-nothing storage; complex namespace routingPrivate 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.

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 NameDescription
smriti_encodeIngests a new memory. Accept private=True to exclude from team syncs.
smriti_recallRetrieves memories using semantic and graph-based retrieval.
smriti_get_contextHelper to inject the current active working memory slots into the context window.
smriti_how_well_do_i_knowPerforms a meta-memory confidence check on a given topic.
smriti_knowledge_gapsIdentifies topics the agent has identified it needs more information on.
smriti_pinMarks a memory as permanent (protects it from strength decay).
smriti_forgetSoft-deletes/archives a memory, leaving a cryptographic tombstone.
smriti_consolidateTriggers a background System 2 consolidation run.
smriti_statsReturns system-wide statistics (total memories, rooms, private counts).
smriti_create_private_roomSpawns a private room. All memories inside this room are visibility-isolated.
smriti_open_uiLaunches the interactive visual D3.js memory graph in your default browser.
smriti_sync_obsidianExports 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 ToolNative MappingReturn Format
amp.encodesmriti_encodeAMP standard JSON response
amp.recallsmriti_recallArray of {id, content, score, timestamp, status}
amp.forgetsmriti_forget{status: "forgotten" | "not_found"}
amp.statssmriti_stats{memory_count, ...}
amp.pinsmriti_pin{status: "pinned" | "not_found"}
amp.consolidatesmriti_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):

SystemF1 ScoreLatencyTokens/QueryConsolidation
FullContext0.3451147ms550
MemGPT-style0.3341397ms478
NaiveRAG0.3121387ms145
SMRITI0.2791317ms14641.2s (async)
Mem0-style0.2351088ms106

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 ConfigurationExact Match AccuracyAverage Query Latency
Baseline (Full Context)100.0%11.98s
SMRITI Dual-Process80.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.

Keywords

llm

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts