Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.compose.market/llms.txt

Use this file to discover all available pages before exploring further.

Manowar memory is built from a few plain services. MongoDB stores the records. Redis 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

StoreCollection or keyData
MongoDBmemoryVectors, durable facts, knowledge rows, archive summaries, workflow memory rows.
MongoDBsession_transcriptsFull user, assistant, system, and tool messages for a session.
MongoDBsessionsWorking memory buffers with a TTL index on expiresAt.
MongoDBpatternsRepeated tool sequences and procedural patterns.
MongoDBarchivesCompressed historical payloads and optional IPFS CIDs.
MongoDBskillsLearned skills promoted from validated patterns.
MongoDBmemory_jobsInline and Temporal maintenance job records.
Redisembedding:*, embedding:q:*24 hour embedding cache.
Redismemory:query:*Vector, graph, and layer query caches.
Redismemory:ns:*Scoped invalidation tokens.
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.
FieldMeaning
agentWalletRequired. The deployed agent or workflow wallet that owns the memory.
userAddressOptional user scope. Also accepted as user_id.
threadIdOptional short-term thread scope. Also accepted as thread_id, runId, or run_id.
modeglobal or local.
haiIdRequired when mode is local. Also accepted as hai_id.
filtersAllowlisted filters merged into Mongo and post-search checks.
metadataStored metadata, not a retrieval filter unless copied into filters.
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.
CollectionImportant indexes
memoryvectorId, agentWallet, agentWallet + createdAt, agentWallet + threadId, agentWallet + mode + haiId + threadId, userAddress, source, metadata.app_id, decayScore, lastAccessedAt.
session_transcriptsUnique sessionId, threadId, agentWallet, agentWallet + createdAt, agentWallet + mode + haiId + threadId, userAddress, metadata.app_id.
sessionssessionId, agentWallet, agentWallet + mode + haiId + threadId, metadata.app_id, TTL expiresAt, lastAccessedAt.
patternsagentWallet, patternId, agentWallet + patternType, trigger.type + trigger.value, successRate, lastExecuted, agentWallet + successRate, metadata.app_id.
archivesagentWallet, archiveId, agentWallet + createdAt, dateRange.start + dateRange.end, metadata.app_id.
skillsskillId, creator, trigger.type, successRate + usageCount, agents, category.
memory_jobsUnique jobId, agentWallet + createdAt, status + createdAt.
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 Redis namespace keys at several levels:
Namespace levelWhat changes
GlobalInvalidates every memory query cache if no agent scope is supplied.
AgentInvalidates all cached queries for one agentWallet.
Mode and HAIInvalidates local-mode caches for one HAI scope.
UserInvalidates durable user-scoped caches.
ThreadInvalidates hot short-term caches for one thread.
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

BoundaryBehavior
Agent turnframework.ts retrieves memory before execution and queues persistence after execution. Memory errors are logged and do not crash the agent turn.
Internal fact extractiongraph.ts calls ${API_URL}/v1/chat/completions with RUNTIME_INTERNAL_SECRET headers.
Embeddingsembedding.ts requires MONGO_DB_API_KEY and does not silently fall back to another embedder.
Rerankranking.ts uses Cloudflare only when credentials exist and the candidate set needs reranking. Failures fall back to decayed vector order.
Maintenancejobs.ts runs inline jobs; temporal/memory/service.ts runs Temporal jobs when execution: "temporal" is requested.