# adoin/git-agent architecture

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

- Interactive diagram: https://gitdiagram.com/adoin/git-agent
- Repository: https://github.com/adoin/git-agent

## Overview

Git Agent is a native desktop Git client. Users open or create a repository, review and stage changes, commit, then manage branches/remotes or inspect history and diffs; conflicts can be resolved in a dedicated editor, optionally with AI suggestions. The graph captures the documented product areas and the available module boundaries. Most implementation files were not sampled, so edges between the main UI and those subsystems reflect documented responsibilities rather than verified call sites; uncertain internal wiring is omitted.

Main entry points: [`src/app.rs`](https://github.com/adoin/git-agent/blob/main/src/app.rs) (Main application), [`src/git.rs`](https://github.com/adoin/git-agent/blob/main/src/git.rs) (Git operations), [`src/merge_tool.rs`](https://github.com/adoin/git-agent/blob/main/src/merge_tool.rs) (Three-way merge editor), [`src/bin/git-agent-diff.rs`](https://github.com/adoin/git-agent/blob/main/src/bin/git-agent-diff.rs) (Diff tool entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_app["Main application<br/>[app.rs]"]
  node_diff_entry["Diff tool entry<br/>[git-agent-diff.rs]"]
  node_merge_entry["Merge tool entry<br/>[git-agent-merge.rs]"]
end

subgraph group_git_workflows["Git workflows"]
  node_git["Git operations<br/>[git.rs]"]
  node_worktree["Worktree changes<br/>[git.rs]"]
  node_gitignore["Ignore rules<br/>[gitignore.rs]"]
end

subgraph group_review_resolution["Review and resolution"]
  node_history["History graph<br/>[graph.rs]"]
  node_diff["Diff window<br/>[diff_tool.rs]"]
  node_patch["Patch workflows<br/>[patch.rs]"]
  node_merge["Three-way merge editor<br/>[merge_tool.rs]"]
end

subgraph group_support["Assistance and customization"]
  node_commit_ai["AI commit messages<br/>[commit_ai.rs]"]
  node_syntax["Syntax highlighting<br/>[syntax.rs]"]
  node_theme["Appearance settings<br/>[theme.rs]"]
  node_i18n["Localization<br/>[i18n.rs]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.rs]"]
end

node_user(("Git user"))
node_system_git["System Git"]
node_ai_provider["Model provider"]
node_keyring["OS credential store"]

node_user -->|"uses"| node_app
node_app -->|"requests Git actions"| node_git
node_git -->|"runs commands"| node_system_git
node_git -->|"loads change status"| node_worktree
node_app -->|"shows history"| node_history
node_app -->|"opens diff tool"| node_diff_entry
node_diff_entry -->|"starts"| node_diff
node_app -->|"handles patches"| node_patch
node_app -->|"opens merge tool"| node_merge_entry
node_merge_entry -->|"starts"| node_merge
node_app -->|"requests message"| node_commit_ai
node_commit_ai -.->|"sends context"| node_ai_provider
node_app -->|"edits ignore rules"| node_gitignore
node_app -->|"uses highlighting"| node_syntax
node_app -->|"uses preferences"| node_theme
node_app -->|"gets translations"| node_i18n
node_app -->|"records events"| node_diagnostics
node_merge -.->|"requests suggestions"| node_ai_provider
node_merge -.->|"uses saved credentials"| node_keyring

click node_app "https://github.com/adoin/git-agent/blob/main/src/app.rs"
click node_git "https://github.com/adoin/git-agent/blob/main/src/git.rs"
click node_worktree "https://github.com/adoin/git-agent/blob/main/src/git.rs"
click node_history "https://github.com/adoin/git-agent/blob/main/src/graph.rs"
click node_diff "https://github.com/adoin/git-agent/blob/main/src/diff_tool.rs"
click node_diff_entry "https://github.com/adoin/git-agent/blob/main/src/bin/git-agent-diff.rs"
click node_patch "https://github.com/adoin/git-agent/blob/main/src/patch.rs"
click node_merge_entry "https://github.com/adoin/git-agent/blob/main/src/bin/git-agent-merge.rs"
click node_merge "https://github.com/adoin/git-agent/blob/main/src/merge_tool.rs"
click node_commit_ai "https://github.com/adoin/git-agent/blob/main/src/commit_ai.rs"
click node_gitignore "https://github.com/adoin/git-agent/blob/main/src/gitignore.rs"
click node_syntax "https://github.com/adoin/git-agent/blob/main/src/syntax.rs"
click node_theme "https://github.com/adoin/git-agent/blob/main/src/theme.rs"
click node_i18n "https://github.com/adoin/git-agent/blob/main/src/i18n.rs"
click node_diagnostics "https://github.com/adoin/git-agent/blob/main/src/diagnostics.rs"

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_app,node_diff_entry,node_merge_entry,node_user toneBlue
class node_git,node_worktree,node_gitignore toneAmber
class node_history,node_diff,node_patch,node_merge toneMint
class node_commit_ai,node_syntax,node_theme,node_i18n,node_diagnostics toneRose
class node_system_git,node_ai_provider,node_keyring toneIndigo
```

## Components

### Desktop experience

- [Main application](https://github.com/adoin/git-agent/blob/main/src/app.rs): `src/app.rs`
- [Diff tool entry](https://github.com/adoin/git-agent/blob/main/src/bin/git-agent-diff.rs): `src/bin/git-agent-diff.rs`
- [Merge tool entry](https://github.com/adoin/git-agent/blob/main/src/bin/git-agent-merge.rs): `src/bin/git-agent-merge.rs`

### Git workflows

- [Git operations](https://github.com/adoin/git-agent/blob/main/src/git.rs): `src/git.rs`
- [Worktree changes](https://github.com/adoin/git-agent/blob/main/src/git.rs): `src/git.rs`
- [Ignore rules](https://github.com/adoin/git-agent/blob/main/src/gitignore.rs): `src/gitignore.rs`

### Review and resolution

- [History graph](https://github.com/adoin/git-agent/blob/main/src/graph.rs): `src/graph.rs`
- [Diff window](https://github.com/adoin/git-agent/blob/main/src/diff_tool.rs): `src/diff_tool.rs`
- [Patch workflows](https://github.com/adoin/git-agent/blob/main/src/patch.rs): `src/patch.rs`
- [Three-way merge editor](https://github.com/adoin/git-agent/blob/main/src/merge_tool.rs): `src/merge_tool.rs`

### Assistance and customization

- [AI commit messages](https://github.com/adoin/git-agent/blob/main/src/commit_ai.rs): `src/commit_ai.rs`
- [Syntax highlighting](https://github.com/adoin/git-agent/blob/main/src/syntax.rs): `src/syntax.rs`
- [Appearance settings](https://github.com/adoin/git-agent/blob/main/src/theme.rs): `src/theme.rs`
- [Localization](https://github.com/adoin/git-agent/blob/main/src/i18n.rs): `src/i18n.rs`
- [Diagnostics](https://github.com/adoin/git-agent/blob/main/src/diagnostics.rs): `src/diagnostics.rs`

### Other components

- **Git user**
- **System Git**
- **Model provider**
- **OS credential store**

## Connections

- Git user → Main application: uses
- Main application → Git operations: requests Git actions
- Git operations → System Git: runs commands
- Git operations → Worktree changes: loads change status
- Main application → History graph: shows history
- Main application → Diff tool entry: opens diff tool
- Diff tool entry → Diff window: starts
- Main application → Patch workflows: handles patches
- Main application → Merge tool entry: opens merge tool
- Merge tool entry → Three-way merge editor: starts
- Main application → AI commit messages: requests message
- AI commit messages → Model provider: sends context
- Main application → Ignore rules: edits ignore rules
- Main application → Syntax highlighting: uses highlighting
- Main application → Appearance settings: uses preferences
- Main application → Localization: gets translations
- Main application → Diagnostics: records events
- Three-way merge editor → Model provider: requests suggestions
- Three-way merge editor → OS credential store: uses saved credentials
