# mansal02/fypproject architecture

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

- Interactive diagram: https://gitdiagram.com/mansal02/fypproject
- Repository: https://github.com/mansal02/fypproject

## Overview

MARIE is a privacy-first desktop assistant: a user interacts through its GUI, the assistant reasons over conversation and local knowledge, and it can respond with speech or execute desktop actions. Its other major capability is background learning from notes into searchable memory. The graph reflects README-described capabilities and relationships supported by the sampled excerpts or source index; unsampled implementation details are represented only where documented, and uncertain links are omitted.

Main entry points: [`aiassistant/frontend/main_gui.py`](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/frontend/main_gui.py) (Assistant GUI), [`aiassistant/backend/server_reasoning.py`](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/backend/server_reasoning.py) (Reasoning API), [`aiassistant/core/llm_core.py`](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/core/llm_core.py) (Agent orchestrator), [`aiassistant/infra/rag_memory.py`](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/rag_memory.py) (Local RAG)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop experience"]
  node_gui["Assistant GUI<br/>[main_gui.py]"]
  node_avatar["Live2D avatar<br/>[face.py]"]
end

subgraph group_reasoning["Reasoning and actions"]
  node_core["Agent orchestrator<br/>[llm_core.py]"]
  node_workers["Task workers<br/>[worker.py]"]
  node_tools["Desktop tools<br/>[tools_os.py]"]
  node_streaming["Stream utilities<br/>[streaming_utils.py]"]
  node_optimization["Model optimization<br/>[optimization.py]"]
end

subgraph group_knowledge["Memory and knowledge"]
  node_config["App configuration<br/>[app_config.py]"]
  node_database[("Session database")]
  node_docindex["Document indexer<br/>[doc_indexer.py]"]
  node_rag["Local RAG<br/>[rag_memory.py]"]
  node_embeddings["Embedding model<br/>[embeddings.py]"]
  node_memoryagent["Memory agent<br/>[memory_agent.py]"]
end

subgraph group_voice["Voice and avatar"]
  node_hearing["Speech recognition<br/>[hear.py]"]
  node_speech["Speech synthesis<br/>[voice.py]"]
  node_voicedb["Voice profiles<br/>[voice_db.py]"]
end

subgraph group_services["Backend services"]
  node_reasonserver["Reasoning API"]
  node_voiceserver["Voice API<br/>[server_voice.py]"]
end

node_user(("User"))
node_ollama["Ollama runtime"]
node_piper["Piper TTS"]
node_google["Google fallback"]

node_user -->|"interacts with"| node_gui
node_gui -->|"submits requests"| node_core
node_gui -->|"uses sessions"| node_database
node_gui -->|"uses indexing"| node_docindex
node_gui -->|"dispatches actions"| node_tools
node_gui -->|"loads preferences"| node_voicedb
node_gui -.->|"renders avatar"| node_avatar
node_core -->|"executes tools"| node_tools
node_core -->|"reads history"| node_database
node_core -->|"retrieves context"| node_rag
node_core -->|"delegates tasks"| node_workers
node_core -->|"uses optimization"| node_optimization
node_rag -->|"embeds content"| node_embeddings
node_rag -->|"reads database path"| node_database
node_rag -->|"queries memory"| node_memoryagent
node_memoryagent -->|"uses embeddings"| node_embeddings
node_database -->|"loads settings"| node_config
node_gui -->|"loads settings"| node_config
node_speech -->|"loads voice data"| node_voicedb
node_speech -->|"generates audio"| node_piper
node_voiceserver -->|"uses synthesis"| node_speech
node_reasonserver -->|"routes reasoning"| node_core
node_reasonserver -->|"uses streams"| node_streaming
node_reasonserver -->|"loads context"| node_rag
node_reasonserver -->|"uses sessions"| node_database
node_reasonserver -->|"uses optimization"| node_optimization
node_reasonserver -->|"requests inference"| node_ollama
node_reasonserver -.->|"optional fallback"| node_google
node_workers -->|"requests generation"| node_ollama
node_hearing -.->|"feeds recognized speech"| node_gui

click node_gui "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/frontend/main_gui.py"
click node_avatar "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/avatar/face.py"
click node_core "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/core/llm_core.py"
click node_workers "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/workers/worker.py"
click node_tools "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/tools/tools_os.py"
click node_streaming "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/backend/streaming_utils.py"
click node_config "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/config/app_config.py"
click node_database "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/db/database_manager.py"
click node_docindex "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/doc_indexer.py"
click node_rag "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/rag_memory.py"
click node_embeddings "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/embeddings.py"
click node_memoryagent "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/memory_agent.py"
click node_optimization "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/optimization.py"
click node_hearing "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/voice/hear.py"
click node_speech "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/voice/voice.py"
click node_voicedb "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/voice/voice_db.py"
click node_reasonserver "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/backend/server_reasoning.py"
click node_voiceserver "https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/backend/server_voice.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_gui,node_avatar,node_user toneBlue
class node_core,node_workers,node_tools,node_streaming,node_optimization toneAmber
class node_config,node_database,node_docindex,node_rag,node_embeddings,node_memoryagent toneMint
class node_hearing,node_speech,node_voicedb toneRose
class node_reasonserver,node_voiceserver,node_ollama,node_piper,node_google toneIndigo
```

## Components

### Desktop experience

- [Assistant GUI](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/frontend/main_gui.py): `aiassistant/frontend/main_gui.py`
- [Live2D avatar](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/avatar/face.py): `aiassistant/infra/avatar/face.py`

### Reasoning and actions

- [Agent orchestrator](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/core/llm_core.py): `aiassistant/core/llm_core.py`
- [Task workers](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/workers/worker.py): `aiassistant/workers/worker.py`
- [Desktop tools](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/tools/tools_os.py): `aiassistant/tools/tools_os.py`
- [Stream utilities](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/backend/streaming_utils.py): `aiassistant/backend/streaming_utils.py`
- [Model optimization](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/optimization.py): `aiassistant/infra/optimization.py`

### Memory and knowledge

- [App configuration](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/config/app_config.py): `aiassistant/infra/config/app_config.py`
- [Session database](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/db/database_manager.py): `aiassistant/infra/db/database_manager.py`
- [Document indexer](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/doc_indexer.py): `aiassistant/infra/doc_indexer.py`
- [Local RAG](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/rag_memory.py): `aiassistant/infra/rag_memory.py`
- [Embedding model](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/embeddings.py): `aiassistant/infra/embeddings.py`
- [Memory agent](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/memory_agent.py): `aiassistant/infra/memory_agent.py`

### Voice and avatar

- [Speech recognition](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/voice/hear.py): `aiassistant/infra/voice/hear.py`
- [Speech synthesis](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/voice/voice.py): `aiassistant/infra/voice/voice.py`
- [Voice profiles](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/infra/voice/voice_db.py): `aiassistant/infra/voice/voice_db.py`

### Backend services

- [Reasoning API](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/backend/server_reasoning.py): `aiassistant/backend/server_reasoning.py`
- [Voice API](https://github.com/mansal02/fypproject/blob/please-run-better/aiassistant/backend/server_voice.py): `aiassistant/backend/server_voice.py`

### Other components

- **User**
- **Ollama runtime**
- **Piper TTS**
- **Google fallback**

## Connections

- User → Assistant GUI: interacts with (evidence: `README.md`)
- Assistant GUI → Agent orchestrator: submits requests (evidence: `aiassistant/frontend/main_gui.py`)
- Assistant GUI → Session database: uses sessions (evidence: `aiassistant/frontend/main_gui.py`)
- Assistant GUI → Document indexer: uses indexing (evidence: `aiassistant/frontend/main_gui.py`)
- Assistant GUI → Desktop tools: dispatches actions (evidence: `aiassistant/frontend/main_gui.py`)
- Assistant GUI → Voice profiles: loads preferences (evidence: `aiassistant/frontend/main_gui.py`)
- Assistant GUI → Live2D avatar: renders avatar (evidence: `README.md`)
- Agent orchestrator → Desktop tools: executes tools (evidence: `aiassistant/core/llm_core.py`)
- Agent orchestrator → Session database: reads history (evidence: `aiassistant/core/llm_core.py`)
- Agent orchestrator → Local RAG: retrieves context (evidence: `aiassistant/core/llm_core.py`)
- Agent orchestrator → Task workers: delegates tasks (evidence: `aiassistant/core/llm_core.py`)
- Agent orchestrator → Model optimization: uses optimization (evidence: `aiassistant/core/llm_core.py`)
- Local RAG → Embedding model: embeds content (evidence: `aiassistant/infra/rag_memory.py`)
- Local RAG → Session database: reads database path (evidence: `aiassistant/infra/rag_memory.py`)
- Local RAG → Memory agent: queries memory (evidence: `aiassistant/infra/rag_memory.py`)
- Memory agent → Embedding model: uses embeddings (evidence: `aiassistant/infra/memory_agent.py`)
- Session database → App configuration: loads settings (evidence: `aiassistant/infra/db/database_manager.py`)
- Assistant GUI → App configuration: loads settings (evidence: `aiassistant/frontend/main_gui.py`)
- Speech synthesis → Voice profiles: loads voice data (evidence: `aiassistant/infra/voice/voice.py`)
- Speech synthesis → Piper TTS: generates audio (evidence: `aiassistant/infra/voice/voice.py`)
- Voice API → Speech synthesis: uses synthesis (evidence: `aiassistant/backend/server_voice.py`)
- Reasoning API → Agent orchestrator: routes reasoning (evidence: `aiassistant/backend/server_reasoning.py`)
- Reasoning API → Stream utilities: uses streams (evidence: `aiassistant/backend/server_reasoning.py`)
- Reasoning API → Local RAG: loads context (evidence: `aiassistant/backend/server_reasoning.py`)
- Reasoning API → Session database: uses sessions (evidence: `aiassistant/backend/server_reasoning.py`)
- Reasoning API → Model optimization: uses optimization (evidence: `aiassistant/backend/server_reasoning.py`)
- Reasoning API → Ollama runtime: requests inference (evidence: `aiassistant/backend/server_reasoning.py`)
- Reasoning API → Google fallback: optional fallback (evidence: `aiassistant/backend/server_reasoning.py`)
- Task workers → Ollama runtime: requests generation (evidence: `aiassistant/workers/worker.py`)
- Speech recognition → Assistant GUI: feeds recognized speech
