6.5kā
by rubenaquispe
token-saver ā OpenClaw Skill
token-saver is an OpenClaw Skills integration for data analytics workflows. Reduce OpenClaw AI costs by optimizing workspace files, model selection, and chat compaction. Analyzes .md files for compression, audits AI model usage, and recommends chat compaction thresholds. Writes to AGENTS.md for persistent mode. Accesses home directory to read OpenClaw config and session history.
Skill Snapshot
| name | token-saver |
| description | Reduce OpenClaw AI costs by optimizing workspace files, model selection, and chat compaction. Analyzes .md files for compression, audits AI model usage, and recommends chat compaction thresholds. Writes to AGENTS.md for persistent mode. Accesses home directory to read OpenClaw config and session history. OpenClaw Skills integration. |
| owner | rubenaquispe |
| repository | rubenaquispe/token-saver |
| language | Markdown |
| license | MIT |
| topics | |
| security | L1 |
| install | openclaw add @rubenaquispe/token-saver |
| last updated | Feb 7, 2026 |
Maintainer

name: token-saver version: 2.0.0 description: "Reduce OpenClaw AI costs by optimizing workspace files, model selection, and chat compaction. Analyzes .md files for compression, audits AI model usage, and recommends chat compaction thresholds. Writes to AGENTS.md for persistent mode. Accesses home directory to read OpenClaw config and session history." author: RubenAQuispe repository: https://github.com/RubenAQuispe/token-saver
Token Saver
š” Did you know? Every time you send a prompt, your workspace files (SOUL.md, USER.md, MEMORY.md, AGENTS.md, and more) are sent along with it ā every single time. These files count toward your context window, slowing down responses and costing you real money on every message.
Token Saver compresses these files using AI-efficient notation that preserves all your data while making everything lighter, faster, and cheaper.
Commands
| Command | What it does |
|---|---|
/optimize | Full audit dashboard ā files, models, compaction |
/optimize tokens | Compress workspace files (auto-backup) |
/optimize compaction | Chat compaction control |
/optimize compaction 120 | Set custom compaction threshold |
/optimize revert | Restore files from backups, disable persistent mode |
Features
š Workspace File Compression
Scans all .md files sent with each API call. Shows token count and potential savings per file.
File-aware compression:
- SOUL.md ā Light compression, keeps evocative/personality language
- AGENTS.md ā Medium compression, dense instructions
- USER.md / MEMORY.md ā Heavy compression, key:value data
- PROJECTS.md ā No compression (user-specific structure)
š¤ Model Audit
Detects current AI models for main chat, cron jobs, and subagents. Suggests cheaper alternatives where appropriate (e.g., Gemini free tier for background tasks).
š¬ Chat Compaction
Analyzes your conversation history (default: last 7 days) to recommend optimal compaction threshold.
How it works:
- Scans your sessions to detect topic change patterns
- Recommends threshold based on YOUR usage
- Shows savings estimate per preset
Presets:
- š¢ Safe (160K) ā ~$30/mo savings
- š” Balanced (120K) ā ~$100/mo savings
- š“ Aggressive (80K) ā ~$200/mo savings
Options:
--monthā Scan last 30 days (more data)--allā Scan all history (takes longer)- Custom number:
/optimize compaction 100= compact at 100K tokens
š Persistent Mode
When enabled, adds file-type-aware writing guidance to AGENTS.md:
| File | Writing Style |
|---|---|
| SOUL.md | Evocative, personality-shaping |
| AGENTS.md | Dense instructions, symbols OK |
| USER.md | Key:value facts |
| MEMORY.md | Ultra-dense data |
| memory/*.md | Log format, dated |
| PROJECTS.md | Keep user's structure |
Safety
- Auto-backup ā All modified files get
.backupextension - Integrity > Size ā Never sacrifices meaning for smaller tokens
- Revert anytime ā
/optimize revertrestores all backups - No external calls ā All analysis runs locally
Installation
clawhub install token-saver
Version
2.0.0 ā Chat compaction, file-aware compression, persistent mode
š Token Saver
š” Did you know? Every time you send a prompt, your workspace files (SOUL.md, USER.md, MEMORY.md, AGENTS.md, and more) are sent along with it ā every single time. These files count toward your context window, slowing down responses and costing you real money on every message. Token Saver compresses these files using AI-efficient notation that preserves all your data while making everything lighter, faster, and cheaper.
Cut your OpenClaw AI costs by 40-90% with one command.
Quick Start
/optimize
That's it. You'll see a dashboard with your savings options.
What It Does
| Feature | Description |
|---|---|
| šļø File Compression | Scans ALL .md workspace files and compresses them using AI-efficient notation |
| š¤ Model Audit | Detects your current AI models and suggests cheaper alternatives |
| š Cost Dashboard | Shows weekly/monthly/annual savings with clear before & after |
| š”ļø Safe Rollback | Auto-backups + one-command revert |
Example
Before (500+ tokens):
When Ruben greets me in the morning with phrases like "good morning" or "what's on today", I should proactively review our task list, mention pending items, and check for urgent issues...
After (30 tokens):
MORNING: greeting ā review(todos+pending+urgent)
Same meaning. 90% fewer tokens. Real dollar savings.
Commands
| Command | What It Does |
|---|---|
/optimize | Show savings dashboard |
/optimize tokens | Compress workspace files (auto-backup) |
/optimize models | Detailed model cost comparison |
/optimize revert | Restore all files from backups |
Dashboard Preview
š Token Optimizer Dashboard
š¾ Current Context: 12,169 tokens across 10 files
š° Est. Monthly Cost: $158.08
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā šļø WORKSPACE FILES OPTIMIZATION ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
š“ MEMORY.md: 2,640 ā 215 tokens (92% possible saving)
š“ USER.md: 563 ā 103 tokens (82% possible saving)
š¢ AGENTS.md: 2,063 ā 2,063 tokens (0% possible saving)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā š¤ AI MODEL AUDIT ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
⢠Default: claude-sonnet-4 (~$14.40/month)
⢠Cron jobs: gemini-pro (free)
š” Subagents: Switch Opus ā Sonnet ā ~$14.40/month possible saving
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā š COMBINED POSSIBLE SAVINGS ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
File compression: ~$37.40/month
Model switching: ~$17.57/month
Total: ~$54.97/month possible saving
Install
# From ClawHub
clawhub install token-saver
# Or clone directly
git clone https://github.com/RubenAQuispe/token-saver.git
⨠Persistent Mode ā One-and-Done
When you run /optimize tokens, Token Saver also enables Persistent Mode ā your AI will continue writing in compressed notation going forward. No need to re-optimize!
- Automatic ā Enabled when you optimize, disabled when you revert
- Smart ā AI maintains compressed format in all workspace files
- Reversible ā
/optimize revertturns it off and restores everything
Safety First
- ā Auto-backup before any file changes
- ā "Possible savings" shown until you actually apply
- ā
One-command revert ā
/optimize revertrestores everything + turns off persistent mode - ā Only compresses files where real savings exist
How It Works
AI models understand compressed notation perfectly. The optimizer converts verbose instructions into dense, structured formats that preserve 100% of the meaning while using 40-90% fewer tokens.
Every token saved = money saved on every single API call.
License
MIT ā Use it, modify it, share it.
Permissions & Security
Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.
Requirements
- OpenClaw CLI installed and configured.
- Language: Markdown
- License: MIT
- Topics:
FAQ
How do I install token-saver?
Run openclaw add @rubenaquispe/token-saver in your terminal. This installs token-saver into your OpenClaw Skills catalog.
Does this skill run locally or in the cloud?
OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.
Where can I verify the source code?
The source repository is available at https://github.com/openclaw/skills/tree/main/skills/rubenaquispe/token-saver. Review commits and README documentation before installing.
