Skip to content

LimbicDB Integration Guide

Complete guide for integrating LimbicDB with AI assistants and platforms.


🎯 Quick Integration (5 Minutes)

For AI Assistants:

  1. Copy the System Prompt Template

    bash
    # English
    cp templates/system-prompt.en.md /path/to/your/ai/system-prompt.md
    
    # Chinese
    cp templates/system-prompt.zh-CN.md /path/to/your/ai/system-prompt.md
  2. Add to Your AI's Configuration

    • Paste the template content into your system prompt
    • Or reference it in your config file
  3. Restart Your AI

    • The AI will now have access to LimbicDB commands
  4. Test It

    bash
    limbicdb remember "Integration test successful"
    limbicdb recall "test"

🤖 Platform-Specific Guides

OpenClaw

  1. Add to OpenClaw Config

    Edit your OpenClaw configuration:

    json
    {
      "systemPrompt": {
        "append": "path/to/limbicdb/templates/system-prompt.zh-CN.md"
      }
    }
  2. Restart OpenClaw

    bash
    openclaw gateway restart
  3. Verify

    • Start a new session
    • Say something important
    • The AI should automatically store it

Method 2: MCP Server

  1. Configure MCP in OpenClaw

    Add to your OpenClaw config:

    json
    {
      "mcp": {
        "servers": [
          {
            "name": "limbicdb",
            "command": "npx",
            "args": ["limbicdb-mcp"],
            "cwd": "/path/to/workspace"
          }
        ]
      }
    }
  2. Restart OpenClaw

    bash
    openclaw gateway restart
  3. Use in Conversations

    • LimbicDB tools will appear automatically
    • AI can call them without manual commands

Claude Code

MCP Server Integration

  1. Create Claude Code Config

    Create or edit ~/.claude/settings.json:

    json
    {
      "mcpServers": {
        "limbicdb": {
          "command": "npx",
          "args": ["limbicdb-mcp"],
          "cwd": "/path/to/workspace"
        }
      }
    }
  2. Restart Claude Code

    bash
    claude
  3. Verify Tools

    • Type /tools in Claude Code
    • You should see LimbicDB tools listed

System Prompt Integration

  1. Copy Template

    bash
    cp templates/system-prompt.en.md ~/.claude/system-prompt.md
  2. Add to Claude Code Config

    json
    {
      "systemPrompt": "~/.claude/system-prompt.md"
    }

Codex (OpenAI)

System Prompt Only

Codex doesn't support MCP yet, so use system prompt:

  1. Copy Template Content

    bash
    cat templates/system-prompt.en.md
  2. Add to Your Codex Config

    • Paste into your system prompt configuration
    • Or add to your API call's system parameter
  3. Enable CLI Access

    • Ensure Codex can execute shell commands
    • Or use the Node.js API (see below)

Custom AI Platforms

CLI Mode

If your AI can execute shell commands:

bash
# Store memory
limbicdb remember "User preference: TypeScript"

# Retrieve memory
limbicdb recall "programming languages"

# Check conflicts
limbicdb conflicts

Example Integration Code:

javascript
async function storeMemory(content) {
  const { exec } = require('child_process');
  return new Promise((resolve, reject) => {
    exec(`limbicdb remember "${content}"`, (error, stdout, stderr) => {
      if (error) reject(error);
      else resolve(stdout);
    });
  });
}

async function retrieveMemory(query) {
  const { exec } = require('child_process');
  return new Promise((resolve, reject) => {
    exec(`limbicdb recall "${query}"`, (error, stdout, stderr) => {
      if (error) reject(error);
      else resolve(stdout);
    });
  });
}

Node.js API

For direct integration:

javascript
import { open } from 'limbicdb';

// Open database
const db = open('./agent.limbic');

// Store memory
await db.remember('User prefers dark mode', {
  sessionId: 'current',
  scope: 'core'
});

// Retrieve memories
const memories = await db.recall('preferences', {
  limit: 10,
  scopes: ['core', 'session']
});

// Check conflicts
const conflicts = await db.conflicts();

// Close database
await db.close();

Installation:

bash
npm install limbicdb

Python API

python
from limbicdb import open as ldb_open

# Open database
with ldb_open('./agent.limbic') as db:
    # Store memory
    db.remember('User prefers dark mode')

    # Retrieve memories
    result = db.recall('preferences', limit=10)

    # Check conflicts
    conflicts = db.conflicts()

Installation:

bash
pip install limbicdb

🔧 Advanced Configuration

Database Location

By default, LimbicDB stores data in the current directory:

bash
# Default
./agent.limbic

# Custom location
limbicdb remember "test" --db /path/to/custom.limbic

Environment Variable:

bash
export LIMBICDB_PATH=/path/to/custom.limbic
limbicdb remember "test"

Memory Scopes

LimbicDB supports three scopes:

ScopeDescriptionUse Case
coreLong-term, persistentUser preferences, identity
sessionSession-specificCurrent conversation context
projectProject-specificProject-related memories

Example:

bash
# Core memory (always available)
limbicdb remember "User's name is Alex" --scope core

# Session memory (current conversation only)
limbicdb remember "Discussing README" --scope session

# Project memory (project-specific)
limbicdb remember "Using SQLite" --scope project

Session Management

bash
# List all sessions
limbicdb sessions

# Switch to specific session
limbicdb sessions switch <session-id>

# Archive old session
limbicdb sessions archive <session-id>

# Delete session
limbicdb sessions delete <session-id>

🎯 Best Practices

For AI Developers

DO ✅

  • Store immediately: When user shares important info, store it right away
  • Confirm storage: Tell the user "I've noted that..."
  • Check before answering: Query LimbicDB before answering questions about the past
  • Surface conflicts: Proactively point out contradictions
  • Use appropriate scopes: Core for identity, session for context, project for work

DON'T ❌

  • Don't store everything: Be selective about what's important
  • Don't retrieve without reason: Only query when relevant
  • Don't ignore conflicts: Address them when they appear
  • Don't assume you remember: Actually check LimbicDB
  • Don't expose technical commands: Keep CLI commands internal unless asked

Memory Storage Guidelines

Store These:

  • ✅ Personal preferences (likes, dislikes, favorites)
  • ✅ Projects and goals
  • ✅ Important dates and deadlines
  • ✅ Relationships (family, friends, colleagues)
  • ✅ Skills and expertise
  • ✅ Location/timezone
  • ✅ Health information (if shared)

Don't Store:

  • ❌ Casual conversation
  • ❌ Temporary context (use session scope instead)
  • ❌ Sensitive data (passwords, financial info)
  • ❌ Everything the user says

Conflict Resolution

When conflicts are detected:

  1. Inform the User

    "I notice there might be some conflicting information here.
    Earlier you mentioned X, but now you're saying Y.
    Which one is current?"
  2. Offer to Update

    "Would you like me to update the memory for you?"
  3. Use forget if Needed

    bash
    limbicdb forget <old-memory-id>
    limbicdb remember "new correct information"

📊 Integration Examples

Example 1: Personal Assistant AI

javascript
class PersonalAssistant {
  constructor() {
    this.db = await open('./assistant.limbic');
  }

  async handleMessage(message) {
    // Check for important info to store
    const importantInfo = this.extractImportantInfo(message);
    if (importantInfo) {
      await this.db.remember(importantInfo, { scope: 'core' });
      console.log(`I've noted that ${importantInfo}`);
    }

    // Check for questions about the past
    if (this.isPastQuestion(message)) {
      const query = this.extractQuery(message);
      const memories = await this.db.recall(query);
      return this.formatResponse(memories);
    }

    // Check for conflicts
    const conflicts = await this.db.conflicts();
    if (conflicts.length > 0) {
      return this.handleConflicts(conflicts);
    }

    // Normal response
    return this.generateResponse(message);
  }

  extractImportantInfo(message) {
    // Implement your logic here
    // Look for patterns like "I like", "I prefer", "My name is", etc.
  }

  isPastQuestion(message) {
    return /do you remember|did i|what did i|tell you about/i.test(message);
  }

  extractQuery(message) {
    // Extract the topic from the question
  }

  formatResponse(memories) {
    // Format memories as a natural response
  }

  handleConflicts(conflicts) {
    // Present conflicts to the user
  }
}

Example 2: Project Management AI

javascript
class ProjectAssistant {
  constructor(projectName) {
    this.db = await open(`./${projectName}.limbic`);
    this.projectName = projectName;
  }

  async startMeeting() {
    await this.db.remember(`Meeting started at ${new Date()}`, {
      sessionId: 'current',
      scope: 'session'
    });
  }

  async captureDecision(decision) {
    await this.db.remember(`Decision: ${decision}`, {
      sessionId: 'current',
      scope: 'project'
    });
  }

  async endMeeting() {
    const summary = await this.db.recall('', {
      sessionId: 'current',
      limit: 100
    });

    await this.db.archiveSession('current');
    
    return this.generateSummary(summary);
  }

  async getProjectHistory() {
    return await this.db.timeline(this.projectName);
  }
}

Example 3: Research Assistant AI

javascript
class ResearchAssistant {
  constructor() {
    this.db = await open('./research.limbic');
  }

  async readPaper(title, findings) {
    await this.db.remember(`Paper: ${title}`, { scope: 'project' });
    await this.db.remember(`Findings: ${findings}`, { scope: 'project' });
  }

  async findRelatedPapers(topic) {
    const memories = await this.db.search(topic);
    return memories.filter(m => m.content.includes('Paper:'));
  }

  async trackResearchProgress() {
    const timeline = await this.db.timeline('research');
    return this.generateProgressReport(timeline);
  }
}

🚨 Troubleshooting

AI Not Storing Memories

Problem: AI isn't calling limbicdb remember

Solutions:

  1. Check that the system prompt template is loaded
  2. Verify the AI has CLI execution permissions
  3. Add explicit instructions: "When the user shares important info, call limbicdb remember"

AI Not Retrieving Memories

Problem: AI isn't checking LimbicDB before answering

Solutions:

  1. Add to system prompt: "Before answering questions about the past, always call limbicdb recall"
  2. Test with explicit questions: "What did I tell you about X?"
  3. Check that the database file exists and has data

Conflicts Not Detected

Problem: Contradictory memories aren't flagged

Solutions:

  1. Ensure limbicdb conflicts is called regularly
  2. Check that memories are being stored with consistent keywords
  3. Verify the conflict detection logic is working

Database Not Found

Problem: "Database not found" error

Solutions:

bash
# Check current directory
pwd

# Specify database path
limbicdb remember "test" --db /full/path/to/agent.limbic

# Or set environment variable
export LIMBICDB_PATH=/full/path/to/agent.limbic

Permission Denied

Problem: "Permission denied" when running commands

Solutions:

bash
# Fix permissions
chmod +x /usr/local/bin/limbicdb
chmod +x /usr/local/bin/limbicdb-mcp

# Or reinstall
npm install -g limbicdb --unsafe-perm

📚 Additional Resources


🆘 Need Help?


Integration Guide Version: 1.0 | LimbicDB v2.1.1+

Released under the MIT License.