dci_tool/lib.rs
1//! # dci-tool — Direct Corpus Interaction
2//!
3//! A sandboxed, ripgrep-backed corpus-interaction toolset and agent for
4//! cyber-focused LLM agents, built on [`rig`](rig_core).
5//!
6//! Instead of embedding a corpus into a vector database, a DCI agent
7//! *interrogates the raw text directly* with a small set of bounded,
8//! strongly-typed commands — search, find, read, list — that run ripgrep's own
9//! engine in-process. This trades opaque semantic recall for transparent,
10//! reproducible, real-time evidence with `path:line` citations.
11//!
12//! ## Layers
13//!
14//! - [`sandbox`]: a read-only path-jail ([`CorpusRoot`]) plus resource
15//! [`Limits`].
16//! - [`engine`]: the in-process ripgrep search/find/read/list functions.
17//! - [`tools`]: those functions wrapped as rig [`Tool`](rig_core::tool::Tool)s.
18//! - [`agent`]: a [`DciAgent`] that wires the tools onto any
19//! [`CompletionModel`](rig_core::completion::CompletionModel).
20//!
21//! ## Example
22//!
23//! ```no_run
24//! use dci_tool::{CorpusRoot, DciAgent};
25//! # async fn run<M: rig_core::completion::CompletionModel + 'static>(model: M)
26//! # -> Result<(), Box<dyn std::error::Error>> {
27//! let corpus = CorpusRoot::new("/path/to/corpus")?;
28//! let agent = DciAgent::builder(model, corpus).build();
29//! let answer = agent.investigate("Which host first contacted 10.0.0.5?").await?;
30//! println!("{answer}");
31//! # Ok(())
32//! # }
33//! ```
34
35#![forbid(unsafe_code)]
36#![warn(missing_docs)]
37
38pub mod agent;
39pub mod engine;
40pub mod error;
41pub mod sandbox;
42pub mod session;
43pub mod telemetry;
44pub mod tools;
45
46#[cfg(feature = "mcp")]
47pub mod mcp;
48
49#[cfg(feature = "eval")]
50pub mod eval;
51
52pub use agent::{DEFAULT_MAX_TURNS, DEFAULT_PREAMBLE, DciAgent, DciAgentBuilder};
53pub use error::{DciError, Result};
54pub use sandbox::{CorpusRoot, Limits};
55pub use session::{InvestigationState, InvestigationTurn, SessionConfig, SessionStore};
56pub use tools::{CorpusTools, FindTool, ListTool, ReadTool, SearchTool};
57
58#[cfg(feature = "mcp")]
59pub use mcp::{DciDelegate, DciMcpService};
60
61#[cfg(feature = "eval")]
62pub use eval::{Comparison, DciRetriever, EvalConfig, Retriever, VectorRetriever, evaluate};