The same operation is available as
atomicmemory package in the CLI and as the memory_package tool via the Model Context Protocol (MCP) server. All three surfaces share the same underlying logic.POST /v1/memories/consolidate
Consolidation retrieves relevant memories from the specified scope, optionally filtered by a topic query, and compresses them into a coherent context string within the requested token budget. The engine applies tiered compression (L0/L1/L2) to fit as much relevant context as possible while staying under the budget.Request
POST /v1/memories/consolidate
The scope to consolidate memories from. At least one of the following keys must be present:
An optional topic or question to focus the consolidation. When provided, the engine biases memory selection toward content relevant to this query, producing a more targeted context string. When omitted, the engine selects broadly across all memories in scope.
The maximum number of tokens the output
context string may contain. The engine will not exceed this limit. Lower values produce shorter, more compressed context; higher values allow more detail to be preserved.Example Request
Response
A ready-to-use context string containing the consolidated memories, formatted for direct injection into a model prompt. The string fits within the requested
tokenBudget.The list of memory IDs that were included in the consolidated context. Use this to trace which source records contributed to the output.
The approximate token count of the returned
context string.Example Response
Using the Context String
Inject thecontext string as a system message at the beginning of your model call to ground the response in what the agent already knows about the user: