# fxmario/remie architecture

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

- Interactive diagram: https://gitdiagram.com/fxmario/remie
- Repository: https://github.com/fxmario/remie

## Overview

Remie is a terminal coding agent. A user submits a prompt in the Textual interface; the app manages a per-tab session and invokes the provider-independent runner, which streams model responses and dispatches requested tools. Results return to the session for display and persistence. The graph also preserves provider setup, chat/worktree management, memory, and web access described in the README. Edges use README statements or shown source-index references and excerpts; unsampled subsystem wiring is omitted where it cannot be verified.

Main entry points: [`remie/tui/app.py`](https://github.com/fxmario/remie/blob/master/remie/tui/app.py) (Textual interface), [`remie/tui/chat_session.py`](https://github.com/fxmario/remie/blob/master/remie/tui/chat_session.py) (Tab sessions), [`remie/tools/executor.py`](https://github.com/fxmario/remie/blob/master/remie/tools/executor.py) (Tool executor), [`remie/tools/registry.py`](https://github.com/fxmario/remie/blob/master/remie/tools/registry.py) (Tool registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["TUI and sessions"]
  node_tui["Textual interface<br/>[app.py]"]
  node_widgets["Chat widgets<br/>[widgets.py]"]
  node_session["Tab sessions<br/>[chat_session.py]"]
  node_workspaces["Worktrees<br/>[workspaces.py]"]
end

subgraph group_agent["Agent runtime"]
  node_runner["Turn runner<br/>[runner.py]"]
  node_agentfacade["Agent facade<br/>[agent.py]"]
  node_prompts["Prompt construction<br/>[prompts.py]"]
  node_executor["Tool executor<br/>[executor.py]"]
  node_registry["Tool registry<br/>[registry.py]"]
end

subgraph group_providers["Model providers"]
  node_providerrouter["Provider router<br/>[router.py]"]
  node_catalog["Model catalogs<br/>[catalog.py]"]
  node_codexauth["Codex sign-in<br/>[codex_auth.py]"]
  node_codex["Codex client<br/>[codex_client.py]"]
  node_openrouter["OpenRouter client"]
  node_config["Provider config<br/>[config.py]"]
end

subgraph group_capabilities["Tools and persistence"]
  node_files["File tools<br/>[files.py]"]
  node_commands["Command tools<br/>[commands.py]"]
  node_web["Web tools<br/>[web.py]"]
  node_memory[("Scoped memory<br/>[memory.py]")]
  node_chats[("Chat history<br/>[chats.py]")]
  node_tabs[("Tab layout<br/>[tabs.py]")]
end

node_user(("User"))
node_project["Project files and shell"]
node_modelservices["Model services"]
node_websites["Websites"]

node_user -->|"submits prompt"| node_tui
node_tui -->|"renders controls"| node_widgets
node_tui -->|"manages tabs"| node_session
node_session -->|"runs turns"| node_runner
node_session -->|"loads and saves"| node_chats
node_session -->|"persists layout"| node_tabs
node_session -->|"allocates worktrees"| node_workspaces
node_runner -->|"executes calls"| node_executor
node_runner -->|"streams responses"| node_providerrouter
node_tui -->|"configures agent"| node_agentfacade
node_agentfacade -->|"loads profiles"| node_config
node_agentfacade -->|"discovers models"| node_catalog
node_providerrouter -->|"routes Codex calls"| node_codex
node_providerrouter -->|"routes OpenRouter calls"| node_openrouter
node_catalog -->|"fetches catalog"| node_codex
node_catalog -->|"fetches catalog"| node_openrouter
node_tui -->|"starts OAuth"| node_codexauth
node_executor -->|"dispatches tools"| node_registry
node_executor -->|"runs file operations"| node_files
node_executor -->|"runs commands"| node_commands
node_executor -->|"handles memory"| node_memory
node_registry -->|"registers web tools"| node_web
node_registry -->|"registers file tools"| node_files
node_registry -->|"registers command tool"| node_commands
node_files -->|"reads and edits"| node_project
node_commands -->|"runs in directory"| node_project
node_web -->|"fetches and searches"| node_websites
node_providerrouter -->|"requests completions"| node_modelservices
node_prompts -.->|"supplies instructions"| node_runner

click node_tui "https://github.com/fxmario/remie/blob/master/remie/tui/app.py"
click node_widgets "https://github.com/fxmario/remie/blob/master/remie/tui/widgets.py"
click node_session "https://github.com/fxmario/remie/blob/master/remie/tui/chat_session.py"
click node_workspaces "https://github.com/fxmario/remie/blob/master/remie/tui/workspaces.py"
click node_runner "https://github.com/fxmario/remie/blob/master/remie/core/runner.py"
click node_agentfacade "https://github.com/fxmario/remie/blob/master/remie/agent.py"
click node_prompts "https://github.com/fxmario/remie/blob/master/remie/prompts.py"
click node_executor "https://github.com/fxmario/remie/blob/master/remie/tools/executor.py"
click node_registry "https://github.com/fxmario/remie/blob/master/remie/tools/registry.py"
click node_providerrouter "https://github.com/fxmario/remie/blob/master/remie/providers/router.py"
click node_catalog "https://github.com/fxmario/remie/blob/master/remie/providers/catalog.py"
click node_codexauth "https://github.com/fxmario/remie/blob/master/remie/codex_auth.py"
click node_codex "https://github.com/fxmario/remie/blob/master/remie/codex_client.py"
click node_openrouter "https://github.com/fxmario/remie/blob/master/remie/openrouter_client.py"
click node_config "https://github.com/fxmario/remie/blob/master/remie/config.py"
click node_files "https://github.com/fxmario/remie/blob/master/remie/tools/files.py"
click node_commands "https://github.com/fxmario/remie/blob/master/remie/tools/commands.py"
click node_web "https://github.com/fxmario/remie/blob/master/remie/tools/web.py"
click node_memory "https://github.com/fxmario/remie/blob/master/remie/storage/memory.py"
click node_chats "https://github.com/fxmario/remie/blob/master/remie/storage/chats.py"
click node_tabs "https://github.com/fxmario/remie/blob/master/remie/storage/tabs.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_tui,node_widgets,node_session,node_workspaces,node_user toneBlue
class node_runner,node_agentfacade,node_prompts,node_executor,node_registry toneAmber
class node_providerrouter,node_catalog,node_codexauth,node_codex,node_openrouter,node_config toneMint
class node_files,node_commands,node_web,node_memory,node_chats,node_tabs toneRose
class node_project,node_modelservices,node_websites toneIndigo
```

## Components

### TUI and sessions

- [Textual interface](https://github.com/fxmario/remie/blob/master/remie/tui/app.py): `remie/tui/app.py`
- [Chat widgets](https://github.com/fxmario/remie/blob/master/remie/tui/widgets.py): `remie/tui/widgets.py`
- [Tab sessions](https://github.com/fxmario/remie/blob/master/remie/tui/chat_session.py): `remie/tui/chat_session.py`
- [Worktrees](https://github.com/fxmario/remie/blob/master/remie/tui/workspaces.py): `remie/tui/workspaces.py`

### Agent runtime

- [Turn runner](https://github.com/fxmario/remie/blob/master/remie/core/runner.py): `remie/core/runner.py`
- [Agent facade](https://github.com/fxmario/remie/blob/master/remie/agent.py): `remie/agent.py`
- [Prompt construction](https://github.com/fxmario/remie/blob/master/remie/prompts.py): `remie/prompts.py`
- [Tool executor](https://github.com/fxmario/remie/blob/master/remie/tools/executor.py): `remie/tools/executor.py`
- [Tool registry](https://github.com/fxmario/remie/blob/master/remie/tools/registry.py): `remie/tools/registry.py`

### Model providers

- [Provider router](https://github.com/fxmario/remie/blob/master/remie/providers/router.py): `remie/providers/router.py`
- [Model catalogs](https://github.com/fxmario/remie/blob/master/remie/providers/catalog.py): `remie/providers/catalog.py`
- [Codex sign-in](https://github.com/fxmario/remie/blob/master/remie/codex_auth.py): `remie/codex_auth.py`
- [Codex client](https://github.com/fxmario/remie/blob/master/remie/codex_client.py): `remie/codex_client.py`
- [OpenRouter client](https://github.com/fxmario/remie/blob/master/remie/openrouter_client.py): `remie/openrouter_client.py`
- [Provider config](https://github.com/fxmario/remie/blob/master/remie/config.py): `remie/config.py`

### Tools and persistence

- [File tools](https://github.com/fxmario/remie/blob/master/remie/tools/files.py): `remie/tools/files.py`
- [Command tools](https://github.com/fxmario/remie/blob/master/remie/tools/commands.py): `remie/tools/commands.py`
- [Web tools](https://github.com/fxmario/remie/blob/master/remie/tools/web.py): `remie/tools/web.py`
- [Scoped memory](https://github.com/fxmario/remie/blob/master/remie/storage/memory.py): `remie/storage/memory.py`
- [Chat history](https://github.com/fxmario/remie/blob/master/remie/storage/chats.py): `remie/storage/chats.py`
- [Tab layout](https://github.com/fxmario/remie/blob/master/remie/storage/tabs.py): `remie/storage/tabs.py`

### Other components

- **User**
- **Project files and shell**
- **Model services**
- **Websites**

## Connections

- User → Textual interface: submits prompt
- Textual interface → Chat widgets: renders controls (evidence: `remie/tui/app.py`)
- Textual interface → Tab sessions: manages tabs (evidence: `remie/tui/app.py`)
- Tab sessions → Turn runner: runs turns (evidence: `remie/tui/app.py`)
- Tab sessions → Chat history: loads and saves (evidence: `remie/tui/chat_session.py`)
- Tab sessions → Tab layout: persists layout (evidence: `remie/tui/chat_session.py`)
- Tab sessions → Worktrees: allocates worktrees (evidence: `remie/tui/chat_session.py`)
- Turn runner → Tool executor: executes calls (evidence: `remie/core/runner.py`)
- Turn runner → Provider router: streams responses (evidence: `remie/core/runner.py`)
- Textual interface → Agent facade: configures agent (evidence: `remie/tui/app.py`)
- Agent facade → Provider config: loads profiles (evidence: `remie/agent.py`)
- Agent facade → Model catalogs: discovers models (evidence: `remie/agent.py`)
- Provider router → Codex client: routes Codex calls (evidence: `remie/providers/router.py`)
- Provider router → OpenRouter client: routes OpenRouter calls (evidence: `remie/providers/router.py`)
- Model catalogs → Codex client: fetches catalog (evidence: `remie/providers/catalog.py`)
- Model catalogs → OpenRouter client: fetches catalog (evidence: `remie/providers/catalog.py`)
- Textual interface → Codex sign-in: starts OAuth
- Tool executor → Tool registry: dispatches tools (evidence: `remie/tools/executor.py`)
- Tool executor → File tools: runs file operations (evidence: `remie/tools/executor.py`)
- Tool executor → Command tools: runs commands (evidence: `remie/tools/executor.py`)
- Tool executor → Scoped memory: handles memory (evidence: `remie/tools/executor.py`)
- Tool registry → Web tools: registers web tools (evidence: `remie/tools/registry.py`)
- Tool registry → File tools: registers file tools (evidence: `remie/tools/registry.py`)
- Tool registry → Command tools: registers command tool (evidence: `remie/tools/registry.py`)
- File tools → Project files and shell: reads and edits
- Command tools → Project files and shell: runs in directory
- Web tools → Websites: fetches and searches
- Provider router → Model services: requests completions
- Prompt construction → Turn runner: supplies instructions
