Skip to main content

codetether_agent/tool/rlm/
mod.rs

1//! RLM tool: Recursive Language Model for large context analysis.
2//!
3//! This module exposes the tool shell and delegates schema, input loading,
4//! and processing to focused submodules.
5
6mod collect;
7mod ctx;
8mod execute;
9mod fallback;
10mod schema;
11
12use super::{Tool, ToolResult};
13use crate::provider::Provider;
14use crate::rlm::RlmConfig;
15use anyhow::Result;
16use async_trait::async_trait;
17use serde_json::Value;
18use std::sync::Arc;
19
20/// RLM Tool - Invoke the Recursive Language Model subsystem
21/// for analyzing large codebases that exceed the context window.
22pub struct RlmTool {
23    pub(super) provider: Arc<dyn Provider>,
24    pub(super) model: String,
25    pub(super) config: RlmConfig,
26}
27
28impl RlmTool {
29    /// Build an `RlmTool` backed by `provider`/`model`.
30    pub fn new(provider: Arc<dyn Provider>, model: String, config: RlmConfig) -> Self {
31        Self {
32            provider,
33            model,
34            config,
35        }
36    }
37}
38
39#[async_trait]
40impl Tool for RlmTool {
41    fn id(&self) -> &str {
42        "rlm"
43    }
44
45    fn name(&self) -> &str {
46        "RLM"
47    }
48
49    fn description(&self) -> &str {
50        schema::DESCRIPTION
51    }
52
53    fn parameters(&self) -> Value {
54        schema::parameters()
55    }
56
57    async fn execute(&self, args: Value) -> Result<ToolResult> {
58        execute::run(self, args).await
59    }
60}