# slimtoolkit/slim architecture

> Architecture diagram of the GitHub repository slimtoolkit/slim, 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/slimtoolkit/slim
- Repository: https://github.com/slimtoolkit/slim

## Overview

SlimToolkit is a container inspection, optimization, and security CLI. Its principal workflow profiles a target image by running an instrumented container, observing application behavior, and producing reports and security artifacts; image-building capabilities can then produce smaller images. The README also documents separate analysis, debugging, image-management, registry, and vulnerability commands. Several command handlers and subsystem implementations were not sampled, so those branches are represented at their documented directory paths; edges are limited to documented capabilities or visible source references.

Main entry points: [`pkg/app/master/command/profile/handler.go`](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/profile/handler.go) (Profile), [`pkg/app/master/command/xray/handler.go`](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/xray/handler.go) (Xray), [`pkg/app/master/command/merge/handler.go`](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/merge/handler.go) (Merge), [`pkg/report/command_report.go`](https://github.com/slimtoolkit/slim/blob/master/pkg/report/command_report.go) (Command reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_master["Slim CLI<br/>[app.go]"]
  node_profile["Profile<br/>[handler.go]"]
  node_build["Build<br/>[handler.go]"]
  node_xray["Xray<br/>[handler.go]"]
  node_lint["Lint<br/>[handler.go]"]
  node_debug["Debug"]
  node_merge["Merge<br/>[handler.go]"]
  node_registry["Registry"]
  node_vulnerability["Vulnerability"]
end

subgraph group_analysis["Container analysis"]
  node_docker["Docker client<br/>[client.go]"]
  node_container["Container inspector"]
  node_imageinspect["Image inspector<br/>[image_inspector.go]"]
  node_http_probe["HTTP probing"]
end

subgraph group_image["Image operations"]
  node_builder["Image builder<br/>[imagebuilder.go]"]
  node_engine["Build engine<br/>[engine.go]"]
  node_reader["Image reader<br/>[imagereader.go]"]
end

subgraph group_runtime["Sensor runtime"]
  node_sensor["Sensor app<br/>[app.go]"]
  node_execution["Execution modes"]
  node_monitor["Process monitors"]
  node_ptrace["Ptrace monitor<br/>[ptrace.go]"]
end

subgraph group_results["Reports and security"]
  node_reports["Command reports<br/>[command_report.go]"]
  node_linter["Dockerfile linter<br/>[linter.go]"]
  node_epss["EPSS client<br/>[client.go]"]
end

node_user(("Developer"))

node_user -->|"runs commands"| node_master
node_master -.->|"dispatches"| node_profile
node_master -.->|"dispatches"| node_build
node_user -->|"profiles images"| node_profile
node_user -->|"optimizes images"| node_build
node_user -->|"inspects images"| node_xray
node_user -->|"lints images"| node_lint
node_user -->|"debugs containers"| node_debug
node_user -->|"merges images"| node_merge
node_user -->|"manages registry"| node_registry
node_user -->|"checks vulnerabilities"| node_vulnerability
node_profile -->|"creates client"| node_docker
node_profile -->|"inspects target"| node_imageinspect
node_profile -->|"runs container"| node_container
node_profile -->|"starts probes"| node_http_probe
node_profile -.->|"records results"| node_reports
node_xray -->|"creates client"| node_docker
node_xray -->|"inspects image"| node_imageinspect
node_xray -.->|"records results"| node_reports
node_lint -->|"runs checks"| node_linter
node_merge -->|"reads images"| node_reader
node_merge -->|"builds output"| node_engine
node_merge -.->|"records results"| node_reports
node_build -.->|"builds image"| node_engine
node_engine -->|"uses builder API"| node_builder
node_vulnerability -->|"queries scores"| node_epss
node_sensor -->|"selects mode"| node_execution
node_sensor -->|"uses monitors"| node_monitor
node_ptrace -->|"publishes events"| node_reports

click node_master "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/app.go"
click node_profile "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/profile/handler.go"
click node_build "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/containerize/handler.go"
click node_xray "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/xray/handler.go"
click node_lint "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/lint/handler.go"
click node_debug "https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/command/debug"
click node_merge "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/merge/handler.go"
click node_registry "https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/command/registry"
click node_vulnerability "https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/command/vulnerability"
click node_docker "https://github.com/slimtoolkit/slim/blob/master/pkg/docker/dockerclient/client.go"
click node_container "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/inspectors/container/container_inspector.go"
click node_imageinspect "https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/inspectors/image/image_inspector.go"
click node_http_probe "https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/probe/http"
click node_sensor "https://github.com/slimtoolkit/slim/blob/master/pkg/app/sensor/app.go"
click node_execution "https://github.com/slimtoolkit/slim/tree/master/pkg/app/sensor/execution"
click node_monitor "https://github.com/slimtoolkit/slim/tree/master/pkg/app/sensor/monitor"
click node_ptrace "https://github.com/slimtoolkit/slim/blob/master/pkg/monitor/ptrace/ptrace.go"
click node_builder "https://github.com/slimtoolkit/slim/blob/master/pkg/imagebuilder/imagebuilder.go"
click node_engine "https://github.com/slimtoolkit/slim/blob/master/pkg/imagebuilder/internalbuilder/engine.go"
click node_reader "https://github.com/slimtoolkit/slim/blob/master/pkg/imagereader/imagereader.go"
click node_reports "https://github.com/slimtoolkit/slim/blob/master/pkg/report/command_report.go"
click node_linter "https://github.com/slimtoolkit/slim/blob/master/pkg/docker/linter/linter.go"
click node_epss "https://github.com/slimtoolkit/slim/blob/master/pkg/vulnerability/epss/client/client.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_master,node_profile,node_build,node_xray,node_lint,node_debug,node_merge,node_registry,node_vulnerability toneBlue
class node_docker,node_container,node_imageinspect,node_http_probe toneAmber
class node_builder,node_engine,node_reader toneMint
class node_sensor,node_execution,node_monitor,node_ptrace toneRose
class node_reports,node_linter,node_epss,node_user toneIndigo
```

## Components

### CLI workflows

- [Slim CLI](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/app.go): `pkg/app/master/app.go`
- [Profile](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/profile/handler.go): `pkg/app/master/command/profile/handler.go`
- [Build](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/containerize/handler.go): `pkg/app/master/command/containerize/handler.go`
- [Xray](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/xray/handler.go): `pkg/app/master/command/xray/handler.go`
- [Lint](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/lint/handler.go): `pkg/app/master/command/lint/handler.go`
- [Debug](https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/command/debug): `pkg/app/master/command/debug`
- [Merge](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/command/merge/handler.go): `pkg/app/master/command/merge/handler.go`
- [Registry](https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/command/registry): `pkg/app/master/command/registry`
- [Vulnerability](https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/command/vulnerability): `pkg/app/master/command/vulnerability`

### Container analysis

- [Docker client](https://github.com/slimtoolkit/slim/blob/master/pkg/docker/dockerclient/client.go): `pkg/docker/dockerclient/client.go`
- [Container inspector](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/inspectors/container/container_inspector.go): `pkg/app/master/inspectors/container/container_inspector.go`
- [Image inspector](https://github.com/slimtoolkit/slim/blob/master/pkg/app/master/inspectors/image/image_inspector.go): `pkg/app/master/inspectors/image/image_inspector.go`
- [HTTP probing](https://github.com/slimtoolkit/slim/tree/master/pkg/app/master/probe/http): `pkg/app/master/probe/http`

### Image operations

- [Image builder](https://github.com/slimtoolkit/slim/blob/master/pkg/imagebuilder/imagebuilder.go): `pkg/imagebuilder/imagebuilder.go`
- [Build engine](https://github.com/slimtoolkit/slim/blob/master/pkg/imagebuilder/internalbuilder/engine.go): `pkg/imagebuilder/internalbuilder/engine.go`
- [Image reader](https://github.com/slimtoolkit/slim/blob/master/pkg/imagereader/imagereader.go): `pkg/imagereader/imagereader.go`

### Sensor runtime

- [Sensor app](https://github.com/slimtoolkit/slim/blob/master/pkg/app/sensor/app.go): `pkg/app/sensor/app.go`
- [Execution modes](https://github.com/slimtoolkit/slim/tree/master/pkg/app/sensor/execution): `pkg/app/sensor/execution`
- [Process monitors](https://github.com/slimtoolkit/slim/tree/master/pkg/app/sensor/monitor): `pkg/app/sensor/monitor`
- [Ptrace monitor](https://github.com/slimtoolkit/slim/blob/master/pkg/monitor/ptrace/ptrace.go): `pkg/monitor/ptrace/ptrace.go`

### Reports and security

- [Command reports](https://github.com/slimtoolkit/slim/blob/master/pkg/report/command_report.go): `pkg/report/command_report.go`
- [Dockerfile linter](https://github.com/slimtoolkit/slim/blob/master/pkg/docker/linter/linter.go): `pkg/docker/linter/linter.go`
- [EPSS client](https://github.com/slimtoolkit/slim/blob/master/pkg/vulnerability/epss/client/client.go): `pkg/vulnerability/epss/client/client.go`

### Other components

- **Developer**

## Connections

- Developer → Slim CLI: runs commands
- Slim CLI → Profile: dispatches
- Slim CLI → Build: dispatches
- Developer → Profile: profiles images
- Developer → Build: optimizes images
- Developer → Xray: inspects images
- Developer → Lint: lints images
- Developer → Debug: debugs containers
- Developer → Merge: merges images
- Developer → Registry: manages registry
- Developer → Vulnerability: checks vulnerabilities
- Profile → Docker client: creates client (evidence: `pkg/app/master/command/profile/handler.go`)
- Profile → Image inspector: inspects target (evidence: `pkg/app/master/command/profile/handler.go`)
- Profile → Container inspector: runs container (evidence: `pkg/app/master/command/profile/handler.go`)
- Profile → HTTP probing: starts probes (evidence: `pkg/app/master/command/profile/handler.go`)
- Profile → Command reports: records results
- Xray → Docker client: creates client (evidence: `pkg/app/master/command/xray/handler.go`)
- Xray → Image inspector: inspects image (evidence: `pkg/app/master/command/xray/handler.go`)
- Xray → Command reports: records results
- Lint → Dockerfile linter: runs checks (evidence: `pkg/app/master/command/lint/handler.go`)
- Merge → Image reader: reads images (evidence: `pkg/app/master/command/merge/handler.go`)
- Merge → Build engine: builds output (evidence: `pkg/app/master/command/merge/handler.go`)
- Merge → Command reports: records results
- Build → Build engine: builds image
- Build engine → Image builder: uses builder API (evidence: `pkg/imagebuilder/internalbuilder/engine.go`)
- Vulnerability → EPSS client: queries scores (evidence: `pkg/app/master/command/vulnerability/handler_tool_epss.go`)
- Sensor app → Execution modes: selects mode (evidence: `pkg/app/sensor/app.go`)
- Sensor app → Process monitors: uses monitors (evidence: `pkg/app/sensor/app.go`)
- Ptrace monitor → Command reports: publishes events (evidence: `pkg/monitor/ptrace/ptrace.go`)
