tokenjuice is a deterministic output compactor for terminal-heavy agent workflows. Coding agents routinely run noisy commands like git status, pnpm test, docker build, or ripgrep and dump the full output back into their context window; tokenjuice observes the output after the command runs and returns a smaller payload built from rule-driven reducers, leaving the command's semantics untouched. The aim is less transcript waste and fewer wasted reruns without making the shell behave magically -- raw output remains available on explicit request (--raw/--full or opt-in artifact storage).
It exposes three surfaces: reduce compacts existing text, wrap runs a command and compacts its observed output, and reduce-json provides a stable JSON protocol for host adapters. The reduction engine is driven by inspectable JSON rules (built-in, user-level, and per-project layers that override by rule id) which classify command output, normalize lines, keep or drop patterns, count facts, and retain deterministic head/tail slices. A safe-inventory policy keeps exact file-content reads raw while allowing repository-inventory commands to compact.
Host integrations are deliberately thin wrappers around the same core reducer: each installs a hook, extension, rule, or guidance file for a given client and returns compacted context through that host's native surface. Supported hosts include Claude Code, Codex CLI, Cursor, GitHub Copilot CLI, Gemini CLI, OpenClaw (as a bundled plugin), OpenCode, Cline, and dozens more in beta, with doctor commands to verify installed wiring per host.
