Skip to content

Tiered search: narrow-to-wide retrieval strategy #103

@jordanpartridge

Description

@jordanpartridge

Problem

Current search queries the entire knowledge base uniformly. This is wasteful — most queries are answered by recent, high-confidence entries. Searching everything equally burns tokens and can surface stale or low-relevance results.

Proposal

Implement tiered search that starts narrow and widens only if needed:

Search Tiers (in order)

  1. Working context — Current session/project active entries
  2. Recent entries — Last 14 days of daily logs
  3. Structured storage — Permanent entries matching the query domain
  4. Archive — Historical entries, only if earlier tiers yield nothing

Behavior

  • Search starts at Tier 1 and returns early if confident matches are found
  • Each tier adds latency/tokens, so early return is the optimization
  • User can force a specific tier: know search --tier archive "old config"
  • Results include tier source so the user knows where info came from
  • Confidence and freshness factor into result ranking

Result Ranking

score = relevance * confidence_weight * freshness_decay

Where:

  • relevance: semantic/keyword match score (Qdrant)
  • confidence_weight: high=1.0, medium=0.7, low=0.4
  • freshness_decay: exponential decay based on last_verified date

Benefits

  • Faster results for common queries
  • Token-efficient (don't load archive for simple lookups)
  • Fresher, higher-confidence results surface first
  • Historical search still available when needed

Acceptance Criteria

  • Search implements tiered strategy with early return
  • Results show which tier they came from
  • --tier flag to target specific tiers
  • Ranking incorporates confidence and freshness
  • Archive search only triggered when earlier tiers insufficient

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions