Price: $0.01 USDC
Consolidate automatically finds and merges semantically similar memories. It uses vector similarity to identify clusters of redundant memories and merges them via rule-based or LLM-powered strategies.
Request Body
All fields are optional. The API auto-discovers similar memory pairs.
Minimum cosine similarity threshold for clustering (0.5–1.0). Default: 0.85. Higher = stricter matching.
Merge strategy:
rule (default): Keep highest-importance memory, merge tags, soft-delete rest. Creates supersedes relationships.
llm: Synthesize a new memory from the cluster via LLM. Creates derived_from relationships.
Only consolidate memories in this namespace.
If true, return clusters that would be merged without actually merging. Default: false.
Response (200 OK)
Number of similar memory clusters found.
Number of memories that were soft-deleted (merged into others).
Number of new synthesized memories (LLM mode only).
Details of each cluster. IDs of memories in this cluster.
Average pairwise similarity within the cluster.
ID of the surviving/synthesized memory (absent in dry_run).
Example
curl -X POST https://api.memoclaw.com/v1/memories/consolidate \
-H "Content-Type: application/json" \
-d '{
"min_similarity": 0.85,
"mode": "rule",
"dry_run": true
}'
{
"clusters_found" : 2 ,
"memories_merged" : 3 ,
"memories_created" : 0 ,
"clusters" : [
{
"memory_ids" : [ "uuid-1" , "uuid-2" ],
"similarity" : 0.92 ,
"merged_into" : "uuid-1"
},
{
"memory_ids" : [ "uuid-3" , "uuid-4" , "uuid-5" ],
"similarity" : 0.87 ,
"merged_into" : "uuid-3"
}
]
}
In rule mode, the highest-importance memory survives and inherits tags from all merged memories. In llm mode, a new memory is synthesized that combines all unique information from the cluster.