by HKUDS
TokenWise: Self-Evolving Context with Up to 50% Token Savings
# Add to your Claude Code skills
git clone https://github.com/HKUDS/TokenWiseGuides for using ai agents skills like TokenWise.
See how TokenWise compares with popular alternatives.
TokenWise is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by HKUDS. TokenWise: Self-Evolving Context with Up to 50% Token Savings. It has 2,290 GitHub stars.
TokenWise's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/HKUDS/TokenWise" and add it to your Claude Code skills directory (see the Installation section above).
TokenWise is primarily written in TypeScript. It is open-source under HKUDS on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh TokenWise against similar tools.
No comments yet. Be the first to share your thoughts!
Available after the catalog security scan passes.
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM lists this project for discovery and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
English · 简体中文
The Problem: AI agents pay for every token they read—even the ones they do not need.
🗑️ Redundant and irrelevant tokens
📈 Growing token costs
🧠 No self-evolving context
✂️ Read less. Keep what matters.
Remove noise before it reaches the model while preserving task-critical context.
🧠 Evolve with every workflow.
Learn from real usage and adapt to new tools, commands, and context.
🔄 Learn once. Improve every agent.
Share proven optimization strategies across agents and platforms.
📊 See every token saved.
Track per-response and cumulative savings in real time.
Every response shows the tokens saved and the reduction percentage—directly inside your agent.
Results are based on one real-world run with each agent.
Paste the following into your agent:
Install TokenWise for every supported agent on this machine and verify that each integration works.
Repository: https://github.com/HKUDS/TokenWise
TokenWise starts working with your next command—no configuration required.
To add custom optimization rules, invoke TokenWise from your agent:
/tokenwise # Claude Code and other supported agents
$tokenwise # Codex
@tokenwise # OpenCode and DeepSeek Harness
/skill:tokenwise # pi
Requirements: Node.js 22 and pnpm.
# Clone and build TokenWise
git clone https://github.com/HKUDS/TokenWise.git
cd TokenWise
pnpm install
pnpm build
# Install the CLI globally
npm install -g ./packages/cli
# Detect your agents and install TokenWise
tokenwise setup
# Verify every agent integration
tokenwise doctor --probe
Available on macOS and Linux. Integration depth varies by agent; see connection details.
From the checkout, after npm install -g ./packages/cli:
pi install "$PWD/adapters/pi" # pi
dsh plugin --profile web add -w "$PWD/adapters/dsh" # DeepSeek Harness (your profile)
claude plugin marketplace add "$PWD" && claude plugin install tokenwise@tokenwise
codex plugin marketplace add "$PWD" && codex plugin add tokenwise@tokenwise # then trust its hooks in /hooks
codebuddy plugin marketplace add "$PWD" && codebuddy plugin install tokenwise@tokenwise
grok plugin marketplace add "$PWD" && grok plugin install tokenwise@tokenwise --trust
copilot plugin marketplace add "$PWD" && copilot plugin install tokenwise@tokenwise
# OpenCode
mkdir -p ~/.config/opencode/plugins
cp adapters/opencode/dist/index.js ~/.config/opencode/plugins/tokenwise.js
# Hermes Agent
mkdir -p ~/.hermes/plugins
cp -R adapters/hermes/tokenwise ~/.hermes/plugins/tokenwise
hermes plugins enable tokenwise && hermes config set context.engine tokenwise
# The tokenwise skill, where each agent reads skills
cp -R skills/tokenwise ~/.claude/skills/ # Claude Code; likewise ~/.codebuddy/skills, ~/.grok/skills,
# ~/.config/opencode/skills, ~/.hermes/skills and ~/.copilot/skills
cp -R skills/tokenwise ~/.agents/skills/ # Codex, pi and DeepSeek Harness
# Anything else: wrap the command
tokenwise run -c 'cargo test'
tokenwise setup runs these for you; tokenwise setup --dry-run only prints them.
| Agent | Context on demand | Learning from inside the agent |
|---|---|---|
| pi 1.1+ | in-process; TokenWise writes the compacted context | /tokenwise panel |
| DeepSeek Harness 0.2.x | in-process; TokenWise writes the compacted context | Plugins page, Learn now |
| OpenCode 1.19+ | in-process; TokenWise writes the compacted context | tokenwise learn |
| Hermes Agent 0.22+ | Python plugin and context engine | tokenwise learn |
| Claude Code 2.1+ | hooks; the catalog follows Claude's own summary | /tokenwise:learn |
| Codex 0.162+ | hooks; the catalog follows Codex's own summary | $tokenwise learn |
| CodeBuddy 2.175+ | hooks and a mod that rewrites the stored summary | /tokenwise:learn |
| Grok Build 1.0+ | hooks; the catalog follows Grok's own summary | /tokenwise:learn |
| GitHub Copilot CLI 1.0+ | hooks; shell output only (Copilot compacts with its own summary) | tokenwise learn |
| Any agent or shell | tokenwise run, recall over MCP |
tokenwise learn |
Every agent also gets the tokenwise skill: /tokenwise, $tokenwise in Codex,
@tokenwise in OpenCode and DeepSeek Harness, /skill:tokenwise in pi. Each agent's folder under adapters/ has the details;
docs/adapters.md shows how to connect another agent.
| Command | What it does |
|---|---|
tokenwise setup [agent...], uninstall [--purge] |
add TokenWise to your agents, or take it out |
tokenwise saved [--month|--all] |
what TokenWise saved you, as a pixel jar in the terminal (--json for the numbers) |
tokenwise dashboard [--port N] [--no-open] |
the same jar as a page in your browser, filling as it saves |
tokenwise report [--host H] [--session S] |
the detailed numbers behind |