Skip to content

fix: exclude system prompt from routing classification#14

Merged
evansantos merged 1 commit intomainfrom
fix/exclude-system-prompt-from-classification
Feb 19, 2026
Merged

fix: exclude system prompt from routing classification#14
evansantos merged 1 commit intomainfrom
fix/exclude-system-prompt-from-classification

Conversation

@evansantos
Copy link
Copy Markdown
Owner

@evansantos evansantos commented Feb 19, 2026

Problem

Every message — even a simple "oi" — was being classified as reasoning tier with lengthy-content signal. The routing classifier was including the system prompt (~15k+ chars of AGENTS.md, SOUL.md, USER.md, TOOLS.md) in the classification input, which always triggered the text.length > 1000 threshold.

Fix

Exclude system prompt from classification messages. The system prompt is static context that doesn't indicate request complexity — only user messages and recent history should determine routing tier.

Before

User: "oi"
🔀 reasoning tier (0.83) → opus | signals: [lengthy-content, high-confidence]

After

User: "oi"
🔀 simple tier → haiku

Files Changed

  • src/index.ts — removed systemPrompt from classification messages

🐕 GitSniff Summary

What this PR does

This change enhances the accuracy of the SlimClaw plugin's routing classification by preventing the system prompt from influencing the classification of user requests. By excluding the static system prompt, the classifier can more accurately determine the complexity and intent of actual user messages, leading to more appropriate model routing decisions and token optimization. This correction ensures that small, simple user prompts are correctly identified as such, rather than being misclassified due to a lengthy system prompt.

Key Changes

  • Removed the system prompt from the classificationMessages array in llm_input hook.
  • Added comments explaining the rationale for excluding the system prompt from classification.
  • Ensured routing classification focuses solely on user messages and recent conversational history.
  • Corrected the issue where all messages were being classified as reasoning tier with lengthy-content signal due to large system prompts.

Review Score: Excellent 🟢

Tip

No major issues found. Safe to merge.

Open in Dashboard

🐕 Reviewed by GitSniff

System prompt is static context (AGENTS.md, SOUL.md, USER.md, etc.)
that inflates text length and triggers 'lengthy-content' signal on
every request. Only classify user messages + recent history for
accurate intent detection.

Before: 'oi' → reasoning (lengthy-content from 15k+ system prompt)
After: 'oi' → simple (only user message evaluated)
Copy link
Copy Markdown

@gitsniff gitsniff bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Score: Excellent

This PR fixes a logical error in the routing classification by excluding the system prompt from the messages used for classification. This ensures that the classification accurately reflects user intent rather than the static context of the system prompt, preventing misclassification as 'reasoning/lengthy-content' due to large system prompts.

1 finding posted as inline comments below.

Review completed in 33s | Basic Plan | Gemini 2.5 Flash

Comment on lines 349 to 350
const classificationMessages: Message[] = [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Info

The blank line at L350 is unnecessary and can be removed to improve code readability and adhere to typical code formatting standards.

Fix: Remove the blank line at L350.

Suggested change
const classificationMessages: Message[] = [];
const classificationMessages: Message[] = [];

@evansantos evansantos merged commit 99cb867 into main Feb 19, 2026
6 checks passed
@evansantos evansantos deleted the fix/exclude-system-prompt-from-classification branch February 19, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant