Skip to main content

Knowledge

client.knowledge provides access to the structured knowledge base built automatically from processed memories. As memories are created and enriched, Memsolus extracts facts and organizes them into categorized knowledge entries that represent what is known about each user.


list

Lists knowledge entries for a user or workspace. When merged: true, returns a single unified Markdown document combining all knowledge categories — the recommended way to load full user context at the start of a conversation.

Signature

client.knowledge.list(params?: ListKnowledgeInput): Promise<PaginatedResult<Knowledge> | MergedKnowledge>
ParameterTypeRequiredDescription
userIdstringNoFilter entries to a specific user
categorystringNoFilter entries to a specific category
mergedbooleanNoWhen true, returns MergedKnowledge instead of a paginated list
pagenumberNoPage number for paginated results (default 1)
limitnumberNoResults per page (default 20)

Loading the full user profile

Use merged: true at the start of a conversation to get the complete knowledge profile as a single Markdown document:

const profile = await client.knowledge.list({
userId: 'user_123',
merged: true,
});

// profile is MergedKnowledge when merged=true
console.log(profile.content);
// ## Tech Stack
// The user builds with Next.js and Supabase...
//
// ## Projects
// Currently working on a SaaS product for...
//
// ## Preferences
// Prefers TypeScript for all new projects...

console.log(profile.entries.length); // 3 — one entry per category
console.log(profile.mergedAt); // "2026-06-07T10:00:00.000Z"

Browsing individual entries

Use paginated listing when you want to inspect individual knowledge entries:

const page = await client.knowledge.list({
userId: 'user_123',
category: 'tech-stack',
page: 1,
limit: 10,
});

for (const entry of page.data) {
console.log(entry.category); // "tech-stack"
console.log(entry.content); // Markdown content for this category
console.log(entry.sourceMemoryIds); // ["9b1deb4d-...", "a4c7..."] — source memories
console.log(entry.createdAt); // "2026-06-07T09:30:00.000Z"
}

console.log(page.meta.total); // 3

Filtering by category

Categories correspond to the tags applied when memories are created. Common categories include tech-stack, preferences, projects, context, and any custom tags you define:

const projectKnowledge = await client.knowledge.list({
userId: 'user_123',
category: 'projects',
});

// Returns only knowledge entries tagged as "projects"

get

Retrieves a specific knowledge entry by its ID.

Signature

client.knowledge.get(params: { id: string }): Promise<Knowledge>

Example

const entry = await client.knowledge.get({
id: 'kn-uuid-here',
});

console.log(entry.id); // "kn-uuid-here"
console.log(entry.category); // "tech-stack"
console.log(entry.content); // Compiled Markdown for this category
console.log(entry.userId); // "user_123"
console.log(entry.sourceMemoryIds); // ["9b1deb4d-...", "a4c7..."]
console.log(entry.createdAt); // "2026-06-07T09:30:00.000Z"

Throws NotFoundError if the knowledge entry does not exist or does not belong to the workspace.


How knowledge is built

Knowledge entries are not created directly — they are derived automatically from memories after they are processed. When multiple memories share related facts, they are consolidated into a single knowledge entry per category per user. The content of each entry is a Markdown summary of everything known in that category.

This means:

  • You cannot create or update knowledge entries directly
  • Storing more memories with consistent categories produces richer knowledge entries
  • The merged profile grows more accurate over time as more memories are processed