Skip to content

spike(config): model-role shape — flat map vs per-driver map, role vocabulary (gates the modelRoles feature) #974

Closed

Description

@admarble

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

  1. 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?
  2. 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)?
  3. 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?
  4. Where do shipped defaults live so a fresh sequant setup gets 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

  1. admarble commented on Aug 29, 2026

    @admarble
    ContributorAuthor

    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: a DEFAULT_MODEL_ROLES const in src/lib/settings.ts applied via the zod schema's .default() — fresh sequant setup writes nothing.


    RQ1 — How opencode and aider identify models (and whether any alias is portable)

    opencode: models are provider_id/model_id strings (e.g. anthropic/claude-opus-5), set via the root model key in opencode.json or the --model/-m flag; the provider/model registry comes from models.dev (75+ providers via the AI SDK). Selection priority: CLI flag → config model key → 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 under provider.models. Per-phase override without touching user files is available via OPENCODE_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 an alias: section in .aider.conf.yml; priority CLI > config file > built-in). Source: aider model-aliases docs. Sequant's AiderDriver passes settings.model verbatim 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's modelUsage keys); 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 sonnet is accepted by two backends with different semantics: latest-in-family in claude-code vs. pinned-and-stale claude-sonnet-4-6 in 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:

    RQ3 — Role vocabulary

    Three roles, named by workflow function: fast, strong, frontier.

    Role Function Current consumers
    fast high-volume generation: exec, testgen phase policy #914
    strong judgment/review: spec, qa phase policy #914 (vid-gen evidence: sonnet exec + opus QA tiering)
    frontier escalation target: hardest debugging, ladder top rung #971 ladder; #916/#944 measure when it pays

    AC-2 — Exact settings shape (worked example, two drivers)

    // .sequant/settings.json
    {
      "run": {
        "modelRoles": {
          // string shorthand — desugars to { "claude-code": "sonnet" }
          "fast": "sonnet",
    
          // per-driver object — keys are driver registry names
          "strong": {
            "claude-code": "opus",
            "opencode": "anthropic/claude-opus-5"
          },
    
          // claude-code-only role: running --agent opencode on a phase bound to
          // "frontier" is a loud dispatch-time error, not a silent fallback
          "frontier": { "claude-code": "fable" }
        },
        "phases": {
          // roles are referenced with an explicit "role:" prefix; a bare string
          // stays a verbatim model string exactly as today (#914) — no shadowing,
          // fully backward compatible. "role:<undefined>" is a loud config error.
          "exec": { "model": "role:fast", "effort": "medium" },
          "qa":   { "model": "role:strong" }
        }
      }
    }

    Zod shape (open record; role names are user-extensible):

    export const DEFAULT_MODEL_ROLES = {
      fast: "sonnet",     // shorthand ⇒ claude-code only
      strong: "opus",
      frontier: "fable",
    } as const;
    
    const ModelRoleValueSchema = z.union([
      z.string(),                       // shorthand: claude-code
      z.record(z.string(), z.string()), // driver name → model string
    ]);
    // run.modelRoles
    z.record(z.string(), ModelRoleValueSchema).default(DEFAULT_MODEL_ROLES)

    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 named sonnet shadow a real alias, and aider's own docs use fast as an example model alias — explicit prefix removes the ambiguity class entirely.

    RQ4 — Where shipped defaults live

    Single source: DEFAULT_MODEL_ROLES in src/lib/settings.ts, wired as the schema .default(). Consequences:

    • A fresh sequant setup does not write modelRoles at all — an absent key parses to the defaults. This keeps the roster out of user files until they override.
    • The two existing default-emitting surfaces — 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 from DEFAULT_MODEL_ROLES. The settings docs table is already generated in the same file, so it shares the source.
    • Defaults are claude-code-shorthand only (sonnet/opus/fable). Deliberately no shipped opencode/aider entries: sequant can't know which providers a user has configured in those tools, and a guessed anthropic/… 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

    1. Flat map becomes right if every supported backend accepts identical strings resolving to the same actual model. Cheap re-test when adding backend N: (a) does bare sonnet parse, and to what does it resolve? (b) is a provider prefix required? Today: aider resolves sonnet to a pinned stale ID (divergent semantics), opencode rejects it (prefix required) → flat rejected.
    2. The claude-code desugar target becomes wrong if claude-code stops being the default/privileged backend, or a second backend adopts claude-code's exact alias semantics (desugar becomes ambiguous). Response: drop the shorthand, require objects — mechanical migration, loudly detectable.
    3. Loud-missing-entry (vs. translation) becomes wrong if a canonical cross-backend registry (models.dev-style 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.
    4. The 3-role vocabulary flips only when a consumer needs a binding the three can't express (e.g. a subagent utility tier if the upstream agents.model bug is fixed). Additive, no migration — record the new role's function definition, never a family.
    5. Assumption to re-verify per backend (the shorthand's safety rests on it): every driver fails loudly on a bad model string. Probe = the fix(driver): result subtype "success" with is_error:true is reported as phase success — unrecognized model yields a zero-work "successful" phase #973 repro pattern: dispatch with a garbage model, assert the phase reports failure rather than zero-work success. claude-code: probed (A0 / fix(driver): result subtype "success" with is_error:true is reported as phase success — unrecognized model yields a zero-work "successful" phase #973). aider: assumed from exit-code mapping (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, the role: 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).

  2. admarble commented on Aug 30, 2026

    @admarble
    ContributorAuthor

    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/frontier vocabulary, defaults solely in DEFAULT_MODEL_ROLES via 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions