-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
M26Milestone 26: Smart tool output filteringMilestone 26: Smart tool output filteringP0Critical priorityCritical prioritysize/Ltoken-savingsToken economy improvementsToken economy improvementstoolsTool execution and MCP integrationTool execution and MCP integration
Description
Parent
Epic: #426
Summary
Add an OutputFilter trait and registry to zeph-tools that applies command-specific filtering between execute_bash() and ToolOutput construction.
Design
pub trait OutputFilter: Send + Sync {
/// Commands this filter handles (e.g., ["cargo test", "cargo nextest"])
fn matches(&self, command: &str) -> bool;
/// Filter raw output, return compressed version
fn filter(&self, command: &str, raw_output: &str, exit_code: i32) -> FilterResult;
}
pub struct FilterResult {
pub output: String,
pub raw_chars: usize,
pub filtered_chars: usize,
}
pub struct OutputFilterRegistry {
filters: Vec<Box<dyn OutputFilter>>,
}Implementation
- Define
OutputFiltertrait incrates/zeph-tools/src/filter.rs - Add
OutputFilterRegistrywithregister()andapply(command, output, exit_code)methods - Match logic: iterate filters, first
matches()wins; fallback = passthrough - Integrate into
ShellExecutor::execute_inner()afterexecute_bash()returns - Add config toggle:
[tools.filters] enabled = true - Preserve full output in overflow file before filtering (tee pattern)
Acceptance Criteria
-
OutputFiltertrait defined and documented - Registry with registration and matching
- Integration point in
ShellExecutor - Passthrough filter as default (no behavior change)
- Config toggle
- Unit tests for registry matching logic
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
M26Milestone 26: Smart tool output filteringMilestone 26: Smart tool output filteringP0Critical priorityCritical prioritysize/Ltoken-savingsToken economy improvementsToken economy improvementstoolsTool execution and MCP integrationTool execution and MCP integration