Skip to main content

Memory‑OS 🧠

PyPI version License: MIT

Memory‑OS is a local Personal Knowledge Operating System that syncs, indexes, and retrieves information across your GitHub repositories, emails, and Notion workspaces. It runs a unified interactive CLI, exposing hybrid keyword + semantic search and natural language QA powered by RAG, local embeddings, and a knowledge graph.


🏗️ Architecture

Memory-OS is built as a modular architecture consisting of ingestion, databases, scoring ranking engines, and a terminal user loop:

graph TD
    %% Ingestion
    subgraph Ingestion [1. Ingestion Layer]
        GH[GitHub Repos & Docs]
        GM[Gmail Inbox Messages]
        NT[Notion Page Contents]
        CP[Composio Integration Platform]
        GH --> CP
        GM --> CP
        NT --> CP
    end

    %% Storage & Indexing
    subgraph Storage [2. Storage & Indexing Layer]
        DB[(SQLite: workspace.db)]
        QD[(Qdrant: Qdrant Server)]
        N4J[(Neo4j Graph Database)]
        SQL_G[(SQLite Graph Fallback)]
        
        CP -->|Insert Metadata & Docs| DB
        DB -->|Text Chunks| CH[Chunking Core]
        CH -->|Local Embeddings| EM[SentenceTransformer]
        EM -->|Vectors| QD
        
        DB -->|Graph Construction| N4J
        DB -->|Graph Construction| SQL_G
    end

    %% Retrieval & RAG
    subgraph Retrieval [3. Retrieval & RAG Layer]
        HS[Hybrid Search Router]
        QD -->|Cosine Similarity| HS
        DB -->|Keyword Matching| HS
        N4J -->|Graph Lookups| HS
        SQL_G -->|Graph Fallback Lookups| HS
        
        HR[Hybrid Ranking Scoring]
        HS --> HR
        
        RAG[RAG Context Builder]
        HR -->|Merged Context| RAG
        
        LLM[Groq LLM Pipeline]
        RAG -->|Prompt Assembly| LLM
    end

    %% User Interaction
    subgraph User [4. Interface Layer]
        CLI[main.py: CLI Command Loop]
        CLI -->|Sync/Rebuild| Ingestion
        CLI -->|Search/Ask Queries| Retrieval
        LLM -->|Formatted Answer| CLI
    end

🗄️ Database Technology Rationale

Memory-OS adopts a multi-model storage engine strategy, selecting each technology to excel at its designated retrieve-and-rank role:

Database Selection Rationale
SQLite (workspace.db) Chosen for lightweight structured storage. It holds raw documents, chunk segments, email metadata, and repository statistics, providing ACID compliance and ultra-fast exact keyword searches.
Qdrant Chosen as a high-performance vector database optimized for storing and executing cosine similarity search queries on $384$-dimensional dense vector embeddings generated by Sentence-Transformers.
Neo4j / Fallback SQLite Neo4j is utilized as a native graph database to map complex developer relationships (e.g. Repository-[USES]->Technology or Email-[SENT_BY]->User). If Neo4j is unreachable, it seamlessly falls back to a relational SQLite graph schema, preserving search functionality offline.

🗄️ Workspace Structure

Memory-OS manages directories and configuration under the user's home folder (~/.memory-os/):

~/.memory-os/
├── config.toml                     # Global TOML settings configuration
├── active_profile                  # Stores name of the currently active profile
└── workspaces/
    ├── default/                    # Default workspace profile directory
    │   ├── workspace.db            # SQLite relational database
    │   ├── qdrant/                 # Qdrant local bind-mounted storage folder
    │   ├── neo4j/                  # Neo4j local bind-mounted storage folder
    │   ├── logs/                   # Log folder containing memory_os.log
    │   └── cache/                  # Chunker cache folder
    └── personal/                   # Personal workspace profile directory

📦 Setup & Installation

Ensure you have Python >= 3.12 and Docker + Docker Compose installed.

1. Install via pip

You can install Memory-OS directly as a package:

pip install .

This registers the CLI entry point executable memory-os on your path.

2. Run the Initialization Wizard

Kick off the interactive wizard to verify system dependencies, configure API keys, spin up containers, and pre-warm model weights:

memory-os init

🚀 CLI Commands Reference

Memory-OS exposes a comprehensive CLI for administration:

Core Daemon Lifecycle

  • memory-os start: Spins up Neo4j and Qdrant database services in the background using Docker Compose.
  • memory-os stop: Stops the database services while retaining data directories intact.

Operations & Ingestion

  • memory-os sync [--source SOURCE] [--rebuild]: Triggers incremental data imports from registered sources (GitHub, Gmail, Notion). Add --rebuild for full vector/graph resets.
  • memory-os ask <question>: Runs natural language queries against the RAG retrieval pipeline.
  • memory-os graph <repo>: Visualizes the relationships of an indexed repository in the terminal knowledge graph.

Diagnostics & Monitoring

  • memory-os doctor: Analyzes connection validation health across all endpoints and prints actionable troubleshooting tips on failure.
  • memory-os monitor: Displays aggregated data latencies (indexing speed, search rates, LLM times) by parsing system log traces.
  • memory-os benchmark: Performs query speed runs on keyword, semantic, hybrid searches, and RAG pipelines.
  • memory-os logs [--tail N]: Tails the running logs of Memory-OS (rotates at 5MB, up to 3 backups).

Configuration Management

  • memory-os config show: Displays the active key-value configuration block.
  • memory-os config get <key>: Fetches a nested key value (e.g. groq.model).
  • memory-os config set <key> <value>: Sets a nested key value with type validation checks.
  • memory-os config reset: Prompts and reverts all configurations to factory defaults.

Workspace Profile Profiles

  • memory-os workspace list: Lists all profiles (* marks active).
  • memory-os workspace create <name>: Allocates a new workspace folder tree.
  • memory-os workspace switch <name>: Switches the active profile context.
  • memory-os workspace delete <name>: Wipes profile folder directories.
  • memory-os workspace info: Displays detailed record metrics (nodes, vectors, sizes) for the active profile.

Portability (Export / Import)

  • memory-os export <backup-zip>: Compresses database schemas, configurations, and vector indices into a versioned zip package.
  • memory-os import <backup-zip>: Overwrites the active workspace profile using files from an export package after validating versions and model compatibility.

🔌 Plugin System Architecture

Memory-OS features a structured connector registry. Every connector implements BaseConnector (connectors/base.py) and is registered using the @register decorator (connectors/registry.py):

from connectors.base import BaseConnector
from connectors.registry import register

@register
class SlackConnector(BaseConnector):
    name = "Slack"
    slug = "slack"

    def authenticate(self) -> bool:
        # Check OAuth or API status
        return True

    def sync(self) -> dict:
        # Fetch channels and messages
        return {"synced": 42}

    def health(self) -> tuple[bool, str]:
        return True, "Connected"

To list registered plugins:

memory-os plugins

🛠️ Troubleshooting

  • Database Offline / Port conflicts: If Neo4j (ports 7474/7687) or Qdrant (port 6333) fails to start, modify port configurations:
    memory-os config set neo4j.port_http 7475
    memory-os config set qdrant.port 6334
    memory-os start
    
  • Failing Diagnostics: Run memory-os doctor to inspect status. It provides detailed actionable tips to address common environment issues.

📜 License

This project is licensed under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_memory_os-0.1.15.tar.gz (86.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_memory_os-0.1.15-py3-none-any.whl (87.8 kB view details)

Uploaded Python 3

File details

Details for the file cli_memory_os-0.1.15.tar.gz.

File metadata

  • Download URL: cli_memory_os-0.1.15.tar.gz
  • Upload date:
  • Size: 86.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for cli_memory_os-0.1.15.tar.gz
Algorithm Hash digest
SHA256 850399910c1fda4bbc357ecf50f910c09a24cf5f85d43c7c044c6a2ad5d92d87
MD5 08483e92d2820386c576c38e8395ed5c
BLAKE2b-256 25c29740f9f351b4374bde5a2e12c61c5d3a5c71d133ab1a1f426c3f30626209

See more details on using hashes here.

File details

Details for the file cli_memory_os-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: cli_memory_os-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 87.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for cli_memory_os-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 93a73402523ac30fb2d77b76e5fa50ef1d91fc6966bf4195c49783621af5e5e3
MD5 b57247affd9c8df3a99870402d4fce63
BLAKE2b-256 755914081ca7f38887c6b190c5f5fd237a9ca375d81b37c48a5b139b60629e39

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.17

2 files

0.1.16

2 files

This release

0.1.15 This release

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page