What is the OpenClaw Token Saver Skill?
The Token Saver skill is a model-aware optimization tool that reduces OpenClaw
AI costs by intelligently compressing workspace files. Every API call sends
your workspace files (SOUL.md, USER.md, MEMORY.md, AGENTS.md, etc.) along with
your message, and these files count toward your context window, slowing
responses and costing real money on every message.
How It Works
Token Saver v3 is model-awareβit knows your model's context window and adapts
recommendations accordingly. Using Gemini's 1M context? Presets scale up. On
GPT-4o's 128K? Presets adjust down. This intelligent approach ensures optimal
compression without losing essential information.
Key Features of Token Saver v3
Model-Aware Dashboard
The skill provides a comprehensive dashboard showing your current model,
context window, and usage percentage. For example:
π€ Model: Claude Opus 4.5 (200K context)
Detected: openclaw.json
π Context Usage: [ββββββββββββββββββββ] 42% (84K/200K)
Workspace File Compression
The skill scans all .md files in your workspace, showing token count and
potential savings. It features smart bypass that skips already-optimized
files, ensuring you don't waste time re-compressing content that's already
efficient.
File-Aware Compression Strategies
Each file type receives optimized compression:
- SOUL.md β Light compression, keeps personality language
- AGENTS.md β Medium compression, dense instructions
- USER.md / MEMORY.md β Heavy compression, key:value format
- PROJECTS.md β No compression (user structure preserved)
### Dynamic Compaction Presets
Presets adapt to your model's context window:
| Preset | % of Context | Claude 200K | GPT-4o 128K | Gemini 1M |
|---|---|---|---|---|
| Aggressive | 40% | 80K | 51K | 400K |
| Balanced | 60% | 120K | 77K | 600K |
| Conservative | 80% | 160K | 102K | 800K |
| Off | 95% | 190K | 122K | 950K |
### Robust Model Detection
The skill features a sophisticated detection system with multiple fallback
options:
1. Runtime injection (--model=...)
2. Environment variables (SKILL_MODEL, OPENCLAW_MODEL)
3. Config file (~/.openclaw/openclaw.json)
4. File inference (TOOLS.md, MEMORY.md mentions)
5. Fallback: Claude Sonnet 4 (safe default)
### 24+ Model Registry
The skill supports extensive model coverage:
* **Claude:** Opus 4.6 (1M), Opus 4.5, Sonnet 4.5, Sonnet 4, Haiku 4.5, Haiku 3.5 (200K)
* **OpenAI:** GPT-5.2, GPT-5.1, GPT-5-mini, GPT-5-nano (256K), GPT-4.1, GPT-4o (128K), o1, o3, o4-mini
* **Gemini:** 3 Pro (2M), 2.5 Pro, 2.0 Flash (1M)
* **Others:** DeepSeek V3 (64K), Kimi K2.5 (128K), Llama 3.3 70B, Mistral Large
## Available Commands
The skill provides several commands for different optimization needs:
* **/optimize** β Full dashboard showing files, models, and context usage percentage
* **/optimize tokens** β Compress workspace files with auto-backup
* **/optimize compaction** β Chat compaction control with model-aware settings
* **/optimize compaction balanced** β Apply balanced preset (60% of context)
* **/optimize compaction 120** β Custom threshold (compact at 120K)
* **/optimize models** β Detailed model audit with registry
* **/optimize revert** β Restore backups, disable persistent mode
## Installation and Setup
Installing the Token Saver skill is straightforward:
clawhub install token-saver --registry "https://www.clawhub.ai"
After installation, the skill automatically detects your model and applies
optimal compression settings.
## Safety and Integrity Features
The skill prioritizes safety and data integrity:
* **Auto-backup** β All modified files get .backup extension
* **Integrity > Size** β Never sacrifices meaning for smaller tokens
* **Smart bypass** β Skips already-optimized files
* **Revert anytime** β /optimize revert restores everything
* **No external calls** β All analysis runs locally
## Persistent Mode
The skill includes a persistent mode that adds writing guidance to AGENTS.md
for continued token efficiency:
* **SOUL.md** β Evocative, personality-shaping language
* **AGENTS.md** β Dense instructions, symbols OK
* **USER.md** β Key:value facts
* **MEMORY.md** β Ultra-dense data
## Version History
The skill has evolved significantly:
* **3.0.0** β Model registry, dynamic presets, robust detection, smart bypass
* **2.0.1** β Chat compaction, file-aware compression, persistent mode
* **1.0.0** β Initial release
## Why Use Token Saver?
The Token Saver skill can significantly reduce your AI costs by optimizing
how your workspace files are sent with each API call. By intelligently
compressing files based on your specific model's context window, it ensures
you're not paying for unnecessary tokens while maintaining the quality and
functionality of your OpenClaw experience.
Whether you're using Claude, GPT, Gemini, or other models, the Token Saver
skill adapts to your needs, providing automatic optimization that saves you
money without requiring manual intervention or technical expertise.
Skill can be found at:
saver/SKILL.md>
Top comments (0)