Skip to main content

codetether_rlm/context_index/
mod.rs

1//! Persistent, symbol-aware context indexing for RLM evidence.
2//!
3//! The index turns raw tool output into typed evidence records so the
4//! engine retrieves relevant spans instead of compressing whole blobs.
5
6mod cache;
7mod extract;
8mod fallback;
9mod plan;
10mod record;
11mod retrieval;
12mod score;
13mod symbol;
14#[cfg(test)]
15mod tests;
16mod text;
17mod text_records;
18mod types;
19
20pub use types::{ContextIndex, EvidenceKind, EvidenceRecord, PlanIntent, RetrievalPlan};
21
22/// Load a cached index for identical content or build and persist one.
23pub fn load_or_build(source: &str, content: &str) -> ContextIndex {
24    cache::load(source, content).unwrap_or_else(|| {
25        let index = extract::build(source, content);
26        cache::store(&index);
27        index
28    })
29}
30
31/// Retrieve the highest-value evidence records for `query`.
32pub fn retrieve(index: &ContextIndex, query: &str, budget_tokens: usize) -> Vec<EvidenceRecord> {
33    retrieval::retrieve(index, query, budget_tokens)
34}