Skip to content

Memory System Architecture Implementation Alternatives #387

@lucas-oma

Description

@lucas-oma

Clear and concise description of the problem

Please correct me if I'm wrong in any point

Looks like AIRI currently lacks a memory system for RAG. The existing DuckDB setup seems to only only creates a temporary table with no persistence or advanced memory functionality for web/app.

I intend to write a PR for this (if issue is approved)

Suggested solution / Ideas

Option 1: Standalone Memory-Core + Database Implementations

A shared TypeScript/JavaScript library (@proj-airi/memory-core) that provides database-agnostic memory operations, with platform-specific implementations for DuckDB (web) and PostgreSQL (desktop).

Pros:
  • Platform Flexibility: Each platform uses its optimal database (DuckDB for web, Postgres for rust/tauri app)
  • No Infrastructure: No servers needed for basic usage
Cons:
  • Data Isolation: Memories don't sync between platforms
  • Setup Complexity: Each platform needs database setup (code: classes, methods, etc)
  • Limited Sharing: Can't share memories across devices

Technical Requirements

Memory-Core Package (@proj-airi/memory-core):

  • Database-agnostic interfaces for memory operations
  • Shared consolidation and categorization logic
  • Common types and utilities
  • Platform-agnostic embedding service interface

DuckDB WASM Persistence (for web UI):

  • Configure DuckDB for IndexedDB storage
  • Implement database export/import for backup
  • Handle browser storage limits

PostgreSQL Integration (for rust/tauri base app):

Similar to what has been done for telegram-bot

  • Use the pgvector extension
  • Implement HNSW vector indexing
  • Handle local PostgreSQL setup

Alternative

Option 2: Docker Memory Service

A centralized memory service running in Docker that provides a shared memory backend for all AIRI applications (web, desktop, Discord bot, Telegram bot) through a REST API.

Pros:
  • Data Synchronization: Shared memories across all platforms (Web, desktop, Discord, Telegram, all share same memory if configured)
  • Centralized Management: Single source of truth/memory
  • Advanced Features: Full PostgreSQL + pgvector capabilities even for web app
  • Cloud Hosting: Can be hosted on personal server ( or Moeru's cloud in the future!) for shared memory across devices. Could also be useful for sharing across computers, and maybe smartphones in the future.
  • Consistency: All platforms use identical memory logic and features
  • Future-Proof: Easy to extend with new features for all platforms simultaneously
Cons:
  • Infrastructure Required: Needs server setup (user will have to run docker alongside the usual app)
  • Complexity: Docker setup and maintenance

Technical Requirements

Memory Service API:

  • REST API for memory operations
  • WebSocket support for real-time updates

Additional context

My preference: Option 2 - Docker Memory Service

Why Option 2?

One Update, All Platforms

  • Fix a memory bug? All platforms get the fix instantly
  • Add new memory features? Available everywhere immediately

Shared Memory Across Devices

  • Chat on web --> Continue on desktop --> Same memories
  • Discord bot knows your web conversations (if you decide to connect the same memory)

Advanced DB features

  • No platform restrictions: Not limited by browser storage, IndexedDB quotas, or web app constraints - can use any database technology

Multi-Persona Support (future feature?)

  • Instead of one AIRI with one memory, you can create multiple AIRI "personalities" each with their own separate memories.
  • Example: One for personal assistant (work focused), one for gaming, etc.

Questions for Community

  1. Which option do you prefer? Standalone or Docker service?
  2. Technical Priorities: What memory features are most important?

Tags: enhancement, memory-system, rag, architecture, database

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions