Skip to main content

codetether_rlm/engine/
classify.rs

1//! Query classification for the evidence-first engine.
2
3use crate::oracle::{GrepOracle, QueryType};
4
5/// Engine route chosen before evidence collection.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum QueryKind {
8    /// Deterministic line-oriented pattern search.
9    Pattern,
10    /// Deterministic tree-sitter structural search.
11    Structural,
12    /// Model synthesis over curated evidence.
13    Semantic,
14}
15
16/// Classify a query using oracle-compatible categories.
17pub fn classify(tool_id: &str, query: &str) -> QueryKind {
18    if matches!(
19        tool_id,
20        "session_context" | "context_reset" | "summary_index"
21    ) {
22        return QueryKind::Semantic;
23    }
24    match GrepOracle::classify_query(query) {
25        QueryType::PatternMatch => QueryKind::Pattern,
26        QueryType::Structural => QueryKind::Structural,
27        QueryType::Semantic => QueryKind::Semantic,
28    }
29}