Prompt Compressor
name: prompt-compressor
by ckpxgfnksd-max · published 2026-03-22
$ claw add gh:ckpxgfnksd-max/ckpxgfnksd-max-prompt-token-saver---
name: prompt-compressor
description: Saves 20-40% of LLM tokens by teaching the agent to write compressed responses, compressed memory logs, and compressed pre-compaction summaries. Works via SOUL.md instructions — no hooks, no extra process, no dependencies. Also provides explicit compression when the user asks to compress a prompt. Use when the user asks about reducing token costs, optimizing API spend, compressing prompts, or making the agent more efficient.
version: 1.0.0
metadata: {"openclaw":{"emoji":"🗜️","homepage":"https://github.com/ckpxgfnksd-max/prompt-compressor-openclaw"}}
---
# Prompt Compressor
Saves tokens on turns 2+ by making all agent output compressed from the start.
How it works
This is NOT a hook (hooks require newer OpenClaw versions). Instead, it works by adding instructions to SOUL.md that make the agent:
1. **Write compressed responses** — no filler, no hedging, lead with answers
2. **Write compressed MEMORY.md** — one fact per line, no narrative
3. **Write compressed daily logs** — decisions only, not discussions
4. **Compress pre-compaction flushes** — facts not paragraphs
The savings compound: compressed responses → compressed history → compressed compaction summaries → fewer tokens on every subsequent turn.
Install
Append the contents of `soul-snippet.md` to the user's SOUL.md:
cat {baseDir}/soul-snippet.md >> ~/.openclaw/SOUL.mdOr if using a workspace SOUL.md:
cat {baseDir}/soul-snippet.md >> <workspace>/SOUL.mdThen start a new session (`/new`) so the updated SOUL.md loads.
When user asks to compress a specific prompt
Apply these rules manually to their text:
Remove
Shorten
Normalize
Never touch
Rules
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...