The MentisDB Agent Memory Cookbook

Patterns and recipes for building AI agents that remember

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.

Who this is for: Most readers are regular users of coding agents like OpenCode, Codex, Claude Code, Cursor, or Claude Desktop. Start with the foundations, then read the Operator Playbook. Developers building custom harnesses can continue into the API and library patterns after that.

Table of Contents

Part 0 — Foundations
Start Here for Coding Agents — Operator Playbook
Part 1 — Core Memory Patterns
Part 2 — Advanced Patterns
Part 3 — Production Hardening
Part 4 — Agentic Harnesses Reference
Part 5 — Custom Agent Recipes (Copy-Paste Code)

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

Prerequisites: Rust 1.75+ for library examples, Python 3.10+ for the LangChain recipe, Node 20+ for the TypeScript recipe. All recipes assume you have a MentisDB chain initialized locally — see 0.3 for setup.