mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
BaseMemoryBackend stores one record per scope and key in one collection, over
Base's /v1/collections/{name}/records. MEMORY.md and
agent_memory.collection.json create the collection.
Records use the scope names the control plane and the other SDKs use, so Go's
user scope is filed as actor. A create that loses a race to the unique index
updates the record that won: the last write wins.
The in-memory backend's similarity search returned nothing. It now ranks by
cosine and honours filters, through the same math as the Base store.
Co-authored-by: Hanzo Dev <[email protected]>
28 lines
1002 B
JSON
28 lines
1002 B
JSON
{
|
|
"collections": [
|
|
{
|
|
"name": "agent_memory",
|
|
"type": "base",
|
|
"listRule": null,
|
|
"viewRule": null,
|
|
"createRule": null,
|
|
"updateRule": null,
|
|
"deleteRule": null,
|
|
"fields": [
|
|
{ "name": "scope", "type": "text", "required": true, "max": 32 },
|
|
{ "name": "scope_id", "type": "text", "max": 255 },
|
|
{ "name": "mkey", "type": "text", "required": true, "max": 255 },
|
|
{ "name": "value", "type": "text", "max": 1048576 },
|
|
{ "name": "embedding", "type": "json", "maxSize": 1048576 },
|
|
{ "name": "metadata", "type": "json", "maxSize": 65536 },
|
|
{ "name": "created", "type": "autodate", "onCreate": true },
|
|
{ "name": "updated", "type": "autodate", "onCreate": true, "onUpdate": true }
|
|
],
|
|
"indexes": [
|
|
"CREATE UNIQUE INDEX idx_agent_memory_key ON agent_memory (scope, scope_id, mkey)",
|
|
"CREATE INDEX idx_agent_memory_scope ON agent_memory (scope, scope_id)"
|
|
]
|
|
}
|
|
]
|
|
}
|