codetether_rlm/oracle/types.rs
1//! Primitive types shared across oracle submodules.
2//!
3//! Provides [`TraceStep`] for recording individual tool
4//! invocations and [`VerificationMethod`] for tagging which
5//! oracle backend produced a verdict.
6//!
7//! # Examples
8//!
9//! ```ignore
10//! use codetether_agent::rlm::oracle::TraceStep;
11//! let step = TraceStep { iteration: 1, action: "grep(\"TODO\")".into(), output: "3 matches".into() };
12//! ```
13
14use serde::{Deserialize, Serialize};
15
16/// A single tool invocation recorded during an RLM REPL session.
17///
18/// Each step captures the iteration counter, a human-readable
19/// description of the action, and the tool's output. The
20/// resulting `Vec<TraceStep>` is embedded in [`super::trace_types::ValidatedTrace`]
21/// for downstream golden-trace export.
22///
23/// # Examples
24///
25/// ```ignore
26/// let step = TraceStep {
27/// iteration: 2,
28/// action: "rlm_grep(\"async fn\")".into(),
29/// output: "L12: pub async fn run()".into(),
30/// };
31/// assert_eq!(step.iteration, 2);
32/// ```
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct TraceStep {
35 /// 1-indexed loop counter within the REPL session.
36 pub iteration: usize,
37 /// Human-readable action description, e.g. `"grep(\"async fn\")"`.
38 pub action: String,
39 /// Raw or truncated tool output captured for the trace.
40 pub output: String,
41}
42
43/// Identifies which oracle backend produced a verdict.
44///
45/// Attached to every [`super::trace_types::ValidatedTrace`] so
46/// consumers know the provenance of the classification.
47///
48/// # Examples
49///
50/// ```ignore
51/// let method = VerificationMethod::GrepOracle;
52/// assert_eq!(method, VerificationMethod::GrepOracle);
53/// ```
54#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
55pub enum VerificationMethod {
56 /// No oracle was able to verify the trace.
57 None,
58 /// Verified by line-oriented grep pattern matching.
59 GrepOracle,
60 /// Verified by tree-sitter AST structural checks.
61 AstOracle,
62 /// Verified by multi-run agreement consensus.
63 Consensus,
64}