token-saver
Reduce OpenClaw AI costs with model-aware optimization. Features dynamic compaction presets based on your model's context window, intelligent file compression, and robust model detection with fallback. Supports Claude, GPT-4, Gemini, DeepSeek, and more.
Why use this skill?
Cut your AI API costs with Token Saver v3. Features model-aware dynamic compression, workspace file optimization, and intelligent context monitoring for Claude, GPT, and Gemini.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/rubenaquispe/token-saverWhat This Skill Does
Token Saver v3 is an essential optimization engine designed to minimize API costs and improve response latency for OpenClaw users. By intelligently managing the volume of workspace context—including critical documentation like SOUL.md, USER.md, and MEMORY.md—this skill prevents unnecessary token bloat. Unlike static alternatives, Token Saver v3 is fully model-aware. It cross-references your current active AI model against a comprehensive internal registry of over 24 models (including Claude 3.5, GPT-4o, and Gemini 2.0/3.0) to dynamically calculate context window thresholds. It employs smart file-level compression that respects the intent of specific documentation types: keeping personality-driven files like SOUL.md lightly compressed while applying heavy data-density algorithms to MEMORY.md. This ensures you only pay for the context that provides real utility to the LLM.
Installation
You can install this skill directly via the OpenClaw ecosystem by running the following command in your terminal: clawhub install openclaw/skills/skills/rubenaquispe/token-saver. Once installed, the skill automatically integrates with your active session, enabling persistent model detection and monitoring.
Use Cases
This skill is perfect for long-running AI sessions where large project codebases are being tracked. It is specifically useful for power users working with high-context models like Gemini 3 Pro (2M window), as it helps keep the relevant context within the 'sweet spot' for model recall. It also serves as a critical cost-control tool for developers using premium models like Claude 3.5 Sonnet, where every token counts toward the monthly billing threshold. Additionally, if you find your AI agent 'forgetting' instructions due to context window saturation, Token Saver can clean up obsolete workspace information, creating room for high-priority logic.
Example Prompts
- '/optimize' — Run this to view the interactive dashboard and check your current context consumption vs. your model's limits.
- '/optimize compaction balanced' — Apply the standard 60% capacity constraint to ensure optimal performance without sacrificing memory depth.
- '/optimize tokens' — Manually trigger a workspace sweep to compress current markdown files and save on next-message costs.
Tips & Limitations
- Backups: Token Saver v3 automatically creates backups before compression. If you feel a document was over-compressed, simply run '/optimize revert' to restore your original project structure.
- Custom Thresholds: If you are debugging complex logic, you can bypass dynamic presets by using '/optimize compaction 120' to explicitly set a high-token threshold.
- Limitations: This skill is currently optimized for markdown-based project structures. Binary files or non-standard configuration files may be ignored during the compression sweep.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-rubenaquispe-token-saver": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-write, file-read
Related Skills
sandwrap
Run untrusted skills safely with soft-sandbox protection. Wraps skills in multi-layer prompt-based defense (~85% attack prevention). Use when: (1) Running third-party skills from unknown sources, (2) Processing untrusted content that might contain prompt injection, (3) Analyzing suspicious files or URLs safely, (4) Testing new skills before trusting them. Supports manual mode ('run X in sandwrap') and auto-wrap for risky skills.
skill-auditor
Security scanner that catches malicious skills before they steal your data. Detects credential theft, prompt injection, and hidden backdoors. Works immediately with zero setup. Optional AST dataflow analysis traces how your data moves through code.
GSD Claw
Spec-driven development with built-in verification for substantial projects. Use when user wants to plan a project, scope a feature, build something with structure, or says "GSD mode", "let's plan", "scope out", "spec-driven". Workflow is Discuss → Plan → Execute → Verify. Based on glittercowboy's GSD system (MIT license). NOT for quick questions or simple tasks.
frankenstein
Combine the best parts of multiple skills into one. Searches ClawHub, GitHub, skills.sh, skillsmp.com and other AI skill repos. Analyzes each safely, compares features, and builds a combined 'Frankenstein' skill with the best of each. Uses skill-auditor for security scanning and sandwrap for safe analysis. Use when: (1) Multiple skills exist for same purpose, (2) Want best-of-breed combination, (3) Building a comprehensive skill from fragments.