Skip to content

Source the Claude Code model catalog from the t3code manifest - #439

Merged
Tryanks merged 1 commit into
mainfrom
feat/claude-model-manifest
Sep 15, 2026
Merged

Tryanks merged 1 commit into
mainfrom
feat/claude-model-manifest

Conversation

@Tryanks

@Tryanks Tryanks commented Sep 15, 2026

Copy link
Copy Markdown
Owner

What changes

Claude Code's model catalog is no longer hand-written in claude.rs. It is resolved from the t3code project's model-manifest.json (MIT), which lists each model's slug, name, option descriptors (effort levels with defaults, fast mode, context window), Claude CLI min/max version, and the launch adapter mappings (effortMap, [1m] suffix, context window tokens).

  • crates/agent/src/claude_manifest.rs is the single owner: serde decode of the fields tcode reads, validation (version, unique slugs, profile references, semver bounds, non-empty ids), resolution to ModelSpec, and the refresh.
  • A verbatim copy of the upstream file is bundled (claude_model_manifest.json) as the offline fallback. At runtime, under the process feature, the same file is fetched from raw.githubusercontent.com at most once per hour (5 min back-off after failure, 10 s timeout, 1 MiB cap) and the last good copy is cached in the data dir. A bundle newer by updatedAt outranks the cache. Invalid data never replaces a usable catalog; the network never fails list_models.
  • The fetch is gated by the existing "Provider update checks" setting; with it off, only the disk cache and bundle are used.
  • Removed: built_in_models, model_available, normalize_claude_cli_effort, the native context-window table and the descriptor builder helpers. Manifest effort is translated to tcode's reasoningEffort in one place; everything in the UI is unchanged.
  • list_models takes a CatalogRefresh { cache_dir, network } supplied by the runtime's existing provider refresh path.

Upstream data is adopted wholesale; there is no local override table.

User-visible differences (from adopting upstream data)

  • Fable 5.1 / Fable 5 default effort: high → medium.
  • Opus 4.7 and 4.8 lose the Context Window selector (fixed 1M). Opus 4.5, 4.6 and 4.7 gain Fast Mode.
  • Opus 4.6 default window 200k → 1M; Sonnet 5 default 1M → 200k (launches with autoCompactWindow 200000).
  • Fable and Opus 5 with the default 1M selection launch as <slug>[1m]; verified with claude 2.1.272 that the CLI accepts it and reports the same 1M window.
  • Fable 5.1 is the manifest default model.

Tests

Synthetic manifest tests cover: descriptor mapping (defaults, boolean, unknown descriptor types dropped), 11 invalid-manifest rejections, install keeps the previous catalog on invalid data, TTL/retry/network-off pacing including a clock moving backwards, disk cache adopted only when not older than the bundle, effortMap application (ultracode→xhigh, ultrathink→no flag, per-profile xhigh→max / max→high, passthrough), min/max version gating, [1m] suffix and autoCompactWindow semantics across window profiles.

Checks run

  • cargo fmt --all --check — pass
  • cargo clippy --workspace --all-targets --locked -- -D warnings — pass
  • cargo build --workspace --locked — pass
  • cargo test --workspace --locked — pass (agent 182)
  • cargo machete — no unused dependencies
  • RUSTFLAGS='-D warnings' cargo check -p tcode-web --target wasm32-unknown-unknown --locked — pass
  • cargo run -p agent --example probe -- claude "Reply with exactly: PONG" /tmp/smoke — PONG, context window 1000000; with --effort ultracode the spawn args are effort=xhigh settings={"ultracode":true}.
  • iOS/Android not run locally.

Docs: docs/claude-models.md describes the source and cache policy.

Replace the hand-written Claude catalog (models, option descriptors,
effort special cases, version gates and the [1m]/context-window table)
with the t3code model manifest. A verbatim copy is bundled as the
offline fallback; `list_models` refreshes it from t3code main at most
hourly (5 min back-off, 10 s timeout, 1 MiB cap), caches the last good
copy in the data dir, and skips the network when provider update checks
are disabled. A bundle newer by `updatedAt` outranks the cache, and
invalid data never replaces a usable manifest.

The manifest's `effort` id is translated to `reasoningEffort` at the
boundary; effortMap drives the --effort flag, modelSuffixes the [1m]
suffix, and contextWindowTokens/fixedContextWindowTokens the window a
selection resolves to. Upstream data is adopted wholesale, so some
defaults change (Fable 5.1 effort medium, Sonnet 5 window 200k, Opus 4.7
and 4.8 fixed 1M without a selector, fastMode on Opus 4.5–4.8 and Opus 5).

Also initialises the `title_generating` field in a sidebar test fixture
that no longer compiled after #428.
@Tryanks
Tryanks merged commit 4c74e3d into main Sep 15, 2026
6 checks passed
@Tryanks
Tryanks deleted the feat/claude-model-manifest branch September 15, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant