Memory scoping
If no base ID is provided, new memories are stored in a system-managed section of your primary base. This is mostly suited for personal usage.
There may be situations were you want to robustly separate memories (for example, for different users, projects, or contexts). In this case, you must specify a base ID when creating the memory.
To get a base ID, you can use Exabase's Bases API, which will issue a new base with UUID at creation time. Bases act as formal containers, keeping content separate and sandboxed.
First, create a new base:
import { Exabase } from "@exabase/sdk";
const api = new Exabase({
apiKey: process.env.EXABASE_API_KEY,
});
const base = await api.bases.create({
name: 'Project Alpha',
});
curl https://api.exabase.io/v2/bases \
-X POST \
-H 'X-Api-Key: <EXABASE_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Project Alpha"
}'
Then, use the returned base ID for creating scoped memories:
const memoryResponse = await api.memories.create({
source: 'text',
infer: false,
content: 'Project Alpha is focused on AI development.',
}, { baseId: base.id });
curl https://api.exabase.io/v2/memories \
-X POST \
-H 'X-Api-Key: <EXABASE_API_KEY>' \
-H 'X-Exabase-Base-Id: <BASE_ID>' \
-H 'Content-Type: application/json' \
-d '{
"source": "text",
"infer": false,
"content": "Project Alpha is focused on AI development."
}'