# saffroncarp1106/redoxcodex architecture

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

- Interactive diagram: https://gitdiagram.com/saffroncarp1106/redoxcodex
- Repository: https://github.com/saffroncarp1106/redoxcodex

## Overview

ReDox is a native Rust desktop chat client for Codex and Ollama. The primary workflow is a user composing a project chat, choosing a provider, and receiving a streamed response; the app also manages history, attachments, queued messages, usage, and settings. README-documented branches include Ollama project tools and Codex delegation, multiple UI looks, and a UI design/export runtime. Some subsystems are represented at their exact source paths because their implementation was not sampled; their connections are shown only where documented or indexed.

Main entry points: [`src/app.rs`](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/app.rs) (Desktop app), [`src/ui/shell.rs`](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/shell.rs) (Chat interface), [`src/codex.rs`](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/codex.rs) (Codex client), [`src/ollama.rs`](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ollama.rs) (Ollama client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application workflow"]
  node_application["Desktop app<br/>[app.rs]"]
  node_usage["Usage tracking<br/>[usage.rs]"]
end

subgraph group_providers["Chat providers"]
  node_codex_provider["Codex client<br/>[codex.rs]"]
  node_ollama_provider["Ollama client<br/>[ollama.rs]"]
  node_delegation["Ollama delegation<br/>[delegation.rs]"]
  node_tools["Project tools<br/>[ollama_tools.rs]"]
end

subgraph group_chat["Chat domain"]
  node_domain["Chat state<br/>[domain.rs]"]
  node_history["Chat history<br/>[history.rs]"]
  node_attachments["Attachments<br/>[attachments.rs]"]
  node_message_edit["Prompt branches<br/>[message_edit.rs]"]
end

subgraph group_ui["Interface and looks"]
  node_ui_shell["Chat interface<br/>[shell.rs]"]
  node_conversation["Conversation view<br/>[conversation.rs]"]
  node_settings["Settings<br/>[settings.rs]"]
  node_ui_packs["UI packs<br/>[packs.rs]"]
  node_looks["Alternate looks<br/>[skins.rs]"]
  node_terminal["Windows 98 terminal<br/>[win98_terminal.rs]"]
end

subgraph group_studio["Design runtime"]
  node_design_export["Design export<br/>[design_export.rs]"]
  node_studio_document["Studio document<br/>[document.rs]"]
  node_studio_actions["Studio actions<br/>[actions.rs]"]
  node_studio_scenes["Studio scenes<br/>[scenes.rs]"]
end

node_user(("User"))
node_codex_cli["Codex CLI"]
node_ollama_server["Ollama server"]

node_user -->|"uses"| node_application
node_application -->|"sends prompts"| node_codex_provider
node_codex_provider -->|"launches app-server"| node_codex_cli
node_application -->|"sends prompts"| node_ollama_provider
node_ollama_provider -->|"calls server"| node_ollama_server
node_application -->|"manages chat state"| node_domain
node_application -->|"loads history"| node_history
node_application -->|"accepts attachments"| node_attachments
node_application -->|"branches prompts"| node_message_edit
node_application -->|"enables delegation"| node_delegation
node_codex_provider -->|"offers delegate tool"| node_delegation
node_ollama_provider -->|"provides project tools"| node_tools
node_application -->|"shows usage"| node_usage
node_application -->|"draws interface"| node_ui_shell
node_ui_shell -->|"shows conversation"| node_conversation
node_ui_shell -->|"opens settings"| node_settings
node_settings -->|"imports packs"| node_ui_packs
node_ui_shell -->|"selects look"| node_looks
node_ui_shell -->|"offers terminal view"| node_terminal
node_ui_shell -->|"records controls"| node_design_export
node_design_export -->|"writes design"| node_studio_document
node_studio_document -->|"uses action types"| node_studio_actions
node_studio_document -->|"uses scene types"| node_studio_scenes

click node_application "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/app.rs"
click node_codex_provider "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/codex.rs"
click node_ollama_provider "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ollama.rs"
click node_domain "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/domain.rs"
click node_history "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/history.rs"
click node_attachments "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/attachments.rs"
click node_message_edit "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/message_edit.rs"
click node_delegation "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/delegation.rs"
click node_tools "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ollama_tools.rs"
click node_usage "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/usage.rs"
click node_ui_shell "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/shell.rs"
click node_conversation "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/conversation.rs"
click node_settings "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/settings.rs"
click node_ui_packs "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/packs.rs"
click node_looks "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/skins.rs"
click node_terminal "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/win98_terminal.rs"
click node_design_export "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/design_export.rs"
click node_studio_document "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/studio_runtime/src/document.rs"
click node_studio_actions "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/studio_runtime/src/actions.rs"
click node_studio_scenes "https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/studio_runtime/src/scenes.rs"

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_application,node_usage,node_user toneBlue
class node_codex_provider,node_ollama_provider,node_delegation,node_tools toneAmber
class node_domain,node_history,node_attachments,node_message_edit,node_ollama_server toneMint
class node_ui_shell,node_conversation,node_settings,node_ui_packs,node_looks,node_terminal toneRose
class node_design_export,node_studio_document,node_studio_actions,node_studio_scenes,node_codex_cli toneIndigo
```

## Components

### Application workflow

- [Desktop app](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/app.rs): `src/app.rs`
- [Usage tracking](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/usage.rs): `src/usage.rs`

### Chat providers

- [Codex client](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/codex.rs): `src/codex.rs`
- [Ollama client](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ollama.rs): `src/ollama.rs`
- [Ollama delegation](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/delegation.rs): `src/delegation.rs`
- [Project tools](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ollama_tools.rs): `src/ollama_tools.rs`

### Chat domain

- [Chat state](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/domain.rs): `src/domain.rs`
- [Chat history](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/history.rs): `src/history.rs`
- [Attachments](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/attachments.rs): `src/attachments.rs`
- [Prompt branches](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/message_edit.rs): `src/message_edit.rs`

### Interface and looks

- [Chat interface](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/shell.rs): `src/ui/shell.rs`
- [Conversation view](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/conversation.rs): `src/ui/conversation.rs`
- [Settings](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/settings.rs): `src/ui/settings.rs`
- [UI packs](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/packs.rs): `src/ui/packs.rs`
- [Alternate looks](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/skins.rs): `src/ui/skins.rs`
- [Windows 98 terminal](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/win98_terminal.rs): `src/ui/win98_terminal.rs`

### Design runtime

- [Design export](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/design_export.rs): `src/ui/design_export.rs`
- [Studio document](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/studio_runtime/src/document.rs): `src/ui/studio_runtime/src/document.rs`
- [Studio actions](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/studio_runtime/src/actions.rs): `src/ui/studio_runtime/src/actions.rs`
- [Studio scenes](https://github.com/saffroncarp1106/redoxcodex/blob/main/src/ui/studio_runtime/src/scenes.rs): `src/ui/studio_runtime/src/scenes.rs`

### Other components

- **User**
- **Codex CLI**
- **Ollama server**

## Connections

- User → Desktop app: uses (evidence: `README.md`)
- Desktop app → Codex client: sends prompts (evidence: `README.md`)
- Codex client → Codex CLI: launches app-server (evidence: `README.md`)
- Desktop app → Ollama client: sends prompts (evidence: `README.md`)
- Ollama client → Ollama server: calls server (evidence: `README.md`)
- Desktop app → Chat state: manages chat state (evidence: `src/domain.rs`)
- Desktop app → Chat history: loads history (evidence: `README.md`)
- Desktop app → Attachments: accepts attachments (evidence: `README.md`)
- Desktop app → Prompt branches: branches prompts (evidence: `README.md`)
- Desktop app → Ollama delegation: enables delegation (evidence: `README.md`)
- Codex client → Ollama delegation: offers delegate tool (evidence: `src/codex.rs`)
- Ollama client → Project tools: provides project tools (evidence: `README.md`)
- Desktop app → Usage tracking: shows usage (evidence: `README.md`)
- Desktop app → Chat interface: draws interface (evidence: `src/ui/shell.rs`)
- Chat interface → Conversation view: shows conversation (evidence: `README.md`)
- Chat interface → Settings: opens settings (evidence: `src/ui/shell.rs`)
- Settings → UI packs: imports packs (evidence: `README.md`)
- Chat interface → Alternate looks: selects look
- Chat interface → Windows 98 terminal: offers terminal view
- Chat interface → Design export: records controls (evidence: `src/ui/shell.rs`)
- Design export → Studio document: writes design (evidence: `src/ui/design_export.rs`)
- Studio document → Studio actions: uses action types (evidence: `src/ui/studio_runtime/src/document.rs`)
- Studio document → Studio scenes: uses scene types (evidence: `src/ui/studio_runtime/src/document.rs`)
