← 返回 Skills 市场
mkhaytman87

Token Optimizer

作者 mkhaytman87 · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
800
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install mkhaytman-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.
安全使用建议
Before installing or running this skill: - Verify you have the 'openclaw' CLI installed and accessible on PATH. The code calls 'openclaw' via subprocess though the registry metadata lists no required binary. - Review the included code (scripts/token_optimize, src/*.py) yourself — the tool reads session transcript files (~/.openclaw/agents/main/sessions/*.jsonl) and will process potentially sensitive message contents and tool arguments. - Run read-only actions first (e.g., --analyze, --health-check, --compress) to inspect output and confirm behavior. Avoid using --cleanup --apply until you’ve reviewed what 'apply' does (operating-notes indicate it currently issues a gateway restart) and tested in a staging environment. - Confirm where compressed snapshots and config files will be written (~/.openclaw/workspace/token-usage/), and whether that storage is acceptable for your data sensitivity requirements. - Because the skill source is 'unknown' and not from a verified publisher, prefer running it on a non-production system first and consider searching for the repository or contacting the author to verify provenance. If you want, I can list the exact lines where the tool invokes the 'openclaw' CLI and where it reads/writes files so you can more easily audit the risky calls.
功能分析
Type: OpenClaw Skill Name: mkhaytman-token-optimizer Version: 1.0.0 The skill is classified as suspicious due to two main high-risk capabilities. Firstly, the `token_optimize.py` script allows an arbitrary file write via the `--output` argument, which could overwrite any file on the system if the agent has sufficient permissions, potentially leading to denial of service or system instability, even though the content written is a benign JSON report. Secondly, the `--cleanup --apply` command executes `openclaw gateway restart`, a privileged action that could disrupt the OpenClaw environment. While this action is conditional on detecting 'stuck sessions' and explicitly documented as the only automated cleanup action in `references/operating-notes.md`, it represents a significant impact capability that could be exploited if the conditions for 'stuck sessions' are manipulable.
能力评估
Purpose & Capability
The skill's name/description (token optimization for OpenClaw) matches the code behavior: it reads OpenClaw session data, analyzes tokens, compresses contexts, and proposes/apply cleanup actions. However, the skill assumes an 'openclaw' CLI and specific ~/.openclaw paths but the registry metadata lists no required binaries or credentials — that omission is an incoherence that could mislead users about runtime prerequisites.
Instruction Scope
SKILL.md instructs running the included CLI which: reads session transcript files (~/.openclaw/agents/main/sessions/*.jsonl), writes compressed snapshots and a local config under ~/.openclaw/workspace/token-usage/, and can build/apply a cleanup plan. Reading transcripts and tool results is expected for token analysis but contains potentially sensitive content; the '--apply' mode can perform a gateway restart (disruptive operational effect) per operating-notes.
Install Mechanism
No remote downloads or unpacking are used. The repo includes scripts and a small install.sh that only chmods the CLI; package.json maps a bin. No installer downloads arbitrary code from external URLs. This is low install risk, but the lack of an install spec declaring 'openclaw' as a required binary is an operational gap.
Credentials
The skill requests no environment variables or external credentials. It only accesses local OpenClaw configuration and session files under the user's home directory, which is proportionate to its purpose. Be aware those files can include sensitive messages and tool arguments.
Persistence & Privilege
always:false and no special persistence are set (good). The skill can be invoked autonomously by the agent (platform default). The notable privilege is that the tool can execute 'openclaw gateway restart' when user requests '--cleanup --apply' which is a potentially disruptive system operation; it does not try to modify other skills or request permanent elevated credentials.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install mkhaytman-token-optimizer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /mkhaytman-token-optimizer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of Token Optimizer skill for OpenClaw. - Analyze and reduce token waste through context compression, tool-call deduplication insights, and session hygiene checks. - Provides CLI commands for token usage analysis, optimization snapshots, health checks, cleanup planning, and preflight budgeting. - Supports model selection guidance and session-limit-aware optimization. - Output includes compression snapshots, JSON reports, and configurable baseline settings. - Extensive documentation and quick start guidance included in SKILL.md.
元数据
Slug mkhaytman-token-optimizer
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

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. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 800 次。

如何安装 Token Optimizer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install mkhaytman-token-optimizer」即可一键安装,无需额外配置。

Token Optimizer 是免费的吗?

是的,Token Optimizer 完全免费(开源免费),可自由下载、安装和使用。

Token Optimizer 支持哪些平台?

Token Optimizer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Token Optimizer?

由 mkhaytman87(@mkhaytman87)开发并维护,当前版本 v1.0.0。

💬 留言讨论