How to Use Tokenless

更新时间:
复制 MD 格式

Tokenless is the token optimization component of ANOLISA. It reduces LLM inference costs by automatically compressing tool definitions and model responses without impacting your business logic. Tokenless supports mainstream agent scenarios such as cosh and OpenClaw. This topic describes how to install, configure, and use Tokenless.

How to Use Tokenless

Product Introduction

Tokenless is the token-saving toolkit of ANOLISA. Through five complementary strategies—schema compression, response compression, TOON encoding, command rewriting, and tool-ready checks—it trims redundancy from tool definitions, API responses, and command output before they enter the LLM context window, reducing token consumption and retry costs at agent runtime.

Core capabilities

Tokenless provides the following capabilities:

Capability

Description

Context compression

Streamlines function calling tool definitions, filters noise from CLI command responses, and compresses structured data through compact encoding.

Statistics tracking

Automatically records before-and-after compression comparisons and summarizes savings by type.

Transparent integration

Integrates automatically through plug-ins and hooks with zero intrusion on the agent framework.


Scope of use

This tool supports the following 7 agent frameworks:

Agent framework

Integration method

Compression strategy

cosh (Copilot Shell)

Integrated by default; no extra installation required

Tool ready + command rewriting + response compression + TOON + schema compression

OpenClaw

Plug-in

Command rewriting + response compression + schema compression

Hermes Agent

Plug-in

Tool ready + command rewriting + response compression + TOON

Qoder CLI

Plug-in

Tool ready + command rewriting + response compression

Claude Code

Plug-in

Tool ready + command rewriting + response compression + TOON

Codex

Plug-in

Tool ready + command rewriting + response compression + TOON

Qwen Code

Extension plug-in

Tool ready + command rewriting + response compression + schema compression

Installation methods

You can install Tokenless by using an RPM package (recommended for Alinux 4) or from source code.

RPM package installation (recommended):

# Install with dnf (auto-resolves dependencies)
sudo dnf install tokenless

RPM installs to the following system-level FHS paths:

  • Binary: /usr/bin/tokenless

  • Supporting tools: /usr/libexec/anolisa/tokenless/{rtk,toon}

  • Adapter resources: /usr/share/anolisa/adapters/tokenless/

  • cosh extension: /usr/share/anolisa/extensions/tokenless/

Install from source:

git clone --recursive https://github.com/alibaba/anolisa.git
cd src/tokenless
make setup
# Build dependencies: Rust >= 1.91, just, Git, nodejs+npm (to compile the OpenClaw TS plug-in).
# Runtime dependencies: python3, jq, bash.

Configuration and integration

After RPM installation, the adapter resources for each agent reside under /usr/share/anolisa/adapters/tokenless/. Each subdirectory contains a scripts/install.sh script that registers the integration for the corresponding framework.

Cosh (Copilot Shell) integration

No manual action is required. After RPM installation, the cosh extension is deployed in place and is discovered automatically when cosh starts.

OpenClaw integration

Run the install.sh script to complete the OpenClaw plug-in integration:

sudo bash /usr/share/anolisa/adapters/tokenless/openclaw/scripts/install.sh
# Restart the OpenClaw gateway after installation:
openclaw gateway restart
# Use the openclaw command to check the Tokenless plug-in installation status
openclaw plugins list |grep tokenless

Hermes Agent integration

Run the install.sh script to complete the Hermes plug-in integration:

sudo bash /usr/share/anolisa/adapters/tokenless/hermes/scripts/install.sh
# Use the hermes command to check the Tokenless plug-in installation status
hermes plugins list |grep tokenless

Qoder CLI integration

Run the install.sh script to complete the Qoder CLI plug-in integration:

sudo bash /usr/share/anolisa/adapters/tokenless/qoder/scripts/install.sh
# Use the qoder command to check the Tokenless plug-in installation status
qoder plugins list |grep tokenless

Claude Code integration

Run the install.sh script to complete the Claude Code plug-in integration:

sudo bash /usr/share/anolisa/adapters/tokenless/claude-code/scripts/install.sh
# Use the claude command to check the Tokenless plug-in installation status
claude plugins list

Codex integration

Run the install.sh script to complete the Codex plug-in integration:

sudo bash /usr/share/anolisa/adapters/tokenless/codex/scripts/install.sh
# Use the codex command to check the Tokenless plug-in installation status
codex plugin list |grep tokenless

Qwen Code integration

Run the install.sh script to complete the Qwen plug-in integration:

sudo bash /usr/share/anolisa/adapters/tokenless/qwencode/scripts/install.sh
# Use the qwen command to check the Tokenless plug-in installation status
qwen extensions list

Tool ready

  tokenless env-check --tool Shell      # Check a single tool
  tokenless env-check --all             # Check all tools
  tokenless env-check --all --fix       # Auto-fix
  tokenless env-check --all --json      # Machine-readable JSON

Compression statistics

Query with the stats command

Run the tokenless stats command to view Tokenless compression statistics:

  tokenless stats summary                # Summary (grouped by operation type)
  tokenless stats summary --json         # JSON format
  tokenless stats list                   # Last 20 records
  tokenless stats list -l 50             # Last 50 records
  tokenless stats show 42                # Show before-and-after text of record 42
  tokenless stats clear --yes            # Clear statistics
  tokenless stats status                 # View stats/SLS toggle status and source
  tokenless stats enable                 # Enable statistics recording
  tokenless stats disable                # Disable statistics recording

Dual-run comparison (tokenless stats summary --compare)

Use dry-run mode to compare the actual token consumption of the same task with compression enabled versus disabled:

  # Run 1: dry-run baseline (no compression)
  TOKENLESS_COMPRESSION_ENABLED=0 <run the same task>  # Record session ID

  # Run 2: real compression
  TOKENLESS_COMPRESSION_ENABLED=1 <run the same task>  # Record session ID

  # Compare
  tokenless stats summary --compare <session-A> <session-B>
  tokenless stats summary --compare <session-A> <session-B> --json

Comparison result:

  Sample output:

  Tokenless Comparison Report
  ============================================================
  operation                 baseline     tokenless     saved     saved%
  --------------------------------------------------------------------
  compress-response              4500          1200       3300       73.3%
  compress-schema                1200           500        700       58.3%
  --------------------------------------------------------------------
  TOTAL                          5700          1700       4000       70.2%

AgentSight integration

AgentSight integrates with the Tokenless compression statistics database. You can view compression results on the AgentSight dashboard. For more information, see How to use AgentSight.