OpenClaw · Updated 2026-10-29
Reduce OpenClaw Token Usage: Compress Tool Results
OpenClaw sessions grow with tool results, file reads, shell and log output, MCP results and history that sits in context until compaction. Here is where those tokens go and what supercompress setup wires so large tool results become a session digest prepended on the next prompt.
npx supercompress-proxy setup or supercompress setup. Setup opens a browser sign-in link (no API key step), then writes OpenClaw MCP, hooks, plugin, skill and AGENTS.md. The plugin compresses large tool results into a session-scoped digest and prepends that digest on the next prompt build. It does not replace the tool result OpenClaw already has.
Where OpenClaw tokens go
- Tool results. Each tool call leaves its output in the session.
- File reads. Whole files come back even when a few lines matter.
- Shell and log output. Test runs, builds and logs stay in context for later turns.
- MCP results. Large results from other MCP servers ride along after they are read.
- Session history before compaction. Old turns stay in the prompt until OpenClaw compact runs.
How SuperCompress works
SuperCompress is hosted, extractive and query-aware. It keeps original lines chosen against the question and drops the rest. It never rewrites or summarizes, so file paths, error messages, IDs and code come back as they were. The question itself is never compressed.
Every compress call reports original_tokens and kept_tokens, so you can see what was dropped on your own work. The agent can also call MCP tools compress_context, connect_account and runway_check.
What supercompress setup wires in OpenClaw
supercompress setup and supercompress plugin write the same OpenClaw files. Existing MCP servers and theme stay in place. A *.sc-bak.<timestamp> backup of openclaw.json is written first. If openclaw or claw is on PATH, setup also runs openclaw hooks enable ... and openclaw plugins enable supercompress.
| File | Change |
|---|---|
~/.openclaw/openclaw.json | Adds mcp.servers.supercompress (stdio supercompress-mcp) next to your existing servers. Enables internal hooks supercompress-bootstrap and supercompress-compact under hooks.internal.entries. Enables plugin supercompress under plugins.entries and adds its path to plugins.load.paths. |
~/.openclaw/AGENTS.md | Appends a SuperCompress instructions block after your own text. |
~/.openclaw/skills/supercompress/SKILL.md | Copies the SuperCompress skill. |
~/.openclaw/hooks/supercompress-bootstrap/ | Copies the agent:bootstrap hook, which injects this session's digest as SUPERCOMPRESS.md. |
~/.openclaw/hooks/supercompress-compact/ | Copies the session:compact:before hook, which compacts SuperCompress rolling session memory before OpenClaw compacts. |
~/.openclaw/extensions/supercompress/ | Copies the SuperCompress plugin. |
For clients you wire by hand, the hosted MCP endpoint is https://www.supercompress.dev/api/mcp.
How a turn works
- OpenClaw runs a tool. The original tool result stays with OpenClaw. The plugin does not replace it.
- On
after_tool_call, if that result is large (default: above 400 characters), the plugin compresses it into a session-scoped digest at~/.supercompress/inbox/<sessionId>/latest.md. - On the next
before_prompt_build, the plugin prepends that session's digest.
The agent can also call compress_context itself, with the bulky text as context and the user's question as query. Hook agent:bootstrap injects the session digest as SUPERCOMPRESS.md. Hook session:compact:before compacts SuperCompress rolling session memory before OpenClaw's own compact.
Session-scoped digests
Each OpenClaw session has its own inbox path: ~/.supercompress/inbox/<sessionId>/latest.md. Digests are never shared across sessions. If a session id is missing, the plugin does not write a digest, so unrelated chats do not mix.
Install
npx supercompress-proxy setup
If the CLI is already installed:
supercompress setup
Setup opens a browser sign-in link. There is no API key step. It detects the coding agents on the machine and wires each one, including OpenClaw. Restart OpenClaw so it loads the new MCP server, hooks and plugin.
Check what got wired
supercompress doctor
doctor prints a per-agent health check. For OpenClaw the plugin table row is MCP, Hooks and Instructions.
Undo
supercompress uninstall
supercompress uninstall --yes skips the confirm prompt. Uninstall removes SuperCompress instructions, skill, both hooks, plugin, auto config and MCP registration, and restores the user's OpenClaw config and AGENTS.md.
When to skip it
- Short sessions with small tool results. There is little to drop.
- Files the agent is about to edit line by line. It needs those in full.
- Work where every byte must be passed through unchanged for compliance reasons.
FAQ
Does the plugin replace OpenClaw tool output?
No. The plugin does not replace the tool result OpenClaw already has. It writes a compressed digest for that session and prepends the digest on the next prompt build.
Does SuperCompress summarize what OpenClaw reads?
No. It is extractive and query-aware. It keeps original lines chosen against the question and drops the rest. It never rewrites or summarizes, so file paths, error messages and code stay as they were.
Are OpenClaw digests shared across sessions?
No. Digests are per session at ~/.supercompress/inbox/<sessionId>/latest.md. Sessions do not share a digest.
Does setup change my other OpenClaw MCP servers or theme?
No. It adds mcp.servers.supercompress next to the servers you already have and leaves your theme as it was. It writes a *.sc-bak.<timestamp> backup of openclaw.json first.
How do I undo the OpenClaw setup?
Run supercompress uninstall. It removes the SuperCompress instructions, skill, both hooks, plugin, auto config and MCP registration, and restores your OpenClaw config.