← 返回
数据分析 中文

Token Optimizer

Automatically analyze and reduce OpenClaw token waste through context compression, tool-call deduplication insights, model selection guidance, and session hygiene checks. Use when sessions are nearing context limits, costs are climbing, or you want proactive token optimization before expensive tasks.
通过上下文压缩、工具调用去重分析、模型选择指导和会话清理检查,自动分析和减少OpenClaw令牌浪费。适用于会话接近上下文限制、成本上升,或在进行昂贵任务前需要主动优化令牌的场景。
mkhaytman87
数据分析 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 1
Stars
📥 1,212
下载
💾 40
安装
1
版本
#latest

概述

Token Optimizer

Overview

Use this skill to optimize OpenClaw token usage with a local CLI that performs analysis, compression snapshots, health checks, cleanup planning, and preflight token budgeting.

Quick Start

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --analyze --period 7d

Core Commands

1) Enable local optimizer config:

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --enable

2) Optimization analysis:

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --analyze --period 7d

3) Force context compression snapshot:

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --compress --threshold 0.7 --session agent:main:main

4) Session health check:

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --health-check --active-minutes 120

5) Auto-cleanup planning and apply:

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --cleanup
$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --cleanup --apply

Preflight Optimization

Use preflight planning before expensive task batches:

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize \
  --preflight /path/to/actions.json \
  --session-limit 180000

actions.json should be a JSON array of planned operations, for example:

[
  {"type": "web_search", "query": "..."},
  {"type": "web_fetch", "url": "..."},
  {"type": "summarize", "target": "youtube"}
]

Output Artifacts

  • Compression snapshots: $OPENCLAW_WORKSPACE/token-usage/compressed/
  • Optional JSON output: --format json --output /path/file.json
  • Baseline config (from --enable): $OPENCLAW_WORKSPACE/token-usage/token-optimizer.config.json

Defaults

Default behavior is configured in:

  • config/defaults.json

Override with:

$OPENCLAW_SKILLS_DIR/token-optimizer/scripts/token-optimize --config /path/custom.json --analyze

Resources

  • scripts/token_optimize.py: main CLI
  • src/optimizer.py: core optimization engine
  • src/models.py: model selection logic
  • src/compression.py: context compression helpers
  • src/cleanup.py: session hygiene evaluation
  • references/operating-notes.md: implementation details and safe-operating guidance

Validation

python3 $OPENCLAW_SKILLS_DIR/.system/skill-creator/scripts/quick_validate.py \
  $OPENCLAW_SKILLS_DIR/token-optimizer

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 04:25 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,470
content-creation

Awwwards Design

mkhaytman87
运用高级动画、创意交互和独特视觉体验,打造获奖且令人难忘的网站。适用于作品集、代理展示、产品发布等需要惊艳效果的项目。
★ 11 📥 4,817
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,124