@@ -218,6 +218,8 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
218218 maxTokens : profile . maxTokens ,
219219 } ) ;
220220
221+ let skipToolLoop = false ;
222+
221223 if ( structuredPlan ) {
222224 stderrLog ( formatExecutionPlanBlock ( structuredPlan , noColor ) + '\n' ) ;
223225 enrichedPrompt = enrichUserPromptWithPlan ( prompt , structuredPlan ) ;
@@ -231,7 +233,10 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
231233 if ( searchPlan ) {
232234 stderrLog ( formatPlanBlock ( searchPlan , noColor ) + '\n' ) ;
233235 } else {
234- stderrLog ( formatInternalStatus ( 'planning skipped — using generic search strategy' , noColor ) + '\n' ) ;
236+ // No plan at all — question likely isn't code-related.
237+ // Skip the tool loop and answer directly.
238+ stderrLog ( formatInternalStatus ( 'no codebase search needed — answering directly' , noColor ) + '\n' ) ;
239+ skipToolLoop = true ;
235240 }
236241 enrichedPrompt = enrichUserPrompt ( prompt , searchPlan ) ;
237242 }
@@ -242,10 +247,12 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
242247 let currentStepIdx = 0 ;
243248 const stepVerifier = new StepVerifier ( ) ;
244249
245- const MAX_TOOL_ROUNDS = 15 ;
250+ const MAX_TOOL_ROUNDS = skipToolLoop ? 0 : 15 ;
246251 let synthesisInjected = false ;
247252
248- stderrLog ( formatSeparator ( 'Searching codebase' , noColor ) ) ;
253+ if ( ! skipToolLoop ) {
254+ stderrLog ( formatSeparator ( 'Searching codebase' , noColor ) ) ;
255+ }
249256
250257 for ( let round = 0 ; round < MAX_TOOL_ROUNDS ; round ++ ) {
251258 // ── Step injection: remind model of the current plan step ─────────
@@ -443,9 +450,11 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
443450 }
444451 }
445452
446- // Exceeded round limit — fall through to streaming
453+ // Exceeded round limit or skipped — fall through to streaming
447454 await mcpManager . shutdown ( ) ;
448- stderrLog ( formatSeparator ( 'Max tool rounds reached, generating answer' , noColor ) ) ;
455+ if ( ! skipToolLoop ) {
456+ stderrLog ( formatSeparator ( 'Max tool rounds reached, generating answer' , noColor ) ) ;
457+ }
449458 }
450459
451460 // ── Standard streaming response ───────────────────────────────────────────
0 commit comments