Cortex Plugin
Cortex is an OpenClaw/ClawDBot plugin that gives AI agents persistent memory with personality traits, bond evolution, and full context assembly — all powered by YantrikDB’s 5-index architecture.
While the MCP server gives any MCP client raw access to YantrikDB’s memory tools, Cortex adds an agent personality layer on top: traits that evolve per-user, relationships that grow over time, and a single process_turn() call that handles everything.
Installation
Section titled “Installation”pip install yantrik-memoryyantrik-memory initOr as an OpenClaw plugin:
cd ~/.openclaw/skillsgit clone https://github.com/yantrikos/cortex.gitpip install -e cortexWhat It Adds Over Raw YantrikDB
Section titled “What It Adds Over Raw YantrikDB”| Feature | YantrikDB (raw) | Cortex |
|---|---|---|
| Memory storage | record() / recall() | remember() / recall() with agent scoping |
| Personality | — | 9 evolving traits per user |
| Relationships | — | 6-stage bond evolution |
| Context assembly | — | get_full_context() with mood, intent, guidance |
| Single entry point | — | process_turn() does everything |
| Knowledge graph | relate() / entity_profile() | relate() / get_entity() |
| Cognitive maintenance | think() | think() (passthrough) |
Quick Start
Section titled “Quick Start”from yantrik_memory import YantrikMemory
mem = YantrikMemory()
# Single entry point — handles everythingcontext = mem.process_turn( agent_id="assistant", user_id="alex", message="I prefer concise responses. We're using FastAPI.",)
# context includes:# - memories: relevant recalled memories with scores# - traits: {'conciseness': 0.55, 'helpfulness': 0.5, ...}# - bond: {'level': 'acquaintance', 'score': 0.08}# - personality_guidance: "Be more concise in responses."# - mood: {'mood': 'neutral', 'confidence': 0.5}# - intent: 'casual'Real Conversation Demo
Section titled “Real Conversation Demo”Here’s Cortex running inside OpenClaw. The agent remembers context across turns, learns preferences, and builds a profile.
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:
Alex: We’re using Python with FastAPI. I prefer keeping things simple — no over-engineering.
Agent: (provides a clean, minimal FastAPI project structure)
Turn 3 — Agent remembers the database preference:
Alex: Remember — I always use PostgreSQL for production and SQLite for local dev.
Agent: (provides database setup code using SQLAlchemy with the exact backends Alex specified)
Turn 4 — Alex asks what the agent remembers:
Alex: What do you remember about me?
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, YantrikDB tracked:
- 5 memories stored across the Vector, Graph, and Temporal indexes
- Traits evolved:
helpfulness: 0.55,conciseness: 0.55 - Bond level:
acquaintanceafter 4 interactions - Knowledge graph:
Alex → works_at → Startup,TaskApp → uses → FastAPI
Personality Traits
Section titled “Personality Traits”9 traits that evolve bidirectionally based on user interactions:
| Trait | Positive signals | Negative signals |
|---|---|---|
| Humor | ”haha”, “funny”, “lol" | "be serious”, “no jokes” |
| Empathy | ”thank you”, “appreciate" | "don’t care”, “whatever” |
| Curiosity | ”interesting”, “tell me more" | "boring”, “skip” |
| Creativity | ”creative”, “innovative" | "just do the normal thing” |
| Helpfulness | ”helpful”, “perfect" | "useless”, “not helpful” |
| Honesty | ”honest”, “straightforward" | "misleading”, “fake” |
| Conciseness | ”concise”, “to the point" | "elaborate”, “more detail” |
| Formality | ”formal”, “professional" | "casual”, “chill” |
| Directness | ”straight to the point" | "gentle”, “diplomatically” |
Negative signals are weighted 33% heavier to prevent one-way trait inflation. Traits decay toward 0.5 (neutral) with a 30-day half-life.
Bond Evolution
Section titled “Bond Evolution”Relationships grow logarithmically through 6 stages:
| Stage | Threshold | Description |
|---|---|---|
| Stranger | 0.00 | No established relationship |
| Acquaintance | 0.15 | Basic familiarity |
| Familiar | 0.35 | Regular interaction |
| Companion | 0.55 | Comfortable working relationship |
| Trusted | 0.75 | Deep trust, anticipates needs |
| Bonded | 0.90 | Strong mutual understanding |
Milestones are tracked at 1, 5, 10, 25, 50, 100, 250, and 500 interactions. Bonds decay after 60 days of inactivity.
Architecture
Section titled “Architecture”┌─────────────────────────────┐│ Cortex │ Agent-facing API│ traits, bonds, context │├─────────────────────────────┤│ YantrikDB │ Storage engine│ Vector · Graph · Temporal ││ Decay Heap · KV │└─────────────────────────────┘ Single SQLite fileCortex is the brain layer. YantrikDB is the memory layer. Together they give agents persistent, evolving intelligence with zero external dependencies.