Skip to main content
Knowledge Engine · Layer 01

Query Router

The Query Router translates detected intent into retrieval strategy. It decides which tiers to activate, in what order, with what query shape.


Intent → Strategy Map​

Detected IntentPrimary tierSecondaryVector?
REFACTORTier 1 — dependency graphTier 2 — LSP typesNo
BUG_FIXTier 1 — symbol + gate historyTier 2 — LSPNo
FEATURE_ADDTier 1 — module exportsTier 2 — LSPSometimes
NEEDS_EXPLORETier 3 — vectorTier 1 fallbackYes
CONFIG_CHANGETier 1 — file metadataNoneNo
UNKNOWNTier 1 broadAll tiersNo

Routing Logic​

1. parse_intent(spec) → intent_class (max 2)
2. select_tiers(intent_class) → ordered tier list
3. for each tier:
result = query(tier, spec, index)
if result.sufficient: break
else: accumulate + continue
4. assemble_eco(accumulated_results) → ECO

Sufficiency Gates​

Each intent class has a binary sufficiency gate — a set of conditions that must be true before the ECO is considered complete enough to pass to the Task Orchestrator.

If the gate fails after all tiers are exhausted, the system halts with ECO_INSUFFICIENT and requires human input before proceeding.