Skip to main content

Tokenless User Manual

中文版

Tokenless is designed for tool-heavy AI agents. Its CLI compacts schemas and JSON responses, while its adapters can also rewrite shell commands, check tool dependencies, and pass compressed results to an agent. The exact effect depends on the host framework: some adapters replace the original result, while others add compressed context without removing the original.

Start with the Quick Start if this is your first use.

Build the standalone CLI from source

Source builds are intended for development and debugging. The project currently validates and supports source builds on Linux only:

git clone https://github.com/alibaba/anolisa.git
cd anolisa/src/tokenless
cargo build --release --locked -p tokenless-cli
./target/release/tokenless --version

This path produces only the standalone tokenless CLI. It does not install rtk, toon, or the agent integration resources. To use the complete feature set in an agent, install through the anolisa CLI as described in the Quick Start.

Capabilities and boundaries

CapabilityBehavior implemented in the current codeImportant boundary
Schema compressionRemoves title and examples, removes fenced and inline code from descriptions, collapses whitespace, and truncates descriptionsOnly available through the cosh and Qwen Code schema hooks; other users can call the CLI
Response compressionRemoves exact, case-sensitive debug-field names, null, empty strings/arrays/objects, and truncates values past configured limitsAccepts JSON; content-retrieval tools are intentionally skipped by adapters
TOON encodingEncodes JSON and keeps the JSON input when the estimated token count does not decreaseWhether TOON replaces or accompanies the original depends on the adapter
Command rewritingCalls rtk rewrite and submits the rewritten shell input when a rule is availableThe command actually sent to the shell changes; unsupported or denied rewrites pass through
Tool ReadyChecks declared binaries, versions, configuration, permissions, and optional dependencies--fix installs only missing required dependencies and may change the environment
StashStores content removed by string, array, depth, or schema-description truncationOne-hour TTL and 10,000 live entries by default; other removed fields are not stashed

The implementation contains no fixed saving-rate guarantee. Results depend on the payload, adapter delivery semantics, and the share of the model context that came from tool data. Measure your own workload as described in Measuring savings.

How Tokenless participates in a tool call

After an adapter is enabled, a tool call may pass through these stages:

Before the tool: Tool Ready check → command rewrite
After the tool: response compression → optional Stash → TOON encoding → statistics
Before the model: schema compression

This is a capability map, not a pipeline that every framework runs. For example, OpenClaw disables TOON by default, Codex adds compressed context instead of replacing the original tool result, and only cosh and Qwen Code register schema compression. See Framework integration.

Behaviors to understand

Installation does not enable every adapter

anolisa install tokenless installs the component and its adapter resources. To make an agent use Tokenless automatically, also run:

anolisa adapter enable tokenless <framework>

CLI-only use does not require an adapter.

“Compression off” affects only compression operations

With compression_enabled=false or TOKENLESS_COMPRESSION_ENABLED=0, compress-schema, compress-response, and compress-toon—whether called directly or through an adapter—still calculate predicted savings and may write statistics, but return the original input. They do not write Stash entries in this mode.

This setting does not disable RTK command rewriting, Tool Ready checks, adapter execution, or retrieval. To stop all Tokenless behavior in an agent, disable the adapter:

anolisa adapter disable tokenless <framework>

Reversible compression is conditional

Active response and schema truncation stash the removed payload in ~/.tokenless/stash.db by default and add a marker such as:

<<tokenless:0123456789abcdef01234567>>

The payload can be recovered through tokenless retrieve or the MCP tokenless_retrieve tool. Recovery is unavailable when:

  • --no-stash was used.
  • Compression was running in dry-run mode.
  • The Stash database was unavailable or a write failed.
  • The entry exceeded its TTL.
  • The 10,000-live-entry capacity evicted an older entry.
  • The caller uses a different Stash database path.

Stash does not make all compression reversible. Removed debug/trace fields, null and empty values, schema title/examples, and Markdown formatting are not stored for retrieval. Validate critical payloads with representative data before enabling active compression.

Processing errors usually fail open

Compression and rewrite hooks normally return no modification when tokenless or rtk is missing, compression provides no savings, or an ordinary processing error occurs. Tool Ready is different: some adapters intentionally block a tool that is still NOT_READY after an auto-fix attempt. A Stash write failure may still allow lossy compression to continue.

Command rewriting also changes the shell command submitted by the host. Most adapters replace the command input directly; Hermes blocks the first call and tells the agent to retry with the rewritten command. Validate important command workflows as well as compressed output.

Supported agent frameworks

FrameworkIntegrationCurrent code path
coshExtensionTool Ready, rewrite, response + TOON, Schema; Cosh-NG has a replacement path, while legacy Copilot Shell appends additional context
OpenClawPluginTool Ready, exec rewrite, persisted-result replacement, optional TOON; no Schema
HermesPluginTool Ready, block-and-retry rewrite, result replacement with response + TOON; no Schema
QoderPluginTool Ready, rewrite, response + TOON through additionalContext; no Schema
Claude CodeMarketplace pluginTool Ready, Bash rewrite, response replacement on Claude Code 2.1.121 or later; conditional TOON; no Schema
CodexPluginTool Ready, rewrite, response/TOON analysis added as context; the original result is retained; no Schema
Qwen CodeExtensionTool Ready, rewrite, response + TOON through additionalContext, Schema

Find documentation by task

I want toDocument
Install and verify for the first timeQuick Start
Build the standalone CLI from sourceThis page · Build the standalone CLI from source
Connect or switch an agent frameworkFramework integration
Compress, retrieve, or run MCP manuallyCLI reference
Inspect savings or content changes, or run a dual comparisonMeasuring savings
Change settings or understand local dataConfiguration and data privacy
Fix missing statistics, adapter, or Stash issuesTroubleshooting
Upgrade or uninstallTroubleshooting · Upgrade and uninstall
  1. Complete the Quick Start with non-sensitive test data.
  2. Record a dry-run baseline for the same task.
  3. Enable active compression and compare both output quality and savings.
  4. Confirm that local-data and SLS behavior meets your requirements.
  5. Enable the adapter for production agents.

The tokenless --help output from the installed version is the final authority for CLI and configuration behavior.