Files
portal/tools
Дмитрий 41deac7bc8 feat(router): prefilter 3 groups + manual override + anchor (phase 2 task 9)
Phase 2 Task 9 of LLM-first router overhaul. Spec §4.1 — adds prefilter() Layer 1
with 7-check chain: manual override → continuation (inheritance ≤30 min) →
acknowledgment → cancellation → short-conversation + anchor → micro → fall-through.

- tools/router-classifier.mjs: +export prefilter(prompt, { prevState, registry }).
  Pure (no fs/exec/net). Imports INHERITANCE_MAX_AGE_MIN from router-config.mjs.
  Constants: CONTINUATION_PATTERNS (13), ACKNOWLEDGMENT_PATTERNS (10),
  CANCELLATION_PATTERNS (8), MANUAL_OVERRIDE_RE, ANCHOR_NOUNS (28),
  ANCHOR_IMPERATIVES (10, fires only when length > 30), SKILL_ALIAS_MAP
  (well-known superpower aliases for manual override without registry).
  Existing classifyByRegex / classifyByLLM untouched — Task 10 extracts
  them to a fallback module.
- tools/router-classifier.test.mjs: +8 prefilter tests covering all 7 checks
  plus content-prompt fall-through.

Tests in worktree: 118/118 PASS (8 new prefilter + 110 existing).
2026-05-25 14:28:24 +03:00
..