skills$openclaw/token-saver
rubenaquispe6.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.

6.5k stars7.7k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026data analytics

Skill Snapshot

nametoken-saver
descriptionReduce 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.
ownerrubenaquispe
repositoryrubenaquispe/token-saver
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @rubenaquispe/token-saver
last updatedFeb 7, 2026

Maintainer

rubenaquispe

rubenaquispe

Maintains token-saver in the OpenClaw Skills directory.

View GitHub profile
File Explorer
9 files
.
scripts
analyzer.js
13.7 KB
compressor.js
15.4 KB
optimizer.js
31.3 KB
_meta.json
458 B
audit.json
6.1 KB
package.json
538 B
README.md
4.5 KB
SKILL.md
3.2 KB
SKILL.md

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

CommandWhat it does
/optimizeFull audit dashboard — files, models, compaction
/optimize tokensCompress workspace files (auto-backup)
/optimize compactionChat compaction control
/optimize compaction 120Set custom compaction threshold
/optimize revertRestore 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:

FileWriting Style
SOUL.mdEvocative, personality-shaping
AGENTS.mdDense instructions, symbols OK
USER.mdKey:value facts
MEMORY.mdUltra-dense data
memory/*.mdLog format, dated
PROJECTS.mdKeep user's structure

Safety

  • Auto-backup — All modified files get .backup extension
  • Integrity > Size — Never sacrifices meaning for smaller tokens
  • Revert anytime — /optimize revert restores 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

README.md

šŸš€ 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.

License Version

Quick Start

/optimize

That's it. You'll see a dashboard with your savings options.

What It Does

FeatureDescription
šŸ—œļø File CompressionScans ALL .md workspace files and compresses them using AI-efficient notation
šŸ¤– Model AuditDetects your current AI models and suggests cheaper alternatives
šŸ“Š Cost DashboardShows weekly/monthly/annual savings with clear before & after
šŸ›”ļø Safe RollbackAuto-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

CommandWhat It Does
/optimizeShow savings dashboard
/optimize tokensCompress workspace files (auto-backup)
/optimize modelsDetailed model cost comparison
/optimize revertRestore 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 revert turns it off and restores everything

Safety First

  • āœ… Auto-backup before any file changes
  • āœ… "Possible savings" shown until you actually apply
  • āœ… One-command revert — /optimize revert restores 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.