Skip to content

Conversation

@MichaelAnders
Copy link
Contributor

Summary

  • Strip <system-reminder> blocks from user messages before running the smart tool selection classifier

Problem

The CLI injects <system-reminder> blocks into user messages containing keywords like "search", "explain", and "documentation". The smart selection classifier scans the full message content including these injected blocks, causing misclassification based on keywords the user never typed. For example, a simple greeting could be classified as a "research" request because the system-reminder contained the word "search".

Changes

  • src/tools/smart-selection.js: Added pre-compiled SYSTEM_REMINDER_PATTERN regex; strip matched blocks from content before classification in classifyRequestType()

Testing

  • Messages with system-reminder blocks now classify based on actual user content
  • Simple greetings no longer misclassified as research/coding requests
  • Messages without system-reminder blocks behave identically
  • npm run test:unit passes with no regressions

Problem: The CLI injects <system-reminder> blocks into user messages containing
keywords like "search", "explain", and "documentation". The smart selection
classifier was scanning the full message content including these injected blocks,
causing it to misclassify requests based on keywords that the user never typed.
For example, a simple greeting could be classified as a "research" request
because the system-reminder block contained the word "search".

Changes implemented:

1. System-reminder stripping (src/tools/smart-selection.js)
   - Added pre-compiled SYSTEM_REMINDER_PATTERN regex to match
     <system-reminder>...</system-reminder> blocks
   - Strip these blocks from message content before running classification
   - Pattern is compiled once at module load for performance
   - Only affects classification input; original message is unchanged

Testing:
- Messages with system-reminder blocks now classify based on actual user content
- Simple greetings no longer misclassified as research/coding requests
- Messages without system-reminder blocks behave identically to before
- npm run test:unit passes with no regressions
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