-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
M26Milestone 26: Smart tool output filteringMilestone 26: Smart tool output filteringP1Important priorityImportant prioritysize/Stoken-savingsToken economy improvementsToken economy improvementstoolsTool execution and MCP integrationTool execution and MCP integration
Description
Parent
Epic: #426
Summary
Strip ANSI escape sequences and progress bar output from all tool outputs as a baseline preprocessing step before command-specific filters.
Expected Savings
5-15% baseline on all outputs, 85-95% on progress-heavy commands (cargo build with progress, wget, pip install).
Behavior
- Strip all ANSI escape codes:
\x1b\[[0-9;]*[a-zA-Z] - Strip carriage return progress lines: lines ending with
\rthat rewrite the same terminal line - Collapse consecutive blank lines to max 2
- Strip common progress patterns:
[=====> ] 45%,Downloading...,Compiling N/M
Implementation
sanitize_output(raw: &str) -> Stringfunction infilter.rs, applied before any command-specific filter- Should be fast (single-pass regex or manual char iteration)
- Already partially handled by terminal — verify what
execute_bashcaptures vs raw PTY
Acceptance Criteria
- ANSI codes stripped
- Progress lines collapsed
- Blank line normalization
- Performance: < 1ms for 100KB output
- Unit tests
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
M26Milestone 26: Smart tool output filteringMilestone 26: Smart tool output filteringP1Important priorityImportant prioritysize/Stoken-savingsToken economy improvementsToken economy improvementstoolsTool execution and MCP integrationTool execution and MCP integration