Skip to content

Latest commit

Β 

History

History
155 lines (134 loc) Β· 5.84 KB

File metadata and controls

155 lines (134 loc) Β· 5.84 KB

MemoryOS Architecture

Overview

MemoryOS is a local-first AI memory layer. All data stays on your machine.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Your Machine                          β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Browser    β”‚    β”‚     MemoryOS Backend :8765       β”‚  β”‚
β”‚  β”‚  Extension   │───▢│  FastAPI + SQLAlchemy (async)    β”‚  β”‚
β”‚  β”‚  (MV3, TS)   β”‚    β”‚  β”œβ”€β”€ SQLite + FTS5               β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β”œβ”€β”€ ChromaDB (cosine vectors)   β”‚  β”‚
β”‚                       β”‚  β”œβ”€β”€ sentence-transformers      β”‚  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚  └── Ollama / Groq / OpenAI     β”‚  β”‚
β”‚  β”‚  Dashboard   │───▢│                                  β”‚  β”‚
β”‚  β”‚  Next.js 14  β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”‚  :3000       β”‚                                           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚                       β”‚  ~/.memoryos/      β”‚               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚  memories.db       β”‚               β”‚
β”‚  β”‚  CLI         │───▢│  chroma/           β”‚               β”‚
β”‚  β”‚  memoryos    β”‚    β”‚  models/           β”‚               β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

Ingestion Pipeline

Extension detects new AI message
        β”‚
        β–Ό
Content hash deduplication
        β”‚
        β–Ό
Background SW batches (2s window)
        β”‚
        β–Ό
POST /api/v1/memories/bulk
        β”‚
        β–Ό
MemoryService.add()
   β”œβ”€β”€ Generate UUID
   β”œβ”€β”€ EmbeddingService.embed(content)        β†’ all-MiniLM-L6-v2
   β”œβ”€β”€ ChromaDB.add(id, embedding, metadata)
   β”œβ”€β”€ Summarizer.score_importance(content)
   β”œβ”€β”€ Summarizer.extract_entities(content)
   β”œβ”€β”€ SQLite INSERT (memories table)
   β”œβ”€β”€ SQLite INSERT (memories_fts FTS5)
   └── asyncio.create_task(background_summarize)   [if len > 500]

Retrieval Pipeline

Query: "what auth approach did I use?"
        β”‚
        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Hybrid Search             β”‚
β”‚                                   β”‚
β”‚  Semantic branch:                 β”‚
β”‚  query β†’ embed β†’ ChromaDB.query() β”‚
β”‚  β†’ top 20 by cosine similarity    β”‚
β”‚                                   β”‚
β”‚  Keyword branch:                  β”‚
β”‚  query β†’ FTS5 MATCH β†’ top 20     β”‚
β”‚                                   β”‚
β”‚  Merge + re-rank:                 β”‚
β”‚  score = 0.7Γ—semantic             β”‚
β”‚        + 0.3Γ—keyword              β”‚
β”‚        Γ— importance_score         β”‚
β”‚        Γ— recency_factor           β”‚
β”‚        Γ— pin_boost (1.5Γ— pinned)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        β–Ό
Top 10 results returned
        β”‚
        β–Ό
get_context() β†’ formatted string β†’ paste into AI

Database Schema

memories table

Column Type Description
id TEXT (UUID) Primary key
content TEXT Full conversation text
summary TEXT AI-generated 1-2 sentence summary
embedding_id TEXT ChromaDB vector ID
source ENUM chatgpt / claude / gemini / cursor / manual / api / cli
session_id TEXT (FK) Parent session
entities JSON Extracted entities
importance_score FLOAT 0.0 – 1.0
is_pinned BOOL Never auto-forgotten if true
is_forgotten BOOL Soft delete
created_at DATETIME Creation timestamp
accessed_at DATETIME Last access timestamp
access_count INT Number of retrievals

memories_fts (virtual FTS5)

Column Description
content Indexed full text
summary Indexed summary
id Unindexed reference

sessions table

Column Type Description
id TEXT (UUID) Primary key
source TEXT AI tool name
title TEXT Auto or manual title
summary TEXT Session summary
memory_count INT Number of memories
started_at DATETIME Session start
ended_at DATETIME Session end
url TEXT Source page URL

Vector Store

  • Engine: ChromaDB PersistentClient
  • Collection: memories (cosine similarity space)
  • Dimensions: 384 (all-MiniLM-L6-v2)
  • Metadata filters: source, is_forgotten
  • Storage: ~/.memoryos/chroma/

Embedding Model

Property Value
Model all-MiniLM-L6-v2
Dimensions 384
Max sequence 256 tokens
Size on disk ~90 MB
Speed ~50ms/query (CPU)
Requires internet First download only

Privacy

  • Zero external calls by default
  • Extension only communicates with localhost:8765
  • CORS restricted to chrome-extension:// and localhost
  • No telemetry, no analytics
  • See PRIVACY.md