Skip to main content

Module classify

Module classify 

Source
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 four 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
  • Large: Large successful outputs 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.
CommandCategory
Command category — determines default output handling when no pattern matches.

Constants§

SMALL_THRESHOLD
4 KB — below this, output passes through verbatim.

Functions§

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.