Skip to main content
MemContext gives your AI system a simple memory workflow:
  1. Save durable context.
  2. Search for relevant context before generating an answer.
  3. Use scopes to isolate users or tenants.
  4. Send feedback when results are helpful or wrong.
You do not need to manage deduplication, evolving facts, or retrieval quality yourself.

Save Memories

Use POST /api/memories, the TypeScript SDK, or MCP save_memory.
await client.save({
  content: "User prefers concise release notes.",
  category: "preference",
  scope: "user_123",
  project: "docs",
});
MemContext returns a status that tells you what happened:
StatusMeaning
savedA new memory was created
updatedA newer memory replaced an older one
extendedThe memory added detail to an existing fact
duplicateThe same memory already exists
acceptedA larger note was accepted for extraction
For large notes, use the returned jobId to track extraction.

Search Memories

Search before your app generates a response or makes a decision.
const results = await client.search({
  query: "How should release notes be written?",
  scope: "user_123",
  project: "docs",
});
Each result includes memory content, optional category/project information, and a relevance score.

Use Scopes For Isolation

Use scope as the hard boundary for your own users, tenants, accounts, or organizations.
const userMemory = client.withScope("user_123");
Only memories saved in that scope are searched when the same scope is provided. If you omit scope, MemContext searches only the unscoped memory lane. Use project for grouping inside a scope:
const projectMemory = userMemory.withProject("supportbot");

Handle Changing Information

You can save updated information without manually deleting old memories. Example:
  1. Save: User prefers long-form LinkedIn posts.
  2. Later save: User now prefers short hook-first LinkedIn posts.
MemContext can return the newer memory during search while preserving history for audit or debugging through the history endpoint.

Use Categories

Categories help you filter and reason about memory:
CategoryUse for
preferenceLikes, dislikes, style rules
factObjective information
decisionChoices that were made
contextGeneral background or state

Use Expiry For Temporary Facts

Set validUntil when a memory should stop being used after a specific time.
await client.save({
  content: "Sprint demo is on Friday.",
  category: "fact",
  validUntil: "2026-06-05T23:59:59Z",
});
Expired memories are excluded from search.
  1. Search MemContext with the current user or workspace context.
  2. Add the returned memories to your AI prompt.
  3. Generate the answer in your own app.
  4. Save any durable new preference, fact, or decision.
  5. Send feedback when retrieved memories were useful or wrong.