Documentation Index Fetch the complete documentation index at: https://docs.memoclaw.com/llms.txt
Use this file to discover all available pages before exploring further.
Price: $0.01 USDC
Automatically assemble relevant memories into a context block ready for LLM prompts. This is useful for building AI assistants that need contextual memory.
Request Body
Natural language query describing what context is needed. Used to find relevant memories.
Maximum number of memories to include. Default: 10. Max: 100.
Target maximum tokens for the context. Default: 4000. Range: 100-16000.
Output format: text (plain text) or structured (JSON with metadata). Default: text.
Include memory metadata (tags, importance, type) in the output. Default: false.
Use LLM to summarize multiple similar memories into fewer entries. Default: false.
Response (200 OK)
The assembled context text or JSON.
Number of memories included in the context.
Approximate token count of the context.
Example
curl
JavaScript
Python
TypeScript
curl -X POST https://api.memoclaw.com/v1/context \
-H "Content-Type: application/json" \
-d '{
"query": "user preferences and project context",
"max_memories": 5,
"max_tokens": 2000,
"format": "text"
}'
{
"context" : "User preferences: \n - Prefers dark mode \n - Uses vim keybindings \n - Timezone: PST \n\n Project context: \n - Using PostgreSQL 15 with pgvector \n - Deploy to staging before production" ,
"memories_used" : 5 ,
"tokens" : 180
}
Response (structured format)
{
"context" : {
"memories" : [
{
"content" : "User prefers dark mode" ,
"importance" : 0.8 ,
"memory_type" : "preference" ,
"tags" : [ "ui" ],
"source" : "recall"
},
{
"content" : "Uses vim keybindings" ,
"importance" : 0.7 ,
"memory_type" : "preference" ,
"tags" : [ "editor" ],
"source" : "recall"
}
]
},
"memories_used" : 2 ,
"tokens" : 85
}