# meshapplied/goethe architecture

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

## Overview

Goethe turns a supported machine into a private model-serving API. The main workflow is to install or choose a model, assess GPU fit, start a suitable runtime, and serve requests through a shared gateway; a daemon supports persistent operation. The CLI also includes an Ask flow for interpreting requests and planning commands. The README documents product capabilities, while source excerpts and the index substantiate only some internal connections; unsupported implementation links are omitted or marked unverified.

Main entry points: [`goethe/crates/goethe/src/main.rs`](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/main.rs) (Goethe CLI), [`goethe/crates/goethe/src/ask/planner.rs`](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/planner.rs) (Ask planner), [`goethe/crates/core/src/engines/mod.rs`](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/mod.rs) (Engine selection), [`goethe/crates/goethed/src/mux.rs`](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethed/src/mux.rs) (API gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and planning"]
  node_cli["Goethe CLI<br/>[main.rs]"]
  node_ask["Ask planner<br/>[planner.rs]"]
  node_ask_parse["Ask parsing<br/>[parse.rs]"]
  node_ask_schema["Ask schema<br/>[schema.rs]"]
  node_ask_embed["Ask embeddings<br/>[embed.rs]"]
  node_spec["Command spec<br/>[spec.rs]"]
  node_client_spec["Command completion<br/>[complete.rs]"]
end

subgraph group_models["Models and placement"]
  node_catalog["Model recommendations<br/>[recommend.rs]"]
  node_install["Model installation<br/>[install.rs]"]
  node_huggingface["Model downloads<br/>[hf.rs]"]
  node_model_facts["Model facts<br/>[model_facts.rs]"]
  node_placement["GPU placement<br/>[chooser.rs]"]
  node_vram["VRAM calculation<br/>[calc.rs]"]
  node_memory_spec["Memory estimates<br/>[memory_spec.rs]"]
end

subgraph group_runtime["Serving runtime"]
  node_engine_dispatch["Engine selection<br/>[mod.rs]"]
  node_kernel_engine["Kernel-pack engine<br/>[goethe_engine.rs]"]
  node_llama_engine["llama.cpp engine<br/>[llama_cpp.rs]"]
  node_sglang_engine["SGLang engine<br/>[sglang.rs]"]
  node_python_env["Python environments<br/>[pyenv.rs]"]
  node_gateway["API gateway<br/>[mux.rs]"]
  node_python_probe["Python setup<br/>[pyenv.rs]"]
end

subgraph group_operations["Daemon and operations"]
  node_state_db[("Local state<br/>[db.rs]")]
  node_daemon["Background daemon<br/>[main.rs]"]
  node_daemon_curator["Engine curator<br/>[curator.rs]"]
  node_service["Service management<br/>[service.rs]"]
  node_metrics["Usage metrics<br/>[metrics.rs]"]
  node_host["Host detection<br/>[host.rs]"]
  node_paths["Home and paths<br/>[paths.rs]"]
  node_system["System utilities<br/>[sys.rs]"]
  node_updater["Runtime updates<br/>[update.rs]"]
end

subgraph group_protocol["Client connectivity"]
  node_link["Remote linking<br/>[link.rs]"]
  node_net["Network utilities<br/>[net.rs]"]
end

node_operator(("Operator"))
node_client(("API clients"))

node_operator -->|"runs commands"| node_cli
node_cli -.->|"installs models"| node_install
node_cli -.->|"starts serving"| node_gateway
node_client -->|"sends API requests"| node_gateway
node_ask -->|"uses parsing"| node_ask_parse
node_ask -->|"uses schema"| node_ask_schema
node_ask -->|"uses embeddings"| node_ask_embed
node_ask -->|"plans commands"| node_spec
node_cli -->|"dispatches Ask"| node_ask
node_install -->|"downloads weights"| node_huggingface
node_install -->|"registers models"| node_state_db
node_placement -->|"checks memory"| node_vram
node_placement -->|"checks engines"| node_engine_dispatch
node_engine_dispatch -->|"selects engine"| node_kernel_engine
node_engine_dispatch -->|"selects engine"| node_llama_engine
node_engine_dispatch -->|"selects engine"| node_sglang_engine
node_kernel_engine -->|"resolves Python"| node_python_env
node_llama_engine -->|"uses Python setup"| node_python_env
node_sglang_engine -->|"uses Python setup"| node_python_env
node_daemon -->|"loads gateway"| node_gateway
node_daemon -->|"starts curator"| node_daemon_curator
node_daemon_curator -->|"coordinates serving"| node_gateway
node_service -.->|"spawns daemon"| node_daemon
node_link -->|"uses home paths"| node_paths
node_link -->|"uses networking"| node_net
node_host -->|"probes system"| node_system
node_host -->|"uses home paths"| node_paths
node_python_probe -->|"fetches packages"| node_updater
node_cli -->|"offers completion"| node_client_spec

click node_cli "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/main.rs"
click node_ask "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/planner.rs"
click node_ask_parse "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/parse.rs"
click node_ask_schema "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/schema.rs"
click node_ask_embed "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/embed.rs"
click node_spec "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/spec.rs"
click node_catalog "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/recommend.rs"
click node_install "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/install.rs"
click node_huggingface "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/hf.rs"
click node_model_facts "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/model_facts.rs"
click node_placement "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/chooser.rs"
click node_vram "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/calc.rs"
click node_memory_spec "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/memory_spec.rs"
click node_state_db "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/db.rs"
click node_engine_dispatch "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/mod.rs"
click node_kernel_engine "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/goethe_engine.rs"
click node_llama_engine "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/llama_cpp.rs"
click node_sglang_engine "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/sglang.rs"
click node_python_env "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/pyenv.rs"
click node_gateway "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethed/src/mux.rs"
click node_daemon "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethed/src/main.rs"
click node_daemon_curator "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethed/src/curator.rs"
click node_service "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/service.rs"
click node_metrics "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/metrics.rs"
click node_link "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/client/link.rs"
click node_net "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/net.rs"
click node_host "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/host.rs"
click node_paths "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/paths.rs"
click node_system "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/sys.rs"
click node_updater "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/update.rs"
click node_python_probe "https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/pyenv.rs"
click node_client_spec "https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/complete.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_cli,node_ask,node_ask_parse,node_ask_schema,node_ask_embed,node_spec,node_client_spec,node_client toneBlue
class node_catalog,node_install,node_huggingface,node_model_facts,node_placement,node_vram,node_memory_spec toneAmber
class node_engine_dispatch,node_kernel_engine,node_llama_engine,node_sglang_engine,node_python_env,node_gateway,node_python_probe toneMint
class node_state_db,node_daemon,node_daemon_curator,node_service,node_metrics,node_host,node_paths,node_system,node_updater toneRose
class node_link,node_net,node_operator toneIndigo
```

## Components

### CLI and planning

- [Goethe CLI](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/main.rs): `goethe/crates/goethe/src/main.rs`
- [Ask planner](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/planner.rs): `goethe/crates/goethe/src/ask/planner.rs`
- [Ask parsing](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/parse.rs): `goethe/crates/goethe/src/ask/parse.rs`
- [Ask schema](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/schema.rs): `goethe/crates/goethe/src/ask/schema.rs`
- [Ask embeddings](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/ask/embed.rs): `goethe/crates/goethe/src/ask/embed.rs`
- [Command spec](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/spec.rs): `goethe/crates/goethe/src/spec.rs`
- [Command completion](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethe/src/complete.rs): `goethe/crates/goethe/src/complete.rs`

### Models and placement

- [Model recommendations](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/recommend.rs): `goethe/crates/core/src/recommend.rs`
- [Model installation](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/install.rs): `goethe/crates/core/src/install.rs`
- [Model downloads](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/hf.rs): `goethe/crates/core/src/hf.rs`
- [Model facts](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/model_facts.rs): `goethe/crates/core/src/model_facts.rs`
- [GPU placement](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/chooser.rs): `goethe/crates/core/src/chooser.rs`
- [VRAM calculation](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/calc.rs): `goethe/crates/core/src/calc.rs`
- [Memory estimates](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/memory_spec.rs): `goethe/crates/core/src/memory_spec.rs`

### Serving runtime

- [Engine selection](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/mod.rs): `goethe/crates/core/src/engines/mod.rs`
- [Kernel-pack engine](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/goethe_engine.rs): `goethe/crates/core/src/engines/goethe_engine.rs`
- [llama.cpp engine](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/llama_cpp.rs): `goethe/crates/core/src/engines/llama_cpp.rs`
- [SGLang engine](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/engines/sglang.rs): `goethe/crates/core/src/engines/sglang.rs`
- [Python environments](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/pyenv.rs): `goethe/crates/core/src/pyenv.rs`
- [API gateway](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethed/src/mux.rs): `goethe/crates/goethed/src/mux.rs`
- [Python setup](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/pyenv.rs): `goethe/crates/core/src/pyenv.rs`

### Daemon and operations

- [Local state](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/db.rs): `goethe/crates/core/src/db.rs`
- [Background daemon](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethed/src/main.rs): `goethe/crates/goethed/src/main.rs`
- [Engine curator](https://github.com/meshapplied/goethe/blob/main/goethe/crates/goethed/src/curator.rs): `goethe/crates/goethed/src/curator.rs`
- [Service management](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/service.rs): `goethe/crates/core/src/service.rs`
- [Usage metrics](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/metrics.rs): `goethe/crates/core/src/metrics.rs`
- [Host detection](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/host.rs): `goethe/crates/core/src/host.rs`
- [Home and paths](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/paths.rs): `goethe/crates/core/src/paths.rs`
- [System utilities](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/sys.rs): `goethe/crates/core/src/sys.rs`
- [Runtime updates](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/update.rs): `goethe/crates/core/src/update.rs`

### Client connectivity

- [Remote linking](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/client/link.rs): `goethe/crates/core/src/client/link.rs`
- [Network utilities](https://github.com/meshapplied/goethe/blob/main/goethe/crates/core/src/net.rs): `goethe/crates/core/src/net.rs`

### Other components

- **Operator**
- **API clients**

## Connections

- Operator → Goethe CLI: runs commands (evidence: `README.md`)
- Goethe CLI → Model installation: installs models (evidence: `README.md`)
- Goethe CLI → API gateway: starts serving (evidence: `README.md`)
- API clients → API gateway: sends API requests (evidence: `README.md`)
- Ask planner → Ask parsing: uses parsing (evidence: `goethe/crates/goethe/src/ask/planner.rs`)
- Ask planner → Ask schema: uses schema (evidence: `goethe/crates/goethe/src/ask/planner.rs`)
- Ask planner → Ask embeddings: uses embeddings (evidence: `goethe/crates/goethe/src/ask/planner.rs`)
- Ask planner → Command spec: plans commands (evidence: `goethe/crates/goethe/src/ask/planner.rs`)
- Goethe CLI → Ask planner: dispatches Ask
- Model installation → Model downloads: downloads weights (evidence: `goethe/crates/core/src/install.rs`)
- Model installation → Local state: registers models (evidence: `goethe/crates/core/src/install.rs`)
- GPU placement → VRAM calculation: checks memory (evidence: `goethe/crates/core/src/chooser.rs`)
- GPU placement → Engine selection: checks engines (evidence: `goethe/crates/core/src/chooser.rs`)
- Engine selection → Kernel-pack engine: selects engine (evidence: `goethe/crates/core/src/engines/mod.rs`)
- Engine selection → llama.cpp engine: selects engine (evidence: `goethe/crates/core/src/engines/mod.rs`)
- Engine selection → SGLang engine: selects engine (evidence: `goethe/crates/core/src/engines/mod.rs`)
- Kernel-pack engine → Python environments: resolves Python (evidence: `goethe/crates/core/src/engines/goethe_engine.rs`)
- llama.cpp engine → Python environments: uses Python setup (evidence: `goethe/crates/core/src/engines/llama_cpp.rs`)
- SGLang engine → Python environments: uses Python setup (evidence: `goethe/crates/core/src/engines/sglang.rs`)
- Background daemon → API gateway: loads gateway (evidence: `goethe/crates/goethed/src/main.rs`)
- Background daemon → Engine curator: starts curator (evidence: `goethe/crates/goethed/src/main.rs`)
- Engine curator → API gateway: coordinates serving (evidence: `goethe/crates/goethed/src/curator.rs`)
- Service management → Background daemon: spawns daemon
- Remote linking → Home and paths: uses home paths (evidence: `goethe/crates/core/src/client/link.rs`)
- Remote linking → Network utilities: uses networking (evidence: `goethe/crates/core/src/client/link.rs`)
- Host detection → System utilities: probes system (evidence: `goethe/crates/core/src/host.rs`)
- Host detection → Home and paths: uses home paths (evidence: `goethe/crates/core/src/host.rs`)
- Python setup → Runtime updates: fetches packages (evidence: `goethe/crates/core/src/pyenv.rs`)
- Goethe CLI → Command completion: offers completion (evidence: `goethe/crates/goethe/src/main.rs`)
