SerialMemory Examples

November 26, 2025 ยท View on GitHub

Ready-to-run example projects demonstrating SerialMemory integration patterns.

Quick Start

  1. Start SerialMemory locally:

    ./dev-bootstrap.sh      # Linux/Mac
    .\dev-bootstrap.ps1     # Windows
    
  2. Run an example:

    # .NET
    cd examples/ai-second-brain/dotnet
    dotnet run
    
    # Node.js
    cd examples/ai-second-brain/node
    npm install && npm start
    

Available Examples

AI Second Brain

A persistent "second brain" for AI assistants. Demonstrates:

  • Storing notes, decisions, and learnings
  • Semantic search for relevant context
  • User persona management
  • Multi-hop knowledge graph traversal

Use cases: Personal AI assistant, knowledge management, decision logging

Project Context Memory

Project-specific memory isolation. Demonstrates:

  • Scoped memory per project/repository
  • Metadata-based filtering
  • Cross-project search when needed
  • Multi-tenant patterns

Use cases: IDE integration, development tools, multi-repo AI assistants

SDK Examples

Lower-level SDK usage examples are in the sdks/ directory:

Common Patterns

Memory Content Structure

Well-structured content improves search relevance:

[Category]: [Brief title]

Context:
[Background information]

Details:
[Main content]

Tags: tag1, tag2
Date: YYYY-MM-DD

Using Metadata

await client.ingest(content, {
  source: 'my-app',
  metadata: {
    type: 'decision',
    project: 'acme',
    importance: 'high',
    tags: ['architecture', 'database']
  }
});

Error Handling

try {
  const result = await client.search(query);
} catch (error) {
  if (error instanceof RateLimitExceededError) {
    await sleep(error.retryAfter);
    // retry
  } else if (error instanceof UsageLimitExceededError) {
    console.log('Upgrade plan or wait for reset');
  }
}

Environment Variables

All examples support these environment variables:

VariableDefaultDescription
SERIALMEMORY_URLhttp://localhost:5000API base URL
SERIALMEMORY_API_KEYdemo-keyAPI key for authentication

Need Help?