The bash hook intercepts noisy CLI commands and pipes their output through the Tokenjuice reduce pipeline before you see it. Zero agent awareness needed.
ls -laR~/.cache/tokenjuice/Add to your ~/.bashrc:
source /path/to/.agents/hooks/bash-optimizer.sh
Or use the install script:
bash .agents/hooks/install.sh
Verify it works:
tokenjuice-hook-status
opt CommandPrefix any command with opt to optimize its output:
opt curl -s https://api.github.com/repos/expressjs/express opt npm view express opt git log --oneline -30 opt ls -laR node_modules/
Enable auto-optimization for common commands without the prefix:
export TOKENJUICE_HOOK_ALIAS=1
When enabled, curl, git, npm, pnpm, docker, kubectl, and other noisy commands are automatically intercepted.
NO_OPTIMIZE=1 opt curl -s https://api.github.com/repos/expressjs/express
| Variable | Default | Description |
|---|---|---|
TOKENJUICE_HOOK |
on |
on or off — global toggle |
TOKENJUICE_OPT |
auto |
always, auto, or off |
TOKENJUICE_MIN_RAW |
4096 |
Min bytes before optimization kicks in (4KB) |
TOKENJUICE_MAX_RAW |
10485760 |
Max bytes to capture (10MB cap) |
TOKENJUICE_HOOK_ALIAS |
0 |
1 to enable transparent aliases |
TOKENJUICE_CACHE |
~/.cache/tokenjuice |
Cache directory for optimized results |
NO_OPTIMIZE |
0 |
1 to skip optimization for a single command |
Use the uninstall script:
bash .agents/hooks/uninstall.sh
Or manually:
sed -i '/bash-optimizer.sh/d' ~/.bashrc source ~/.bashrc