Skip to main content

Yantrik Memory

PyPI Python License

Your agent starts every conversation as a stranger. It re-asks what stack you use, forgets the preference you stated last week, and treats a two-year user exactly like a first-time one.

Yantrik Memory is a framework-agnostic Python memory layer that fixes that: one call per turn returns the memories, the personality traits the agent has learned about this user, how far the relationship has progressed, and the context an LLM needs to answer. Storage is a single SQLite file via YantrikDB (docs) — no vector service, no external database, no API keys.

Install (60 seconds)

pip install yantrik-memory

That is the whole install. Embeddings come from the engine's bundled
`potion-base-8M` model, which it fetches on first use — no `sentence-transformers`,
no PyTorch. To use a sentence-transformers model instead, install it yourself and
pass `{"embedding_model": "all-MiniLM-L6-v2"}`; stores created before v0.1.1 keep
that model automatically, because their index dimension is fixed at creation.
yantrik-memory init
from yantrik_memory import YantrikMemory

mem = YantrikMemory()

context = mem.process_turn(
    agent_id="assistant",
    user_id="user123",
    message="I prefer dark mode and concise answers",
)

print(context["traits"])         # {'conciseness': 0.55, 'humor': 0.5, ...}
print(context["bond"]["level"])  # 'acquaintance'
print(context["memories"])       # what this user told you before

That is the whole integration: one process_turn call per user message, and the returned dict carries memories, traits, bond state, personality guidance, mood and intent. Works with any agent framework — it never sees your LLM.

What it does

Gives your AI agent persistent memory that survives across conversations:

  • Remember & Recall — Store and retrieve memories with hybrid search (semantic + graph + temporal + keyword)
  • Personality Traits — 9 evolving traits that adapt to each user
  • Bond Evolution — Relationships grow from stranger to bonded over time
  • Knowledge Graph — Entity relationships for context-aware retrieval
  • Context Assembly — One call to get everything an LLM needs

Real Conversation Demo

Here's Yantrik Memory running inside OpenClaw — an open-source AI agent platform. The agent remembers context across turns, learns preferences, and builds a profile over time.

Turn 1 — Alex introduces himself:

Alex: Hey! I'm Alex. I'm a backend engineer at a startup. We're building a task management app and I need help setting up the API.

Agent: Hi Alex. What stack are you using? What API help do you need?

Turn 2 — Alex shares preferences, agent adapts:

Alex: We're using Python with FastAPI. I prefer keeping things simple — no over-engineering. Can you suggest a basic project structure?

Agent:

taskapp/
├── app/
│   ├── main.py          # FastAPI app
│   ├── api/
│   │   ├── tasks.py     # /tasks endpoints
│   │   └── users.py     # /users endpoints
│   ├── core/
│   │   ├── config.py    # Settings
│   │   └── security.py  # Auth utils
│   ├── models/
│   │   ├── task.py      # Pydantic models
│   │   └── user.py
│   └── db/
│       └── database.py  # DB connection
├── requirements.txt
└── README.md

Turn 3 — Agent remembers the database preference:

Alex: That's perfect, thanks! Oh and remember — I always use PostgreSQL for production and SQLite for local dev. What about the database layer?

Agent:

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings

# Use SQLite for dev, PostgreSQL for prod
engine = create_engine(settings.DATABASE_URL)
SessionLocal = sessionmaker(bind=engine)

Turn 4 — Alex asks what the agent remembers:

Alex: Great work! You're really helpful. One more thing — what do you remember about me and my project so far?

Agent:

  • Backend engineer at a startup
  • Building a task management app
  • Using Python with FastAPI
  • Prefer simple solutions, no over-engineering
  • Always use PostgreSQL for production, SQLite for local dev

Behind the scenes, Yantrik Memory tracked:

  • Traits evolved: helpfulness: 0.55 (from "really helpful"), conciseness: 0.55 (from "keeping things simple")
  • Bond level: acquaintance (score: 0.08 after 4 interactions)
  • Memories stored: 5 facts about Alex, preferences, and project context
  • Knowledge graph: Alex → works_at → Startup, TaskApp → uses → FastAPI

OpenClaw / ClawDBot Plugin

Yantrik Memory is a ClawHub plugin. Install via:

openclaw plugins install yantrik-memory

Or add to your skills directory:

cd ~/.openclaw/skills
git clone https://github.com/yantrikos/yantrik-memory.git
pip install -e yantrik-memory

Powered by YantrikDB

5 unified indexes on a single SQLite file:

Index Purpose
Vector (HNSW) Semantic similarity
Graph Entity relationships
Temporal Time-aware retrieval
Decay Heap Memory lifecycle
KV Fast lookups

<60ms latency. Zero config. No external databases.

Part of a portfolio of agent infrastructure built by one person, designed to be used together:

  • yantrikdb — the cognitive memory engine underneath: Rust core, Python bindings, temporal decay, contradiction detection.
  • yantrikdb-server — the same engine as an HTTP service / cluster when several agents share one memory.
  • yantrikdb-mcp — that memory as an MCP server for Claude Code, Cursor and Windsurf.
  • langchain-yantrikdb — the same memory as a LangChain VectorStore and ChatMessageHistory.
  • openclaw-memory-yantrikdb — OpenClaw memory-slot plugin backed by the same engine.

License

MIT

Metadata

Release files for yantrik-memory 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yantrik-memory 0.1.1
File Size Uploaded
yantrik_memory-0.1.1.tar.gz 21.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yantrik-memory 0.1.1
File Interpreter ABI Platform
yantrik_memory-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.3 kB

Release files / yantrik_memory-0.1.1.tar.gz

Download URL yantrik_memory-0.1.1.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2b233826d979bcb70aa6131302715f0a5b1e370e2cd41e8700291a8a7003e408
BLAKE2b-256 checksum
How to use checksums
e9f694575ef4cb50429b4653c3f5c87f397062209e546e2bbc4969d399043638
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release files / yantrik_memory-0.1.1-py3-none-any.whl

Download URL yantrik_memory-0.1.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab565bca95272da11f312017d3a74dc94fe2215184ba008f0efb101f6bec6736
BLAKE2b-256 checksum
How to use checksums
f0b3d46fece98b38d7fd29cc0fc26aed4dcb8b240d743d9053881bdb33d471ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page