Skip to content

feat: query intent classification for hybrid search — auto-derive --bias-type + signal weighting from the query (extends #82) #234

Description

@edheltzel

Context

From the 2026-07-13 mnemon competitive review, red-team validated (breadcrumb #3984, learning #668). STEAL LATER tier — explicitly queued behind #231/#232 and the --readonly issue; modest expected value, filed to keep the record.

Prior art: #82 shipped --bias-type (soft type bias in FTS5 ranking — present in src/commands/search.ts, src/lib/memory.ts, src/mcp-server.ts). This proposal is the auto-detection layer on top of it, NOT a new ranking model.

mnemon reference: internal/search/intent.go:80 — regex-vote intent detection (WHY/WHEN/ENTITY/GENERAL) that adapts retrieval behavior per intent. Red-team caveat carried over: mnemon's docs overstate its implementation (per-intent rerank weights are fiction; intent only steers traversal) — borrow the idea, not the implementation.

Proposal

Classify the query's intent cheaply (regex/keyword vote, no LLM call) and map it to existing knobs:

  • 'why did we…', 'reason for…' → bias decisions
  • 'how do I…', 'fix for…', 'wrong→right' → bias learnings
  • 'when did…', 'recently…' → recency-weighted ordering
  • named entity/project queries → bias breadcrumbs/LoA
  • default → current behavior, unchanged

Explicit --bias-type always wins over detection. Detection result surfaced in output (intent: why → bias decisions) so ranking stays explainable.

Acceptance criteria

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions