mirror of
https://github.com/hanzoai/agent.git
synced 2026-09-11 21:08:51 +00:00
An agent can now keep its memory in Hanzo Base, so its state sits in the same single binary as everything it runs beside: one record per scope and key, in one collection, visible in Base's own admin view while the agent is running. The collection ships as a schema to import rather than being built on first write — a client that writes its own schema can write the wrong one from a typo and then read nothing from the collection everyone else is looking at. The similarity search that every backend needs now exists once. The in-memory backend answered every search with an empty list, which is the one answer a caller cannot tell from "nothing was similar", and it holds the vectors already. Filters were honoured by nobody. Both read the same cosine and the same matcher now, so they cannot drift. A scope id is caller data and rides a quoted filter clause, so the order of escaping is load-bearing: backslashes double first, then quotes. The other order lets a value ending in a backslash escape the closing quote and end the literal where the caller chose. 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)"
|
|
]
|
|
}
|
|
]
|
|
}
|