OmniRoute Compression Modes Explained: Lite vs Standard vs Aggressive vs Ultra vs RTK

OmniRoute's compression pipeline implements five sequential modes—lite, standard, aggressive, ultra, and RTK—that progressively escalate from simple whitespace cleanup to sophisticated token pruning and structured output filtering.

The OmniRoute repository (diegosouzapw/OmniRoute) organizes its compression system as a multi-phase stack where each mode activates specific engines defined in open-sse/services/compression/types.ts. These phases range from lightweight rule-based heuristics to LLM-driven summarization and optional ONNX model inference, allowing developers to balance token reduction against processing overhead.

Understanding the Five OmniRoute Compression Modes

Each compression mode corresponds to a specific architectural phase in the pipeline. The progression moves from low-cost text transformations to computationally intensive operations that maximize token savings.

According to the type definitions in open-sse/services/compression/types.ts, the CompressionMode union explicitly orders these as distinct phases 1 through 5, with each phase building upon or replacing the capabilities of the previous one.

Phase-by-Phase Breakdown of Compression Engines

Lite Mode: Phase 1 Rule-Based Cleanup

Lite mode runs the lite engine for minimal-cost token reduction. It performs rule-based cleanups including whitespace collapsing, system prompt deduplication, tool result compression, and redundant text removal. It also replaces image URLs with compact references.

This mode auto-triggers by default when requests are small, providing quick token savings without invoking any summarization logic.

Standard Mode: Phase 2 Caveman Engine

Standard mode activates the caveman engine, which applies deterministic regex transformations to compress text. This phase uses a rich set of "caveman rules" for structural trimming, deduplication, and language-aware pattern matching.

Use this mode when you need stronger reduction than lite mode provides but want to avoid LLM-based summarization entirely.

Aggressive Mode: Phase 3 Summarization and Aging

Aggressive mode combines the caveman engine with the aggressive phase, introducing LLM-driven operations. It runs a summarizer over conversation history, compresses tool-result payloads (including file content, grep output, shell results, JSON, and error messages), and applies aging to older messages.

The aging mechanism progressively trims historical context through stages: full-summary → moderate → light → verbatim retention. This mode suits scenarios requiring larger token budgets where LLM summarization is acceptable.

Ultra Mode: Phase 4 Heuristic and SLM Compression

Ultra mode implements the most demanding token-budget scenarios using two possible tiers. By default, it runs the ultra heuristic token pruner, which scores individual tokens and retains a configurable fraction (commonly 50%).

Alternatively, configure ultraEngine: "slm" to activate a second-tier LLMLingua-2 compressor using an ONNX SLM model. If the model is unavailable, the system automatically falls back to the heuristic tier.

RTK Mode: Phase 5 Structured Tool-Output Filtering

RTK mode activates the rtk engine for fine-grained control over structured tool outputs. It filters output line-by-line, deduplicates entries, strips comments, groups similar lines, and renders specialized formats like Terraform plans or git diffs.

Unlike previous modes, RTK supports stacking with other engines (e.g., rtk → caveman) and offers granular configuration through enable/disable filter lists and raw-output retention settings.

Configuration Examples for Each Compression Mode

Enabling Aggressive Mode in Request Payloads

{
  "model": "gpt-4o",
  "messages": [{ "role": "user", "content": "…large prompt…" }],
  "compression": {
    "enabled": true,
    "defaultMode": "aggressive"
  }
}

This payload instructs the routing layer to execute the aggressive pipeline with summarization, tool compression, and aging as defined in open-sse/services/compression/aggressive.ts.

Activating Ultra Mode with SLM Tier

{
  "compression": {
    "enabled": true,
    "defaultMode": "ultra",
    "ultraEngine": "slm",
    "ultraSlmPrewarm": true,
    "ultra": { "compressionRate": 0.4 }
  }
}

Setting ultraEngine: "slm" requests the Tier-B LLMLingua-2 compressor. The ultraSlmPrewarm flag initializes the ONNX model on startup, and the system falls back to heuristic pruning if the SLM tier fails to load.

Fine-Grained RTK Configuration

{
  "compression": {
    "enabled": true,
    "defaultMode": "rtk",
    "rtkConfig": {
      "enabled": true,
      "intensity": "aggressive",
      "enabledFilters": ["remove-ansi", "strip-json-comments"],
      "disableGrouping": false,
      "rawOutputRetention": "always"
    }
  }
}

This configuration targets the rtk engine in open-sse/services/compression/engines/rtk/index.ts, enabling specific filters while preserving original tool output for debugging purposes.

Programmatic Configuration via Node Client

import { setCompressionSettings } from '@omniroute/client';

await setCompressionSettings({
  enabled: true,
  defaultMode: 'standard',
  cavemanConfig: { intensity: 'full', enabled: true }
});

The client API mirrors the JSON payload structure and updates the server-side CompressionConfig directly.

Key Source Files and Implementation Details

File Phase Responsibility
open-sse/services/compression/types.ts All Core type definitions, CompressionMode union, and configuration structures (CavemanConfig, AggressiveConfig, UltraConfig, RtkConfig)
open-sse/services/compression/lite.ts 1 lite engine implementation: cheap heuristics and whitespace cleanup
open-sse/services/compression/caveman.ts 2 caveman engine: regex-based text transforms for standard mode
open-sse/services/compression/aggressive.ts 3 Summarizer integration, tool-result compression, and aging logic
open-sse/services/compression/ultra.ts 4 Heuristic token pruner and SLM tier management with fallback handling
open-sse/services/compression/engines/rtk/index.ts 5 RTK engine: line-by-line tool-output filtering and engine stacking
open-sse/services/compression/strategySelector.ts All Runtime selection logic for determining which mode or combination to execute

Summary

  • Lite mode offers zero-cost whitespace and prompt deduplication for small requests.
  • Standard mode provides deterministic regex-based compression via the caveman engine.
  • Aggressive mode introduces LLM summarization, tool-result compression, and message aging for substantial token reduction.
  • Ultra mode delivers maximum compression through heuristic token pruning with optional LLMLingua-2 SLM inference.
  • RTK mode specializes in structured tool-output filtering and supports stacking with other engines for complex workflows.

Frequently Asked Questions

Which OmniRoute compression mode should I use for small API requests?

Lite mode is designed specifically for small requests where minimal latency is critical. It automatically triggers for lightweight payloads and performs only cheap rule-based operations like whitespace collapsing and system prompt deduplication without adding computational overhead.

Can I combine multiple OmniRoute compression modes in a single request?

Yes, certain modes support stacking, particularly RTK mode. According to the implementation in open-sse/services/compression/engines/rtk/index.ts, you can chain RTK with other engines (e.g., rtk → caveman) to apply fine-grained tool filtering followed by general text compression. The strategySelector.ts file handles the routing logic for these combinations.

What happens if the SLM model is unavailable when using ultra mode?

When ultraEngine: "slm" is configured but the ONNX model fails to load, the system implements a fallback mechanism that automatically switches to the heuristic token-pruning tier. This ensures compression continues uninterrupted, though potentially with less semantic preservation than the LLMLingua-2 model would provide.

How does RTK mode handle different types of tool output?

RTK mode applies specialized filters based on output type, including ANSI code removal, JSON comment stripping, and line grouping for similar entries. It can render domain-specific formats like Terraform plans or git diffs, and the rtkConfig allows you to enable specific filters (e.g., ["remove-ansi", "strip-json-comments"]) or retain raw output for debugging using the rawOutputRetention setting.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →