Yantrikdb Server 标志

Yantrikdb Server

组织
yantrikos

Cognitive memory database for AI agents — consolidates duplicates, detects contradictions, fades stale memories via temporal decay. Rust, Apache-2.0, ships as library / MCP server / HTTP cluster.

发布者yantrikos
代码仓库yantrikdb-server
语言Rust
复刻数
14
星标数
175
可用工具
0
传输类型stdio
许可协议Apache-2.0
链接
  • 将工具接入 AI 工作流

    Yantrikdb Server 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 175 个星标和 14 个复刻。

YantrikDB

⚠ Correction notice (2026-04-19): Phase 3 benchmark writeups committed earlier today (docs/phase3a/, docs/phase3b/, docs/phase3c/, docs/phase3d/) used a Python simulator for the "structured memory" condition — NOT the actual yantrikdb engine. Rerun with real yantrikdb is in docs/phase3e/. Full audit trail, preliminary corrected numbers, and the exact publication gate for a findings post are in CORRECTIONS.md.

A memory database that forgets, consolidates, and detects contradictions.

Vector databases store memories. They don't manage them. After 10,000 memories, recall quality degrades because there's no consolidation, no forgetting, no conflict resolution. Your AI agent just gets noisier.

YantrikDB is different. It's a cognitive memory engine — embed it, run it as a server, or connect via MCP. It thinks about what it stores.

Shortest path to try it: MCP setup for Claude Code / Cursor / Windsurf → (one pip install, one config block).

The bigger picture: YantrikDB is the memory layer being built on the road to YantrikOS — an AI-native operating system where agents are first-class primitives, not apps on top. Memory was the bottleneck, so we're shipping it first.

Crates.io PyPI Docker DOI License: Apache 2.0

📄 New paper (May 2026): Skill as Memory, Not Document — measuring three failure modes when agent skill catalogs scale to 5,000 skills. Code + raw CSVs reproducible in benchmarks/skill_recall/.

YantrikDB demo: storing three facts, recalling them, then think() flagging a contradiction between two memories

99.9% token savings vs file-based memory

MemoriesFile-Based (CLAUDE.md)YantrikDBToken SavingsRecall Precision
1001,770 tokens69 tokens96%66%
5009,807 tokens72 tokens99.3%77%
1,00019,988 tokens72 tokens99.6%84%
5,000101,739 tokens53 tokens99.9%88%

At 500 memories, file-based memory exceeds 32K context. At 5,000, it doesn't fit in any model — not even 200K. YantrikDB stays at ~70 tokens per query. Precision improves with more data — the opposite of context stuffing.

Reproduce: the script lives in yantrikdb-mcp, not this repo -- git clone https://github.com/yantrikos/yantrikdb-mcp && cd yantrikdb-mcp && python benchmarks/bench_token_savings.py


Three things no other database does

1. It forgets

python
db.record("read the SLA doc by Friday", importance=0.4, half_life=86400)  # 1 day
# 24 hours later, this memory's relevance score has decayed
# 7 days later, recall stops surfacing it unless explicitly queried

2. It consolidates

python
# 20 similar memories about the same meeting
for note in meeting_notes:
    db.record(note, namespace="standup-2026-04-12")

db.think()
# → {"consolidation_count": 5}  # collapsed 20 fragments into 5 canonical memories

3. It detects contradictions

python
db.record("Acme is based in Boston.")
db.record("Acme is based in Denver.")   # added later, in another conversation

db.think()
# → {"conflicts_found": 1, ...}
db.get_conflicts()
# → [{"kind": "identity_fact", ...}]

Detection runs over the relations the extractor recognises — here a location relation, single-valued at any moment — not over arbitrary sentences. Two limits are worth knowing before you rely on it:

  • Claims are keyed by subject. "Alice is the CEO of Acme" and "Bob is the CEO of Acme" have different subjects with one value each, so nothing compares. The constraint here is inverse-functional — it lives on the object ("CEO of Acme" admits one filler) — and that direction is not modelled.
  • Copular attribute claims are off by default. "The logo is blue" → "The logo is green" needs ThinkConfig.extract_attribute_claims; without it the copular path never runs.

Both are tracked in #95.

Plus: temporal decay with configurable half-life, entity graph with relationship edges, personality derivation from memory patterns, session-aware context surfacing, multi-signal scoring (recency × importance × similarity × graph proximity).


What makes this different

YantrikDB isn't just storage with operations. The engine has a layer that makes agents feel less reactive:

  • Proactive triggers — the system surfaces what needs attention: pending conflicts, decaying important memories, approaching deadlines, patterns across domains. Agents don't have to ask what they should care about. The memory tells them.
  • Derived personality — stable tendencies extracted from memory patterns over time. "This user prefers X, reacts to Y, values Z." Informs default agent behavior across sessions.
  • Procedural memory — strategies that worked before get recorded and reinforced. Agents learn what to do, not just what they know.
  • Temporal awareness — stale surfaces important memories that haven't been touched recently. upcoming surfaces memories with approaching deadlines.

Full cognitive architecture lives in the standalone engine repo. This server repo focuses on deployment, HTTP API, and cluster operations.


Get started in 60 seconds — Claude Code / Cursor / Windsurf

The fastest adoption path. One pip install, one config block, and your agent gets persistent memory that auto-recalls on conversation start, auto-remembers decisions, and flags contradictions — without you prompting it.

bash
pip install yantrikdb-mcp

Add this to your MCP client config — typically ~/.claude.json or .mcp.json in your project for Claude Code, and the equivalent mcp block in settings for Cursor/Windsurf (Claude Code · Cursor · Windsurf):

json
{
  "mcpServers": {
    "yantrikdb": {
      "command": "yantrikdb-mcp"
    }
  }
}

That's it. No env vars. Uses a local SQLite memory file at ~/.yantrikdb/memory.db. First call auto-initializes the schema. Restart your client — the yantrikdb MCP server will show up with 15 memory tools (see below).

Want a shared memory across machines or teammates? Point at a YantrikDB cluster instead of local SQLite:

json
{
  "mcpServers": {
    "yantrikdb": {
      "command": "yantrikdb-mcp",
      "env": {
        "YANTRIKDB_SERVER_URL": "http://node1:7438,http://node2:7438",
        "YANTRIKDB_TOKEN": "ydb_your_database_token"
      }
    }
  }
}

Want it over HTTP/SSE instead of stdio? (For IDE integrations that don't support stdio MCP servers.)

json
{
  "mcpServers": {
    "yantrikdb": {
      "type": "sse",
      "url": "http://your-server:8420/sse",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}

Then start: yantrikdb-mcp --transport sse --port 8420.

The 15 MCP tools your agent gets

Tools
Core memoryremember · recall · forget · correct
Cognitionthink (consolidate + conflict-detect) · memory · trigger (proactive insights)
Knowledge graphgraph (entities + relations) · category
Conflicts & correctionsconflict (list + resolve contradictions)
Timesession · temporal (stale/upcoming queries)
Behaviorprocedure (strategies) · personality (derived traits)
Opsstats (engine health + diagnostics)

Full tool reference and agent-integration patterns: yantrikdb-mcp → · docs


Other ways to use it

As a network server (binary API + HA cluster)

bash
docker run -p 7438:7438 ghcr.io/yantrikos/yantrikdb:latest
curl -X POST http://localhost:7438/v1/remember -d '{"text":"hello"}'

Single Rust binary. HTTP + binary wire protocol. 2-voter + 1-witness HA cluster via Docker Compose or Kubernetes. Per-tenant quotas, Prometheus metrics, AES-256-GCM at-rest encryption, runtime deadlock detection. See docker-compose.cluster.yml and k8s manifests.

As an embedded library (Python or Rust)

bash
pip install yantrikdb
# or
cargo add yantrikdb
python
import yantrikdb
db = yantrikdb.YantrikDB("memory.db", embedding_dim=384)
db.set_embedder(SentenceTransformer("all-MiniLM-L6-v2"))
db.record("Alice leads engineering", importance=0.8)
db.recall("who leads the team?", top_k=3)
db.think()  # consolidate, detect conflicts, derive personality

Performance

Live numbers from a 2-core LXC cluster with 1689 memories:

OperationLatency
Recall p50112ms (most is query embedding ~100ms)
Recall p99190ms
Batch write76 writes/sec
Engine lock acquire<0.1ms
Deep health probe<1ms

For pre-computed embeddings (skip query-time embedding), recall p50 drops to ~5ms.


Status

v0.5.13 — hardened alpha + RFC 006 Phase 0 observability telemetry shipped. The embeddable engine has been used in production by the YantrikOS ecosystem since early 2026. The network server runs live on a 3-node Proxmox cluster with multiple tenants.

A 42-task hardening sprint just completed across 8 epics:

  • parking_lot mutexes everywhere with runtime deadlock detection (caught a self-deadlock that would have taken hours to find with std::sync)
  • Per-handler Prometheus metrics, structured JSON logging, deep health checks
  • Chaos-tested failover (leader kill, network partition, kill-9 mid-write)
  • Per-tenant quotas, load shedding, control plane replication
  • 1178 core tests + chaos harness + cargo-fuzz + CRDT property tests
  • 5 operational runbooks, watchdog with auto-restart

Read the maturity notes: https://yantrikdb.com/server/quickstart/#maturity

The Problem

Current AI memory is:

Store everything → Embed → Retrieve top-k → Inject into context → Hope it helps.

That's not memory. That's a search engine with extra steps.

Real memory is hierarchical, compressed, contextual, self-updating, emotionally weighted, time-aware, and predictive. YantrikDB is built for that.

Why Not Existing Solutions?

SolutionWhat it doesWhat it lacks
Vector DBs (Pinecone, Weaviate)Nearest-neighbor lookupNo decay, no causality, no self-organization
Knowledge Graphs (Neo4j)Structured relationsPoor for fuzzy memory, not adaptive
Memory Frameworks (LangChain, Mem0)Retrieval wrappersNot a memory architecture — just middleware
File-based (CLAUDE.md, memory files)Dump everything into contextO(n) token cost, no relevance filtering

Benchmark: Selective Recall vs. File-Based Memory

MemoriesFile-BasedYantrikDBToken SavingsPrecision
1001,770 tokens69 tokens96%66%
5009,807 tokens72 tokens99.3%77%
1,00019,988 tokens72 tokens99.6%84%
5,000101,739 tokens53 tokens99.9%88%

At 500 memories, file-based exceeds 32K context windows. At 5,000, it doesn't fit in any context window — not even 200K. YantrikDB stays at ~70 tokens per query. Precision improves with more data — the opposite of context stuffing.

Architecture

Design Principles

  • Embedded, not client-server — single file, no server process (like SQLite)
  • Local-first, sync-native — works offline, syncs when connected
  • Cognitive operations, not SQL — record(), recall(), relate(), not SELECT
  • Living system, not passive store — does work between conversations
  • Thread-safe — Send + Sync with internal Mutex/RwLock, safe for concurrent access

Five Indexes, One Engine

┌──────────────────────────────────────────────────────┐
│                   YantrikDB Engine                    │
│                                                      │
│  ┌──────────┬──────────┬──────────┬──────────┐       │
│  │  Vector  │  Graph   │ Temporal │  Decay   │       │
│  │  (HNSW)  │(Entities)│ (Events) │  (Heap)  │       │
│  └──────────┴──────────┴──────────┴──────────┘       │
│  ┌──────────┐                                        │
│  │ Key-Value│  WAL + Replication Log (CRDT)          │
│  └──────────┘                                        │
└──────────────────────────────────────────────────────┘
  1. Vector Index (HNSW) — semantic similarity search across memories
  2. Graph Index — entity relationships, profile aggregation, bridge detection
  3. Temporal Index — time-aware queries ("what happened Tuesday", "upcoming deadlines")
  4. Decay Heap — importance scores that degrade over time, like human memory
  5. Key-Value Store — fast facts, session state, scoring weights

Memory Types (Tulving's Taxonomy)

TypeWhat it storesExample
SemanticFacts, knowledge"User is a software engineer at Meta"
EpisodicEvents with context"Had a rough day at work on Feb 20"
ProceduralStrategies, what worked"Deploy with blue-green, not rolling update"

All memories carry importance, valence (emotional tone), domain, source, certainty, and timestamps — used in a multi-signal scoring function that goes far beyond cosine similarity.

Key Capabilities

Relevance-Conditioned Scoring

Not just vector similarity. Every recall combines:

  • Semantic similarity (HNSW) — what's topically related
  • Temporal decay — recent memories score higher
  • Importance weighting — critical decisions beat trivia
  • Graph proximity — entity relationships boost connected memories
  • Retrieval feedback — learns from past recall quality

Weights are tuned automatically from usage patterns.

Conflict Detection & Resolution

When memories contradict, YantrikDB doesn't guess — it creates a conflict segment:

"works at Google" (recorded Jan 15) vs. "works at Meta" (recorded Mar 1)
→ Conflict: identity_fact, priority: high, strategy: ask_user

Resolution is conversational: the AI asks naturally, not programmatically.

Semantic Consolidation

After many conversations, memories pile up. think() runs:

  1. Consolidation — merge similar memories, extract patterns
  2. Conflict scan — find contradictions across the knowledge base
  3. Pattern mining — cross-domain discovery ("work stress correlates with health entries")
  4. Trigger evaluation — proactive insights worth surfacing

Proactive Triggers

The engine generates triggers when it detects something worth reaching out about:

  • Memory conflicts needing resolution
  • Approaching deadlines (temporal awareness)
  • Patterns detected across domains
  • High-importance memories about to decay
  • Goal tracking ("how's the marathon training?")

Every trigger is grounded in real memory data — not engagement farming.

Multi-Device Sync (CRDT)

Local-first with append-only replication log:

  • CRDT merging — graph edges, memories, and metadata merge without conflicts
  • Vector indexes rebuild locally — raw memories sync, each device rebuilds HNSW
  • Forget propagation — tombstones ensure forgotten memories stay forgotten
  • Conflict detection — contradictions across devices are flagged for resolution

Sessions & Temporal Awareness

python
sid = db.session_start("default", "claude-code")
db.record("decided to use PostgreSQL")  # auto-linked to session
db.record("Alice suggested Redis for caching")
db.session_end(sid)
# → computes: memory_count, avg_valence, topics, duration

db.stale(days=14)    # high-importance memories not accessed recently
db.upcoming(days=7)  # memories with approaching deadlines

Full API

OperationMethods
Corerecord, record_batch, recall, recall_with_response, recall_refine, forget, correct
Knowledge Graphrelate, get_edges, search_entities, entity_profile, relationship_depth, link_memory_entity
Cognitionthink, get_patterns, scan_conflicts, resolve_conflict, derive_personality
Triggersget_pending_triggers, acknowledge_trigger, deliver_trigger, act_on_trigger, dismiss_trigger
Sessionssession_start, session_end, session_history, active_session, session_abandon_stale
Temporalstale, upcoming
Proceduralrecord_procedural, surface_procedural, reinforce_procedural
Lifecyclearchive, hydrate, decay, evict, list_memories, stats
Syncextract_ops_since, apply_ops, get_peer_watermark, set_peer_watermark
Maintenancerebuild_vec_index, rebuild_graph_index, learned_weights

Technical Decisions

DecisionChoiceRationale
Core languageRustMemory safety, no GC, ideal for embedded engines
ArchitectureEmbedded (like SQLite)No server overhead, sub-ms reads, single-tenant
BindingsPython (PyO3), TypeScriptAgent/AI layer integration
StorageSingle file per userPortable, backupable, no infrastructure
SyncCRDTs + append-only logConflict-free for most operations, deterministic
Thread safetyMutex/RwLock, Send+SyncSafe concurrent access from multiple threads
Query interfaceCognitive operations APINot SQL — designed for how agents think

Ecosystem

PackageWhatInstallSource
yantrikdb-mcpMCP server for Claude Code / Cursor / Windsurf — start herepip install yantrikdb-mcpGitHub · PyPI
yantrikdb-clientPython client SDK for the HTTP server (typed memory, reflect, character primitives)pip install yantrikdb-clientGitHub · PyPI
yantrikdb-serverHTTP + wire-protocol server, HA clusterdocker run ghcr.io/yantrikos/yantrikdbGitHub
yantrikdb (Rust)Embedded Rust enginecargo add yantrikdbGitHub
yantrikdb (Python)Python bindings via PyO3pip install yantrikdbGitHub
langchain-yantrikdbLangChain VectorStore + ChatMessageHistory with explainable recallpip install langchain-yantrikdbGitHub · PyPI
yantrikdb-hermes-pluginMemory provider for NousResearch/hermes-agent, with a reproducible recall benchmarkpip install yantrikdb-hermes-pluginGitHub · PyPI
yantrik-memoryFramework-agnostic Python memory layer — traits, bond evolution, knowledge graphpip install yantrik-memoryGitHub · PyPI
openclaw-memory-yantrikdbOpenClaw memory plugin — conflict-aware session briefings, recall with retrieval reasons, auto-captureopenclaw plugins install npm:@yantrikos/openclaw-memory-yantrikdbGitHub

Roadmap

  • V0 — Embedded engine, core memory model (record, recall, relate, consolidate, decay)
  • V1 — Replication log, CRDT-based sync between devices
  • V2 — Conflict resolution with human-in-the-loop
  • V3 — Proactive cognition loop, pattern detection, trigger system
  • V4 — Sessions, temporal awareness, cross-domain pattern mining, entity profiles
  • V5 — Multi-agent shared memory, federated learning across users

Research & Publications

📄 Skill as Memory, Not Document (May 2026)

Sarkar, P. (2026). Skill as Memory, Not Document: A Database-Native Substrate for Agent Skill Catalogs. Zenodo.

Per-query top-K=5 prompt-token cost vs catalog size (log-log). Full-catalog and full-metadata disclosure grow linearly past production context windows; YantrikDB top-K stays constant at ~369 tokens.

A measurement paper on what happens when LLM agent skill catalogs scale. On a 5,000-skill corpus:

  • Token cost: full-catalog disclosure consumes 919,200 tokens (exceeds Claude 3.7's 200K window). YantrikDB's indexed top-K disclosure: 369 tokens, constant in catalog size. The honest ratio against an indexed filesystem baseline is 1.49× — an ablation pinpoints the entire gap as YAML frontmatter overhead.
  • Latency: p50 = 87.3 ms, p95 = 106.3 ms at 5,000-skill scale, single-node.
  • Invalid-skill admission: YantrikDB rejects 70/70 adversarially-malformed skills (0%) at write time; a document-only baseline admits 68/70 (97%).

Three failure modes for filesystem-shaped skill catalogs (token burn, slowdown, invalid-skill admission). One unifying framing: skill catalogs for autonomous learning aren't documents; they're memory.

Code + scripts + raw CSVs are reproducible at benchmarks/skill_recall/. Full deposit (PDF + source + data + scripts) on Zenodo. Companion blog post: yantrikdb.com/papers/skill-substrate.

Earlier work

Author

Pranab Sarkar — ORCID · LinkedIn · developer@pranab.co.in

License

Apache-2.0. See LICENSE for the full text.

The MCP server is MIT-licensed.

将 Yantrikdb Server MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Yantrikdb Server 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 Yantrikdb Server 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Yantrikdb Server MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "yantrikdb-server": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Yantrikdb Server MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Yantrikdb Server MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Yantrikdb Server 帮我完成这项任务吗?
Yantrikdb Server
当然,我看过了。
以下是我使用 Yantrikdb Server 得到的结果。

常见问题

Yantrikdb Server MCP 服务器有什么用途?

Yantrikdb Server 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Yantrikdb Server MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 Yantrikdb Server。

为什么在 TypingMind 中使用 Yantrikdb Server MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 Yantrikdb Server 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Yantrikdb Server MCP 连接到 TypingMind?

Yantrikdb Server 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Yantrikdb Server MCP 在 TypingMind 中提供哪些工具?

Yantrikdb Server 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Yantrikdb Server MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 Yantrikdb Server 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇