Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

TypeScript SDK

The TypeScript SDK communicates with Mnemo via MCP STDIO, spawning the mnemo binary as a child process.

Installation

npm install @mndfreek/mnemo-sdk

Usage

import { MnemoClient } from '@mndfreek/mnemo-sdk';

const client = new MnemoClient({
  dbPath: 'agent.db',
  agentId: 'my-agent',
});

await client.connect();

// Store a memory
const result = await client.remember({
  content: 'User prefers dark mode',
  importance: 0.8,
  tags: ['preferences'],
});

// Recall memories
const memories = await client.recall({
  query: 'user preferences',
  limit: 5,
});

// Share with another agent
await client.share({
  memory_id: result.id,
  target_agent_id: 'agent-2',
  permission: 'read',
});

// Verify integrity
const verification = await client.verify({
  agent_id: 'my-agent',
});
console.log(`Chain valid: ${verification.valid}`);

await client.close();

API Reference

Constructor Options

OptionTypeDefaultDescription
commandstring"mnemo"Path to mnemo binary
dbPathstring"mnemo.db"Database file path
agentIdstring"default"Default agent ID
orgIdstring-Organization ID
openaiApiKeystring-OpenAI API key for embeddings
dimensionsnumber1536Embedding dimensions

Methods

All methods return promises and correspond to MCP tools:

  • remember(input) / recall(input) / forget(input)
  • share(input) / checkpoint(input) / branch(input)
  • merge(input) / replay(input) / verify(input) / delegate(input)