Expand description
Deterministic oracle system for validating RLM REPL trace outputs.
This module provides oracles that can verify FINAL() answers from RLM traces without requiring cloud LLM judges. This enables synthetic training data generation for the BitNet distilled navigation model.
§Architecture
- Grep Oracle: Pattern-match verification (e.g., “find all async functions”)
- Tree-sitter Oracle: Structural AST verification (function signatures, etc.)
- Validator Pipeline: Routes queries to appropriate oracles and outputs golden traces
§Usage
ⓘ
use codetether_agent::rlm::oracle::{TraceValidator, OracleResult};
let validator = TraceValidator::new();
let result = validator.validate(&analysis_result, &source_file).await;
match result {
OracleResult::Golden(trace) => save_to_jsonl(trace),
OracleResult::Unverified => {} // No oracle available
OracleResult::Failed(reason) => {} // Oracle disagrees
}Structs§
- AstPayload
- AST/structural query payload.
- AstResult
- A single AST query result.
- Batch
Validation Stats - Statistics from batch trace validation.
- Generated
Query - A pre-generated query ready for use.
- Grep
Match - A single grep match with line number and text.
- Grep
Oracle - Grep-based oracle for validating pattern-match queries.
- Grep
Payload - Grep/pattern-match payload.
- Oracle
Trace Persist Result - Captures the outcome of writing a single oracle trace to the local spool and (optionally) uploading it to remote storage.
- Oracle
Trace Record - Flat, serialisable snapshot of an oracle verdict plus its full trace — the unit of persistence for the spool and S3.
- Oracle
Trace Storage - Coordinates local-spool-first persistence with optional upload to a MinIO/S3 remote backend.
- Oracle
Trace Sync Stats - Counters from a single sync pass over the local spool.
- Query
Template - A query template for oracle-friendly trace generation.
- Semantic
Payload - Semantic/free-form text payload (unverifiable).
- Split
Write Stats - Statistics from split-write operations.
- Trace
Step - A single tool invocation recorded during an RLM REPL session.
- Trace
Validator - Main trace validator for RLM REPL outputs.
- Tree
Sitter Oracle - Tree-sitter based oracle for validating structural queries.
- Validated
Trace - Complete snapshot of a validated RLM REPL session.
Enums§
- Final
Answer Format - Classification of an RLM FINAL() answer format.
- Final
Payload - The top-level FINAL() payload envelope.
- Grep
Verification - Result of grep oracle verification.
- Oracle
Result - Outcome of oracle validation for a single REPL session.
- Query
Type - Query type classification for routing to the appropriate oracle.
- Template
Kind - The kind of oracle this template is designed for.
- Tree
Sitter Verification - Result of tree-sitter oracle verification.
- Verification
Method - Identifies which oracle backend produced a verdict.
Functions§
- default_
spool_ dir - Resolve the directory where oracle traces are buffered before upload to remote storage.