# domaiynlabs/koala architecture

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

- Interactive diagram: https://gitdiagram.com/domaiynlabs/koala
- Repository: https://github.com/domaiynlabs/koala

## Overview

Koala audits model artifacts and, optionally, a configured live model: an operator invokes the CLI or REST API, the shared service runs static and dynamic checks, maps evidence to governance controls, then returns reports and optional integrity/history artifacts. Framework packs and custom rulebooks supply the controls; runtime adapters and probes handle live-model checks. The README documents several report formats and capabilities whose individual wiring is not fully shown, so those relationships are represented only where source references or documentation support them.

Main entry points: [`src/koala/service.py`](https://github.com/domaiynlabs/koala/blob/main/src/koala/service.py) (Audit service), [`src/koala/cli.py`](https://github.com/domaiynlabs/koala/blob/main/src/koala/cli.py) (CLI), [`src/koala/engine/evaluator.py`](https://github.com/domaiynlabs/koala/blob/main/src/koala/engine/evaluator.py) (Control evaluator), [`src/koala/api/app.py`](https://github.com/domaiynlabs/koala/blob/main/src/koala/api/app.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Interfaces and orchestration"]
  node_cli["CLI<br/>[cli.py]"]
  node_api["REST API<br/>[app.py]"]
  node_service["Audit service<br/>[service.py]"]
  node_config["Settings<br/>[config.py]"]
end

subgraph group_checks["Audit evaluation"]
  node_inventory["Artifact scan<br/>[artifacts.py]"]
  node_loader["Pack loader<br/>[loader.py]"]
  node_packs["Framework packs"]
  node_evaluator["Control evaluator<br/>[evaluator.py]"]
  node_models["Audit models<br/>[models.py]"]
  node_remediation["Recommendations<br/>[remediation.py]"]
end

subgraph group_outputs["Reports and history"]
  node_report_schema["Report schema<br/>[schema.py]"]
  node_markdown["Markdown renderer<br/>[render_md.py]"]
  node_html["HTML renderer<br/>[render_html.py]"]
  node_sarif["SARIF renderer<br/>[render_sarif.py]"]
  node_manifest["Audit manifest<br/>[manifest.py]"]
  node_history[("History store<br/>[history.py]")]
  node_diff["Report diff<br/>[diff.py]"]
end

subgraph group_runtime["Runtime integrations"]
  node_probes["Dynamic probes<br/>[builtin.py]"]
  node_adapter["Adapter interface<br/>[base.py]"]
  node_ollama["Ollama adapter<br/>[ollama.py]"]
  node_openai["OpenAI-compatible adapter<br/>[openai_compat.py]"]
end

node_operator(("Operator"))

node_operator -->|"runs audit"| node_cli
node_operator -->|"submits audit"| node_api
node_cli -->|"calls audit"| node_service
node_api -->|"calls audit"| node_service
node_api -->|"reads settings"| node_config
node_service -->|"reads settings"| node_config
node_service -->|"scans artifacts"| node_inventory
node_service -->|"loads controls"| node_loader
node_loader -->|"loads packs"| node_packs
node_service -->|"evaluates audit"| node_evaluator
node_evaluator -->|"runs static checks"| node_inventory
node_evaluator -->|"runs probes"| node_probes
node_evaluator -->|"creates results"| node_models
node_evaluator -->|"uses guidance"| node_remediation
node_probes -->|"generates prompts"| node_adapter
node_adapter -->|"dispatches target"| node_ollama
node_adapter -->|"dispatches target"| node_openai
node_service -->|"builds report"| node_report_schema
node_cli -->|"renders report"| node_markdown
node_cli -->|"renders report"| node_html
node_cli -.->|"exports report"| node_sarif
node_service -->|"stores report"| node_history
node_cli -->|"writes metadata"| node_manifest
node_cli -->|"compares reports"| node_diff
node_history -.->|"supplies history"| node_diff

click node_cli "https://github.com/domaiynlabs/koala/blob/main/src/koala/cli.py"
click node_api "https://github.com/domaiynlabs/koala/blob/main/src/koala/api/app.py"
click node_service "https://github.com/domaiynlabs/koala/blob/main/src/koala/service.py"
click node_config "https://github.com/domaiynlabs/koala/blob/main/src/koala/config.py"
click node_inventory "https://github.com/domaiynlabs/koala/blob/main/src/koala/inventory/artifacts.py"
click node_loader "https://github.com/domaiynlabs/koala/blob/main/src/koala/engine/loader.py"
click node_packs "https://github.com/domaiynlabs/koala/tree/main/src/koala/packs"
click node_evaluator "https://github.com/domaiynlabs/koala/blob/main/src/koala/engine/evaluator.py"
click node_models "https://github.com/domaiynlabs/koala/blob/main/src/koala/models.py"
click node_remediation "https://github.com/domaiynlabs/koala/blob/main/src/koala/remediation.py"
click node_probes "https://github.com/domaiynlabs/koala/blob/main/src/koala/probes/builtin.py"
click node_adapter "https://github.com/domaiynlabs/koala/blob/main/src/koala/adapters/base.py"
click node_ollama "https://github.com/domaiynlabs/koala/blob/main/src/koala/adapters/ollama.py"
click node_openai "https://github.com/domaiynlabs/koala/blob/main/src/koala/adapters/openai_compat.py"
click node_report_schema "https://github.com/domaiynlabs/koala/blob/main/src/koala/report/schema.py"
click node_markdown "https://github.com/domaiynlabs/koala/blob/main/src/koala/report/render_md.py"
click node_html "https://github.com/domaiynlabs/koala/blob/main/src/koala/report/render_html.py"
click node_sarif "https://github.com/domaiynlabs/koala/blob/main/src/koala/report/render_sarif.py"
click node_manifest "https://github.com/domaiynlabs/koala/blob/main/src/koala/report/manifest.py"
click node_history "https://github.com/domaiynlabs/koala/blob/main/src/koala/history.py"
click node_diff "https://github.com/domaiynlabs/koala/blob/main/src/koala/report/diff.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_cli,node_api,node_service,node_config toneBlue
class node_inventory,node_loader,node_packs,node_evaluator,node_models,node_remediation toneAmber
class node_report_schema,node_markdown,node_html,node_sarif,node_manifest,node_history,node_diff toneMint
class node_probes,node_adapter,node_ollama,node_openai toneRose
class node_operator toneIndigo
```

## Components

### Interfaces and orchestration

- [CLI](https://github.com/domaiynlabs/koala/blob/main/src/koala/cli.py): `src/koala/cli.py`
- [REST API](https://github.com/domaiynlabs/koala/blob/main/src/koala/api/app.py): `src/koala/api/app.py`
- [Audit service](https://github.com/domaiynlabs/koala/blob/main/src/koala/service.py): `src/koala/service.py`
- [Settings](https://github.com/domaiynlabs/koala/blob/main/src/koala/config.py): `src/koala/config.py`

### Audit evaluation

- [Artifact scan](https://github.com/domaiynlabs/koala/blob/main/src/koala/inventory/artifacts.py): `src/koala/inventory/artifacts.py`
- [Pack loader](https://github.com/domaiynlabs/koala/blob/main/src/koala/engine/loader.py): `src/koala/engine/loader.py`
- [Framework packs](https://github.com/domaiynlabs/koala/tree/main/src/koala/packs): `src/koala/packs`
- [Control evaluator](https://github.com/domaiynlabs/koala/blob/main/src/koala/engine/evaluator.py): `src/koala/engine/evaluator.py`
- [Audit models](https://github.com/domaiynlabs/koala/blob/main/src/koala/models.py): `src/koala/models.py`
- [Recommendations](https://github.com/domaiynlabs/koala/blob/main/src/koala/remediation.py): `src/koala/remediation.py`

### Reports and history

- [Report schema](https://github.com/domaiynlabs/koala/blob/main/src/koala/report/schema.py): `src/koala/report/schema.py`
- [Markdown renderer](https://github.com/domaiynlabs/koala/blob/main/src/koala/report/render_md.py): `src/koala/report/render_md.py`
- [HTML renderer](https://github.com/domaiynlabs/koala/blob/main/src/koala/report/render_html.py): `src/koala/report/render_html.py`
- [SARIF renderer](https://github.com/domaiynlabs/koala/blob/main/src/koala/report/render_sarif.py): `src/koala/report/render_sarif.py`
- [Audit manifest](https://github.com/domaiynlabs/koala/blob/main/src/koala/report/manifest.py): `src/koala/report/manifest.py`
- [History store](https://github.com/domaiynlabs/koala/blob/main/src/koala/history.py): `src/koala/history.py`
- [Report diff](https://github.com/domaiynlabs/koala/blob/main/src/koala/report/diff.py): `src/koala/report/diff.py`

### Runtime integrations

- [Dynamic probes](https://github.com/domaiynlabs/koala/blob/main/src/koala/probes/builtin.py): `src/koala/probes/builtin.py`
- [Adapter interface](https://github.com/domaiynlabs/koala/blob/main/src/koala/adapters/base.py): `src/koala/adapters/base.py`
- [Ollama adapter](https://github.com/domaiynlabs/koala/blob/main/src/koala/adapters/ollama.py): `src/koala/adapters/ollama.py`
- [OpenAI-compatible adapter](https://github.com/domaiynlabs/koala/blob/main/src/koala/adapters/openai_compat.py): `src/koala/adapters/openai_compat.py`

### Other components

- **Operator**

## Connections

- Operator → CLI: runs audit (evidence: `README.md`)
- Operator → REST API: submits audit (evidence: `README.md`)
- CLI → Audit service: calls audit (evidence: `src/koala/cli.py`)
- REST API → Audit service: calls audit (evidence: `src/koala/api/app.py`)
- REST API → Settings: reads settings (evidence: `src/koala/api/app.py`)
- Audit service → Settings: reads settings (evidence: `src/koala/service.py`)
- Audit service → Artifact scan: scans artifacts
- Audit service → Pack loader: loads controls (evidence: `src/koala/service.py`)
- Pack loader → Framework packs: loads packs (evidence: `src/koala/engine/loader.py`)
- Audit service → Control evaluator: evaluates audit (evidence: `src/koala/service.py`)
- Control evaluator → Artifact scan: runs static checks (evidence: `src/koala/engine/evaluator.py`)
- Control evaluator → Dynamic probes: runs probes (evidence: `src/koala/engine/evaluator.py`)
- Control evaluator → Audit models: creates results (evidence: `src/koala/engine/evaluator.py`)
- Control evaluator → Recommendations: uses guidance (evidence: `src/koala/engine/evaluator.py`)
- Dynamic probes → Adapter interface: generates prompts (evidence: `src/koala/probes/builtin.py`)
- Adapter interface → Ollama adapter: dispatches target (evidence: `src/koala/adapters/base.py`)
- Adapter interface → OpenAI-compatible adapter: dispatches target (evidence: `src/koala/adapters/base.py`)
- Audit service → Report schema: builds report (evidence: `src/koala/service.py`)
- CLI → Markdown renderer: renders report (evidence: `src/koala/cli.py`)
- CLI → HTML renderer: renders report (evidence: `src/koala/cli.py`)
- CLI → SARIF renderer: exports report (evidence: `README.md`)
- Audit service → History store: stores report (evidence: `src/koala/service.py`)
- CLI → Audit manifest: writes metadata (evidence: `src/koala/cli.py`)
- CLI → Report diff: compares reports (evidence: `src/koala/cli.py`)
- History store → Report diff: supplies history (evidence: `README.md`)
