Appearance
CLI and runtime internals
This page explains how the public mere.run command tree maps to the package internals.
Top-level flow
Sources/MereRunCLI/MereRunCLI.swiftdefines the public modality-first tree.- Each command in
Sources/MereRunCLI/Commandsparses arguments and performs small amounts of orchestration. - Shared CLI helpers in
Sources/MereRunCLI/Supportbootstrap the model store, expose the managed model registry, and provide output helpers. - Runtime code in
MereRunCore,AudioSTT, andAudioTTSperforms the inference work.
The package is intentionally organized so public command concerns do not live in the deep model code.
Model resolution path
Almost every command eventually passes through the same model-resolution layer:
MereRunModelKit/MereRunModelPaths.swift: configured storage pathsMereRunModelKit/MereRunModelManifest.swift: metadata and provenanceMereRunModelKit/InstalledModelResolver.swift: location policy and lookupMereRunCore/ModelResolver.swift: catalog and runtime-validation adapter
That shared path is what keeps the command surface coherent across image, text, speech, vision, music, SFX, and video.
Resource ownership
Inference admission separates a server's machine reservation from its request queue. MereRunAdmission owns these coordinators and their leases. Runtime residency owns model generations, model leases, and eviction mechanics. Runtime adapters retain model construction, cache, and batching policy.
The shared transcription operation extends the typed operation boundary to file transcription and translation. CLI and API adapters resolve equivalent inputs through the same service.
CLI design conventions
The public surface follows three rules:
1. Modality-first commands
Commands are grouped by user intent:
- image
- text
- speech
- vision
- music
- sfx
- video
- model
- status
- api
2. Canonical public model IDs
The runtime uses explicit public IDs such as:
image-klein-maxtext-chat-gemma4text-chat-q36-nanotext-chat-lfm25-a1b-8bittext-chat-lfm25-2.6b-4bittext-agent-deepseek-v4-flashspeech-tts-qwen3-nano
Docs, tests, and examples should use the canonical IDs reported by mere.run model list.
3. Quiet default output
Normal success-path runs should emit only intended user-facing output. Internal bring-up logging belongs behind the shared debug helper, not in default stdout.
Runtime family pattern
The runtime families now follow a consistent reading pattern:
- root file owns the public type and high-level orchestration
- companion files own loading, generation, decoding, support, or diagnostics
That pattern is used heavily in:
Qwen3TTSGeneratorLightOnOCRGeneratorZImageTurboGeneratorQwenImageEditGeneratorACEStepPipelineImageValidateCommand
Choose the CLI or runtime starting point
Start in the CLI when
- you are changing flags, help text, or output shape
- you are changing which runtime family a command dispatches to
- you are debugging how user input becomes a runtime request
Start in the runtime when
- you are changing inference behavior
- you are debugging loading, decoding, or generation internals
- you are working inside one modality family already
Contributor reading sequence
- Read the repository tour.
- Read the architecture map.
- Read one command file in
Sources/MereRunCLI/Commands. - Read the matching runtime family entry point.
- Read the related tests in
Tests/.