Expand description
oo (double-o) — a context-efficient command runner for AI coding agents.
This library helps AI agents run shell commands efficiently by classifying output and reducing context usage. Commands are executed, their output is analyzed, and results are compressed using pattern matching and intelligent categorization.
§Core Concepts
- Classification: Commands are categorized into four tiers based on success/failure and output size. Small successful outputs pass through verbatim, while large outputs are pattern-matched to extract terse summaries or indexed for later recall.
- Patterns: Regular expressions define how to extract summaries from command output.
Built-in patterns exist for common tools (pytest, cargo test, npm test, etc.), and
user-defined patterns can be loaded from TOML files in
~/.config/oo/patterns/. - Storage: Large unpatterned outputs are stored in a searchable database (SQLite by default, with optional Vipune semantic search). Stored outputs can be recalled with full-text search.
- Categories: Commands are auto-detected as Status (tests, builds, linters), Content (git show, diff, cat), Data (git log, ls, gh), or Unknown. This determines default behavior when no pattern matches.
§Example
use double_o::{classify, Classification, CommandOutput, Pattern};
use double_o::pattern::builtins;
// Run a command
let args = vec!["echo".into(), "hello".into()];
let output = double_o::exec::run(&args).unwrap();
// Classify the output
let command = "echo hello";
let patterns = builtins(); // or load_user_patterns(&path)
let result = classify(&output, command, &patterns);
match result {
Classification::Passthrough { output } => {
println!("Output: {}", output);
}
Classification::Success { label, summary } => {
println!("✓ {}: {}", label, summary);
}
Classification::Failure { label, output } => {
println!("✗ {}: {}", label, output);
}
Classification::Large { label, size, .. } => {
println!("Indexed: {} ({} bytes)", label, size);
}
}Re-exports§
pub use classify::Classification;pub use classify::classify;pub use error::Error;pub use exec::CommandOutput;pub use pattern::Pattern;pub use pattern::builtins;pub use pattern::load_user_patterns;pub use store::SessionMeta;pub use store::Store;
Modules§
- classify
- Command output classification and intelligent truncation. Command output classification and intelligent truncation.
- error
- Error types for oo operations.
- exec
- Command execution and output capture.
- learn
- LLM-powered pattern learning.
- pattern
- Pattern matching and output compression.
- session
- Session tracking and management.
- store
- Storage backends for indexed output.