Merge pull request 'feat(gate): drop reasoning field from selection (~1.5s)' (#90) from feat/gate-drop-reasoning into main
Some checks failed
CI/CD / typecheck (push) Successful in 1m5s
CI/CD / lint (push) Successful in 2m10s
CI/CD / test (push) Successful in 1m19s
CI/CD / smoke (push) Failing after 1m50s
CI/CD / build (push) Successful in 4m7s
CI/CD / publish (push) Has been skipped

This commit was merged in pull request #90.
This commit is contained in:
2026-07-25 02:07:30 +00:00

View File

@@ -95,11 +95,11 @@ export class LlmPromptSelector {
): Promise<LlmSelectionResult> {
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 },