API reference: Memory lists every memory export and type, its options, and links to source and tests.
Three layers
| Layer | API | Use for |
|---|---|---|
| Facts | store.setFact(ns, key, value, ttlMs?) / store.getFact(ns, key) / store.listFacts(ns) | Namespaced JSON facts. Optional TTL. Last-write-wins. |
| Message history | store.createThread(ns, title?), store.listThreads(ns), store.saveMessage(msg), store.listMessages(threadId, limit), store.deleteMessages(threadId) | Ordered chat threads per agent or user; list/delete to compact history. |
| Maintenance | store.deleteExpiredFacts() plus processors | TTL cleanup and history compaction. |
store.listThreadsEffect, store.deleteMessagesEffect, etc.) for use inside an Effect pipeline.
Namespaces
workflow is scoped to a workflow definition; agent to an agent identity; user to an end user; global is shared across everything.
Task Memory Metadata
memory is preserved on the task descriptor as metadata for runtimes and integrations that layer memory behavior onto task execution. The direct store APIs above are the current public memory read/write surface.
Imperative get/set/delete inside a workflow
Thememory={{ recall, remember }} block above is declarative metadata; it is preserved on the task descriptor for runtimes that layer memory onto task execution, not an imperative call. To actually get, set, or delete a fact while a run is executing, build a store with createMemoryStore(db) and call it from inside a compute <Task> (a function task with no agent). The compute callback receives deps only; there is no injected store, so you create one:
store.setFactEffect(ns, key, value, ttlMs?), store.getFactEffect(ns, key), etc., or via MemoryService (MemoryServiceApi), which also exposes the underlying .store.
Processors
Maintenance jobs you run periodically:Inspect from the CLI
Notes
- Memory and task outputs are distinct stores. Don’t use memory for run-scoped state; it’s not transactional with the workflow’s frame commits.
- Working-memory writes are unordered. Use message history when sequence matters.