# sammcj/gollama architecture

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

- Interactive diagram: https://gitdiagram.com/sammcj/gollama
- Repository: https://github.com/sammcj/gollama

## Overview

Gollama is a terminal application for managing Ollama models. Users start in the TUI, browse and select models, then inspect, edit, delete, copy, run, unload, or push them; command-line options also support listing, searching, and editing. A separate vRAM workflow estimates model memory and context/quantisation fit. The graph preserves documented capabilities even where their implementation was not sampled. Connections to Ollama and the registry follow the README or visible API calls; unsampled feature internals are represented at their source-file level.

Main entry points: [`app_model.go`](https://github.com/sammcj/gollama/blob/main/app_model.go) (TUI state and actions), [`main.go`](https://github.com/sammcj/gollama/blob/main/main.go) (CLI and startup), [`vramestimator/vramestimator.go`](https://github.com/sammcj/gollama/blob/main/vramestimator/vramestimator.go) (VRAM estimator), [`styles/styles.go`](https://github.com/sammcj/gollama/blob/main/styles/styles.go) (Theme rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and configuration"]
  node_main["CLI and startup<br/>[main.go]"]
  node_config["Application config<br/>[config.go]"]
  node_themes["Theme files<br/>[theme.go]"]
  node_logging["Application logging<br/>[logging.go]"]
  node_utils["Path utilities<br/>[utils.go]"]
end

subgraph group_interface["Terminal interface"]
  node_app["TUI state and actions<br/>[app_model.go]"]
  node_delegate["Model list rows<br/>[item_delegate.go]"]
  node_top["Running models view<br/>[top_view.go]"]
  node_compare["Modelfile comparison<br/>[compare.go]"]
  node_styles["Theme rendering<br/>[styles.go]"]
end

subgraph group_model_ops["Model operations"]
  node_operations["Model management<br/>[operations.go]"]
  node_model["Model records<br/>[model.go]"]
end

subgraph group_analysis["VRAM analysis"]
  node_estimator["VRAM estimator<br/>[vramestimator.go]"]
  node_cuda["CUDA memory probe<br/>[cuda.go]"]
end

node_user(("User"))
node_ollama{{"Ollama API"}}
node_registry{{"Ollama registry"}}

node_user -->|"starts"| node_main
node_main -->|"loads"| node_config
node_main -->|"runs TUI"| node_app
node_main -->|"estimates VRAM"| node_estimator
node_main -.->|"requests model data"| node_ollama
node_app -->|"renders rows"| node_delegate
node_app -->|"shows running models"| node_top
node_app -->|"compares Modelfiles"| node_compare
node_app -->|"dispatches model actions"| node_operations
node_app -->|"runs model actions"| node_ollama
node_operations -->|"calls model API"| node_ollama
node_top -->|"queries running models"| node_ollama
node_compare -->|"fetches model details"| node_ollama
node_compare -->|"fetches registry files"| node_registry
node_app -->|"formats interface"| node_styles
node_delegate -->|"styles rows"| node_styles
node_styles -.->|"reads theme settings"| node_themes
node_config -->|"gets config paths"| node_utils
node_main -->|"initializes logging"| node_logging
node_estimator -->|"fetches model info"| node_ollama
node_estimator -.->|"checks CUDA memory"| node_cuda
node_estimator -->|"formats estimates"| node_styles

click node_main "https://github.com/sammcj/gollama/blob/main/main.go"
click node_config "https://github.com/sammcj/gollama/blob/main/config/config.go"
click node_themes "https://github.com/sammcj/gollama/blob/main/config/theme.go"
click node_app "https://github.com/sammcj/gollama/blob/main/app_model.go"
click node_delegate "https://github.com/sammcj/gollama/blob/main/item_delegate.go"
click node_top "https://github.com/sammcj/gollama/blob/main/top_view.go"
click node_compare "https://github.com/sammcj/gollama/blob/main/compare.go"
click node_styles "https://github.com/sammcj/gollama/blob/main/styles/styles.go"
click node_operations "https://github.com/sammcj/gollama/blob/main/operations.go"
click node_model "https://github.com/sammcj/gollama/blob/main/model.go"
click node_estimator "https://github.com/sammcj/gollama/blob/main/vramestimator/vramestimator.go"
click node_cuda "https://github.com/sammcj/gollama/blob/main/vramestimator/cuda/cuda.go"
click node_logging "https://github.com/sammcj/gollama/blob/main/logging/logging.go"
click node_utils "https://github.com/sammcj/gollama/blob/main/utils/utils.go"

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_main,node_config,node_themes,node_logging,node_utils,node_user toneBlue
class node_app,node_delegate,node_top,node_compare,node_styles toneAmber
class node_operations,node_model,node_ollama toneMint
class node_estimator,node_cuda toneRose
class node_registry toneIndigo
```

## Components

### Entry and configuration

- [CLI and startup](https://github.com/sammcj/gollama/blob/main/main.go): `main.go`
- [Application config](https://github.com/sammcj/gollama/blob/main/config/config.go): `config/config.go`
- [Theme files](https://github.com/sammcj/gollama/blob/main/config/theme.go): `config/theme.go`
- [Application logging](https://github.com/sammcj/gollama/blob/main/logging/logging.go): `logging/logging.go`
- [Path utilities](https://github.com/sammcj/gollama/blob/main/utils/utils.go): `utils/utils.go`

### Terminal interface

- [TUI state and actions](https://github.com/sammcj/gollama/blob/main/app_model.go): `app_model.go`
- [Model list rows](https://github.com/sammcj/gollama/blob/main/item_delegate.go): `item_delegate.go`
- [Running models view](https://github.com/sammcj/gollama/blob/main/top_view.go): `top_view.go`
- [Modelfile comparison](https://github.com/sammcj/gollama/blob/main/compare.go): `compare.go`
- [Theme rendering](https://github.com/sammcj/gollama/blob/main/styles/styles.go): `styles/styles.go`

### Model operations

- [Model management](https://github.com/sammcj/gollama/blob/main/operations.go): `operations.go`
- [Model records](https://github.com/sammcj/gollama/blob/main/model.go): `model.go`

### VRAM analysis

- [VRAM estimator](https://github.com/sammcj/gollama/blob/main/vramestimator/vramestimator.go): `vramestimator/vramestimator.go`
- [CUDA memory probe](https://github.com/sammcj/gollama/blob/main/vramestimator/cuda/cuda.go): `vramestimator/cuda/cuda.go`

### Other components

- **User**
- **Ollama API**
- **Ollama registry**

## Connections

- User → CLI and startup: starts (evidence: `README.md`)
- CLI and startup → Application config: loads (evidence: `main.go`)
- CLI and startup → TUI state and actions: runs TUI (evidence: `main.go`)
- CLI and startup → VRAM estimator: estimates VRAM (evidence: `main.go`)
- CLI and startup → Ollama API: requests model data
- TUI state and actions → Model list rows: renders rows (evidence: `item_delegate.go`)
- TUI state and actions → Running models view: shows running models (evidence: `README.md`)
- TUI state and actions → Modelfile comparison: compares Modelfiles (evidence: `compare.go`)
- TUI state and actions → Model management: dispatches model actions (evidence: `README.md`)
- TUI state and actions → Ollama API: runs model actions (evidence: `README.md`)
- Model management → Ollama API: calls model API (evidence: `operations.go`)
- Running models view → Ollama API: queries running models (evidence: `top_view.go`)
- Modelfile comparison → Ollama API: fetches model details (evidence: `compare.go`)
- Modelfile comparison → Ollama registry: fetches registry files (evidence: `compare.go`)
- TUI state and actions → Theme rendering: formats interface (evidence: `app_model.go`)
- Model list rows → Theme rendering: styles rows (evidence: `item_delegate.go`)
- Theme rendering → Theme files: reads theme settings
- Application config → Path utilities: gets config paths (evidence: `config/config.go`)
- CLI and startup → Application logging: initializes logging (evidence: `main.go`)
- VRAM estimator → Ollama API: fetches model info (evidence: `vramestimator/vramestimator.go`)
- VRAM estimator → CUDA memory probe: checks CUDA memory
- VRAM estimator → Theme rendering: formats estimates (evidence: `vramestimator/vramestimator.go`)
