Skip to content

mnemo.store()

Store a memory.

Signature

typescript
mnemo.store(entry: {
  text: string;
  category?: MemoryCategory;
  importance?: number;
  scope?: string;
}): Promise<{ id: string }>

Example

typescript
const { id } = await mnemo.store({
  text: 'User prefers dark mode and minimal UI',
  category: 'preference',
  importance: 0.8,
  scope: 'global',
});

console.log(`Stored memory: ${id}`);

Parameters

FieldTypeDefaultDescription
textstringThe text content to remember
categoryMemoryCategory?"fact"Memory classification
importancenumber?0.7Importance score (0.0 – 1.0)
scopestring?"global"Scope for multi-agent isolation

Categories

typescript
type MemoryCategory = "preference" | "fact" | "decision" | "entity" | "other" | "reflection"
CategoryUse For
preferenceUser preferences, settings, likes/dislikes
factFactual information about the user or world
decisionDecisions made, choices, commitments
entityPeople, places, organizations
reflectionSession summaries, insights
otherAnything else

Behavior

  • Deduplication: If a very similar memory exists (>92% cosine similarity), the existing memory is updated instead of creating a duplicate.
  • Contradiction detection: If a conflicting memory is found, the old one is demoted.
  • Embedding: The text is automatically embedded using the configured provider.

Released under the MIT License.