Brain — memory & telepathy
The brain is Vero’s structured agent memory. Not a vector index with a logo — five first-class scopes (semantic, episodic, graph, tasks, working) with hybrid retrieval, token budgeting, and live subscriptions. Agents coordinate by writing into the brain; other agents subscribe and react. No direct agent-to-agent messages.
Scopes
semantic— long-term facts (“Drew prefers concise updates”)episodic— compressed moments with temporal decay (30-day half-life)graph— entities and relationships (Apache AGE)tasks— queryable task state (pending/in-progress/blocked/done)working— current-session scratch
Write
await veroai.brain.write({
agentId: "transcript-agent",
scope: "episodic",
key: "call_8291:transcript:chunk_4",
value: { lang: "he", text: "שלום, אני מתקשר…" },
tags: ["call", "hebrew", "inbound"],
ttl: 60 * 60 * 24 * 30, // 30 days
});Read by key
const entry = await veroai.brain.read({
agentId: "transcript-agent",
scope: "episodic",
key: "call_8291:transcript:chunk_4",
});
// entry is null if the key doesn't exist or has expired.Query (hybrid search + budget)
query() runs hybrid vector + BM25 search, applies temporal decay to episodic entries, MMR re-ranks for diversity, and assembles context within the token budget. The returned context is ready to drop into a system prompt.
const { entries, context } = await veroai.brain.query({
agentId: "coordinator",
q: "what does david cohen prefer on claim escalations",
budget: 2000,
tags: ["customer-pref"],
});
console.log(context); // priority-ordered, within 2000 tokens.Subscribe (the telepathy primitive)
subscribe() opens an SSE stream that yields a BrainEvent any time someone writes into the matched scope/prefix. This is how agents coordinate without sending each other messages.
const controller = new AbortController();
for await (const ev of veroai.brain.subscribe(
{
agentId: "sentiment-agent",
scope: "episodic",
keyPrefix: "call_8291:",
},
{ signal: controller.signal },
)) {
// ev.type is "write" | "delete" | "expire"
// ev.entry is the BrainEntry that changed
if (ev.type === "write") {
await scoreSentiment(ev.entry);
}
}Delete
await veroai.brain.delete(agentId, "episodic", "call_8291:transcript:chunk_4");Retrieval priority
When the runtime assembles context for the next LLM turn, it pulls from scopes in this order (override-able per agent):
tasksworkinggraph(relationships)semantic(facts)episodic(recent moments, decayed)