TOON Context Compression for Openclaw

A specialized CLI utility that transforms JSON data into the TOON format to achieve approximately 40% savings in token context usage.

bonk-moltbot
v1.0.0
Jan 31, 2026
1
2.2k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install toon

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install toon using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is TOON Context Compression?

TOON Context Compression is a powerful utility designed to maximize the efficiency of AI agent interactions by minimizing the size of structured data. By converting verbose JSON into the streamlined TOON format, developers can significantly extend the effective capacity of their LLM context windows. This skill is a vital addition to the ecosystem of Openclaw Skills, providing a seamless way to handle data-heavy tasks without hitting token limits.

The tool operates as a smart filter in the command line. When data is piped through it, the utility automatically identifies JSON structures and compresses them, while allowing non-JSON text to pass through without modification. This makes it a safe, set-and-forget enhancement for any data-retrieval workflow.

TOON Context Compression Use Cases

  • Reducing the token cost of large API responses fetched via curl during agent execution.
  • Compressing local JSON data files before they are read into the AI's active context.
  • Optimizing the output of database queries or log exports for better analysis by AI agents.
  • Building efficient automated pipelines within Openclaw Skills that require high-density data processing.

How TOON Context Compression Works

  1. The user pipes any command output or file content into the toon utility using standard Unix pipes.
  2. The utility scans the input stream to detect valid JSON objects or arrays.
  3. Upon detection, the script utilizes the @toon-format/cli via npx to transform the data into a column-based, header-defined TOON representation.
  4. If the input is identified as plain text or non-JSON, it is passed directly to stdout without alteration.
  5. The resulting minimized output is then consumed by the AI agent, requiring significantly fewer tokens to process the same information.

TOON Context Compression Setup

To integrate this utility into your Openclaw Skills environment, follow these steps:

# Copy the script to your local bin directory
cp scripts/toon ~/.local/bin/

# Make the script executable
chmod +x ~/.local/bin/toon

# Ensure you have Node.js installed to support npx
node -v

TOON Context Compression Data Schema & Taxonomy

The toon utility processes data dynamically without requiring a fixed database schema. It follows the TOON specification for output:

Input Type Logic Output Format
Standard JSON Compression Header-defined TOON format (e.g., [count]{keys}: values)
Plain Text Pass-through Original raw text
Mixed Content Selective JSON blocks are compressed; other lines remain intact

TOON Context Compression Advanced Features

  • Intelligent JSON detection that avoids corrupting standard command line text output.
  • Transparent integration with any CLI tool that outputs to stdout.
  • Significant token savings (~40%) which improves both performance and cost-efficiency for Openclaw Skills.
  • Lightweight dependency model relying on npx for the latest TOON formatting logic.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*