跳到正文
TakoAPI
返回技能列表

token-saver

由 rubenaquispe 提供

Coding Agents & IDEs
4.5k下载量由 clawskills.sh 提供
9星标
1浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Reduce OpenClaw AI costs with model-aware optimization.

描述

该技能的功能

Reduces AI API costs by compressing workspace files (SOUL.md, USER.md, MEMORY.md, etc.) that are sent with every API call. Detects the active model and adapts compaction thresholds to its actual context window size. Supports 24+ models including Claude, GPT-4, Gemini, and DeepSeek.

Dynamic presets scale compaction thresholds to each model's actual context window, so the same preset works correctly whether you're on GPT-4o's 128K or Gemini's 1M context.

何时使用

  • Cutting API costs on long agent sessions with large workspace files
  • Auditing which workspace files consume the most tokens before a project
  • Setting automatic chat compaction thresholds matched to the active model
  • Compressing MEMORY.md and USER.md into dense key-value format
  • Reverting workspace files to their pre-compression state after testing

示例工作流

输入

User asks: optimize my workspace for the current model

智能体
  1. 1

    Detect active model and retrieve its context window from the local registry

  2. 2

    Scan all workspace .md files and calculate token counts

  3. 3

    Apply file-appropriate compression to USER.md and MEMORY.md

  4. 4

    Set compaction threshold to 60% of the detected context window

  5. 5

    Create .backup files for all modified documents

输出

Compressed workspace files with auto-backups, compaction threshold set dynamically to model context size

安装

clawhub install rubenaquispe/token-saver

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接