llama.cpp boundary
MARS manages llama-server as a separate process. That keeps packaging simple and gives the runtime a stable HTTP contract.
Inference and routing
MARS is local-first by default: it detects hardware, selects an eligible local bundle, starts llama-server as a managed subprocess, and routes roles to fast, reasoning, or coding tiers. Operators can also use real OpenAI-compatible endpoints, Ollama, or supported cloud provider routes through explicit configuration. For setup flags, downloads, PATH, and local machine state, open the Install And Setup Reference.
The default model path keeps inference on the user's machine. The Go binary stays CGO-free; llama.cpp runs as a supervised subprocess with model files stored outside the repo. Local model artifacts are large, so MARS downloads and verifies them under the user cache instead of committing them. For the full filesystem ownership map, use the Files And State Reference.
MARS manages llama-server as a separate process. That keeps packaging simple and gives the runtime a stable HTTP contract.
GGUF model files live under ~/.mars/models/. Managed binaries live under ~/.mars/bin/.
Corrupt or partial downloads must not be loaded silently. Setup verifies required model files before marking a bundle ready.
Complex local coding turns can take minutes on large models. MARS uses longer local client timeouts and avoids retrying prompt-context errors that cannot succeed.
A local bundle maps the fast, reasoning, and coding tiers to model artifacts that fit the detected machine. The performance profile controls how aggressive that choice should be.
| Choice | Meaning | User guidance |
|---|---|---|
auto | Highest-ranked eligible local bundle for detected hardware. | Recommended default for most users. |
local-cpu-q3 | Conservative CPU-capable local bundle. | Use for development, dry runs, and low-memory machines. |
local-balanced-q4 | Balanced local bundle for practical autonomous work. | Recommended for Apple Silicon and unified-memory systems below very large RAM sizes. |
local-quality-q8 | Higher-quality local bundle with larger quantized models. | Use only when VRAM or unified memory can absorb the model comfortably. |
performance_profile: auto | Detect and cap profile where needed. | Apple Silicon below 96 GiB tends to cap high/multi hardware to balanced. |
performance_profile: speed | Favor smaller local models. | Useful when generation latency matters more than quality. |
performance_profile: quality | Use detected hardware profile as-is. | Use on dedicated GPUs or large-memory machines after setup verifies files. |
mars models eligible
mars models eligible --json
mars models list --eligible --json
mars models list
mars models list --provider registry --json
mars setup prepares local inference. It creates the
MARS user directory, writes config, detects hardware, installs
llama-server artifacts, downloads model files when requested, and
verifies the active local bundle before runtime.
make install
mars setup
mars doctor
Ordinary setup requires no GitHub credential; use --github only for optional integration.
mars setup \
--inference local \
--local-bundle auto \
--download \
--yes \
--json
Use JSON and --yes for deterministic setup automation.
mars setup --inference defer --skip-download
mars run engineer --repo ~/my-project --dry-run
Dry-run inspection does not need a live model endpoint.
Role manifests declare intent with model: fast,
model: reasoning, or model: coding.
Runtime routing uses explicit overrides first, then manifest tiers,
then role-name defaults, then a coding fallback. This prevents
planning roles from accidentally using the heaviest coding tier
when the manifest requested a lighter tier.
.harness/model-overrides.yaml can override one tier or one role.
The role's model field wins when it names fast, reasoning, or coding.
Known role names can route to an established tier when no explicit tier is present.
If nothing else matches, MARS falls back to the coding tier.
mars start --model-endpoint <url> is an escape hatch
for a real OpenAI-compatible endpoint. It skips local model-file
preflight and does not start local llama-server processes.
Overrides are deliberate target-repo configuration. They are useful when a project needs a different model for one tier, one role, or a remote provider route. They should be committed and reviewed like other harness changes.
mars models override \
--repo ~/my-project \
--tier coding \
--provider ollama \
--model qwen3.6:27b \
--reason "Evaluate local coding candidate"
mars models override \
--repo ~/my-project \
--role engineer \
--provider openai-compatible \
--endpoint http://127.0.0.1:8088/v1 \
--model repo-coder \
--reason "Use dedicated coding server"
mars models override \
--repo ~/my-project \
--tier reasoning \
--routing cloud \
--provider anthropic \
--model claude-sonnet-family \
--api-key-env ANTHROPIC_API_KEY \
--reason "Temporary high-quality review route"
Store the environment variable name, not the secret value.
Cloud routing is explicit. MARS stores provider metadata and
api_key_env names in repo-owned config; it does not
accept raw provider keys in flags, committed files, logs, traces,
telemetry, JSON output, or errors. Enabling a cloud route sends
selected assembled context, model messages, tool schemas, tool
arguments, and tool results to that provider under its terms.
| Provider | Default endpoint | Credential env | User note |
|---|---|---|---|
| OpenAI | https://api.openai.com/v1 | OPENAI_API_KEY | Supported provider route with OpenAI-compatible chat behavior. |
| Anthropic | https://api.anthropic.com/v1 | ANTHROPIC_API_KEY | Uses Anthropic message adapter behind the provider route. |
| Gemini | https://generativelanguage.googleapis.com/v1beta/openai | GEMINI_API_KEY | Uses Google's OpenAI-compatible endpoint. |
| Mistral | Provider catalog route. | MISTRAL_API_KEY | Optional cloud provider route. |
| DeepSeek | https://api.deepseek.com/v1 | DEEPSEEK_API_KEY | OpenAI-compatible chat route. |
| xAI | Provider catalog route. | XAI_API_KEY | Optional cloud provider route. |
| Groq | Provider catalog route. | GROQ_API_KEY | Optional cloud provider route. |
| Cohere | Provider catalog route. | COHERE_API_KEY | Optional cloud provider route. |
| OpenAI-compatible | User supplied. | User supplied. | Use for local gateways, private endpoints, or compatible model servers. |
Credentials are machine-local. A target repo can document which env names it expects, but secret values stay in the user environment or an ignored local file. The Authentication And Credentials Reference maps provider keys, private release auth, and integration secrets.
export ANTHROPIC_API_KEY=...
mars models evaluate \
--provider anthropic \
--model claude-sonnet-family \
--api-key-env ANTHROPIC_API_KEY
Do not paste secret values into repo files, logs, traces, docs, tickets, or chat.
mars models credentials write-local-env \
--repo ~/my-project \
--api-key-env ANTHROPIC_API_KEY \
--yes \
--json
This reads the secret from the process environment, writes ignored .harness/.env.local with owner-only permissions, and updates the committed example with env names only.
Ollama is a broad catalog and explicit swap provider, not an automatic default-promotion path. Operators can list local Ollama models, evaluate any model by name, and configure an explicit tier or role override when they accept responsibility for that route.
mars models list --provider ollama
mars models list --provider ollama --json
Ollama defaults to http://127.0.0.1:11434/v1 for OpenAI-compatible calls.
mars models evaluate \
--provider ollama \
--model qwen3.6:27b \
--json
mars models override \
--repo ~/my-project \
--tier coding \
--provider ollama \
--model qwen3.6:27b
MARS treats new models as candidates until they pass harness-specific benchmark evidence. Newer or larger models do not become defaults because of model-card claims. A promotion must preserve tool-call reliability, structured JSON behavior, repo-ticket reasoning, speed, memory practicality, immutable artifact metadata, and checksum reproducibility.
mars models evaluate
mars models evaluate --json
Without endpoint and model flags, the command prints the refresh plan, candidates, benchmark cases, and promotion rules.
mars models evaluate \
--endpoint http://127.0.0.1:8088/v1 \
--model repo-coder \
--provider openai-compatible \
--repo ~/my-project \
--save-report \
--json
Reports are stored under docs/generated/model-evaluations/ by default when saving is enabled.
mars models evaluate \
--endpoint http://127.0.0.1:8088/v1 \
--model repo-coder \
--revision immutable-artifact-id \
--sha256 SHA256_VALUE \
--source https://example.invalid/model-card
Default promotion requires immutable revision and SHA256 metadata, not only a passing live run.
| Need | Command | Notes |
|---|---|---|
| Check machine and repo health. | mars doctor --repo ~/my-project --json | Reports config, model, database, auth, repo, and operating-model health. |
| Bypass local llama-server. | mars start --repo ~/my-project --model-endpoint URL | Use only a real OpenAI-compatible endpoint. Fake endpoints are not live evidence. |
| Change local bundle. | mars setup --local-bundle auto --download | Setup verifies required files for the active profile before accepting the marker. |
| Reduce memory pressure. | Use performance_profile: speed or a smaller override. | Apple Silicon generation can be memory-bandwidth bound even when CPU looks idle. |
| Diagnose port conflicts. | Use alternate --addr, --dashboard-addr, or --model-endpoint. | Inference port conflicts are classified with remediation rather than retried blindly. |
| Symptom | Meaning | User action |
|---|---|---|
| Missing local model for a tier. | The active role requires a model file not present under ~/.mars/models/. | Run mars setup, lower the local bundle/profile, or bypass local inference with mars start --repo /path/to/repo --model-endpoint http://127.0.0.1:8080/v1 or mars run engineer --repo /path/to/repo --model-endpoint http://127.0.0.1:8080/v1. |
| Prompt exceeds context. | The request cannot fit the served context window. | Reduce routed context, choose a tier with a larger context, or fix the source of context bloat. |
| Ollama override fails. | The named Ollama model is not installed or Ollama is unreachable. | Install/pull the model in Ollama, start Ollama, or remove the override. |
| Cloud route fails auth. | The configured api_key_env is missing in the process environment or local env file. | Export the env var or run mars models credentials write-local-env. |
| Local generation is slow but CPU is low. | Metal/GPU and memory bandwidth may be the limiting resource. | Use balanced/speed profiles, smaller quantization, or fewer parallel slots. |
| Model tests pass but defaults should not change yet. | Evaluation evidence is not the same as default promotion. | Record report, compare to current defaults, add immutable revision and SHA256, then make a deliberate registry change. |