# kovidgoyal/kitty architecture

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

- Interactive diagram: https://gitdiagram.com/kovidgoyal/kitty
- Repository: https://github.com/kovidgoyal/kitty

## Overview

kitty is a GPU-based terminal application with a Python application layer, native terminal and windowing code, and a suite of companion “kittens.” The principal workflow is launch, configure and create a session, run child processes, interpret their terminal output, and render the resulting screen. The tree also shows separate workflows for remote control and file, text, and terminal utilities. The README excerpt only identifies the product, and sampled sources are incomplete; the graph therefore omits uncertain internal call wiring rather than implying a complete call map.

Main entry points: [`kittens/runner.py`](https://github.com/kovidgoyal/kitty/blob/master/kittens/runner.py) (Kitten runner), [`kitty/child.py`](https://github.com/kovidgoyal/kitty/blob/master/kitty/child.py) (Child process), [`kitty/boss.py`](https://github.com/kovidgoyal/kitty/blob/master/kitty/boss.py) (Application controller), [`kitty/main.py`](https://github.com/kovidgoyal/kitty/blob/master/kitty/main.py) (Application startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and configuration"]
  node_launcher["Native launcher<br/>[main.c]"]
  node_app["Application startup<br/>[main.py]"]
  node_options["Options and config<br/>[parse.py]"]
  node_session["Session setup<br/>[session.py]"]
end

subgraph group_terminal["Terminal runtime"]
  node_boss["Application controller<br/>[boss.py]"]
  node_tabs["Tabs and layouts<br/>[tabs.py]"]
  node_window["Terminal window<br/>[window.py]"]
  node_child["Child process<br/>[child.py]"]
  node_monitor["Child monitoring<br/>[child-monitor.c]"]
  node_parser["VT parser<br/>[vt-parser.c]"]
  node_screen["Screen state<br/>[screen.c]"]
end

subgraph group_display["Rendering and input"]
  node_graphics["Graphics rendering<br/>[graphics.c]"]
  node_fonts["Font rendering<br/>[fonts.c]"]
  node_glfw["Window and input<br/>[window.c]"]
  node_gpu["GPU display<br/>[gl.c]"]
end

subgraph group_control["Control and integration"]
  node_remote["Remote control<br/>[remote_control.py]"]
  node_at["Command client<br/>[main.go]"]
end

subgraph group_kittens["Kitten utilities"]
  node_kitten_runner["Kitten runner<br/>[runner.py]"]
  node_file_picker["File chooser<br/>[main.go]"]
  node_palette["Command palette<br/>[main.go]"]
  node_diff["File and image diff<br/>[main.py]"]
  node_ssh["SSH integration<br/>[main.go]"]
  node_transfer["File transfer<br/>[main.go]"]
end

node_user(("Terminal user"))
node_external(("External programs"))

node_user -->|"starts"| node_launcher
node_launcher -->|"starts Python"| node_app
node_app -->|"loads settings"| node_options
node_app -->|"creates sessions"| node_session
node_session -->|"configures runtime"| node_boss
node_boss --> node_tabs
node_tabs --> node_window
node_window -->|"runs process"| node_child
node_monitor -->|"monitors"| node_child
node_child -->|"writes terminal data"| node_parser
node_parser -->|"updates screen"| node_screen
node_screen -->|"provides screen state"| node_graphics
node_fonts -->|"provides glyphs"| node_graphics
node_graphics -->|"renders"| node_gpu
node_glfw -->|"delivers input"| node_boss
node_user -->|"invokes utility"| node_kitten_runner
node_kitten_runner -->|"dispatches"| node_file_picker
node_kitten_runner -->|"dispatches"| node_palette
node_kitten_runner -->|"dispatches"| node_diff
node_kitten_runner -->|"dispatches"| node_ssh
node_kitten_runner -->|"dispatches"| node_transfer
node_user -->|"issues command"| node_at
node_at -->|"sends request"| node_remote
node_remote -->|"controls runtime"| node_boss
node_ssh -->|"runs SSH"| node_external
node_child -->|"executes program"| node_external

click node_launcher "https://github.com/kovidgoyal/kitty/blob/master/kitty/launcher/main.c"
click node_app "https://github.com/kovidgoyal/kitty/blob/master/kitty/main.py"
click node_options "https://github.com/kovidgoyal/kitty/blob/master/kitty/options/parse.py"
click node_session "https://github.com/kovidgoyal/kitty/blob/master/kitty/session.py"
click node_boss "https://github.com/kovidgoyal/kitty/blob/master/kitty/boss.py"
click node_tabs "https://github.com/kovidgoyal/kitty/blob/master/kitty/tabs.py"
click node_window "https://github.com/kovidgoyal/kitty/blob/master/kitty/window.py"
click node_child "https://github.com/kovidgoyal/kitty/blob/master/kitty/child.py"
click node_monitor "https://github.com/kovidgoyal/kitty/blob/master/kitty/child-monitor.c"
click node_parser "https://github.com/kovidgoyal/kitty/blob/master/kitty/vt-parser.c"
click node_screen "https://github.com/kovidgoyal/kitty/blob/master/kitty/screen.c"
click node_graphics "https://github.com/kovidgoyal/kitty/blob/master/kitty/graphics.c"
click node_fonts "https://github.com/kovidgoyal/kitty/blob/master/kitty/fonts.c"
click node_glfw "https://github.com/kovidgoyal/kitty/blob/master/glfw/window.c"
click node_gpu "https://github.com/kovidgoyal/kitty/blob/master/kitty/gl.c"
click node_remote "https://github.com/kovidgoyal/kitty/blob/master/kitty/remote_control.py"
click node_at "https://github.com/kovidgoyal/kitty/blob/master/tools/cmd/at/main.go"
click node_kitten_runner "https://github.com/kovidgoyal/kitty/blob/master/kittens/runner.py"
click node_file_picker "https://github.com/kovidgoyal/kitty/blob/master/kittens/choose_files/main.go"
click node_palette "https://github.com/kovidgoyal/kitty/blob/master/kittens/command_palette/main.go"
click node_diff "https://github.com/kovidgoyal/kitty/blob/master/kittens/diff/main.py"
click node_ssh "https://github.com/kovidgoyal/kitty/blob/master/kittens/ssh/main.go"
click node_transfer "https://github.com/kovidgoyal/kitty/blob/master/kittens/transfer/main.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_launcher,node_app,node_options,node_session,node_user toneBlue
class node_boss,node_tabs,node_window,node_child,node_monitor,node_parser,node_screen toneAmber
class node_graphics,node_fonts,node_glfw,node_gpu toneMint
class node_remote,node_at toneRose
class node_kitten_runner,node_file_picker,node_palette,node_diff,node_ssh,node_transfer,node_external toneIndigo
```

## Components

### Startup and configuration

- [Native launcher](https://github.com/kovidgoyal/kitty/blob/master/kitty/launcher/main.c): `kitty/launcher/main.c`
- [Application startup](https://github.com/kovidgoyal/kitty/blob/master/kitty/main.py): `kitty/main.py`
- [Options and config](https://github.com/kovidgoyal/kitty/blob/master/kitty/options/parse.py): `kitty/options/parse.py`
- [Session setup](https://github.com/kovidgoyal/kitty/blob/master/kitty/session.py): `kitty/session.py`

### Terminal runtime

- [Application controller](https://github.com/kovidgoyal/kitty/blob/master/kitty/boss.py): `kitty/boss.py`
- [Tabs and layouts](https://github.com/kovidgoyal/kitty/blob/master/kitty/tabs.py): `kitty/tabs.py`
- [Terminal window](https://github.com/kovidgoyal/kitty/blob/master/kitty/window.py): `kitty/window.py`
- [Child process](https://github.com/kovidgoyal/kitty/blob/master/kitty/child.py): `kitty/child.py`
- [Child monitoring](https://github.com/kovidgoyal/kitty/blob/master/kitty/child-monitor.c): `kitty/child-monitor.c`
- [VT parser](https://github.com/kovidgoyal/kitty/blob/master/kitty/vt-parser.c): `kitty/vt-parser.c`
- [Screen state](https://github.com/kovidgoyal/kitty/blob/master/kitty/screen.c): `kitty/screen.c`

### Rendering and input

- [Graphics rendering](https://github.com/kovidgoyal/kitty/blob/master/kitty/graphics.c): `kitty/graphics.c`
- [Font rendering](https://github.com/kovidgoyal/kitty/blob/master/kitty/fonts.c): `kitty/fonts.c`
- [Window and input](https://github.com/kovidgoyal/kitty/blob/master/glfw/window.c): `glfw/window.c`
- [GPU display](https://github.com/kovidgoyal/kitty/blob/master/kitty/gl.c): `kitty/gl.c`

### Control and integration

- [Remote control](https://github.com/kovidgoyal/kitty/blob/master/kitty/remote_control.py): `kitty/remote_control.py`
- [Command client](https://github.com/kovidgoyal/kitty/blob/master/tools/cmd/at/main.go): `tools/cmd/at/main.go`

### Kitten utilities

- [Kitten runner](https://github.com/kovidgoyal/kitty/blob/master/kittens/runner.py): `kittens/runner.py`
- [File chooser](https://github.com/kovidgoyal/kitty/blob/master/kittens/choose_files/main.go): `kittens/choose_files/main.go`
- [Command palette](https://github.com/kovidgoyal/kitty/blob/master/kittens/command_palette/main.go): `kittens/command_palette/main.go`
- [File and image diff](https://github.com/kovidgoyal/kitty/blob/master/kittens/diff/main.py): `kittens/diff/main.py`
- [SSH integration](https://github.com/kovidgoyal/kitty/blob/master/kittens/ssh/main.go): `kittens/ssh/main.go`
- [File transfer](https://github.com/kovidgoyal/kitty/blob/master/kittens/transfer/main.go): `kittens/transfer/main.go`

### Other components

- **Terminal user**
- **External programs**

## Connections

- Terminal user → Native launcher: starts
- Native launcher → Application startup: starts Python
- Application startup → Options and config: loads settings
- Application startup → Session setup: creates sessions
- Session setup → Application controller: configures runtime
- Application controller → Tabs and layouts
- Tabs and layouts → Terminal window
- Terminal window → Child process: runs process
- Child monitoring → Child process: monitors
- Child process → VT parser: writes terminal data
- VT parser → Screen state: updates screen
- Screen state → Graphics rendering: provides screen state
- Font rendering → Graphics rendering: provides glyphs
- Graphics rendering → GPU display: renders
- Window and input → Application controller: delivers input
- Terminal user → Kitten runner: invokes utility
- Kitten runner → File chooser: dispatches
- Kitten runner → Command palette: dispatches
- Kitten runner → File and image diff: dispatches
- Kitten runner → SSH integration: dispatches
- Kitten runner → File transfer: dispatches
- Terminal user → Command client: issues command
- Command client → Remote control: sends request
- Remote control → Application controller: controls runtime
- SSH integration → External programs: runs SSH
- Child process → External programs: executes program
