Repository navigation
spike(config): model-role shape — flat map vs per-driver map, role vocabulary (gates the modelRoles feature) #974
Description
Why
The model-roles indirection (filed as the follow-on feature issue) has one open design decision that ripples if made late: the shape of a role. Two candidates:
- Flat map —
modelRoles: { fast: "sonnet", strong: "opus", frontier: "fable" }, values passed to whichever driver runs the phase. - Per-driver map —
fast: { "claude-code": "sonnet", "opencode": "<...>" }, so a role resolves differently per backend.
The flat map is simpler but quietly assumes model strings are portable across drivers. With the opencode driver planned as the first backend that inherits the full skill methodology (#862), and the aider driver already taking raw model strings (src/lib/workflow/drivers/aider.ts:183), that assumption needs checking before the schema ships — a settings-schema migration after adoption is exactly the kind of rework the vid-gen OQ1 spike existed to prevent.
There is also a vocabulary decision with rot evidence already in the repo: settings.ts:52 documents opus as "most capable" (now wrong — fable sits above), and agents.model is a hardcoded enum ["haiku","sonnet","opus"] (settings.ts:389) that predates the current roster. Role names must describe function in the workflow (e.g. fast/strong/frontier, or drafting/review/judgment), never relative capability rank of specific families, or they rot the same way.
Research questions
- How do opencode and aider identify models — provider-prefixed IDs, aliases, config profiles? Is any claude-family alias portable, or does every backend need its own string?
- Flat vs per-driver: if per-driver, what is the fallback when a role has no entry for the active driver (loud failure, per the fix(driver): result subtype "success" with is_error:true is reported as phase success — unrecognized model yields a zero-work "successful" phase #973 contract)?
- Is a 3-role vocabulary sufficient for current consumers (phase policy feat(run): per-phase model and effort configuration for the claude-code driver #914, ladder feat(run): model escalation ladder on capability-bound non-convergence #971, benchmark policies bench: replay outcome-distribution smoke for roster/policy changes (descoped from A/B ranking — phase-0) #916/feat(run): adopt cheaper per-phase model/effort defaults from #916 benchmark results — testgen, docs, assess candidates #944), and what are the names?
- Where do shipped defaults live so a fresh
sequant setupgets a sensible map without hardcoding the roster in more than one place?
Not in scope
Implementation (the follow-on feature issue owns it); the evolution loop for updating the map (gated on #916's phase-0 measurement); the agents.model enum cleanup (rides the feature issue).
Deliverable
A recommendation comment on this issue: chosen shape, role vocabulary, defaults location, and the per-driver fallback semantics — each with the evidence (docs/source references for opencode + aider model handling).
Acceptance Criteria
- AC-1: the recommendation answers all four research questions with source/doc citations for opencode and aider model identification
- AC-2: the chosen schema is written as the exact settings JSON shape (with a worked example for two drivers) so the feature issue can encode it without re-deciding
- AC-3: the decision gate is recorded: what evidence would have flipped the choice (so a future backend addition can re-test the assumption cheaply)
Done when
The feature issue can implement modelRoles from this issue's recommendation without making any schema decision itself.
Activity
admarble commentedon Aug 29, 2026
Spike recommendation: model-role shape (2026-08-29)
TL;DR — chosen shape: per-driver map with a string shorthand that desugars to claude-code. A role value is either a single string (sugar for
{ "claude-code": "<value>" }) or an object keyed by driver name. No cross-driver fallback: a role with no entry for the active driver is a loud dispatch-time config error. Vocabulary:fast/strong/frontier. Defaults live in exactly one place: aDEFAULT_MODEL_ROLESconst insrc/lib/settings.tsapplied via the zod schema's.default()— freshsequant setupwrites nothing.RQ1 — How opencode and aider identify models (and whether any alias is portable)
opencode: models are
provider_id/model_idstrings (e.g.anthropic/claude-opus-5), set via the rootmodelkey inopencode.jsonor the--model/-mflag; the provider/model registry comes from models.dev (75+ providers via the AI SDK). Selection priority: CLI flag → configmodelkey → previously used model → internal priority. There are no bare family aliases — the provider prefix is mandatory, and for a custom provider the IDs are whatever keys the user defined underprovider.models. Per-phase override without touching user files is available viaOPENCODE_CONFIG_CONTENT(per #862 D5). Sources: opencode Models docs, opencode Config docs.aider: LiteLLM-style names via
--model— unprefixed Anthropic names work, other providers use prefixes (gemini/…,deepseek/…). It ships built-in aliases that pin dated IDs:haiku→claude-haiku-4-5,sonnet→claude-sonnet-4-6,opus→claude-opus-4-7— note these are already a generation behind the current roster. Users can define custom aliases (--alias "name:model"or analias:section in.aider.conf.yml; priority CLI > config file > built-in). Source: aider model-aliases docs. Sequant'sAiderDriverpassessettings.modelverbatim as--model(src/lib/workflow/drivers/aider.ts:182-184).claude-code (baseline, from the A0 spike 2026-08-28, CC 2.1.251): bare family aliases resolve latest-in-family (
sonnet→ claude-sonnet-5,fable→ claude-fable-5; resolved ID observable in the result'smodelUsagekeys); strings pass through unvalidated per #914 (claude-code.ts:144); an invalid model does not fall back — it fails at the API, loudly once #973 lands.Portability answer: no claude-family alias is portable — and the failure mode is worse than "doesn't parse". The word
sonnetis accepted by two backends with different semantics: latest-in-family in claude-code vs. pinned-and-staleclaude-sonnet-4-6in aider. A flat map would appear to work while silently running different models under the same role name. opencode rejects the bare form outright (prefix required). Every backend needs its own string.RQ2 — Flat vs per-driver, and the missing-entry fallback
Per-driver object, with a string shorthand that binds to claude-code only:
"fast": "sonnet"desugars to"fast": { "claude-code": "sonnet" }. This keeps flat-map ergonomics for the single-driver majority without the silent-divergence hazard above: run the same settings under--agent aiderand you get the loud missing-entry error below, not aider's stale reinterpretation ofsonnet.entry[d].modelRoles.frontier has no model for driver "opencode" — add run.modelRoles.frontier.opencode to .sequant/settings.json. Nodefaultkey, no cross-driver borrowing (RQ1 shows the strings aren't portable), consistent with the fix(driver): result subtype "success" with is_error:true is reported as phase success — unrecognized model yields a zero-work "successful" phase #973 loud-failure contract. The loudness guarantee per backend: claude-code fails at dispatch once fix(driver): result subtype "success" with is_error:true is reported as phase success — unrecognized model yields a zero-work "successful" phase #973 lands; aider maps non-zero exit to phase failure (aider.ts:146-158); opencode's driver design maps NDJSONerrorevents to structured failure (feat: add opencode agent driver — first backend that can inherit the full skill methodology #862 D1).RQ3 — Role vocabulary
Three roles, named by workflow function:
fast,strong,frontier.faststrongfrontiersettings.ts:52documentingopusas "most capable" — now wrong).drafting/review/judgment— it maps 1:1 onto phases, but feat(run): model escalation ladder on capability-bound non-convergence #971's ladder needs a role meaning "stronger than what just failed" independent of any phase, and review-vs-judgment is a distinction without an operational difference.utilityfor subagents, if Subagent model routing is broken — all mechanisms resolve to parent model (Opus) anthropics/claude-code#43869 is ever fixed andagents.modelbecomes role-valued) is additive and non-breaking — the schema below is an open record, not a closed enum.AC-2 — Exact settings shape (worked example, two drivers)
Zod shape (open record; role names are user-extensible):
The
role:prefix is pinned here deliberately so #975 doesn't re-decide it: implicit lookup (bare"fast"resolving as a role if defined) would let a role namedsonnetshadow a real alias, and aider's own docs usefastas an example model alias — explicit prefix removes the ambiguity class entirely.RQ4 — Where shipped defaults live
Single source:
DEFAULT_MODEL_ROLESinsrc/lib/settings.ts, wired as the schema.default(). Consequences:sequant setupdoes not writemodelRolesat all — an absent key parses to the defaults. This keeps the roster out of user files until they override.generateSettingsJsonc(DEFAULT_SETTINGS)(settings.ts:989/996) and the setup skill's inline settings block (templates/skills/setup/SKILL.md§4) — must not gain hand-written copies of the roster; if the JSONC generator emits the key for discoverability, it generates values fromDEFAULT_MODEL_ROLES. The settings docs table is already generated in the same file, so it shares the source.sonnet/opus/fable). Deliberately no shipped opencode/aider entries: sequant can't know which providers a user has configured in those tools, and a guessedanthropic/…mapping would trade a loud, actionable missing-entry error for a plausible-looking wrong guess. The error message tells the user exactly which key to add.AC-3 — Decision gate: what evidence would flip this
sonnetparse, and to what does it resolve? (b) is a provider prefix required? Today: aider resolvessonnetto a pinned stale ID (divergent semantics), opencode rejects it (prefix required) → flat rejected.provider/model) is adopted by ~all sequant backends including claude-code — then store canonical IDs plus per-driver translation. Watch trigger: ≥3 backends models.dev-native.utilitytier if the upstreamagents.modelbug is fixed). Additive, no migration — record the new role's function definition, never a family.aider.ts:146-158), not yet probed — run the probe when the aider path next matters. opencode: gate the driver PR (feat: add opencode agent driver — first backend that can inherit the full skill methodology #862) on it.Done-when check
#975 can now encode: the
ModelRoleValue = string | Record<driver, string>union, therole:reference prefix, the three default role names and their claude-code values, loud missing-entry/undefined-role errors, and no shipped non-claude-code defaults — with no schema decision left open.Sources: opencode Models · opencode Config · aider model aliases · repo:
src/lib/workflow/drivers/aider.ts:182-184,src/lib/settings.ts:52,389,989,996,templates/skills/setup/SKILL.md§4,src/lib/workflow/drivers/claude-code.ts:144· spikes: A0 model-string contract (2026-08-28, CC 2.1.251), #973 repro · #862 (opencode driver design, D1/D5).admarble commentedon Aug 30, 2026
Recommendation accepted (owner-approved 2026-08-29): per-driver map with string shorthand desugaring to
{"claude-code": value},role:reference prefix, loud missing-entry/undefined-role failures,fast/strong/frontiervocabulary, defaults solely inDEFAULT_MODEL_ROLESvia zod.default(). The full schema + decision gate is in the recommendation comment above. #975 is now unblocked and implements it verbatim — any schema deviation goes back through this issue.