← Back to Skills Marketplace
mkhaytman87

Token Optimizer

by mkhaytman87 · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
800
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install mkhaytman-token-optimizer
Description
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.
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install mkhaytman-token-optimizer
  3. After installation, invoke the skill by name or use /mkhaytman-token-optimizer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug mkhaytman-token-optimizer
Version 1.0.0
License
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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. It is an AI Agent Skill for Claude Code / OpenClaw, with 800 downloads so far.

How do I install Token Optimizer?

Run "/install mkhaytman-token-optimizer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Token Optimizer free?

Yes, Token Optimizer is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Token Optimizer support?

Token Optimizer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Token Optimizer?

It is built and maintained by mkhaytman87 (@mkhaytman87); the current version is v1.0.0.

💬 Comments