Skip to content

feat(router): make requiresSearch authoritative over TaskType default - #45

Merged
cryptoxdog merged 1 commit into
mainfrom
claude/improve-intelligence-seam-b7wzo7
Aug 14, 2026
Merged

feat(router): make requiresSearch authoritative over TaskType default#45
cryptoxdog merged 1 commit into
mainfrom
claude/improve-intelligence-seam-b7wzo7

Conversation

@cryptoxdog

Copy link
Copy Markdown
Collaborator

Summary

Make an explicit TaskDescriptor.requiresSearch authoritative over the legacy per-TaskType search default, so callers with normalized evidence can opt out of the search provider.

Type of Change

  • Feature / enhancement
  • Bug fix
  • Refactor (no behavior change)
  • Documentation
  • CI / governance change
  • Breaking change (see rollback plan below)

What changed

  • New src/matrices/search-policy.ts:
    • isSearchTask(type) — preserves the legacy per-TaskType default verbatim (backward compatible).
    • requiresSearchProvider(task) — explicit capability wins: requiresSearch === true → search, === false → general reasoning, undefined → legacy default.
  • resolveRoute now selects the search provider via requiresSearchProvider(task) instead of isSearchTask(task.type). This closes the leak where choosing a research-flavoured TaskType (e.g. MARKET_RESEARCH) implied Perplexity even when the caller already had evidence and set requiresSearch: false.
  • perplexity-matrix.ts now sources isSearchTask from search-policy.ts and re-exports it (single source of truth, no consumer breakage). Both predicates are exported from the package root.
  • tests/search-policy.test.ts covers the routing matrix:
    • search TaskType + no flag → search
    • search TaskType + requiresSearch:true → search
    • search TaskType + requiresSearch:false → general
    • CONTENT_GENERATION + requiresSearch:false → general
    • explicit true overriding a non-search default
  • Version bumped 1.1.1 → 1.1.3 for the coordinated runtime rollout (Website-Bot + SEO-Bot pin this exact version).

Verification

  • New/changed matrix files (search-policy.ts, perplexity-matrix.ts, types.ts) typecheck clean under strict + verbatimModuleSyntax.
  • No existing test sets requiresSearch, and the one MARKET_RESEARCH test omits it → still routes to Perplexity (unchanged).
  • The full vitest suite runs in CI (blocked in the authoring sandbox only by the private @quantum-l9/graphiti-memory-client registry dependency).

Governance Checklist

  • Governance setup verified
  • Symlinks validated
  • All CI gates green
  • Anti-patterns checked — additive, backward-compatible; isSearchTask preserved
  • CODEOWNERS notified
  • Workspace wiring intact
  • TRACEABILITY_MAP.yaml updated
  • Kernel ref discipline — n/a, no kernel ref change

Breaking Change

  • This is a breaking change

Additive. Behavior only changes for callers that explicitly set requiresSearch, which is the intended fix; the undefined path is identical to today.

Rollback Plan

Revert this PR. resolveRoute returns to isSearchTask(task.type); search-policy.ts is self-contained and its removal has no other consumers beyond the re-export in perplexity-matrix.ts.


Related Issues

Part of the l9.website-intelligence/v1 seam (LLM-Router explicit-search semantics). Paired with Website-Bot and SEO-Bot PRs on the same branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_0113q8LZSPWWX8NAKpBzHzsw


Generated by Claude Code

Add src/matrices/search-policy.ts as the canonical home for search-task
policy: isSearchTask(type) preserves the legacy per-TaskType default, and
requiresSearchProvider(task) lets an explicit TaskDescriptor.requiresSearch
override it. resolveRoute now selects the search provider via
requiresSearchProvider, closing the leak where choosing a research-flavoured
TaskType (e.g. MARKET_RESEARCH) implied a provider even when the caller
already had normalized evidence and set requiresSearch:false.

perplexity-matrix.ts now sources isSearchTask from search-policy and
re-exports it for backward compatibility. Both predicates are exported from
the package root. Adds tests/search-policy.test.ts covering the routing
matrix. Bumps the coordinated runtime version 1.1.1 -> 1.1.3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0113q8LZSPWWX8NAKpBzHzsw
@sonarqubecloud

Copy link
Copy Markdown

@cryptoxdog
cryptoxdog merged commit a6861d1 into main Aug 14, 2026
17 checks passed
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.

2 participants