initが作るmodel既定値。端末ごとの選択です。
設定レシピ
目的から逆引きし、必要な差分だけをconfigへ追加するための5つの実用例です。
このページの内容
置き場所と確認方法を固定する
ここでは、再現できる運用目的がある5ケースだけを扱います。全キー、既定値、deep merge規則はConfigurationを参照してください。
step override、timeout、archive guardをrepositoryで共有します。
providerとGitHubのcredentialはconfigから分離します。
読み方。 各レシピは「目的 → 最小設定 → 確認command → PASS / STOP」の順です。既存configへは必要なobjectだけをmergeします。
利用できるprovider、built-in model、local / managedの対応差は対応プロバイダーを参照してください。
1. Anthropicだけでlocal実行する
初回だけinit --provider anthropicを使います。生成されるuser global configの中心は次の内容です。
npx specrunner init --provider anthropic
npx specrunner config effective
npx specrunner doctor{
"version": 1,
"agents": {},
"steps": {
"defaults": {
"model": "claude-sonnet-4-6",
"maxTurns": null,
"timeoutMs": null
}
}
}claude-*で、required doctor checkにfailがないinitで上書きされると思っている、またはheadless実行でOAuth tokenがないinitは既存global configを変更しません。 fileがすでに存在する場合はscaffoldをskipします。providerを切り替える場合は、現在値を保全してsteps.defaults.modelを明示的に編集します。headless実行ではclaude setup-token後にspecrunner login --provider claudeで保存します。
2. OpenAIだけでlocal実行する
OpenAI scaffoldは軽量modelを既定にし、designだけ上位modelへ分けます。--runtime localは現在のinitでは不要で、指定するとargument errorです。
npx specrunner init --provider openai
codex login
npx specrunner config effective
npx specrunner doctor{
"version": 1,
"agents": {},
"steps": {
"defaults": {
"model": "gpt-5.4-mini",
"maxTurns": null,
"timeoutMs": null
},
"design": {
"model": "gpt-5.5"
}
}
}gpt-5.4-mini、designがgpt-5.5で、doctorがCodex CLIを認識CODEX_API_KEYをSpecRunnerのSDK認証として扱いません。 現行revisionはOPENAI_API_KEYを読み、Codex SDKのapiKeyへ明示的に渡します。通常はcodex loginの保存済み認証を使います。
3. stepごとにProviderを混成する
local runtimeはeffective modelをbuilt-in registryで解決し、AnthropicまたはOpenAI runnerへdispatchします。built-in modelだけならmodels追加は不要です。
{
"version": 1,
"steps": {
"defaults": {
"model": "claude-sonnet-4-6"
},
"design": {
"model": "gpt-5.5"
},
"code-review": {
"model": "gpt-5.4"
}
}
}npx specrunner config effective --json
npx specrunner doctorruntime: managedへOpenAI modelを設定認証はstepごとではなく実行環境へ用意します。途中で初めてOpenAI stepへ到達してから失敗しないよう、run前に両方を確認します。
4. 重いrunだけ上限を広げる
通常値を無制限にせず、spec-changeだけturnと時間を広げます。次の例はlocal Anthropic向けです。
{
"version": 1,
"steps": {
"defaults": {
"model": "claude-sonnet-4-6",
"maxTurns": 30,
"timeoutMs": 1800000,
"byRequestType": {
"spec-change": {
"maxTurns": 60,
"timeoutMs": 3600000
}
}
},
"design": {
"byRequestType": {
"spec-change": {
"model": "claude-opus-4-6[1m]",
"maxTurns": 80,
"timeoutMs": 3600000
}
}
}
}
}npx specrunner config effective --type spec-change
npx specrunner config effective --type chore| field | 使う境界 | 注意 |
|---|---|---|
timeoutMs | processを時間で停止 | nullはlocalでtimeoutなし。0もschema上有効 |
maxTurns | Claude Agent SDKへturn上限を渡す | positive integerまたはnull |
byRequestType | 対象typeだけ上書き | 1階層のみ。未知typeはwarning |
maxTurnsをOpenAIのコスト上限にしません。 現行Codex runnerはmaxTurnsを解決・表示しますが、SDK実行へ渡していません。OpenAI stepではtimeoutMsとusage実績を運用境界にします。
5. merge前後の安全設定を固定する
待機時間、auto-mergeを止めるpath、merge後に必ず動かすcommandをproject configへ置きます。
{
"version": 1,
"archive": {
"mergeWaitTimeoutMs": 1200000,
"mergeWaitPollIntervalMs": 15000,
"protectedPaths": [
".github/workflows/**",
"infra/production/**",
"migrations/**"
],
"postMergeVerify": [
{ "name": "install", "run": "npm ci" },
{ "name": "test", "run": "npm test" }
]
}
}commandはmerge SHAの一時worktreeでfail-fast実行されます。失敗してもrollbackしないため、base branchを修正してarchiveを再実行します。fetchや一時worktree作成の失敗はwarningで続行します。
archive commandのidentity確認と再実行順はPR・merge・archiveを正とします。
config変更後の共通確認
- 01通常typeを確認
config effectiveでmodel・maxTurns・timeoutMsと取得元を確認。 - 02対象typeを確認
--typeを付け、byRequestTypeが意図したfieldだけを変えるか確認。 - 03runtimeを診断
doctorのrequired failureを解消し、warningは採用する運用と照合。
npx specrunner config effective
npx specrunner config effective --type spec-change
npx specrunner config effective --type spec-change --json
npx specrunner doctor実行条件。 expected valueだけでなくsource pathまで一致した場合にrunへ進みます。config effectiveはprovider疎通そのものを保証しません。
参照ソース 8件
src/cli/init.tsprovider別scaffoldsrc/config/model-registry.tsbuilt-in modelとprovidersrc/config/step-config.tsstep設定の解決順src/adapter/dispatching/agent-runner.tsprovider dispatchsrc/adapter/claude-code/agent-runner.tsClaude localの実行設定src/adapter/codex/agent-runner.tsCodex localの実行設定src/config/schema/types.tsarchive設定と既定値src/cli/config-effective.tseffective configの確認