# crosleythomas/mirrorgpt architecture

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

- Interactive diagram: https://gitdiagram.com/crosleythomas/mirrorgpt
- Repository: https://github.com/crosleythomas/mirrorgpt

## Overview

MirrorGPT builds a personalized conversational agent from a subject’s data: sources are extracted, transformed into facts, loaded for retrieval, and queried during a chat session. The runtime also offers optional Gather JSON and human-input tools, plus voice input/output and voice cloning. Interview-based teaching is a documented capability but remains unimplemented: its entrypoint raises NotImplementedError and the agent is only a stub. ETL flow is documented in the README; some storage and integration details are therefore shown only where supported.

Main entry points: [`mirror/mirror_agent/agents/ChatConversationalWithTools.py`](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/mirror_agent/agents/ChatConversationalWithTools.py) (Tool-enabled agent), [`mirror/entrypoints/run_mirror.py`](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/entrypoints/run_mirror.py) (Chat entrypoint), [`mirror/data/extract/extract.py`](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/extract/extract.py) (Extract sources), [`mirror/data/transform/transform.py`](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/transform/transform.py) (Transform facts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data_prep["Profile Data Preparation"]
  node_extract["Extract sources<br/>[extract.py]"]
  node_transform["Transform facts<br/>[transform.py]"]
  node_load["Load profile data<br/>[load.py]"]
  node_profile_store[("Profile datastore")]
end

subgraph group_conversation["Mirror Conversation"]
  node_chat_cli["Chat entrypoint<br/>[run_mirror.py]"]
  node_agent_loader["Agent selector<br/>[agent.py]"]
  node_chat_agent["Tool-enabled agent"]
  node_output_parser["Conversation parser"]
  node_gather_data["Gather JSON data"]
end

subgraph group_personalization["Voice Personalization"]
  node_voice_input["Speech transcription<br/>[utils.py]"]
  node_voice_output["Speech synthesis<br/>[utils.py]"]
  node_voice_clone["Voice clone setup<br/>[create_voice.py]"]
end

subgraph group_teaching["Interview Teaching"]
  node_teach_cli["Teaching entrypoint<br/>[teach_mirror.py]"]
  node_interview_agent["Interview agent stub<br/>[agent.py]"]
end

node_subject(("Human subject"))
node_human(("Human subject"))
node_elevenlabs["ElevenLabs"]

node_subject -->|"provides data"| node_extract
node_extract -->|"extracts text for"| node_transform
node_transform -->|"produces facts for"| node_load
node_load -->|"loads data into"| node_profile_store
node_chat_cli -->|"loads agent"| node_agent_loader
node_agent_loader -->|"selects architecture"| node_chat_agent
node_chat_cli -->|"sends conversation input"| node_chat_agent
node_chat_agent -->|"uses parser"| node_output_parser
node_chat_agent -->|"retrieves profile facts"| node_profile_store
node_chat_agent -->|"reads JSON data"| node_gather_data
node_chat_agent -->|"can ask"| node_human
node_chat_cli -->|"transcribes input"| node_voice_input
node_chat_cli -->|"synthesizes reply"| node_voice_output
node_voice_output -->|"requests speech"| node_elevenlabs
node_voice_clone -->|"uploads sample"| node_elevenlabs
node_subject -->|"provides recording"| node_voice_clone
node_teach_cli -->|"intended to start"| node_interview_agent

click node_extract "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/extract/extract.py"
click node_transform "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/transform/transform.py"
click node_load "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/load/load.py"
click node_profile_store "https://github.com/crosleythomas/mirrorgpt/tree/main/mirror/data"
click node_chat_cli "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/entrypoints/run_mirror.py"
click node_agent_loader "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/mirror_agent/agent.py"
click node_chat_agent "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/mirror_agent/agents/ChatConversationalWithTools.py"
click node_output_parser "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/utils/parsers/CustomConvoParser.py"
click node_gather_data "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/mirror_agent/agents/ChatConversationalWithTools.py"
click node_voice_input "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/voice/utils.py"
click node_voice_output "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/voice/utils.py"
click node_voice_clone "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/voice/create_voice.py"
click node_teach_cli "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/entrypoints/teach_mirror.py"
click node_interview_agent "https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/interview_agent/agent.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_extract,node_transform,node_load,node_profile_store toneBlue
class node_chat_cli,node_agent_loader,node_chat_agent,node_output_parser,node_gather_data toneAmber
class node_voice_input,node_voice_output,node_voice_clone toneMint
class node_teach_cli,node_interview_agent toneRose
class node_subject,node_human,node_elevenlabs toneIndigo
```

## Components

### Profile Data Preparation

- [Extract sources](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/extract/extract.py): `mirror/data/extract/extract.py`
- [Transform facts](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/transform/transform.py): `mirror/data/transform/transform.py`
- [Load profile data](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/data/load/load.py): `mirror/data/load/load.py`
- [Profile datastore](https://github.com/crosleythomas/mirrorgpt/tree/main/mirror/data): `mirror/data`

### Mirror Conversation

- [Chat entrypoint](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/entrypoints/run_mirror.py): `mirror/entrypoints/run_mirror.py`
- [Agent selector](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/mirror_agent/agent.py): `mirror/mirror_agent/agent.py`
- [Tool-enabled agent](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/mirror_agent/agents/ChatConversationalWithTools.py): `mirror/mirror_agent/agents/ChatConversationalWithTools.py`
- [Conversation parser](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/utils/parsers/CustomConvoParser.py): `mirror/utils/parsers/CustomConvoParser.py`
- [Gather JSON data](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/mirror_agent/agents/ChatConversationalWithTools.py): `mirror/mirror_agent/agents/ChatConversationalWithTools.py`

### Voice Personalization

- [Speech transcription](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/voice/utils.py): `mirror/voice/utils.py`
- [Speech synthesis](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/voice/utils.py): `mirror/voice/utils.py`
- [Voice clone setup](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/voice/create_voice.py): `mirror/voice/create_voice.py`

### Interview Teaching

- [Teaching entrypoint](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/entrypoints/teach_mirror.py): `mirror/entrypoints/teach_mirror.py`
- [Interview agent stub](https://github.com/crosleythomas/mirrorgpt/blob/main/mirror/interview_agent/agent.py): `mirror/interview_agent/agent.py`

### Other components

- **Human subject**
- **Human subject**
- **ElevenLabs**

## Connections

- Human subject → Extract sources: provides data (evidence: `README.md`)
- Extract sources → Transform facts: extracts text for (evidence: `README.md`)
- Transform facts → Load profile data: produces facts for (evidence: `README.md`)
- Load profile data → Profile datastore: loads data into (evidence: `README.md`)
- Chat entrypoint → Agent selector: loads agent (evidence: `mirror/entrypoints/run_mirror.py`)
- Agent selector → Tool-enabled agent: selects architecture (evidence: `mirror/mirror_agent/agent.py`)
- Chat entrypoint → Tool-enabled agent: sends conversation input (evidence: `mirror/entrypoints/run_mirror.py`)
- Tool-enabled agent → Conversation parser: uses parser (evidence: `mirror/mirror_agent/agents/ChatConversationalWithTools.py`)
- Tool-enabled agent → Profile datastore: retrieves profile facts (evidence: `README.md`)
- Tool-enabled agent → Gather JSON data: reads JSON data (evidence: `mirror/mirror_agent/agents/ChatConversationalWithTools.py`)
- Tool-enabled agent → Human subject: can ask (evidence: `mirror/mirror_agent/agents/ChatConversationalWithTools.py`)
- Chat entrypoint → Speech transcription: transcribes input (evidence: `mirror/entrypoints/run_mirror.py`)
- Chat entrypoint → Speech synthesis: synthesizes reply (evidence: `mirror/entrypoints/run_mirror.py`)
- Speech synthesis → ElevenLabs: requests speech (evidence: `mirror/voice/utils.py`)
- Voice clone setup → ElevenLabs: uploads sample (evidence: `mirror/voice/create_voice.py`)
- Human subject → Voice clone setup: provides recording (evidence: `README.md`)
- Teaching entrypoint → Interview agent stub: intended to start (evidence: `mirror/entrypoints/teach_mirror.py`)
