Memory
Durable and in-process memory adapters, conversation stores, and observational and working memory tiers for multi-turn agents.
Memory in @maniac-ai/agents is built on a small Memory protocol — save, load, search, and delete over namespaced MemoryRecord blobs. Higher-level stores (ConversationStore, ObservationStore, WorkingMemoryStore) encode conversation turns, compressed observations, and mutable profile docs on top of any adapter.
The Maniac app wires stores automatically and optionally layers observational memory (background compression of chat history), working memory (a single markdown profile doc), and a relevance filter (query-conditioned pruning of memory-tier prefix blocks).
Memory adapters
| Adapter | Import | Best for |
|---|---|---|
InMemoryMemory | @maniac-ai/agents | Tests, scripts, zero-setup quickstarts |
SqliteMemory | @maniac-ai/agents/memory/sqlite | Durable single-process storage (no extra npm deps) |
HonchoMemory | @maniac-ai/agents/memory/honcho | Honcho cloud session context + Dialectic (wraps a base adapter) |
VectorMemory | @maniac-ai/agents | Semantic search over observations via embeddings |
All adapters implement the same protocol defined in @maniac-ai/agents/schemas. Records are scoped with glob patterns (*, **) so agents can isolate threads and resources.
Quick start (durable chat)
import { Maniac } from "@maniac-ai/agents";
import { SqliteMemory } from "@maniac-ai/agents/memory/sqlite";
const memory = new SqliteMemory({ filename: "./agent-runtime.sqlite" });
await memory.setup();
const app = new Maniac({
memory,
agents: [{ id: "support", instructions: "Help users.", model }]
});
await app.chat("support", "thread-1", "Hello");setup() is idempotent — it creates the schema, indexes, and recommended SQLite pragmas (WAL, synchronous = NORMAL). Call memory.close() on shutdown when the adapter owns the file handle.
Memory tiers
Raw conversation history is only one layer. Maniac can splice additional system-message prefixes before each turn:
| Tier | Store | What it holds |
|---|---|---|
| Conversation | ConversationStore | Full message turns |
| Observational | ObservationStore | Compressed observation chunks and reflections |
| Working | WorkingMemoryStore | Single mutable markdown profile |
Optional memoryRelevanceFilter trims observation, reflection, and working-memory sections that are irrelevant to the current user query. Conversation history is never filtered.
Topics
- Adapters —
InMemoryMemory,SqliteMemory,HonchoMemory,VectorMemory - Stores —
ConversationStore,ObservationStore,WorkingMemoryStore - Observational & working memory — background compression,
remembertool, relevance filter
API reference
Generated TypeDoc pages: memory adapters, SqliteMemory, HonchoMemory.