Skip to main content

Module tee_policy

Module tee_policy 

Source
Expand description

Single source of truth for the shell “tee” decision — whether the full, pre-compression output is saved to a recovery file so the agent can retrieve it instead of re-running the command.

Both the CLI buffered path (shell::exec) and the MCP ctx_shell handler call should_tee, so TeeMode::Failures means the exact same thing on both: a non-zero exit code — never a brittle substring match on the word “error” (which misses fatal:, permission denied, localized messages, and terse failures). See #809 / #811.

Functions§

output_was_elided
True only when the inline representation does not contain the complete non-blank output. Wrappers such as <error>…</error> do not count as elision.
savings_pct
Percentage of tokens removed by compression, clamped to 0.0 when the original was empty. Shared so CLI and MCP report identical savings.
should_tee
Decide whether to persist a recovery copy of shell output.