# samkamer/ubuntu-packaging-mentor architecture

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

- Interactive diagram: https://gitdiagram.com/samkamer/ubuntu-packaging-mentor
- Repository: https://github.com/samkamer/ubuntu-packaging-mentor

## Overview

Ubuntu AI Packaging Mentor is a multi-agent CLI for guiding users through Debian/Ubuntu packaging, from environment setup to package checks. Users choose a skill for a source tree; agents inspect or update packaging files, with AI-assisted explanations, and the builder runs linting after a successful build. The README documents skill routing and build-to-lint behavior; sampled code and the source index support internal helper links. The main CLI and some agents were not excerpted, so their specific dispatch paths are not asserted.

Main entry points: [`mentor.py`](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/mentor.py) (Mentor CLI), [`agents/brain.py`](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/brain.py) (LLM provider), [`agents/preflight.py`](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/preflight.py) (Environment setup), [`agents/builder.py`](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/builder.py) (Package builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and Config"]
  node_preflight["Environment setup<br/>[preflight.py]"]
  node_config[("User configuration<br/>[config.py]")]
end

subgraph group_workflow["Packaging Skills"]
  node_auditor["Copyright audit<br/>[auditor.py]"]
  node_license_texts["DEP-5 license texts<br/>[license_texts.py]"]
  node_detective["Dependency detection<br/>[detective.py]"]
  node_scribe["Changelog drafting<br/>[scribe.py]"]
  node_patch["Quilt patching<br/>[patch_manager.py]"]
end

subgraph group_quality["Quality and Security"]
  node_builder["Package builder<br/>[builder.py]"]
  node_linter["Package linting<br/>[linter.py]"]
  node_guardian["Security checks<br/>[guardian.py]"]
end

subgraph group_ai["AI Services"]
  node_brain["LLM provider<br/>[brain.py]"]
  node_network["Host networking<br/>[network.py]"]
end

node_user(("Packaging user"))
node_cli["Mentor CLI<br/>[mentor.py]"]
node_ollama["Ollama service"]
node_copilot["Copilot CLI"]
node_packaging_tools["Packaging tools"]

node_user -->|"runs"| node_cli
node_cli -->|"sets up"| node_preflight
node_preflight -->|"writes settings"| node_config
node_preflight -->|"gets gateway"| node_network
node_cli -->|"selects skill"| node_auditor
node_cli -->|"selects skill"| node_detective
node_cli -->|"selects skill"| node_scribe
node_cli -->|"selects skill"| node_patch
node_cli -->|"selects skill"| node_builder
node_cli -.->|"offers checks"| node_guardian
node_auditor -->|"uses texts"| node_license_texts
node_auditor -->|"asks AI"| node_brain
node_scribe -->|"drafts with"| node_brain
node_builder -->|"analyzes failures"| node_brain
node_builder -->|"runs after build"| node_linter
node_linter -->|"explains errors"| node_brain
node_guardian -->|"explains findings"| node_brain
node_brain -->|"gets gateway"| node_network
node_brain -->|"sends requests"| node_ollama
node_brain -->|"invokes provider"| node_copilot
node_preflight -->|"detects tools"| node_packaging_tools
node_builder -->|"runs debuild"| node_packaging_tools
node_linter -->|"runs lintian"| node_packaging_tools

click node_cli "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/mentor.py"
click node_preflight "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/preflight.py"
click node_config "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/config.py"
click node_auditor "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/auditor.py"
click node_license_texts "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/license_texts.py"
click node_detective "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/detective.py"
click node_scribe "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/scribe.py"
click node_patch "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/patch_manager.py"
click node_builder "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/builder.py"
click node_linter "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/linter.py"
click node_guardian "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/guardian.py"
click node_brain "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/brain.py"
click node_network "https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/network.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_preflight,node_config,node_user toneBlue
class node_auditor,node_license_texts,node_detective,node_scribe,node_patch toneAmber
class node_builder,node_linter,node_guardian toneMint
class node_brain,node_network toneRose
class node_cli toneTeal
class node_ollama,node_copilot,node_packaging_tools toneIndigo
```

## Components

### Setup and Config

- [Environment setup](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/preflight.py): `agents/preflight.py`
- [User configuration](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/config.py): `agents/config.py`

### Packaging Skills

- [Copyright audit](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/auditor.py): `agents/auditor.py`
- [DEP-5 license texts](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/license_texts.py): `agents/license_texts.py`
- [Dependency detection](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/detective.py): `agents/detective.py`
- [Changelog drafting](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/scribe.py): `agents/scribe.py`
- [Quilt patching](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/patch_manager.py): `agents/patch_manager.py`

### Quality and Security

- [Package builder](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/builder.py): `agents/builder.py`
- [Package linting](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/linter.py): `agents/linter.py`
- [Security checks](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/guardian.py): `agents/guardian.py`

### AI Services

- [LLM provider](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/brain.py): `agents/brain.py`
- [Host networking](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/agents/network.py): `agents/network.py`

### Other components

- **Packaging user**
- [Mentor CLI](https://github.com/samkamer/ubuntu-packaging-mentor/blob/master/mentor.py): `mentor.py`
- **Ollama service**
- **Copilot CLI**
- **Packaging tools**

## Connections

- Packaging user → Mentor CLI: runs (evidence: `README.md`)
- Mentor CLI → Environment setup: sets up (evidence: `README.md`)
- Environment setup → User configuration: writes settings (evidence: `agents/preflight.py`)
- Environment setup → Host networking: gets gateway (evidence: `agents/preflight.py`)
- Mentor CLI → Copyright audit: selects skill (evidence: `README.md`)
- Mentor CLI → Dependency detection: selects skill (evidence: `README.md`)
- Mentor CLI → Changelog drafting: selects skill (evidence: `README.md`)
- Mentor CLI → Quilt patching: selects skill (evidence: `README.md`)
- Mentor CLI → Package builder: selects skill (evidence: `README.md`)
- Mentor CLI → Security checks: offers checks
- Copyright audit → DEP-5 license texts: uses texts (evidence: `agents/auditor.py`)
- Copyright audit → LLM provider: asks AI (evidence: `agents/auditor.py`)
- Changelog drafting → LLM provider: drafts with (evidence: `agents/scribe.py`)
- Package builder → LLM provider: analyzes failures (evidence: `agents/builder.py`)
- Package builder → Package linting: runs after build (evidence: `README.md`)
- Package linting → LLM provider: explains errors (evidence: `agents/linter.py`)
- Security checks → LLM provider: explains findings (evidence: `agents/guardian.py`)
- LLM provider → Host networking: gets gateway (evidence: `agents/network.py`)
- LLM provider → Ollama service: sends requests (evidence: `agents/brain.py`)
- LLM provider → Copilot CLI: invokes provider (evidence: `agents/brain.py`)
- Environment setup → Packaging tools: detects tools (evidence: `README.md`)
- Package builder → Packaging tools: runs debuild (evidence: `agents/builder.py`)
- Package linting → Packaging tools: runs lintian (evidence: `agents/linter.py`)
