Memory stores
ConversationStore, ObservationStore, and WorkingMemoryStore — typed persistence helpers on top of Memory.
Memory stores
Stores are thin, typed facades over the Memory protocol. They encode namespace conventions and record shapes so the runner and Maniac app do not manipulate raw MemoryRecord blobs directly.
import { ConversationStore, ObservationStore, WorkingMemoryStore } from "@maniac-ai/agents/memory";
import { SqliteMemory } from "@maniac-ai/agents/memory/sqlite";
const memory = new SqliteMemory({ filename: "./agent.db" });
await memory.setup();
const conversations = new ConversationStore(memory);
const observations = new ObservationStore(memory);
const workingMemory = new WorkingMemoryStore(memory);Maniac constructs these stores internally from its memory adapter. You can also use them directly in scripts, channel bots, or custom orchestration.
ConversationStore
Persists raw chat turns. Each turn is one MemoryRecord with content: { messages: Message[] } and a monotonic metadata.turn_index.
Namespace: agent:<agentId>/threads/<threadId>/messages
await conversations.saveTurn("support", "thread-1", [
{ role: "user", content: "What's my order status?" },
{ role: "assistant", content: "Checking now…" }
]);
const messages = await conversations.loadThread("support", "thread-1");
// flat Message[] across all turnsloadThread flattens turns in index order. clear bulk-deletes every turn in a thread.
ObservationStore
Persists observation chunks and reflections produced by observational memory, plus per-thread state (last_observed_index, activation cursors, etc.).
Namespaces:
| Kind | Path |
|---|---|
| Observations (thread) | agent:<id>/threads/<tid>/observations |
| Reflections (thread) | agent:<id>/threads/<tid>/reflections |
| State (thread) | agent:<id>/threads/<tid>/state |
| Observations (resource) | agent:<id>/resources/<rid>/observations |
| Reflections (resource) | agent:<id>/resources/<rid>/reflections |
Observations carry a status: "buffered" (not yet in the chat prefix) or "active" (spliced into the prefix as [Active observations] blocks).
Key methods:
await observations.saveObservation("agent", "thread", chunk, { resourceId: "user-42" });
await observations.updateObservationStatus("agent", "thread", obsId, "active");
const active = await observations.listObservations("agent", "thread", { status: "active" });
const reflections = await observations.listReflections("agent", "thread");
const hits = await observations.searchObservations("agent", "thread", {
text: "billing issue",
k: 5,
resourceId: "user-42"
});When the underlying Memory is wrapped in VectorMemory, searchObservations and searchReflections use semantic kNN automatically.
WorkingMemoryStore
A single mutable markdown document per scope — user preferences, goals, standing instructions. Mastra-style working memory.
Namespace:
- Thread scope:
agent:<id>/threads/<tid>/working_memory - Resource scope:
agent:<id>/resources/<rid>/working_memory
const doc = await workingMemory.load("agent", "thread", { resourceId: "user-42" });
// "" when missing
await workingMemory.save("agent", "thread", "# Profile\n\n- Prefers email support", {
resourceId: "user-42"
});
await workingMemory.clear("agent", "thread", { resourceId: "user-42" });The document is spliced into the chat prefix as a system message with a [Working memory] header. A background updater rewrites it after each turn when workingMemory is configured on Maniac. The built-in remember(note) tool appends bullets under a configurable ## Notes section.
Honcho store variants
When using HonchoMemory, Maniac swaps in:
HonchoConversationStore— loads thread context from Honchosession.context, mirrors writes to the base adapterHonchoWorkingMemoryStore— mirrors the working-memory doc to a Honcho peer card
Observation storage still uses the standard ObservationStore on the base adapter unless you configure otherwise.
Related stores
These use the same Memory adapter but live outside the conversation/observation/working tier:
| Store | Purpose |
|---|---|
RunCheckpointStore | Durable HITL checkpoints for channel bots (permissions docs) |
BackgroundTaskStore | Serialized background task records (background tasks) |