About This Book
The MentisDB Agent Memory Cookbook is a practical guide to using MentisDB as the memory layer for AI agents, LLM applications, and multi-agent systems.
Every pattern is grounded in a real production use case. Code is runnable, tests are included, and benchmarks where available. The book is opinionated: it favors durability, auditability, and recall over raw speed or compactness.
Table of Contents
- 0.1 Why Agent Memory Matters
- 0.2 MentisDB Mental Model
- 0.3 Quickstart: Your First Memory
- 0.4 The Search-First Discipline
- 0.5 What We Learned Writing This Book — dogfooding lessons
- 1.0 Operator Playbook for Coding Agents — prompts, timing, memory quality, checkpoints, and MCP habits
- OpenCode Deep Guide — current harness, local MCP + skill store primer
- Claude Code — CLI MCP setup and operating loop
- Codex — MCP setup and memory-use prompts
- 1.1 Episodic Task Memory
- 1.2 Semantic Fact Extraction
- 1.3 Multi-Agent Handoff
- 1.4 Long-Running Project Memory
- 1.5 RAG Over Agent History
- 1.6 Preference Learning
- 1.7 Error and Mistake Memory
- 2.1 Semantic Compression
- 2.2 Cross-Session Continuity
- 2.3 Dynamic Skill Loading
- 2.4 Federated Team Memory
- 2.5 Webhook-Driven Workflows
- 3.1 Embedding Provider Selection
- 3.2 Vector Sidecar Management
- 3.3 Retrieval Tuning
- 3.4 Benchmarking Your Memory
- 3.5 Deployment Patterns
- 4.1 OpenCode — current harness, local MCP + skill store primer
- 4.2 Claude Code (CLI) —
claude mcp addsetup, skill priming - 4.3 Claude Desktop — stdio MCP config for the desktop app
- 4.4 Codex (OpenAI CLI) —
~/.codex/config.tomlMCP setup - 4.5 Hermes (Nous Research) — native
MemoryProvider - 4.6 Cursor — IDE MCP +
.cursorrulespriming - 4.7 Continue.dev — open-source IDE assistant
- 4.8 Cline & Aider — VS Code extension and CLI tool
- 4.9 Zed, Windsurf, Other MCP Clients — generic patterns
- 5.1 Rust: Minimal Agent with Memory — 50-line example
- 5.2 Python: LangChain + MentisDB —
MentisDbMemorybuffer - 5.3 Python: Custom Agent with pymentisdb — direct client, no framework
- 5.4 TypeScript: MCP Client Integration — stdio + HTTP transports
- 5.5 Daily Standup Memory — save team updates through your MCP-connected harness
- 5.6 Dashboard: Memory Archaeology — search, filter, graph traverse
How to read this book
If you're new to MentisDB, read Part 0 in order. It builds the mental model and gets you to a working memory in under five minutes.
If you use coding agents through MCP, read 1.0 Operator Playbook next. It teaches what to prompt, when to search, what to save, what to skip, and how to make memory compound across OpenCode, Codex, Claude Code, and similar harnesses.
Local MentisDB is fine for learning and solo work. For teams, the recommended setup is a shared HTTPS MCP server in the cloud or on your internal network, protected with bearer tokens, so every teammate and coding harness writes to the same durable memory.
If you're integrating MentisDB into an application or custom harness, continue into the core memory patterns and Part 5 code recipes. Part 3 is the engineering reference: embedding selection, tuning, benchmarking, and deployment.
Conventions
thought— a single durable memory record (a Decision, a Mistake, a Summary, etc.)chain— the append-only log of thoughts, hash-chained for integrityagent— a named writer to a chain; agents have their own identity, aliases, and optional keysscope—user(default, shared),session, oragentretrieval— ranked lexical + vector + graph hybrid, with optional RRF rerank