TokenPilot Overview
TokenPilot is the first official LightMem2 plugin. It is a cache-aware context runtime that reduces token usage and cost in long-running agent sessions.
What TokenPilot Does
Agent sessions grow. Every turn adds more messages, more tool outputs, more context. The model sees all of it, and you pay for all of it. Much of that context is repetitive — identical prefixes sent every turn, bloated tool outputs, stale history.
TokenPilot addresses this with three techniques:
text
┌─────────────────────────────────────────────────────┐
│ TokenPilot Pipeline │
├─────────────────────────────────────────────────────┤
│ 1. Stable Prefix │
│ Rewrites context into cache-stable form │
│ → Higher cache hit rate │
├─────────────────────────────────────────────────────┤
│ 2. Context Reduction │
│ Trims oversized tool output before it pollutes │
│ → Leaner context per turn │
├─────────────────────────────────────────────────────┤
│ 3. Context Eviction │
│ Limits how much old context is carried forward │
│ → Sessions don't grow unbounded │
└─────────────────────────────────────────────────────┘Key Results
From the TokenPilot paper, evaluated on PinchBench and Claw-Eval benchmarks (continuous mode):
| Metric | PinchBench | Claw-Eval |
|---|---|---|
| Input token reduction | 67.4% | 95.7% |
| Cost reduction | 61.5% | 87.0% |
| Cache read (M tokens) | 8.55 vs. 25.02 (Vanilla) | 21.43 vs. 709.85 (Vanilla) |
See Benchmarks for full results.
Supported Hosts
TokenPilot works on three agent hosts, each with a different integration style:
| Host | Integration | Page |
|---|---|---|
| OpenClaw | Native plugin slot | OpenClaw |
| Codex CLI | Local proxy + hooks | Codex |
| Claude Code | Local gateway + MCP | Claude Code |
Features are consistent across hosts. Differences are documented on each host page.
Quick Tour
- Installation — get TokenPilot running
- Configuration — settings and defaults
- Runtime Modes — conservative, normal, aggressive
- Benchmarks — evaluation results
- Troubleshooting — common problems and fixes