SpecRunnerDocs
ドキュメント設定レシピ
COOKBOOK

設定レシピ

目的から逆引きし、必要な差分だけをconfigへ追加するための5つの実用例です。

このページの内容

置き場所と確認方法を固定する

ここでは、再現できる運用目的がある5ケースだけを扱います。全キー、既定値、deep merge規則はConfigurationを参照してください。

USER GLOBALproviderの既定

initが作るmodel既定値。端末ごとの選択です。

PROJECT LOCALteamの実行契約

step override、timeout、archive guardをrepositoryで共有します。

SECRETconfigへ書かない

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の中心は次の内容です。

terminal
npx specrunner init --provider anthropic
npx specrunner config effective
npx specrunner doctor
~/.config/specrunner/config.json — generated shape
{
  "version": 1,
  "agents": {},
  "steps": {
    "defaults": {
      "model": "claude-sonnet-4-6",
      "maxTurns": null,
      "timeoutMs": null
    }
  }
}
PASSstandard stepのeffective modelがclaude-*で、required doctor checkにfailがない
STOP既存global configがあるのに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です。

terminal
npx specrunner init --provider openai
codex login
npx specrunner config effective
npx specrunner doctor
~/.config/specrunner/config.json — generated shape
{
  "version": 1,
  "agents": {},
  "steps": {
    "defaults": {
      "model": "gpt-5.4-mini",
      "maxTurns": null,
      "timeoutMs": null
    },
    "design": {
      "model": "gpt-5.5"
    }
  }
}
PASSdefaultsがgpt-5.4-mini、designがgpt-5.5で、doctorがCodex CLIを認識
STOPCodex CLIが未install、認証状態が不明、またはunknown modelをregistryへ追加せず指定

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追加は不要です。

.specrunner/config.json
{
  "version": 1,
  "steps": {
    "defaults": {
      "model": "claude-sonnet-4-6"
    },
    "design": {
      "model": "gpt-5.5"
    },
    "code-review": {
      "model": "gpt-5.4"
    }
  }
}
terminal
npx specrunner config effective --json
npx specrunner doctor
PASSdefaultsはAnthropic、designとcode-reviewはOpenAIとして解決され、両providerの認証を確認済み
STOP片方のSDK・認証が欠ける、またはruntime: managedへOpenAI modelを設定

認証はstepごとではなく実行環境へ用意します。途中で初めてOpenAI stepへ到達してから失敗しないよう、run前に両方を確認します。

4. 重いrunだけ上限を広げる

通常値を無制限にせず、spec-changeだけturnと時間を広げます。次の例はlocal Anthropic向けです。

.specrunner/config.json
{
  "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
        }
      }
    }
  }
}
terminal
npx specrunner config effective --type spec-change
npx specrunner config effective --type chore
field使う境界注意
timeoutMsprocessを時間で停止nullはlocalでtimeoutなし。0もschema上有効
maxTurnsClaude 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へ置きます。

.specrunner/config.json
{
  "version": 1,
  "archive": {
    "mergeWaitTimeoutMs": 1200000,
    "mergeWaitPollIntervalMs": 15000,
    "protectedPaths": [
      ".github/workflows/**",
      "infra/production/**",
      "migrations/**"
    ],
    "postMergeVerify": [
      { "name": "install", "run": "npm ci" },
      { "name": "test", "run": "npm test" }
    ]
  }
}
PASSprotected pathは人間判断へ停止し、通常PRはchecks成功後にmerge、postMergeVerify成功後にcleanup
STOP高リスクpathがguardにない、またはmerge後commandの失敗を自動rollbackと誤解
postMergeVerify失敗時点ではmerge済みです

commandはmerge SHAの一時worktreeでfail-fast実行されます。失敗してもrollbackしないため、base branchを修正してarchiveを再実行します。fetchや一時worktree作成の失敗はwarningで続行します。

archive commandのidentity確認と再実行順はPR・merge・archiveを正とします。

config変更後の共通確認

  1. 01
    通常typeを確認

    config effectiveでmodel・maxTurns・timeoutMsと取得元を確認。

  2. 02
    対象typeを確認

    --typeを付け、byRequestTypeが意図したfieldだけを変えるか確認。

  3. 03
    runtimeを診断

    doctorのrequired failureを解消し、warningは採用する運用と照合。

terminal
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