# muhammadnaumantahir/mia architecture

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

- Interactive diagram: https://gitdiagram.com/muhammadnaumantahir/mia
- Repository: https://github.com/muhammadnaumantahir/mia

## Overview

Mia is a local-first personal AI companion, centered on a conversation workflow that connects user input to the Brain’s intent, context, routing, tool execution and verification stages, then returns a response with memory continuity. The repository also contains distinct capabilities for voice, computer access, personal-life workflows, self-programming, source analysis and evolution measurement. The README and source index establish the major product branches; where runtime wiring was not shown, the graph avoids asserting specific calls.

Main entry points: [`src/mia/brain/orchestrator.py`](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/brain/orchestrator.py) (Brain Workflow), [`src/mia/gateway/service.py`](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/gateway/service.py) (Model Gateway), [`src/mia/observatory/api.py`](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/observatory/api.py) (Evolution Observatory), [`src/mia/computer/tasks.py`](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/computer/tasks.py) (Computer Tasks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation Core"]
  node_voice["Voice I/O"]
  node_brain["Brain Workflow<br/>[orchestrator.py]"]
  node_intent["Intent Planning<br/>[intent.py]"]
  node_tool_broker["Tool Broker<br/>[broker.py]"]
  node_holo["Holographic UI<br/>[main.js]"]
end

subgraph group_models["AI Gateway"]
  node_gateway["Model Gateway<br/>[service.py]"]
  node_model_providers["Model Providers<br/>[providers.py]"]
  node_routing["Model Routing<br/>[routing.py]"]
end

subgraph group_memory["Memory Knowledge"]
  node_memory_store[("Conversation Memory<br/>[store.py]")]
  node_structured_memory[("Structured Memory<br/>[structured.py]")]
  node_knowledge["Document Knowledge"]
end

subgraph group_operations["Personal Operations"]
  node_computer_tasks[("Computer Tasks<br/>[tasks.py]")]
  node_approvals[("Action Approvals<br/>[approvals.py]")]
  node_computer_control["Computer Control<br/>[control.py]"]
  node_life_workflows["Life Workflows<br/>[workflows.py]"]
  node_research["Browser Research<br/>[research.py]"]
end

subgraph group_governance["Governed Evolution"]
  node_observatory["Evolution Observatory<br/>[api.py]"]
  node_codegraph["Mia Code Graph<br/>[indexer.py]"]
  node_capability_evolution["Capability Evolution<br/>[capabilities.py]"]
  node_sandbox_worker["Sandbox Validation<br/>[sandbox_worker.py]"]
  node_sps["SPS Layers<br/>[layers.py]"]
end

node_owner(("Owner"))

node_owner -->|"sends input"| node_brain
node_brain -->|"analyzes intent"| node_intent
node_brain -->|"discovers models"| node_gateway
node_brain -->|"gates tools"| node_tool_broker
node_brain -->|"uses memory"| node_memory_store
node_brain -->|"returns response"| node_owner
node_owner -->|"speaks or types"| node_voice
node_voice -.->|"provides input"| node_brain
node_brain -->|"requests inference"| node_gateway
node_gateway -->|"dispatches requests"| node_model_providers
node_gateway -->|"ranks candidates"| node_routing
node_computer_tasks -->|"checks approval"| node_approvals
node_computer_tasks -->|"checks control"| node_computer_control
node_life_workflows -.->|"offers research"| node_research
node_knowledge -->|"stores documents"| node_memory_store
node_holo -.->|"renders interaction"| node_owner
node_observatory -->|"exposes capability"| node_brain
node_observatory -->|"exposes graph"| node_codegraph
node_observatory -.->|"exposes lab"| node_capability_evolution
node_capability_evolution -.->|"validates candidate"| node_sandbox_worker
node_sps -.->|"defines layers"| node_brain

click node_voice "https://github.com/muhammadnaumantahir/mia/tree/main/src/mia/voice"
click node_brain "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/brain/orchestrator.py"
click node_intent "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/brain/intent.py"
click node_tool_broker "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/brain/broker.py"
click node_gateway "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/gateway/service.py"
click node_model_providers "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/gateway/providers.py"
click node_routing "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/gateway/routing.py"
click node_memory_store "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/memory/store.py"
click node_structured_memory "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/memory/structured.py"
click node_knowledge "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/knowledge/document_ingestion.py"
click node_computer_tasks "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/computer/tasks.py"
click node_approvals "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/computer/approvals.py"
click node_computer_control "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/computer/control.py"
click node_life_workflows "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/life/workflows.py"
click node_research "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/life/research.py"
click node_holo "https://github.com/muhammadnaumantahir/mia/blob/main/frontend/holo/src/main.js"
click node_observatory "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/observatory/api.py"
click node_codegraph "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/codegraph/indexer.py"
click node_capability_evolution "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/evolution/capabilities.py"
click node_sandbox_worker "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/evolution/sandbox_worker.py"
click node_sps "https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/sps/layers.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_voice,node_brain,node_intent,node_tool_broker,node_holo toneBlue
class node_gateway,node_model_providers,node_routing toneAmber
class node_memory_store,node_structured_memory,node_knowledge toneMint
class node_computer_tasks,node_approvals,node_computer_control,node_life_workflows,node_research toneRose
class node_observatory,node_codegraph,node_capability_evolution,node_sandbox_worker,node_sps,node_owner toneIndigo
```

## Components

### Conversation Core

- [Voice I/O](https://github.com/muhammadnaumantahir/mia/tree/main/src/mia/voice): `src/mia/voice`
- [Brain Workflow](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/brain/orchestrator.py): `src/mia/brain/orchestrator.py`
- [Intent Planning](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/brain/intent.py): `src/mia/brain/intent.py`
- [Tool Broker](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/brain/broker.py): `src/mia/brain/broker.py`
- [Holographic UI](https://github.com/muhammadnaumantahir/mia/blob/main/frontend/holo/src/main.js): `frontend/holo/src/main.js`

### AI Gateway

- [Model Gateway](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/gateway/service.py): `src/mia/gateway/service.py`
- [Model Providers](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/gateway/providers.py): `src/mia/gateway/providers.py`
- [Model Routing](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/gateway/routing.py): `src/mia/gateway/routing.py`

### Memory Knowledge

- [Conversation Memory](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/memory/store.py): `src/mia/memory/store.py`
- [Structured Memory](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/memory/structured.py): `src/mia/memory/structured.py`
- [Document Knowledge](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/knowledge/document_ingestion.py): `src/mia/knowledge/document_ingestion.py`

### Personal Operations

- [Computer Tasks](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/computer/tasks.py): `src/mia/computer/tasks.py`
- [Action Approvals](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/computer/approvals.py): `src/mia/computer/approvals.py`
- [Computer Control](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/computer/control.py): `src/mia/computer/control.py`
- [Life Workflows](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/life/workflows.py): `src/mia/life/workflows.py`
- [Browser Research](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/life/research.py): `src/mia/life/research.py`

### Governed Evolution

- [Evolution Observatory](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/observatory/api.py): `src/mia/observatory/api.py`
- [Mia Code Graph](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/codegraph/indexer.py): `src/mia/codegraph/indexer.py`
- [Capability Evolution](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/evolution/capabilities.py): `src/mia/evolution/capabilities.py`
- [Sandbox Validation](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/evolution/sandbox_worker.py): `src/mia/evolution/sandbox_worker.py`
- [SPS Layers](https://github.com/muhammadnaumantahir/mia/blob/main/src/mia/sps/layers.py): `src/mia/sps/layers.py`

### Other components

- **Owner**

## Connections

- Owner → Brain Workflow: sends input (evidence: `src/mia/brain/orchestrator.py`)
- Brain Workflow → Intent Planning: analyzes intent (evidence: `src/mia/brain/orchestrator.py`)
- Brain Workflow → Model Gateway: discovers models (evidence: `src/mia/brain/orchestrator.py`)
- Brain Workflow → Tool Broker: gates tools (evidence: `src/mia/brain/orchestrator.py`)
- Brain Workflow → Conversation Memory: uses memory (evidence: `src/mia/brain/orchestrator.py`)
- Brain Workflow → Owner: returns response (evidence: `src/mia/brain/orchestrator.py`)
- Owner → Voice I/O: speaks or types (evidence: `README.md`)
- Voice I/O → Brain Workflow: provides input (evidence: `README.md`)
- Brain Workflow → Model Gateway: requests inference (evidence: `src/mia/brain/orchestrator.py`)
- Model Gateway → Model Providers: dispatches requests (evidence: `src/mia/gateway/service.py`)
- Model Gateway → Model Routing: ranks candidates (evidence: `src/mia/gateway/service.py`)
- Computer Tasks → Action Approvals: checks approval (evidence: `src/mia/computer/tasks.py`)
- Computer Tasks → Computer Control: checks control (evidence: `src/mia/computer/tasks.py`)
- Life Workflows → Browser Research: offers research
- Document Knowledge → Conversation Memory: stores documents (evidence: `src/mia/knowledge/document_ingestion.py`)
- Holographic UI → Owner: renders interaction (evidence: `README.md`)
- Evolution Observatory → Brain Workflow: exposes capability (evidence: `src/mia/observatory/api.py`)
- Evolution Observatory → Mia Code Graph: exposes graph (evidence: `src/mia/observatory/api.py`)
- Evolution Observatory → Capability Evolution: exposes lab (evidence: `README.md`)
- Capability Evolution → Sandbox Validation: validates candidate
- SPS Layers → Brain Workflow: defines layers (evidence: `README.md`)
