diff --git a/src/mcplocal/src/gate/llm-selector.ts b/src/mcplocal/src/gate/llm-selector.ts index 45fe2b0..f174b04 100644 --- a/src/mcplocal/src/gate/llm-selector.ts +++ b/src/mcplocal/src/gate/llm-selector.ts @@ -95,11 +95,11 @@ export class LlmPromptSelector { ): Promise { const { getSystemPromptFn, signal, serverInfer } = opts; - // Keep the answer SHORT: latency is proportional to output length (a - // no-think model runs ~10-13 tok/s), and a verbose reasoning field pushes a - // selection past the gate's responsiveness budget. Ask for compact JSON with - // a <=8-word reasoning — ~2s vs ~9s for a prose reasoning. - const DEFAULT_SYSTEM_PROMPT = `You are a context selection assistant. Given a developer's task keywords and available project prompts, select the relevant ones. Return ONLY compact JSON: {"selectedNames":[...],"reasoning":"<=8 words"}. No prose outside the JSON. Priority 10 prompts must always be included.`; + // Keep the answer as SHORT as possible: latency is proportional to output + // length (a no-think model runs ~10-18 tok/s). Even an "<=8 words" reasoning + // got ignored (models write a full sentence → ~7s). Drop the reasoning field + // entirely — the gate only needs the names → just {selectedNames} → ~1-2s. + const DEFAULT_SYSTEM_PROMPT = `You are a context selection assistant. Given a developer's task keywords and available project prompts, select the relevant ones. Return ONLY this JSON and nothing else: {"selectedNames":[...]}. No reasoning, no prose, no explanation. Priority 10 prompts must always be included.`; const systemPrompt = getSystemPromptFn ? await getSystemPromptFn('llm-gate-context-selector', DEFAULT_SYSTEM_PROMPT) : DEFAULT_SYSTEM_PROMPT; @@ -109,7 +109,7 @@ export class LlmPromptSelector { Available prompts: ${promptIndex.map((p) => `- ${p.name} (priority: ${p.priority}): ${p.summary ?? 'No summary'}${p.chapters?.length ? `\n Chapters: ${p.chapters.join(', ')}` : ''}`).join('\n')} -Select the relevant prompts. Return JSON: { "selectedNames": [...], "reasoning": "..." }`; +Select the relevant prompts. Return ONLY: {"selectedNames":[...]}`; const messages: ChatMessage[] = [ { role: 'system', content: systemPrompt },