MCPcopy
hub / github.com/codeaashu/claude-code / getRuntimeMainLoopModel

Function getRuntimeMainLoopModel

src/utils/model/model.ts:145–167  ·  view source on GitHub ↗
(params: {
  permissionMode: PermissionMode
  mainLoopModel: string
  exceeds200kTokens?: boolean
})

Source from the content-addressed store, hash-verified

143 * @returns The model to use
144 */
145export function getRuntimeMainLoopModel(params: {
146 permissionMode: PermissionMode
147 mainLoopModel: string
148 exceeds200kTokens?: boolean
149}): ModelName {
150 const { permissionMode, mainLoopModel, exceeds200kTokens = false } = params
151
152 // opusplan uses Opus in plan mode without [1m] suffix.
153 if (
154 getUserSpecifiedModelSetting() === 'opusplan' &&
155 permissionMode === 'plan' &&
156 !exceeds200kTokens
157 ) {
158 return getDefaultOpusModel()
159 }
160
161 // sonnetplan by default
162 if (getUserSpecifiedModelSetting() === 'haiku' && permissionMode === 'plan') {
163 return getDefaultSonnetModel()
164 }
165
166 return mainLoopModel
167}
168
169/**
170 * Get the default main loop model setting.

Callers 5

queryLoopFunction · 0.85
getContextUsedPercentFunction · 0.85
analyzeContextUsageFunction · 0.85
getAgentModelFunction · 0.85

Calls 3

getDefaultOpusModelFunction · 0.85
getDefaultSonnetModelFunction · 0.85

Tested by

no test coverage detected