feat(#49): provider-neutral model policy presets

* feat(#49): provider-neutral model policy presets

Adds model_policy config surface with known-provider presets (openai/anthropic/google/qwen) and generic provider escape hatch. model_policy.runtime_tiers resolves before legacy model_profile_overrides. reasoning_effort is stripped for unsupported runtimes.

Closes #49

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(#49): replace unregistered /gsd-settings-advanced token in docs

docs-parity-live-registry enforces every /token in docs/*.md maps to
a live command. /gsd-settings-advanced is a workflow filename, not a
registered command — use /gsd:settings instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(#49): update INVENTORY.md count and manifest for config-types.cjs

inventory-counts and inventory-manifest-sync tests require the headline
count and INVENTORY-MANIFEST.json to reflect every file in bin/lib/.
config-types.cjs (new module added by feat(#49)) was missing from both.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-01 08:46:55 -04:00
committed by GitHub
parent 3f5fa99ac5
commit 2ba6b69d53
13 changed files with 1291 additions and 30 deletions

View File

@@ -0,0 +1,19 @@
"use strict";
/**
* TypeScript type definitions for GSD project config — model_policy block.
*
* These types reflect the model_policy config shape consumed by
* resolveModelPolicy in core.cjs and validated by config-schema.cjs.
*
* See feat #49 (model_policy presets) and config-schema.manifest.json.
* Added under ADR-457: TS sources in src/ compile to CJS artifacts in
* get-shit-done/bin/lib/ at publish time.
*
* Resolution precedence (highest → lowest):
* 1. model_overrides[agent]
* 2. model_policy.runtime_tiers[runtime][tier] (Sub-path A)
* 3. model_policy provider preset + budget (Sub-path B)
* 4. model_profile_overrides
* 5. resolve_model_ids / profile fallback
*/
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -7,7 +7,7 @@ const os = require('os');
const path = require('path');
const { execGit, platformWriteSync, platformReadSync, platformEnsureDir } = require('./shell-command-projection.cjs');
const { MODEL_PROFILES, AGENT_TO_PHASE_TYPE, VALID_PHASE_TYPES, AGENT_DEFAULT_TIERS, VALID_AGENT_TIERS, nextTier } = require('./model-profiles.cjs');
const { MODEL_ALIAS_MAP, RUNTIME_PROFILE_MAP, KNOWN_RUNTIMES, RUNTIMES_WITH_REASONING_EFFORT, renderEffortForRuntime, RUNTIMES_WITH_FAST_MODE } = require('./model-catalog.cjs');
const { MODEL_ALIAS_MAP, RUNTIME_PROFILE_MAP, KNOWN_RUNTIMES, RUNTIMES_WITH_REASONING_EFFORT, renderEffortForRuntime, RUNTIMES_WITH_FAST_MODE, PROVIDER_PRESETS, KNOWN_PROVIDERS } = require('./model-catalog.cjs');
const {
resolveWorktreeContext,
parseWorktreePorcelain: parseWorktreePorcelainPolicy,
@@ -514,6 +514,11 @@ function loadConfig(cwd, options = {}) {
// unknown runtime/tier names at load time, not silently (review finding #10).
runtime: parsed.runtime || null,
model_profile_overrides: parsed.model_profile_overrides || null,
// #49 — provider-neutral model policy presets.
// model_policy is read flat (not via get()) for the same reason as
// model_profile_overrides: it is a top-level config key per CONFIGURATION.md,
// and nested resolution would introduce edge cases without benefit.
model_policy: parsed.model_policy || null,
// #443 — effort/fast_mode: pass through from config.json; resolvers handle
// defaults + tier lookups internally.
effort: parsed.effort || null,
@@ -1384,35 +1389,91 @@ function _warnUnknownProfileOverrides(parsed, configLabel) {
}
const overrides = parsed.model_profile_overrides;
if (!overrides || typeof overrides !== 'object') return;
for (const [overrideRuntime, tierMap] of Object.entries(overrides)) {
if (!KNOWN_RUNTIMES.has(overrideRuntime)) {
const key = `${configLabel}::override-runtime::${overrideRuntime}`;
if (!_warnedConfigKeys.has(key)) {
_warnedConfigKeys.add(key);
try {
process.stderr.write(
`gsd: warning — model_profile_overrides.${overrideRuntime}.* uses ` +
`unknown runtime "${overrideRuntime}". Known runtimes: ` +
`${[...KNOWN_RUNTIMES].sort().join(', ')}. (#2517)\n`
);
} catch { /* ok */ }
}
}
if (!tierMap || typeof tierMap !== 'object') continue;
for (const tierName of Object.keys(tierMap)) {
if (!RUNTIME_OVERRIDE_TIERS.has(tierName)) {
const key = `${configLabel}::override-tier::${overrideRuntime}.${tierName}`;
if (overrides && typeof overrides === 'object') {
for (const [overrideRuntime, tierMap] of Object.entries(overrides)) {
if (!KNOWN_RUNTIMES.has(overrideRuntime)) {
const key = `${configLabel}::override-runtime::${overrideRuntime}`;
if (!_warnedConfigKeys.has(key)) {
_warnedConfigKeys.add(key);
try {
process.stderr.write(
`gsd: warning — model_profile_overrides.${overrideRuntime}.${tierName} ` +
`uses unknown tier "${tierName}". Allowed tiers: opus, sonnet, haiku. (#2517)\n`
`gsd: warning — model_profile_overrides.${overrideRuntime}.* uses ` +
`unknown runtime "${overrideRuntime}". Known runtimes: ` +
`${[...KNOWN_RUNTIMES].sort().join(', ')}. (#2517)\n`
);
} catch { /* ok */ }
}
}
if (!tierMap || typeof tierMap !== 'object') continue;
for (const tierName of Object.keys(tierMap)) {
if (!RUNTIME_OVERRIDE_TIERS.has(tierName)) {
const key = `${configLabel}::override-tier::${overrideRuntime}.${tierName}`;
if (!_warnedConfigKeys.has(key)) {
_warnedConfigKeys.add(key);
try {
process.stderr.write(
`gsd: warning — model_profile_overrides.${overrideRuntime}.${tierName} ` +
`uses unknown tier "${tierName}". Allowed tiers: opus, sonnet, haiku. (#2517)\n`
);
} catch { /* ok */ }
}
}
}
}
}
const policy = parsed.model_policy;
if (policy && typeof policy === 'object') {
const provider = policy.provider;
// 'generic' and 'custom' are sentinel values for the manual model-ID path — not catalog entries.
const _POLICY_SENTINEL_PROVIDERS = new Set(['generic', 'custom']);
if (provider && typeof provider === 'string' &&
!KNOWN_PROVIDERS.has(provider) && !_POLICY_SENTINEL_PROVIDERS.has(provider)) {
const pkey = `${configLabel}::model_policy::provider::${provider}`;
if (!_warnedConfigKeys.has(pkey)) {
_warnedConfigKeys.add(pkey);
try {
process.stderr.write(
`gsd: warning — model_policy.provider has unknown value "${provider}". ` +
`Known providers: ${[...KNOWN_PROVIDERS].sort().join(', ')}. ` +
`For manual model IDs use provider="custom". (#49)\n`
);
} catch { /* ok */ }
}
}
const rtOverrides = policy.runtime_tiers;
if (rtOverrides && typeof rtOverrides === 'object') {
for (const [pruntime, tierMap] of Object.entries(rtOverrides)) {
if (!KNOWN_RUNTIMES.has(pruntime)) {
const key = `${configLabel}::model_policy.runtime_tiers::${pruntime}`;
if (!_warnedConfigKeys.has(key)) {
_warnedConfigKeys.add(key);
try {
process.stderr.write(
`gsd: warning — model_policy.runtime_tiers.${pruntime}.* uses ` +
`unknown runtime "${pruntime}". Known runtimes: ` +
`${[...KNOWN_RUNTIMES].sort().join(', ')}. (#49)\n`
);
} catch { /* ok */ }
}
}
if (!tierMap || typeof tierMap !== 'object') continue;
for (const tierName of Object.keys(tierMap)) {
if (!RUNTIME_OVERRIDE_TIERS.has(tierName)) {
const key = `${configLabel}::model_policy.runtime_tiers::${pruntime}.${tierName}`;
if (!_warnedConfigKeys.has(key)) {
_warnedConfigKeys.add(key);
try {
process.stderr.write(
`gsd: warning — model_policy.runtime_tiers.${pruntime}.${tierName} ` +
`uses unknown tier "${tierName}". Allowed: opus, sonnet, haiku. (#49)\n`
);
} catch { /* ok */ }
}
}
}
}
}
}
}
@@ -1476,6 +1537,78 @@ function _resolveRuntimeTier(config, tier) {
});
}
/**
* #49 — Provider-neutral model policy preset resolution.
*
* Signature: resolveModelPolicy(policy, tier) → string | null
*
* Resolves a model ID string from a model_policy object. Two resolution sub-paths:
*
* A. runtime_tiers sub-block (explicit per-runtime entries):
* policy.runtime_tiers[policy.runtime][tier] → model string
* The active runtime is read from policy.runtime (the caller merges
* config.runtime into the policy object before calling).
*
* B. provider + budget preset lookup (catalog-backed):
* PROVIDER_PRESETS[provider][tier][budget] → model string
* budget defaults to 'medium' if absent from policy.
*
* Returns a string model ID on a hit, null on miss.
* Never throws — unknown provider/tier/budget degrades gracefully to null
* so the caller falls through to model_profile_overrides.
*
* Precedence: runtime_tiers wins over provider presets when both are present
* for the same runtime+tier combination.
*/
function resolveModelPolicy(policy, tier) {
if (!policy || typeof policy !== 'object') return null;
if (!tier) return null;
// Sub-path A: explicit runtime_tiers override (highest precedence within policy).
// The active runtime is read from policy.runtime — the caller is responsible for
// merging config.runtime into the policy object (see step 2.5 in resolveModelInternal).
const runtime = policy.runtime;
const rtOverrides = policy.runtime_tiers;
if (runtime && rtOverrides && typeof rtOverrides === 'object') {
const runtimeEntry = rtOverrides[runtime];
if (runtimeEntry && typeof runtimeEntry === 'object') {
const raw = runtimeEntry[tier];
if (raw != null) {
const entry = typeof raw === 'string' ? { model: raw } : raw;
if (entry && entry.model) return entry.model;
}
}
}
// Sub-path B: catalog-backed provider preset.
const provider = policy.provider;
if (!provider || typeof provider !== 'string') return null;
// Sub-path B1: generic provider — model IDs supplied directly via model_policy.high/medium/low.
// 'generic' and 'custom' are sentinel values meaning "user-supplied IDs, no catalog lookup".
// The tier-to-key mapping: 'opus' → high, 'sonnet' → medium, 'haiku' → low.
if (provider === 'generic' || provider === 'custom') {
const TIER_TO_POLICY_KEY = { opus: 'high', sonnet: 'medium', haiku: 'low' };
const policyKey = TIER_TO_POLICY_KEY[tier];
if (!policyKey) return null;
const v = policy[policyKey];
return (v && typeof v === 'string') ? v : null;
}
const presetForProvider = PROVIDER_PRESETS[provider];
if (!presetForProvider) return null; // Unknown provider — fall through silently.
const tierPresets = presetForProvider[tier];
if (!tierPresets) return null; // Tier not in preset (partial preset catalog entry).
// Budget defaults to 'medium' — mirrors the existing 'balanced' default bias.
const budget = (policy.budget && typeof policy.budget === 'string') ? policy.budget : 'medium';
const budgetEntry = tierPresets[budget];
if (!budgetEntry || !budgetEntry.model) return null; // Missing or null budget slot.
return budgetEntry.model;
}
function resolveModelInternal(cwd, agentType) {
const config = loadConfig(cwd);
@@ -1518,6 +1651,22 @@ function resolveModelInternal(cwd, agentType) {
? 'inherit'
: (agentModels ? (agentModels[profile] || agentModels['balanced']) : null));
// 2.5. model_policy preset (#49) — higher precedence than model_profile_overrides.
// Fires when config.model_policy is set AND runtime is a non-Claude runtime with
// tier !== 'inherit'. The provider preset catalog (Sub-path B) and any
// runtime_tiers overrides (Sub-path A) are checked here before falling through to
// the existing model_profile_overrides chain in step 3.
if (config.runtime && config.runtime !== 'claude' && tier && tier !== 'inherit') {
// Merge config.runtime into the policy object so resolveModelPolicy can use
// it for Sub-path A (runtime_tiers) lookup without needing a separate argument.
const mergedPolicy = config.model_policy
? { ...config.model_policy, runtime: config.runtime }
: null;
const policyModel = resolveModelPolicy(mergedPolicy, tier);
if (policyModel) return policyModel;
// No policy hit → fall through to step 3 (model_profile_overrides).
}
// 3. Runtime-aware resolution (#2517) — only when `runtime` is explicitly set
// to a non-Claude runtime. `runtime: "claude"` is the implicit default and is
// treated as a no-op here so it does not silently override `resolve_model_ids:
@@ -2301,6 +2450,8 @@ module.exports = {
KNOWN_RUNTIMES,
RUNTIME_OVERRIDE_TIERS,
resolveTierEntry,
resolveModelPolicy,
KNOWN_PROVIDERS,
_resetRuntimeWarningCacheForTests,
pathExistsInternal,
gitWorktreeInfoInternal,

View File

@@ -90,6 +90,21 @@ const RUNTIMES_WITH_REASONING_EFFORT = new Set(
.map(([runtime]) => runtime)
);
const PROVIDER_PRESETS = catalog.providerPresets || {};
// KNOWN_PROVIDERS excludes 'generic' — it is a sentinel (all null entries) that
// forces users to supply model IDs via model_profile_overrides. It is not a
// real catalog-backed provider (#49).
const KNOWN_PROVIDERS = new Set(
Object.entries(PROVIDER_PRESETS)
.filter(([, tiers]) =>
Object.values(tiers).some((budgets) =>
budgets && Object.values(budgets).some((entry) => entry && entry.model)
)
)
.map(([name]) => name)
);
function nextTier(currentTier) {
const order = ['light', 'standard', 'heavy'];
const idx = order.indexOf(String(currentTier));
@@ -203,6 +218,8 @@ module.exports = {
RUNTIME_PROFILE_MAP,
KNOWN_RUNTIMES,
RUNTIMES_WITH_REASONING_EFFORT,
PROVIDER_PRESETS,
KNOWN_PROVIDERS,
nextTier,
formatAgentToModelMapAsTable,
getAgentToModelMapForProfile,

View File

@@ -101,7 +101,12 @@
"effort.default",
"fast_mode.enabled",
"plan_review.source_grounding",
"plan_review.source_grounding_authority"
"plan_review.source_grounding_authority",
"model_policy.provider",
"model_policy.budget",
"model_policy.high",
"model_policy.medium",
"model_policy.low"
],
"runtimeStateKeys": [
"workflow._auto_chain_active"
@@ -171,6 +176,11 @@
"topLevel": "review",
"source": "^review\\.max_prompt_tokens_per_reviewer\\.[a-zA-Z0-9_-]+$",
"description": "review.max_prompt_tokens_per_reviewer.<reviewer-slug>"
},
{
"topLevel": "model_policy",
"source": "^model_policy\\.runtime_tiers\\.[a-zA-Z0-9_-]+\\.(opus|sonnet|haiku)$",
"description": "model_policy.runtime_tiers.<runtime>.<opus|sonnet|haiku>"
}
]
}

View File

@@ -83,6 +83,33 @@
"haiku": null
}
},
"providerPresets": {
"anthropic": {
"opus": { "low": { "model": "claude-opus-4-5" }, "medium": { "model": "claude-opus-4-8" }, "high": { "model": "claude-opus-4-8" } },
"sonnet": { "low": { "model": "claude-haiku-4-5" }, "medium": { "model": "claude-sonnet-4-6" }, "high": { "model": "claude-opus-4-8" } },
"haiku": { "low": { "model": "claude-haiku-4-5" }, "medium": { "model": "claude-haiku-4-5" }, "high": { "model": "claude-sonnet-4-6" } }
},
"openai": {
"opus": { "low": { "model": "gpt-5.3-codex", "reasoning_effort": "medium" }, "medium": { "model": "gpt-5.5", "reasoning_effort": "high" }, "high": { "model": "gpt-5.5", "reasoning_effort": "xhigh" } },
"sonnet": { "low": { "model": "gpt-5.4-mini", "reasoning_effort": "low" }, "medium": { "model": "gpt-5.3-codex", "reasoning_effort": "medium" }, "high": { "model": "gpt-5.5", "reasoning_effort": "medium" } },
"haiku": { "low": { "model": "gpt-5.4-mini", "reasoning_effort": "minimal" }, "medium": { "model": "gpt-5.4-mini", "reasoning_effort": "medium" }, "high": { "model": "gpt-5.3-codex", "reasoning_effort": "medium" } }
},
"google": {
"opus": { "low": { "model": "gemini-2.5-flash-lite" }, "medium": { "model": "gemini-3-flash" }, "high": { "model": "gemini-3-pro" } },
"sonnet": { "low": { "model": "gemini-2.5-flash-lite" }, "medium": { "model": "gemini-3-flash" }, "high": { "model": "gemini-3-flash" } },
"haiku": { "low": { "model": "gemini-2.5-flash-lite" }, "medium": { "model": "gemini-2.5-flash-lite" }, "high": { "model": "gemini-3-flash" } }
},
"qwen": {
"opus": { "low": { "model": "qwen3-coder-plus" }, "medium": { "model": "qwen3-max-2026-01-23" }, "high": { "model": "qwen3-max-2026-01-23" } },
"sonnet": { "low": { "model": "qwen3-coder-next" }, "medium": { "model": "qwen3-coder-plus" }, "high": { "model": "qwen3-max-2026-01-23" } },
"haiku": { "low": { "model": "qwen3-coder-next" }, "medium": { "model": "qwen3-coder-next" }, "high": { "model": "qwen3-coder-plus" } }
},
"generic": {
"opus": { "low": null, "medium": null, "high": null },
"sonnet": { "low": null, "medium": null, "high": null },
"haiku": { "low": null, "medium": null, "high": null }
}
},
"agents": {
"gsd-planner": { "golden": "opus", "balanced": "opus", "budget": "sonnet", "phaseType": "planning", "routingTier": "heavy" },
"gsd-roadmapper": { "golden": "opus", "balanced": "sonnet", "budget": "sonnet", "phaseType": "planning", "routingTier": "heavy" },

View File

@@ -1,12 +1,14 @@
<purpose>
Interactive configuration of GSD power-user knobs — plan bounce, node repair, subagent timeouts,
inline plan threshold, cross-AI execution, base branch, branch templates, response language,
context window, gitignored search, graphify build timeout, and runtime model tier overrides.
context window, gitignored search, graphify build timeout, runtime model tier overrides, and
model policy configuration (provider + budget → canonical tier mapping, or manual model ID
assignment per cost tier).
This is a companion to `/gsd:settings` — the common-case prompt there covers model profile,
research/plan_check/verifier toggles, branching strategy, UI/AI phase gates, and worktree
isolation. This advanced command covers everything else that is user-settable, grouped into
seven sections so each prompt batch stays cognitively scoped. Every answer pre-selects the
eight sections so each prompt batch stays cognitively scoped. Every answer pre-selects the
current value; numeric-input answers that are non-numeric are rejected and re-prompted.
</purpose>
@@ -81,6 +83,13 @@ Runtime Model Tiers:
- `model_profile_overrides.<runtime>.sonnet` (default: built-in for the runtime, or absent)
- `model_profile_overrides.<runtime>.haiku` (default: built-in for the runtime, or absent)
Model Policy:
- `model_policy.provider` (default: `null` — known values: anthropic, openai, google, qwen)
- `model_policy.budget` (default: `null` — known values: high, medium, low)
- `model_policy.high` (default: `null` — model ID for the high-cost tier; used by generic provider path)
- `model_policy.medium` (default: `null` — model ID for the medium-cost tier; used by generic provider path)
- `model_policy.low` (default: `null` — model ID for the low-cost tier; used by generic provider path)
Each field's **current value is pre-selected** in the prompt rendering below. When the
current value is absent from the config, render the documented default as the pre-selected
option so the user sees what the effective value is.
@@ -500,7 +509,7 @@ gsd_run query config-set model_profile_overrides.gemini.haiku null
Conceptual shape after merge (unchanged top-level keys like `model_profile`,
`granularity`, `mode`, `brave_search`, `agent_skills.*`, `hooks.context_warnings`, and
anything not listed in Sections 1–7 MUST survive the update):
anything not listed in Sections 1–8 MUST survive the update):
```json
{
@@ -542,6 +551,14 @@ anything not listed in Sections 1–7 MUST survive the update):
"sonnet": <new|existing|null>,
"haiku": <new|existing|null>
}
},
"model_policy": {
...existing_model_policy,
"provider": <new|existing|null>,
"budget": <new|existing|null>,
"high": <new|existing|null>,
"medium": <new|existing|null>,
"low": <new|existing|null>
}
}
```
@@ -551,6 +568,170 @@ route each write through `gsd-tools.cjs query config-set` so sibling preservatio
the central setter.
</step>
### Section 8 — Model Policy
This section configures the `model_policy` key in `.planning/config.json`. Model policy
defines which AI models GSD uses at each cost tier (low / medium / high), independently
of the `runtime` and `model_profile` selections above. Two paths are offered:
- **Known provider:** choose a provider and a budget level; GSD materializes the canonical
tier mapping for that provider.
- **Generic provider:** enter low / medium / high model IDs manually.
**Step A — Read and display the current model policy:**
```bash
cat "$GSD_CONFIG_PATH" | python3 -c "import sys,json; c=json.load(sys.stdin); mp=c.get('model_policy',{}); print(json.dumps(mp,indent=2))" 2>/dev/null || echo "{}"
```
Display the current values (or "(unset)" for any absent field) before asking:
```text
Current model_policy:
provider : <value or "(unset)">
budget : <value or "(unset)">
low : <value or "(unset)">
medium : <value or "(unset)">
high : <value or "(unset)">
```
**Step B — Choose configuration path:**
```text
AskUserQuestion([
{
question: "How do you want to configure the model policy?",
header: "Model Policy",
multiSelect: false,
options: [
{ label: "Known provider", description: "Choose a provider (Claude / OpenAI / Gemini / Qwen) and a budget level — GSD writes the canonical tier mapping automatically." },
{ label: "Generic provider", description: "Enter low / medium / high model IDs manually for any provider or custom deployment." },
{ label: "Keep current", description: "Leave model_policy unchanged." }
]
}
])
```
**If "Keep current" is selected:** skip Steps C–E and move on to the confirm step.
**Step C — Known-provider path:**
```text
AskUserQuestion([
{
question: "Which provider?",
header: "Provider",
multiSelect: false,
options: [
{ label: "anthropic", description: "claude-opus-4-8 / claude-sonnet-4-6 / claude-haiku-4-5 (Anthropic / Claude)" },
{ label: "openai", description: "gpt-5.5 / gpt-5.3-codex / gpt-5.4-mini (OpenAI / Codex)" },
{ label: "google", description: "gemini-3-pro / gemini-3-flash / gemini-2.5-flash-lite (Google Gemini)" },
{ label: "qwen", description: "qwen3-max-2026-01-23 / qwen3-coder-plus / qwen3-coder-next (Qwen)" }
]
}
])
```
After the user picks a provider, ask:
```text
AskUserQuestion([
{
question: "Which budget level?",
header: "Budget",
multiSelect: false,
options: [
{ label: "high", description: "All tiers use the highest-quality model for the chosen provider. Highest cost." },
{ label: "medium", description: "High tier → top model; medium → mid model; low → cheapest model. Best cost/quality ratio." },
{ label: "low", description: "All tiers use the cheapest model for the chosen provider. Lowest cost." }
]
}
])
```
Canonical tier mappings by provider and budget:
| Provider | Budget | high | medium | low |
|-----------|--------|----------------------------|----------------------------|----------------------------|
| anthropic | high | claude-opus-4-8 | claude-opus-4-8 | claude-opus-4-8 |
| anthropic | medium | claude-opus-4-8 | claude-sonnet-4-6 | claude-haiku-4-5 |
| anthropic | low | claude-haiku-4-5 | claude-haiku-4-5 | claude-haiku-4-5 |
| openai | high | gpt-5.5 | gpt-5.5 | gpt-5.5 |
| openai | medium | gpt-5.5 | gpt-5.3-codex | gpt-5.4-mini |
| openai | low | gpt-5.4-mini | gpt-5.4-mini | gpt-5.4-mini |
| google | high | gemini-3-pro | gemini-3-pro | gemini-3-pro |
| google | medium | gemini-3-pro | gemini-3-flash | gemini-2.5-flash-lite |
| google | low | gemini-2.5-flash-lite | gemini-2.5-flash-lite | gemini-2.5-flash-lite |
| qwen | high | qwen3-max-2026-01-23 | qwen3-max-2026-01-23 | qwen3-max-2026-01-23 |
| qwen | medium | qwen3-max-2026-01-23 | qwen3-coder-plus | qwen3-coder-next |
| qwen | low | qwen3-coder-next | qwen3-coder-next | qwen3-coder-next |
Look up the selected (provider, budget) row and proceed to Step E to write those values.
**Step D — Generic-provider path:**
Prompt the user to enter each model ID as a free-text input. An empty input means "keep
the current value for that tier." Validate that non-empty inputs are non-blank strings
(no whitespace-only values); if validation fails, re-prompt that single field.
```text
AskUserQuestion([
{
question: "Model ID for the HIGH-cost tier? (most capable model — used for heavy reasoning tasks)",
header: "High-tier model",
multiSelect: false,
options: [
{ label: "Keep current", description: "Leave unchanged (current: <model_policy.high or '(unset)'>)." },
{ label: "Enter model ID", description: "Type the exact model identifier. Non-blank string required." }
]
},
{
question: "Model ID for the MEDIUM-cost tier? (balanced model — used for most agents)",
header: "Medium-tier model",
multiSelect: false,
options: [
{ label: "Keep current", description: "Leave unchanged (current: <model_policy.medium or '(unset)'>)." },
{ label: "Enter model ID", description: "Type the exact model identifier." }
]
},
{
question: "Model ID for the LOW-cost tier? (cheapest model — used for lightweight/fast tasks)",
header: "Low-tier model",
multiSelect: false,
options: [
{ label: "Keep current", description: "Leave unchanged (current: <model_policy.low or '(unset)'>)." },
{ label: "Enter model ID", description: "Type the exact model identifier." }
]
}
])
```
Set `provider = "custom"` and `budget = null` when writing the generic-provider result.
Proceed to Step E.
**Step E — Write model_policy to config:**
```bash
# Known-provider path — write all four keys atomically:
gsd_run query config-set model_policy.provider "<provider>" # e.g., anthropic / openai / google / qwen
gsd_run query config-set model_policy.budget "<budget>" # high / medium / low
gsd_run query config-set model_policy.high "<high-id>"
gsd_run query config-set model_policy.medium "<medium-id>"
gsd_run query config-set model_policy.low "<low-id>"
# Generic-provider path — write only tiers the user changed ("Keep current" skipped):
gsd_run query config-set model_policy.provider "custom"
gsd_run query config-set model_policy.budget null
# Per-tier writes for each non-"Keep current" answer:
gsd_run query config-set model_policy.high "<high-id>" # omit if user chose "Keep current"
gsd_run query config-set model_policy.medium "<medium-id>" # omit if user chose "Keep current"
gsd_run query config-set model_policy.low "<low-id>" # omit if user chose "Keep current"
```
Never write a tier the user explicitly chose to keep; the existing value must survive.
</step>
<step name="confirm">
Display:
@@ -594,6 +775,11 @@ Display:
| fast_mode.routing_tier_defaults.standard | {true/false} |
| fast_mode.routing_tier_defaults.heavy | {true/false} |
| fast_mode.agent_overrides.<agent-id> | {true/false} |
| model_policy.provider | {anthropic/openai/google/qwen/custom/null} |
| model_policy.budget | {high/medium/low/null} |
| model_policy.high | {model-id/null} |
| model_policy.medium | {model-id/null} |
| model_policy.low | {model-id/null} |
These settings apply to future /gsd:plan-phase, /gsd:execute-phase, /gsd:discuss-phase,
and /gsd:ship runs.
@@ -607,7 +793,7 @@ UI/AI phase gates), use /gsd:settings.
<success_criteria>
- [ ] Current config read from resolved `$GSD_CONFIG_PATH`
- [ ] Seven sections rendered (Planning, Execution, Discussion, Cross-AI, Git, Runtime/Output, Runtime Model Tiers)
- [ ] Eight sections rendered (Planning, Execution, Discussion, Cross-AI, Git, Runtime/Output, Runtime Model Tiers, Model Policy)
- [ ] Every field pre-selected to its current value (or documented default if absent)
- [ ] Numeric inputs validated — non-numeric rejected and re-prompted
- [ ] Branch-template inputs validated — non-default must contain a placeholder
@@ -616,5 +802,9 @@ UI/AI phase gates), use /gsd:settings.
- [ ] Section 7 shows current runtime and built-in tier table
- [ ] Group B runtimes display "(no built-in default — your runtime handles model selection)"
- [ ] Override set/clear/keep paths all work correctly for each tier
- [ ] Confirmation table rendered listing all 23 fields (19 + runtime + 3 tier overrides)
- [ ] Section 8 (Model Policy) offers three top-level choices: Known provider, Generic provider, Keep current
- [ ] Known-provider path: provider + budget → canonical tier mapping written to model_policy.{provider,budget,high,medium,low}
- [ ] Generic-provider path: per-tier manual model IDs; "Keep current" tiers are never written; provider=custom budget=null
- [ ] model_policy written under the model_policy key in config.json, never as a top-level flat key
- [ ] Confirmation table rendered listing all fields including model_policy.{provider,budget,high,medium,low}
</success_criteria>

View File

@@ -57,6 +57,11 @@ Parse current values (default to `true` if not present):
- `model_profile` — which model each agent uses (default: `balanced`)
- `git.branching_strategy` — branching approach (default: `"none"`)
- `workflow.use_worktrees` — whether parallel executor agents run in worktree isolation (default: `true`)
- `model_policy.provider` — provider slug for model policy (default: `null`; known values: anthropic, openai, google, qwen; set via /gsd:config --advanced)
- `model_policy.budget` — budget level for model policy (default: `null`; known values: high, medium, low; set via /gsd:config --advanced)
- `model_policy.high` — model ID for high-cost tier (default: `null`; set via /gsd:config --advanced)
- `model_policy.medium` — model ID for medium-cost tier (default: `null`; set via /gsd:config --advanced)
- `model_policy.low` — model ID for low-cost tier (default: `null`; set via /gsd:config --advanced)
</step>
<step name="present_settings">
@@ -423,6 +428,15 @@ Merge new settings into existing config.json:
"hooks": {
"context_warnings": true/false,
"workflow_guard": true/false
},
"model_policy": {
// Read-only in this flow — written only by /gsd:config --advanced (Section 8).
// Listed here so safe-merge never clobbers an existing model_policy object.
"provider": <existing|null>,
"budget": <existing|null>,
"high": <existing|null>,
"medium": <existing|null>,
"low": <existing|null>
}
}
```
@@ -537,7 +551,7 @@ Quick commands:
- /gsd:plan-phase --research — force research
- /gsd:plan-phase --skip-research — skip research
- /gsd:plan-phase --skip-verify — skip plan check
- /gsd:config --advanced — power-user tuning (plan bounce, timeouts, branch templates, cross-AI, context window)
- /gsd:config --advanced — power-user tuning (plan bounce, timeouts, branch templates, cross-AI, context window, model policy)
```
</step>