How t-crypt/berth works
Berth is a local GPU lease broker: clients request a card, the broker queues by priority, drains the current holder, waits for VRAM to become available, and grants the next lease. The CLI and gateway are principal entry points; visibility, model management, claims, alerts, and agent support are major adjacent capabilities. Several subsystem links below come from the README because their implementation files were not sampled; those paths are present in the tree, but their internals were not inspected.
Main entry points: cli.go CLI commands · gateway.go API gateway · broker.go Lease broker · harbor.go Harbor web UI
Components 28
Lease coordination
- Daemon entry
cmd/berth/main.go - Lease protocol
internal/proto/proto.go - Lease server
internal/server/server.go - Lease broker
internal/broker/broker.go - GPU sampling
internal/gpu/gpu.go - Process claims
internal/claims/claims.go
Clients and gateway
- CLI commands
internal/cli/cli.go - Leased process runner
internal/runner/runner.go - API gateway
internal/gateway/gateway.go - Gateway key checks
internal/apikey/apikey.go
GPU visibility
- Engine discovery and metrics
internal/engines/engines.go - Harbor web UI
internal/harbor/harbor.go - Harbor engine views
internal/harbor/web/engines.js - Telemetry store
internal/store/store.go - Alerts
internal/alerts/alerts.go - Telemetry export
internal/export/export.go
Model management
- Model catalog and scan
internal/models/scan.go - Hugging Face pulls
internal/hf/hf.go - CivitAI pulls
internal/civitai/civitai.go - Model storage roots
internal/storage/root.go
Integrations
- Engine suite management
internal/suite/manage.go - Agent skill and wiring
internal/wire/wire.go - Agent skill install
internal/skill/skill.go
Other components
- User or app
- Inference engine
- GPU driver
- Hugging Face
- CivitAI
Connections 33
- User or app → CLI commands: runs commands
README.md - CLI commands → Leased process runner: runs engine
README.md - Leased process runner → Lease protocol: requests lease
internal/runner/runner.go - Daemon entry → Lease server: starts daemon
- Lease server → Lease protocol: handles messages
internal/server/server.go - Lease server → Lease broker: requests lease
internal/server/server.go - Lease broker → GPU sampling: checks GPU state
internal/broker/broker.go - GPU sampling → GPU driver: samples memory
- Lease broker → Leased process runner: sends drain
README.md - User or app → API gateway: sends API request
README.md - API gateway → Gateway key checks: checks bearer key
internal/gateway/gateway.go - API gateway → Leased process runner: starts engine
internal/gateway/gateway.go - API gateway → Inference engine: proxies request
README.md - API gateway → Lease broker: queues lease
README.md - User or app → Process claims: defines claim rules
README.md - Lease broker → Process claims: accounts GPU processes
- CLI commands → Engine discovery and metrics: checks engines
- Engine discovery and metrics → Inference engine: reads status
internal/engines/engines.go - User or app → Harbor web UI: opens dashboard
README.md - Harbor web UI → Telemetry store: reads history
internal/harbor/harbor.go - Harbor web UI → Harbor engine views: serves UI
- Harbor engine views → Harbor web UI: renders telemetry
- CLI commands → Alerts: configures alerts
- CLI commands → Telemetry export: exports telemetry
README.md - CLI commands → Model catalog and scan: lists and verifies
README.md - CLI commands → Hugging Face pulls: downloads model
README.md - Hugging Face pulls → Hugging Face: fetches files
README.md - CLI commands → CivitAI pulls: downloads model
README.md - CivitAI pulls → CivitAI: fetches files
README.md - CLI commands → Model storage roots: checks roots
- CLI commands → Engine suite management: manages installs
- CLI commands → Agent skill and wiring: wires clients
README.md - CLI commands → Agent skill install: installs skill
README.md