Memory scoping
If no workspace ID is provided, new memories are stored in a system-managed section of your primary workspace. 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 workspace ID when creating the memory.
To get a workspace ID, you can use Fabric's Workspaces API, which will issue a new workspace with UUID at creation time. Workspaces act as formal containers, keeping content separate and sandboxed.
First, create a new workspace:
import { Fabric } from "@fbrc/sdk";
const api = new Fabric({
apiKey: process.env.FABRIC_API_KEY,
});
const workspace = await api.workspace.create({
name: 'Project Alpha',
});
Then, use the returned workspace ID for creating scoped memories:
const memoryResponse = await api.memory.create({
source: 'text',
infer: false,
content: 'Project Alpha is focused on AI development.',
}, { workspaceId: workspace.id });