Consolidate Memories
curl --request POST \
--url https://api.memoclaw.com/v1/memories/consolidate \
--header 'Content-Type: application/json' \
--data '
{
"min_similarity": 123,
"mode": "<string>",
"namespace": "<string>",
"dry_run": true
}
'import requests
url = "https://api.memoclaw.com/v1/memories/consolidate"
payload = {
"min_similarity": 123,
"mode": "<string>",
"namespace": "<string>",
"dry_run": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({min_similarity: 123, mode: '<string>', namespace: '<string>', dry_run: true})
};
fetch('https://api.memoclaw.com/v1/memories/consolidate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memoclaw.com/v1/memories/consolidate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'min_similarity' => 123,
'mode' => '<string>',
'namespace' => '<string>',
'dry_run' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.memoclaw.com/v1/memories/consolidate"
payload := strings.NewReader("{\n \"min_similarity\": 123,\n \"mode\": \"<string>\",\n \"namespace\": \"<string>\",\n \"dry_run\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.memoclaw.com/v1/memories/consolidate")
.header("Content-Type", "application/json")
.body("{\n \"min_similarity\": 123,\n \"mode\": \"<string>\",\n \"namespace\": \"<string>\",\n \"dry_run\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memoclaw.com/v1/memories/consolidate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"min_similarity\": 123,\n \"mode\": \"<string>\",\n \"namespace\": \"<string>\",\n \"dry_run\": true\n}"
response = http.request(request)
puts response.read_body{
"clusters_found": 123,
"memories_merged": 123,
"memories_created": 123,
"clusters": [
{
"clusters[].memory_ids": [
"<string>"
],
"clusters[].similarity": 123,
"clusters[].merged_into": "<string>"
}
]
}API Reference
Consolidate Memories
POST /v1/memories/consolidate — Auto-merge similar memories to reduce redundancy.
POST
/
v1
/
memories
/
consolidate
Consolidate Memories
curl --request POST \
--url https://api.memoclaw.com/v1/memories/consolidate \
--header 'Content-Type: application/json' \
--data '
{
"min_similarity": 123,
"mode": "<string>",
"namespace": "<string>",
"dry_run": true
}
'import requests
url = "https://api.memoclaw.com/v1/memories/consolidate"
payload = {
"min_similarity": 123,
"mode": "<string>",
"namespace": "<string>",
"dry_run": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({min_similarity: 123, mode: '<string>', namespace: '<string>', dry_run: true})
};
fetch('https://api.memoclaw.com/v1/memories/consolidate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memoclaw.com/v1/memories/consolidate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'min_similarity' => 123,
'mode' => '<string>',
'namespace' => '<string>',
'dry_run' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.memoclaw.com/v1/memories/consolidate"
payload := strings.NewReader("{\n \"min_similarity\": 123,\n \"mode\": \"<string>\",\n \"namespace\": \"<string>\",\n \"dry_run\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.memoclaw.com/v1/memories/consolidate")
.header("Content-Type", "application/json")
.body("{\n \"min_similarity\": 123,\n \"mode\": \"<string>\",\n \"namespace\": \"<string>\",\n \"dry_run\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memoclaw.com/v1/memories/consolidate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"min_similarity\": 123,\n \"mode\": \"<string>\",\n \"namespace\": \"<string>\",\n \"dry_run\": true\n}"
response = http.request(request)
puts response.read_body{
"clusters_found": 123,
"memories_merged": 123,
"memories_created": 123,
"clusters": [
{
"clusters[].memory_ids": [
"<string>"
],
"clusters[].similarity": 123,
"clusters[].merged_into": "<string>"
}
]
}
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.number
Minimum cosine similarity threshold for clustering (0.5–1.0). Default:
0.85. Higher = stricter matching.string
Merge strategy:
rule(default): Keep highest-importance memory, merge tags, soft-delete rest. Createssupersedesrelationships.llm: Synthesize a new memory from the cluster via LLM. Createsderived_fromrelationships.
string
Only consolidate memories in this namespace.
boolean
If
true, return clusters that would be merged without actually merging. Default: false.Response (200 OK)
number
Number of similar memory clusters found.
number
Number of memories that were soft-deleted (merged into others).
number
Number of new synthesized memories (LLM mode only).
array
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
}'
const response = await fetch("https://api.memoclaw.com/v1/memories/consolidate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
min_similarity: 0.85,
mode: "rule",
dry_run: true,
}),
});
const data = await response.json();
from memoclaw import MemoClaw
client = MemoClaw()
result = client.consolidate(min_similarity=0.85, mode="rule", dry_run=True)
Response
{
"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.