# romkatv/powerlevel10k architecture

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

- Interactive diagram: https://gitdiagram.com/romkatv/powerlevel10k
- Repository: https://github.com/romkatv/powerlevel10k

## Overview

This tree is the GitStatus C++ subsystem bundled with Powerlevel10k, not the Zsh theme’s full prompt implementation. Its runtime is a request/response service: it parses requests and options, obtains repository status through a repository cache and Git/index scans, then formats responses. The README describes Powerlevel10k’s fast, current Git prompt indicators, but does not document the service protocol. Dashed actor links therefore indicate the apparent service boundary; sampled references establish the internal links.

Main entry points: [`gitstatus/src/gitstatus.cc`](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/gitstatus.cc) (Service dispatch), [`gitstatus/src/repo.cc`](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/repo.cc) (Repository status), [`gitstatus/src/index.cc`](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/index.cc) (Index scanning), [`gitstatus/src/git.cc`](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/git.cc) (Git metadata)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Service protocol"]
  node_request["Request parsing<br/>[request.cc]"]
  node_options["Runtime options<br/>[options.cc]"]
  node_daemon["Service dispatch<br/>[gitstatus.cc]"]
  node_response["Response encoding<br/>[response.cc]"]
end

subgraph group_git["Git status engine"]
  node_cache["Repository cache<br/>[repo_cache.cc]"]
  node_repo["Repository status<br/>[repo.cc]"]
  node_gitops["Git metadata<br/>[git.cc]"]
  node_index["Index scanning<br/>[index.cc]"]
  node_dir["Directory scanning<br/>[dir.cc]"]
  node_mtime["Directory mtime check<br/>[check_dir_mtime.cc]"]
  node_tags["Tag lookup<br/>[tag_db.cc]"]
end

subgraph group_runtime["Runtime support"]
  node_arena["Arena allocation<br/>[arena.cc]"]
  node_pool["Thread pool<br/>[thread_pool.cc]"]
  node_logging["Logging<br/>[logging.cc]"]
  node_timer["Timing<br/>[timer.cc]"]
  node_strings["String utilities<br/>[strings.cc]"]
end

node_client(("Prompt client"))

node_client -.->|"sends requests"| node_request
node_request -.->|"parsed requests"| node_daemon
node_daemon -->|"parses arguments"| node_options
node_daemon -->|"gets repositories"| node_cache
node_daemon -->|"queries status"| node_repo
node_daemon -->|"builds responses"| node_response
node_daemon -->|"initializes workers"| node_pool
node_daemon -->|"uses timing"| node_timer
node_cache -->|"caches repositories"| node_repo
node_cache -->|"uses Git helpers"| node_gitops
node_repo -->|"scans index"| node_index
node_repo -->|"looks up tags"| node_tags
node_repo -->|"checks directory times"| node_mtime
node_repo -->|"reads Git metadata"| node_gitops
node_repo -->|"schedules scans"| node_pool
node_index -->|"lists files"| node_dir
node_index -->|"uses Git helpers"| node_gitops
node_index -->|"parallelizes scans"| node_pool
node_tags -->|"reads references"| node_gitops
node_dir -->|"allocates entries"| node_arena
node_request -->|"formats fields"| node_strings
node_daemon -->|"uses logging"| node_logging
node_client -.->|"receives status"| node_response

click node_request "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/request.cc"
click node_options "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/options.cc"
click node_daemon "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/gitstatus.cc"
click node_response "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/response.cc"
click node_cache "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/repo_cache.cc"
click node_repo "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/repo.cc"
click node_gitops "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/git.cc"
click node_index "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/index.cc"
click node_dir "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/dir.cc"
click node_mtime "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/check_dir_mtime.cc"
click node_tags "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/tag_db.cc"
click node_arena "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/arena.cc"
click node_pool "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/thread_pool.cc"
click node_logging "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/logging.cc"
click node_timer "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/timer.cc"
click node_strings "https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/strings.cc"

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_request,node_options,node_daemon,node_response,node_client toneBlue
class node_cache,node_repo,node_gitops,node_index,node_dir,node_mtime,node_tags toneAmber
class node_arena,node_pool,node_logging,node_timer,node_strings toneMint
```

## Components

### Service protocol

- [Request parsing](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/request.cc): `gitstatus/src/request.cc`
- [Runtime options](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/options.cc): `gitstatus/src/options.cc`
- [Service dispatch](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/gitstatus.cc): `gitstatus/src/gitstatus.cc`
- [Response encoding](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/response.cc): `gitstatus/src/response.cc`

### Git status engine

- [Repository cache](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/repo_cache.cc): `gitstatus/src/repo_cache.cc`
- [Repository status](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/repo.cc): `gitstatus/src/repo.cc`
- [Git metadata](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/git.cc): `gitstatus/src/git.cc`
- [Index scanning](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/index.cc): `gitstatus/src/index.cc`
- [Directory scanning](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/dir.cc): `gitstatus/src/dir.cc`
- [Directory mtime check](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/check_dir_mtime.cc): `gitstatus/src/check_dir_mtime.cc`
- [Tag lookup](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/tag_db.cc): `gitstatus/src/tag_db.cc`

### Runtime support

- [Arena allocation](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/arena.cc): `gitstatus/src/arena.cc`
- [Thread pool](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/thread_pool.cc): `gitstatus/src/thread_pool.cc`
- [Logging](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/logging.cc): `gitstatus/src/logging.cc`
- [Timing](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/timer.cc): `gitstatus/src/timer.cc`
- [String utilities](https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/src/strings.cc): `gitstatus/src/strings.cc`

### Other components

- **Prompt client**

## Connections

- Prompt client → Request parsing: sends requests
- Request parsing → Service dispatch: parsed requests
- Service dispatch → Runtime options: parses arguments (evidence: `gitstatus/src/gitstatus.cc`)
- Service dispatch → Repository cache: gets repositories (evidence: `gitstatus/src/gitstatus.cc`)
- Service dispatch → Repository status: queries status (evidence: `gitstatus/src/gitstatus.cc`)
- Service dispatch → Response encoding: builds responses (evidence: `gitstatus/src/gitstatus.cc`)
- Service dispatch → Thread pool: initializes workers (evidence: `gitstatus/src/gitstatus.cc`)
- Service dispatch → Timing: uses timing (evidence: `gitstatus/src/gitstatus.cc`)
- Repository cache → Repository status: caches repositories (evidence: `gitstatus/src/repo_cache.cc`)
- Repository cache → Git metadata: uses Git helpers (evidence: `gitstatus/src/repo_cache.cc`)
- Repository status → Index scanning: scans index
- Repository status → Tag lookup: looks up tags
- Repository status → Directory mtime check: checks directory times (evidence: `gitstatus/src/repo.cc`)
- Repository status → Git metadata: reads Git metadata (evidence: `gitstatus/src/repo.cc`)
- Repository status → Thread pool: schedules scans (evidence: `gitstatus/src/repo.cc`)
- Index scanning → Directory scanning: lists files (evidence: `gitstatus/src/index.cc`)
- Index scanning → Git metadata: uses Git helpers (evidence: `gitstatus/src/index.cc`)
- Index scanning → Thread pool: parallelizes scans (evidence: `gitstatus/src/index.cc`)
- Tag lookup → Git metadata: reads references (evidence: `gitstatus/src/tag_db.cc`)
- Directory scanning → Arena allocation: allocates entries
- Request parsing → String utilities: formats fields (evidence: `gitstatus/src/request.cc`)
- Service dispatch → Logging: uses logging (evidence: `gitstatus/src/gitstatus.cc`)
- Prompt client → Response encoding: receives status
