# raytolfas/rayseek architecture

> Architecture diagram of the GitHub repository raytolfas/rayseek, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raytolfas/rayseek
- Repository: https://github.com/raytolfas/rayseek

## Overview

RaySeek is a local AI assistant exposed through a command-line session and a small HTTP API. In the main workflow, it gathers conversation history and relevant indexed facts, then requests a response from a locally loaded language model; the CLI additionally offers web search, translation, and symbolic math. The repository also indexes text files into FAISS-backed memory. The README documents these capabilities, while the sampled source shows the call paths; external service behavior is represented only where referenced.

Main entry points: [`main.py`](https://github.com/raytolfas/rayseek/blob/main/main.py) (CLI session), [`api.py`](https://github.com/raytolfas/rayseek/blob/main/api.py) (HTTP API), [`memory_db.py`](https://github.com/raytolfas/rayseek/blob/main/memory_db.py) (Local indexing), [`model_loader.py`](https://github.com/raytolfas/rayseek/blob/main/model_loader.py) (Model loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI session<br/>[main.py]"]
  node_http_api["HTTP API<br/>[api.py]"]
end

subgraph group_workflow["Assistant workflow"]
  node_cli_math["Math solving<br/>[main.py]"]
  node_translation["Translation<br/>[main.py]"]
  node_translator_service["Translation service"]
  node_math_library["SymPy"]
end

subgraph group_knowledge["Knowledge and tools"]
  node_memory["Memory retrieval<br/>[memory_db.py]"]
  node_indexing["Local indexing<br/>[memory_db.py]"]
  node_brand_files["Brand text files"]
  node_faiss[("FAISS memory<br/>[memory_db.py]")]
  node_embedder["Embedding model"]
  node_web_search["Web search<br/>[search.py]"]
  node_search_provider["DDGS search"]
end

subgraph group_runtime["Model runtime"]
  node_model_loader["Model loader<br/>[model_loader.py]"]
  node_model_hub["Hugging Face Hub"]
  node_llm["Local LLM"]
end

node_user(("User"))

node_user -->|"enters commands"| node_cli
node_user -->|"sends chat"| node_http_api
node_cli -->|"indexes on startup"| node_indexing
node_cli -->|"loads engine"| node_model_loader
node_cli -->|"queries facts"| node_memory
node_cli -->|"searches query"| node_web_search
node_cli -->|"checks expression"| node_cli_math
node_cli -->|"translates text"| node_translation
node_cli -->|"requests completion"| node_llm
node_http_api -->|"indexes at startup"| node_indexing
node_http_api -->|"loads engine"| node_model_loader
node_http_api -->|"queries facts"| node_memory
node_http_api -->|"requests completion"| node_llm
node_indexing -->|"reads paragraphs"| node_brand_files
node_indexing -->|"adds vectors"| node_faiss
node_memory -->|"searches vectors"| node_faiss
node_memory -->|"embeds query"| node_embedder
node_indexing -->|"embeds text"| node_embedder
node_web_search -->|"requests results"| node_search_provider
node_model_loader -->|"downloads weights"| node_model_hub
node_model_loader -->|"constructs runtime"| node_llm
node_translation -->|"translates text"| node_translator_service
node_cli_math -->|"evaluates expression"| node_math_library

click node_cli "https://github.com/raytolfas/rayseek/blob/main/main.py"
click node_http_api "https://github.com/raytolfas/rayseek/blob/main/api.py"
click node_cli_math "https://github.com/raytolfas/rayseek/blob/main/main.py"
click node_translation "https://github.com/raytolfas/rayseek/blob/main/main.py"
click node_memory "https://github.com/raytolfas/rayseek/blob/main/memory_db.py"
click node_indexing "https://github.com/raytolfas/rayseek/blob/main/memory_db.py"
click node_brand_files "https://github.com/raytolfas/rayseek/tree/main/brand_data"
click node_faiss "https://github.com/raytolfas/rayseek/blob/main/memory_db.py"
click node_web_search "https://github.com/raytolfas/rayseek/blob/main/search.py"
click node_model_loader "https://github.com/raytolfas/rayseek/blob/main/model_loader.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_http_api,node_user toneBlue
class node_cli_math,node_translation,node_translator_service,node_math_library toneAmber
class node_memory,node_indexing,node_brand_files,node_faiss,node_embedder,node_web_search,node_search_provider toneMint
class node_model_loader,node_model_hub,node_llm toneRose
```

## Components

### User interfaces

- [CLI session](https://github.com/raytolfas/rayseek/blob/main/main.py): `main.py`
- [HTTP API](https://github.com/raytolfas/rayseek/blob/main/api.py): `api.py`

### Assistant workflow

- [Math solving](https://github.com/raytolfas/rayseek/blob/main/main.py): `main.py`
- [Translation](https://github.com/raytolfas/rayseek/blob/main/main.py): `main.py`
- **Translation service**
- **SymPy**

### Knowledge and tools

- [Memory retrieval](https://github.com/raytolfas/rayseek/blob/main/memory_db.py): `memory_db.py`
- [Local indexing](https://github.com/raytolfas/rayseek/blob/main/memory_db.py): `memory_db.py`
- [Brand text files](https://github.com/raytolfas/rayseek/tree/main/brand_data): `brand_data`
- [FAISS memory](https://github.com/raytolfas/rayseek/blob/main/memory_db.py): `memory_db.py`
- **Embedding model**
- [Web search](https://github.com/raytolfas/rayseek/blob/main/search.py): `search.py`
- **DDGS search**

### Model runtime

- [Model loader](https://github.com/raytolfas/rayseek/blob/main/model_loader.py): `model_loader.py`
- **Hugging Face Hub**
- **Local LLM**

### Other components

- **User**

## Connections

- User → CLI session: enters commands (evidence: `README.md`)
- User → HTTP API: sends chat (evidence: `README.md`)
- CLI session → Local indexing: indexes on startup (evidence: `main.py`)
- CLI session → Model loader: loads engine (evidence: `main.py`)
- CLI session → Memory retrieval: queries facts (evidence: `main.py`)
- CLI session → Web search: searches query (evidence: `main.py`)
- CLI session → Math solving: checks expression (evidence: `main.py`)
- CLI session → Translation: translates text (evidence: `main.py`)
- CLI session → Local LLM: requests completion (evidence: `main.py`)
- HTTP API → Local indexing: indexes at startup (evidence: `api.py`)
- HTTP API → Model loader: loads engine (evidence: `api.py`)
- HTTP API → Memory retrieval: queries facts (evidence: `api.py`)
- HTTP API → Local LLM: requests completion (evidence: `api.py`)
- Local indexing → Brand text files: reads paragraphs (evidence: `memory_db.py`)
- Local indexing → FAISS memory: adds vectors (evidence: `memory_db.py`)
- Memory retrieval → FAISS memory: searches vectors (evidence: `memory_db.py`)
- Memory retrieval → Embedding model: embeds query (evidence: `memory_db.py`)
- Local indexing → Embedding model: embeds text (evidence: `memory_db.py`)
- Web search → DDGS search: requests results (evidence: `search.py`)
- Model loader → Hugging Face Hub: downloads weights (evidence: `model_loader.py`)
- Model loader → Local LLM: constructs runtime (evidence: `model_loader.py`)
- Translation → Translation service: translates text (evidence: `main.py`)
- Math solving → SymPy: evaluates expression (evidence: `main.py`)
