Skip to main content
Manowar memory is built from a few plain services. MongoDB stores the records. ValKey stores query and embedding caches. MongoDB’s AI gateway calls Voyage for embeddings. Cloudflare Workers AI reranks candidates when configured. The Compose API extracts facts. Temporal runs maintenance jobs when a job needs workflow semantics.

Component map

Agent turns use the hot path. Temporal uses the maintenance path. Both read and write the same memory collections.

Storage model

The same memory collection stores semantic rows and graph facts. Facts are rows with source: "fact" and metadata.layer: "graph". General semantic rows use source: "session", knowledge, pattern, or archive.

Scope

Memory calls start with a normalized scope. Durable vector search omits threadId from the Mongo filter. A durable fact from one thread can be recalled in another thread for the same agent/user scope. working and scene are the short-term, thread-scoped layers.

Mongo indexes

Mongo indexes are created from runtime/src/manowar/memory/types.ts when the memory client connects. Atlas vector search uses index name vector_index, path embedding, cosine similarity, and 1024 dimensions. Filter fields include agentWallet, userAddress, threadId, mode, haiId, scopeKind, scopeId, source, and selected metadata fields.

Cache invalidation

Memory caches use namespace tokens instead of chasing every cached query key. Writes increment ValKey namespace keys at several levels: Each query cache key includes the current namespace token. A write changes the token, so later reads miss old cache entries without needing a scan-and-delete pass.

Runtime boundaries