@halo-sdk/memory
v2.0.0
Published
Cache-aware long-term memory for Halo AI SDK — an append-only memory segment that stays inside the prefix cache until an explicit write
Maintainers
Readme
@halo-sdk/memory
Cache-aware long-term memory for Halo AI SDK.
Memory lives in a single cache segment placed before the volatile history tail, so it sits inside the prefix cache and stays byte-stable — and the cache stays warm — until an explicit write. remember() is append-only (keeps the existing cached prefix valid); forget() / clear() rebuild the block as a deliberate, attributable cache miss.
Usage
import { Halo } from "@halo-sdk/core";
import { MemoryStore } from "@halo-sdk/memory";
const memory = new MemoryStore();
memory.remember("The user prefers TypeScript.");
memory.remember("The user is in UTC+8.");
const agent = halo.agent({
/* ... */
});
agent.setContextSegments([memory.segment]);
// later
memory.recall(); // ["The user prefers TypeScript.", "The user is in UTC+8."]Each entry is its own message, so appends extend the block without touching earlier entries — the prefix up to the previous tail stays cached.
