Skip to main content

Per-stage model selection

Each LLM-powered pipeline stage resolves its model independently, so you can run cheap stages on Haiku and reserve Opus for scenario generation. Resolution precedence:
  1. TRUECOURSE_MODEL_<STAGE> (per-stage env override)
  2. TRUECOURSE_MODEL (global env override)
  3. .truecourse/config.json (llm.stages.<id>)
  4. llm.api.model (API mode only)
  5. the built-in default
truecourse config llm show prints the effective model + source for every stage.
The built-in defaults are Claude Code tier aliases, which mean nothing to a provider API. In API mode your one configured llm.api.model takes their place and runs every stage. The explicit overrides above still win; in API mode they must name a model id your provider accepts.

Cross-stage knobs

Claude Code mode tuning

In Claude Code mode TrueCourse talks to the model via the claude CLI. Tune that interaction (which binary to invoke, which model to pass, timeouts, retries, and how many claude processes to run in parallel) through environment variables. They apply to Claude Code mode only; in API mode the provider config carries the equivalent settings. For packaged installs, the simplest place to set them is ~/.truecourse/.env, loaded automatically on every invocation:
CLAUDE_CODE_MAX_CONCURRENCY caps how many Claude CLI processes TrueCourse spawns in parallel during a single run. Default 10. Raise it on CI runners with spare headroom; lower it on resource-constrained machines (e.g. 8 GB laptops, shared VMs) to avoid OOM on large repos. For a one-off override, prefix the command:

Preflight

Every command that uses Claude (analyze with LLM rules, spec scan, guard setup, guard generate) runs a quick up-front preflight: one tiny claude call to confirm the CLI is installed and logged in, aborting with the CLI’s own error message if not, so an expired login is caught immediately instead of failing every extraction subprocess at the end of a long run. In API mode that preflight is skipped and the saved provider configuration is validated instead.

Cost estimates

spec scan and guard generate print a pre-flight token + ceiling-cost estimate before calling the LLM: token math is deterministic and offline; cost multiplies the high end of each stage’s call range by per-token prices and ignores prompt-caching discounts, so the real bill lands at or below it. Both estimates are cache-aware (they count only the docs/sections that actually changed), and when nothing changed the confirm prompt is skipped. Model prices are fetched daily from OpenRouter and cached under ~/.truecourse/cache/. Set TRUECOURSE_NO_PRICE_FETCH=1 to skip the network and use bundled list prices (air-gapped setups).

Next steps

Storage

Every file TrueCourse writes, per-repo and per-user.

CLI reference

The full environment-variable table alongside every command.