Expand description
Command output classification and intelligent truncation. Command output classification and intelligent truncation.
This module is the core of oo’s context-efficient output handling. It analyzes
command results and produces one of five Classification outcomes:
- Failure: Non-zero exit codes → filtered error output
- Passthrough: Small successful outputs (<4KB) → verbatim
- Success: Large successful outputs with pattern match → compressed summary
- Bounded: Large Content/Unknown output → full output indexed, byte-bounded display
- Large: Large Data output without pattern → indexed for recall
The [classify] function combines pattern matching with automatic command category
detection to make intelligent decisions about how to present output.
Enums§
- Classification
- Command output classification result.
- Command
Category - Command category — determines default output handling when no pattern matches.
Constants§
- DISPLAY_
CAP - Total byte budget for the display slice of a bounded (Content/Unknown) output.
- MIN_
SAVINGS - Minimum savings (bytes) for the
[saved …]indicator-line suffix. - SMALL_
THRESHOLD - 4 KB — below this, output passes through verbatim.
Functions§
- bounded_
truncate - Byte-based truncation with UTF-8 char-boundary safety.
- classify
- Classify command output using patterns and automatic category detection.
- detect_
category - Detect command category from command string.
- label
- Derive a short label from a command string.
- smart_
truncate - Smart truncation: first 60% + marker + last 40%, capped at MAX_LINES.