AgentStateClient.recall() to pull memories relevant to the incoming message and injects them into the system prompt. A storeMemory tool lets the model write new facts back to the store mid-stream. store/recall talk to the local ONEBRAIN engine over framed IPC — no network round-trip, no encryption key to manage in your route handler.
Installation
Next.js App Router API route
Createapp/api/chat/route.ts with the following implementation. It recalls memories relevant to the incoming message, streams a response with a storeMemory tool available, and lets the model call that tool to persist new facts at any point in the stream.
app/api/chat/route.ts
Environment variables
No environment variables are required forstore/recall — they need no endpoint or apiKey. If you also use @sovseal/sdk’s snapshot/restore for zero-knowledge state replication in the same route, add:
.env.local
How the data flow works
store/recall require the native host launcher at ~/.sovseal/native-host/run.sh. Run npx -y @sovseal/mcp-server once to provision it — see SDK Reference: Overview. Memories never leave your server process in plaintext form over the network either way — store/recall are local IPC calls, not HTTP requests.