Here are the installation commands for the best token-optimization plugins for your Pi AI Agent.

📦 Prerequisites

  • Ensure your Pi installation is v0.60.0 or later.
  • For RTK, install the rtk binary first (e.g., brew install rtk or see the RTK docs for other installation methods).

1. RTK (Rust Token Killer) – For Command Output

Reduces token consumption of shell command outputs by 60-90%.

Installation:

pi install npm:pi-rtk

Or, for an alternative implementation:

pi install npm:pi-token-killer

Once installed, it works transparently on your next session.


2. Caveman – For Response Style

Makes the agent speak in a terse, minimal style, cutting ~75% of output tokens.

Installation (choose one version):

  • @fgladisch/pi-caveman (always-on mode):

    pi install npm:@fgladisch/pi-caveman
    

    Then fetch the ruleset:

    /caveman update
    
  • @viartemev/pi-caveman (native package, always-on by default):

    pi install npm:@viartemev/pi-caveman
    
  • @nielpattin/pi-caveman (compresses .md files manually):

    pi install npm:@nielpattin/pi-caveman
    

    Then use /skill:compress /path/to/AGENTS.md


3. Pix-Optimizer – All-in-One Suite

A token-optimization suite with four tools in one extension, accessible via a single /optimizer command.

Installation:

pi install npm:@xynogen/pix-optimizer

No external binary required — pure prompt injection.


4. Pi-TokenShrink – Deterministic Prompt Compression

Reduces token count deterministically without relying on LLM-based inference.

Installation:

pi install npm:@the-agency/pi-tokenshrink

5. Pi-DCP (Dynamic Context Pruning) – Session-Long Optimization

Aggressively prunes stale, duplicate, and massive tool outputs from the context window during long sessions.

Installation:

pi install npm:pi-dcp

💡 Recommendation

For maximum optimization, install the following combination:

Plugin Command
RTK pi install npm:pi-rtk
Caveman (always-on) pi install npm:@fgladisch/pi-caveman then /caveman update
Pi-DCP pi install npm:pi-dcp

This trio covers:

  • Command output compression (RTK)
  • Response style compression (Caveman)
  • Context window pruning (Pi-DCP)

After installation, restart your Pi session or run /reload inside an active session for the plugins to take effect.