Skip to content

feat(web): generate Claude Code settings for all model tiers#227

Merged
Menci merged 5 commits into
Menci:mainfrom
yyyr-p:worktree-claude-env-vars-research
Jul 16, 2026
Merged

feat(web): generate Claude Code settings for all model tiers#227
Menci merged 5 commits into
Menci:mainfrom
yyyr-p:worktree-claude-env-vars-research

Conversation

@yyyr-p

@yyyr-p yyyr-p commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Expand the CliSnippet Claude Code helper from 3 tier selectors (Big/Sonnet/Haiku) to 4 (Fable/Opus/Sonnet/Haiku). Fable is the new top tier above Opus; the previously-unexposed ANTHROPIC_DEFAULT_FABLE_MODEL / ANTHROPIC_DEFAULT_OPUS_MODEL env vars now have picker slots.
  • Emit a JSON { "env": { ... } } fragment for merging into ~/.claude/settings.json (user-scope) or .claude/settings.json (project-scope), instead of the previous export-style shell block. Claude Code's background-agent supervisor does not reliably inherit shell env — settings.json is the only channel that reaches every execution context (SDK, -p, cross-cwd dispatch, background sessions).
  • Drop the redundant ANTHROPIC_MODEL var: it duplicated whichever per-tier slot was chosen as the startup default, and the four explicit ANTHROPIC_DEFAULT_*_MODEL vars now cover the same ground with tier-clear semantics.
  • Preserve the [1m] context-window suffix on Fable/Opus/Sonnet slots; keep the Haiku slot plain regardless of which model id is picked — Haiku is the background/tool-call tier where 1M-context cost is not warranted.
  • Internal cleanup along the way: rename small -> haiku to match the tier vocabulary, inline the four single-use sortClaude* comparators, rename codexModelsList -> codexModels to match the sibling naming convention, and collapse the four parallel Claude tier bindings into a table-driven CLAUDE_TIER_KEYS tuple + Record<TierKey, string> selection.

Test plan

  • vue-tsc --noEmit clean (typecheck)
  • eslint apps/web/src/components/keys/CliSnippet.vue clean
  • Manual browser verification against a seeded custom upstream with claude-fable-5 / claude-opus-4-8 / claude-sonnet-5 (all 1M ctx) + claude-haiku-4-5 (200K): four tier selects render in Fable/Opus/Sonnet/Haiku order with tier-appropriate defaults; emitted JSON structure is { "env": { ... } } with exactly six keys and no ANTHROPIC_MODEL; [1m] suffix appears on Fable/Opus/Sonnet values only.
  • Probe: switching the Haiku selector to a 1M-context model (claude-fable-5) keeps ANTHROPIC_DEFAULT_HAIKU_MODEL plain (no [1m]) while the other three slots retain their [1m] suffixes — confirms the context-suffix asymmetry is per-slot, not per-picked-model.

yyyr-p added 5 commits July 16, 2026 12:51
Expand the dashboard's Claude Code setup helper from three tiers to four
(Fable / Opus / Sonnet / Haiku) and switch the emitted format from shell
exports to a JSON `env` fragment for `~/.claude/settings.json`.

Fable is Claude Code's new top tier above Opus; missing it left users
without a way to route the CLI's Fable slot through Floway. Missing the
Opus slot meant the CLI fell back to its built-in default opus id
instead of a Floway-catalogued one.

Shell exports also don't reach background agents reliably — the
supervisor only forwards them when it was started from the same gateway
environment and dispatched into the current cwd; @repo / --cwd and the
SDK / -p paths drop them. settings.json's `env` block is the only
channel that covers every execution context.

Emit only the `env` sub-object so users paste it into an existing
settings file without clobbering unrelated top-level keys.

Also collapse the three ad-hoc tier sort helpers into one
distance-to-target factory used for all four buckets, and drop
ANTHROPIC_MODEL (redundant with the per-tier defaults).
The Haiku slot's identifiers were still named 'small' from when the
picker only distinguished big/sonnet/small. Now that Fable / Opus /
Sonnet / Haiku are four peer tiers, the odd-one-out naming is
misleading — align on the tier name.
Replace four per-tier `claudeModels{Fable,Opus,Sonnet,Haiku}` computeds,
four `claude{...}Model` refs, four inline watchEffect fallback lines, and
four near-identical `<div>` slots with a `CLAUDE_TIER_KEYS` tuple, a
single `claudeModelsByTier: Record<ClaudeTierKey, string[]>` computed, a
`claudeSelection` reactive record, and one `v-for` template block. This
mirrors the peer `v-for="key in PATH_KEYS"` + bracket-indexed
`Record<PathKey, ...>` shape already in use in
`upstream-edit/CustomConfigPanel.vue` (with its `PATH_KEYS as const`
tuple in `customConfig.ts`). The four `ANTHROPIC_DEFAULT_<TIER>_MODEL`
env keys stay explicit for grep-ability, and Haiku's no-`addCtx`
asymmetry is preserved.
@Menci Menci changed the title feat(web): add Fable/Opus tiers + settings.json env output to CliSnippet feat(web): generate Claude Code settings for all model tiers Jul 16, 2026
@Menci Menci merged commit 6822898 into Menci:main Jul 16, 2026
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.

2 participants