Skip to main content
MemContext gives you two simple fields for organizing memory: scope and project. Use scope when your API key serves more than one user, tenant, organization, or workspace. Use project when you want to group related memories inside that scope. For Context Vault, there is one additional field: workspaceId. The workspace is the hard company/team boundary. scope is a hard lane inside that workspace. project is a soft grouping inside the selected scope.

Scope

scope is the isolation key. A search with one scope only returns memories saved with that same scope.
{
  "content": "User prefers concise release notes",
  "category": "preference",
  "scope": "user_123"
}
Good scope values are stable IDs from your own app, such as:
  • user_123
  • org_acme
  • workspace_42
  • tenant_kakiyo
If you omit scope, the memory belongs to the default area for that API key. Named scopes are not included unless you pass that scope again during search, update, delete, feedback, or history calls.

Project

project is a filter inside the selected scope. It is useful for product areas, repositories, support queues, or customer workspaces.
{
  "content": "This project uses PNPM",
  "category": "fact",
  "scope": "user_123",
  "project": "memcontext"
}
Projects are not meant for tenant isolation. If two customers must never see each other’s memories, put them in different scopes.

Context Vault Semantics

For company knowledge bases:
FieldMeaningExample
workspaceIdHard company, team, customer, or tenant boundaryacme_workspace_id
scopeHard lane inside the workspacehr, engineering, billing
projectSoft grouping inside the scopeonboarding, api-platform
Use scope when retrieving the wrong lane would be risky. Use project when you only need a helpful filter or collection label. Context Vault search also supports multi-scope retrieval with scopes.
GET /api/company-brain/search?workspaceId=...&query=trial&scopes=dev,billing
When scopes is provided, MemContext searches those named lanes inside the workspace. It does not search other workspaces.

Which Field Should I Use?

NeedUseExample
Separate end usersscopeuser_123
Separate customer tenantsscopetenant_acme
Separate internal workspacesscopeworkspace_support
Group a codebase, app, or workflowprojectdashboard, api, crm
Search all default memories for keyomit bothno scope, no project

Common Patterns

For a SaaS product:
await client.save({
  content: "Kakiyo uses Intercom-style support workflows",
  category: "fact",
  scope: "customer_kakiyo",
  project: "support",
});
For a coding assistant:
await client.save({
  content: "The dashboard package uses Next.js",
  category: "fact",
  project: "memcontext",
});
For a multi-tenant AI app, always pass the same scope on save and search:
const customerMemory = client.withScope("customer_kakiyo");

await customerMemory.save({
  content: "Kakiyo's support widget should answer in a concise tone",
  category: "preference",
});

const results = await customerMemory.search({
  query: "How should the support widget answer customers?",
});
See the TypeScript SDK for full usage.