# sshiv-1/fiat architecture

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

- Interactive diagram: https://gitdiagram.com/sshiv-1/fiat
- Repository: https://github.com/sshiv-1/fiat

## Overview

Fiat is a terminal-based coding assistant. A user interacts through the CLI, which delegates requests to the orchestrator: simple requests go directly to a tool-enabled coder, while complex ones proceed through planning, implementation, testing, and review, with retries when needed. The CLI also supports provider/model configuration and a context dashboard. The README documents these workflow stages and capabilities; some implementation details, especially CLI command routing and the review loop, were not fully excerpted, so the graph omits uncertain connections.

Main entry points: [`src/fiat/agents/orchestrator.py`](https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py) (Orchestrator), [`src/fiat/cli.py`](https://github.com/sshiv-1/fiat/blob/main/src/fiat/cli.py) (Interactive CLI), [`src/fiat/provider_factory.py`](https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_factory.py) (Provider Factory), [`src/fiat/state.py`](https://github.com/sshiv-1/fiat/blob/main/src/fiat/state.py) (Session State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI and Tools"]
  node_cli["Interactive CLI<br/>[cli.py]"]
  node_repo_tools["Repository Tools<br/>[cli.py]"]
  node_prompt["System Prompt<br/>[prompt.py]"]
  node_config["Provider Config<br/>[config.py]"]
end

subgraph group_workflow["Agent Workflow"]
  node_orchestrator["Orchestrator<br/>[orchestrator.py]"]
  node_planner["Planner<br/>[orchestrator.py]"]
  node_coder["Coder<br/>[orchestrator.py]"]
  node_tester["Tester<br/>[orchestrator.py]"]
  node_reviewer["Reviewer<br/>[orchestrator.py]"]
end

subgraph group_providers["Model Providers"]
  node_provider_factory["Provider Factory"]
  node_provider_interface["Provider Interface<br/>[providers.py]"]
  node_gemini["Gemini Provider<br/>[provider_gemini.py]"]
  node_openai["OpenAI-Compatible Provider<br/>[provider_openai.py]"]
  node_anthropic["Anthropic Provider"]
end

subgraph group_session["Session and Context"]
  node_session_state[("Session State<br/>[state.py]")]
  node_context_ui["Context Dashboard<br/>[context_ui.py]"]
end

node_user(("User"))
node_llm_services["LLM Services"]

node_user -->|"enters request"| node_cli
node_cli -->|"delegates chat"| node_orchestrator
node_cli -->|"loads and saves"| node_config
node_cli -->|"configures prompt"| node_prompt
node_cli -->|"opens dashboard"| node_context_ui
node_orchestrator -->|"creates providers"| node_provider_factory
node_orchestrator -->|"loads credentials"| node_config
node_orchestrator -->|"updates workflow status"| node_session_state
node_orchestrator -->|"plans complex tasks"| node_planner
node_orchestrator -->|"implements changes"| node_coder
node_orchestrator -->|"runs validation"| node_tester
node_orchestrator -->|"requests review"| node_reviewer
node_planner -->|"inspects repository"| node_repo_tools
node_coder -->|"edits and runs commands"| node_repo_tools
node_tester -->|"runs commands"| node_repo_tools
node_reviewer -->|"inspects changes"| node_repo_tools
node_provider_factory -->|"implements contract"| node_provider_interface
node_provider_factory -->|"creates"| node_gemini
node_provider_factory -->|"creates"| node_openai
node_provider_factory -->|"creates"| node_anthropic
node_gemini -->|"streams requests"| node_llm_services
node_openai -->|"streams requests"| node_llm_services
node_anthropic -->|"streams requests"| node_llm_services
node_context_ui -->|"reads usage and status"| node_session_state
node_gemini -->|"updates token usage"| node_session_state
node_openai -->|"updates token usage"| node_session_state
node_anthropic -->|"updates token usage"| node_session_state

click node_cli "https://github.com/sshiv-1/fiat/blob/main/src/fiat/cli.py"
click node_repo_tools "https://github.com/sshiv-1/fiat/blob/main/src/fiat/cli.py"
click node_prompt "https://github.com/sshiv-1/fiat/blob/main/src/fiat/prompt.py"
click node_config "https://github.com/sshiv-1/fiat/blob/main/src/fiat/config.py"
click node_orchestrator "https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py"
click node_planner "https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py"
click node_coder "https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py"
click node_tester "https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py"
click node_reviewer "https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py"
click node_provider_factory "https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_factory.py"
click node_provider_interface "https://github.com/sshiv-1/fiat/blob/main/src/fiat/providers.py"
click node_gemini "https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_gemini.py"
click node_openai "https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_openai.py"
click node_anthropic "https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_anthropic.py"
click node_session_state "https://github.com/sshiv-1/fiat/blob/main/src/fiat/state.py"
click node_context_ui "https://github.com/sshiv-1/fiat/blob/main/src/fiat/context_ui.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_cli,node_repo_tools,node_prompt,node_config,node_user toneBlue
class node_orchestrator,node_planner,node_coder,node_tester,node_reviewer toneAmber
class node_provider_factory,node_provider_interface,node_gemini,node_openai,node_anthropic toneMint
class node_session_state,node_context_ui toneRose
class node_llm_services toneIndigo
```

## Components

### CLI and Tools

- [Interactive CLI](https://github.com/sshiv-1/fiat/blob/main/src/fiat/cli.py): `src/fiat/cli.py`
- [Repository Tools](https://github.com/sshiv-1/fiat/blob/main/src/fiat/cli.py): `src/fiat/cli.py`
- [System Prompt](https://github.com/sshiv-1/fiat/blob/main/src/fiat/prompt.py): `src/fiat/prompt.py`
- [Provider Config](https://github.com/sshiv-1/fiat/blob/main/src/fiat/config.py): `src/fiat/config.py`

### Agent Workflow

- [Orchestrator](https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py): `src/fiat/agents/orchestrator.py`
- [Planner](https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py): `src/fiat/agents/orchestrator.py`
- [Coder](https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py): `src/fiat/agents/orchestrator.py`
- [Tester](https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py): `src/fiat/agents/orchestrator.py`
- [Reviewer](https://github.com/sshiv-1/fiat/blob/main/src/fiat/agents/orchestrator.py): `src/fiat/agents/orchestrator.py`

### Model Providers

- [Provider Factory](https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_factory.py): `src/fiat/provider_factory.py`
- [Provider Interface](https://github.com/sshiv-1/fiat/blob/main/src/fiat/providers.py): `src/fiat/providers.py`
- [Gemini Provider](https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_gemini.py): `src/fiat/provider_gemini.py`
- [OpenAI-Compatible Provider](https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_openai.py): `src/fiat/provider_openai.py`
- [Anthropic Provider](https://github.com/sshiv-1/fiat/blob/main/src/fiat/provider_anthropic.py): `src/fiat/provider_anthropic.py`

### Session and Context

- [Session State](https://github.com/sshiv-1/fiat/blob/main/src/fiat/state.py): `src/fiat/state.py`
- [Context Dashboard](https://github.com/sshiv-1/fiat/blob/main/src/fiat/context_ui.py): `src/fiat/context_ui.py`

### Other components

- **User**
- **LLM Services**

## Connections

- User → Interactive CLI: enters request (evidence: `README.md`)
- Interactive CLI → Orchestrator: delegates chat (evidence: `src/fiat/cli.py`)
- Interactive CLI → Provider Config: loads and saves (evidence: `src/fiat/cli.py`)
- Interactive CLI → System Prompt: configures prompt (evidence: `src/fiat/cli.py`)
- Interactive CLI → Context Dashboard: opens dashboard (evidence: `src/fiat/cli.py`)
- Orchestrator → Provider Factory: creates providers (evidence: `src/fiat/agents/orchestrator.py`)
- Orchestrator → Provider Config: loads credentials (evidence: `src/fiat/agents/orchestrator.py`)
- Orchestrator → Session State: updates workflow status (evidence: `src/fiat/agents/orchestrator.py`)
- Orchestrator → Planner: plans complex tasks (evidence: `README.md`)
- Orchestrator → Coder: implements changes (evidence: `README.md`)
- Orchestrator → Tester: runs validation (evidence: `README.md`)
- Orchestrator → Reviewer: requests review (evidence: `README.md`)
- Planner → Repository Tools: inspects repository (evidence: `README.md`)
- Coder → Repository Tools: edits and runs commands (evidence: `src/fiat/agents/orchestrator.py`)
- Tester → Repository Tools: runs commands (evidence: `src/fiat/agents/orchestrator.py`)
- Reviewer → Repository Tools: inspects changes (evidence: `README.md`)
- Provider Factory → Provider Interface: implements contract (evidence: `src/fiat/provider_factory.py`)
- Provider Factory → Gemini Provider: creates (evidence: `src/fiat/provider_factory.py`)
- Provider Factory → OpenAI-Compatible Provider: creates (evidence: `src/fiat/provider_factory.py`)
- Provider Factory → Anthropic Provider: creates (evidence: `src/fiat/provider_factory.py`)
- Gemini Provider → LLM Services: streams requests (evidence: `src/fiat/provider_gemini.py`)
- OpenAI-Compatible Provider → LLM Services: streams requests (evidence: `src/fiat/provider_openai.py`)
- Anthropic Provider → LLM Services: streams requests (evidence: `src/fiat/provider_anthropic.py`)
- Context Dashboard → Session State: reads usage and status (evidence: `src/fiat/context_ui.py`)
- Gemini Provider → Session State: updates token usage (evidence: `src/fiat/provider_gemini.py`)
- OpenAI-Compatible Provider → Session State: updates token usage (evidence: `src/fiat/provider_openai.py`)
- Anthropic Provider → Session State: updates token usage (evidence: `src/fiat/provider_anthropic.py`)
