fix: tighten router switch_project keywords to stop false positives#61
Merged
Conversation
The router's switch_project prompt examples used generic Chinese verbs (用/use, 打开/open, 换/change), so normal work instructions like "用 pandas 处理数据" or "打开这个文件" were misclassified as project switches. Restrict positive examples to explicit switch words only, add an inline disambiguation rule and FORWARD counter-examples, and cover the behavior with deterministic fast-path cases plus a live haiku test. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
quick-sort
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
switch_projectbecause the prompt's switch examples used generic verbs (用/use, 打开/open, 换/change). E.g.用 pandas 处理数据or打开这个文件would trigger a project switch.switch_projectpositive examples to explicit switch words only (switch to/change project to/切换到/切到/切换项目到), added an inline disambiguation rule (bare 用/打开/换 + noun is NOT a switch), and added three FORWARD counter-examples with those trigger verbs in work context.Test Plan
test_fast_classify_no_matchwith the boundary phrases (deterministic guard)test_router_live_prompt_classification) exercising the real haiku classifier — skipped withoutANTHROPIC_API_KEYuv run pytest tests/test_router.py— 37 passed, ruff cleanCloses #60