OmniRoute Compression Modes: Differences Between Lite, Standard, Aggressive, Ultra, and RTK
OmniRoute's compression pipeline uses five sequential phases—lite, standard, aggressive, ultra, and RTK—where each phase activates progressively heavier engines ranging from simple regex cleanup to heuristic token pruning and structured tool-output filtering.
If you are evaluating the differences between lite, standard, aggressive, and ultra compression modes in the diegosouzapw/OmniRoute project, this guide breaks down how each phase behaves according to the source code. The routing layer implements a configurable, multi-phase stack defined in open-sse/services/compression/types.ts, where the CompressionMode union and configuration structures such as CavemanConfig, AggressiveConfig, UltraConfig, and RtkConfig enumerate the available knobs.
How the Five Compression Phases Differ
The following sections describe the engine, core behavior, and execution trigger for each mode as implemented in the OmniRoute repository.
Lite Mode (Phase 1)
The lite engine in open-sse/services/compression/lite.ts performs very cheap, rule-based clean-ups. It collapses whitespace, deduplicates system prompts, compresses tool results, drops redundant text, and replaces image URLs. This mode auto-triggers by default on small requests when you need quick token savings without any summarization.
Standard Mode (Phase 2)
The standard mode runs the caveman engine from open-sse/services/compression/caveman.ts. It applies deterministic, rule-based text transformations using a rich set of regex rules for deduplication, structural trimming, and language-aware patterns. Choose this phase when you want stronger reduction than lite without invoking an LLM summarizer.
Aggressive Mode (Phase 3)
The aggressive phase combines the caveman engine with the aggressive engine, implemented in open-sse/services/compression/aggressive.ts. It runs a summarizer over the conversation, compresses tool-result payloads—including file content, grep output, shell output, JSON, and error messages—and applies aging. Aging progressively trims older messages from full-summary down to moderate, light, and finally verbatim retention. Use this mode when you need a larger token budget and can tolerate LLM-driven summarization.
Ultra Mode (Phase 4)
The ultra engine, found in open-sse/services/compression/ultra.ts, executes heuristic token-pruning based on per-token scores, keeping a configurable fraction such as 50%. If you configure ultraEngine: "slm", it loads an ONNX SLM model to run a second-tier LLMLingua-2 compressor; otherwise, it falls back to the heuristic pruner. This is the most demanding token-budget scenario in the OmniRoute compression pipeline.
RTK Mode (Phase 5)
The RTK engine in open-sse/services/compression/engines/rtk/index.ts filters tool output line-by-line, deduplicates entries, strips comments, groups similar lines, and renders specialized formats like Terraform plans or git diffs. It supports custom filter enable/disable lists, raw-output retention settings, and can be stacked with other engines—for example, chaining rtk into caveman. It is designed for heavy, structured tool-output streams that require fine-grained control.
Configuring Compression Modes in OmniRoute Requests
You can activate any mode by setting defaultMode in the request payload. The following examples show the exact JSON shapes accepted by the routing layer.
Enable Aggressive Mode
{
"model": "gpt-4o",
"messages": [{ "role": "user", "content": "...large prompt..." }],
"compression": {
"enabled": true,
"defaultMode": "aggressive"
}
}
This tells the routing layer to run the aggressive pipeline, which includes the summarizer, tool compression, and aging logic.
Switch to Ultra with the SLM Tier
{
"compression": {
"enabled": true,
"defaultMode": "ultra",
"ultraEngine": "slm",
"ultraSlmPrewarm": true,
"ultra": { "compressionRate": 0.4 }
}
}
Setting ultraEngine: "slm" selects the optional LLMLingua-2 model. If the ONNX model cannot be loaded, the system falls back to the heuristic tier.
Use RTK with Custom Filters
{
"compression": {
"enabled": true,
"defaultMode": "rtk",
"rtkConfig": {
"enabled": true,
"intensity": "aggressive",
"enabledFilters": ["remove-ansi", "strip-json-comments"],
"disableGrouping": false,
"rawOutputRetention": "always"
}
}
}
The rtkConfig toggles fine-grained filters, while rawOutputRetention: "always" preserves the original tool output for debugging.
Programmatic Toggling 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 and directly updates the server-side CompressionConfig.
Core Source Files Behind the Compression Stack
These files define the architectural progression from low-cost lite cleanup to fine-grained RTK filtering:
open-sse/services/compression/types.ts— Core type definitions,CompressionModeunion, and default configsopen-sse/services/compression/lite.ts— Phase 1 lite implementationopen-sse/services/compression/caveman.ts— Phase 2 standard engineopen-sse/services/compression/aggressive.ts— Phase 3 aggressive summarizer and aging logicopen-sse/services/compression/ultra.ts— Phase 4 heuristic token pruner and optional SLM tieropen-sse/services/compression/engines/rtk/index.ts— Phase 5 RTK rule-based tool-output filteropen-sse/services/compression/strategySelector.ts— Runtime mode selection logic
Summary
- Lite provides cheap, rule-based whitespace and prompt cleanup for small requests.
- Standard runs deterministic regex transforms via the
cavemanengine without LLM summarization. - Aggressive adds a summarizer, tool-result compression, and progressive message aging for larger token savings.
- Ultra applies heuristic token pruning and optionally loads an ONNX SLM model for maximum compression.
- RTK targets structured tool output with line-by-line filtering and supports engine stacking for advanced control.
Frequently Asked Questions
What is the default compression mode in OmniRoute?
If no mode is specified, the system relies on the lite phase as its default auto-trigger for small requests, as implemented in open-sse/services/compression/lite.ts. This provides immediate, deterministic token savings without LLM overhead.
Can I stack multiple OmniRoute compression engines?
Yes. The RTK engine explicitly supports stacking with other modes, such as chaining rtk into caveman, as seen in open-sse/services/compression/engines/rtk/index.ts. Additionally, the strategySelector.ts orchestrator can combine or sequence engines depending on configuration.
Does ultra mode always require an ONNX SLM model?
No. The ultra engine in open-sse/services/compression/ultra.ts first performs heuristic token pruning. It only attempts to load the LLMLingua-2 ONNX SLM compressor when ultraEngine is set to "slm", and it falls back to the heuristic tier automatically if the model is unavailable.
Which OmniRoute compression mode should I use for tool output?
Use RTK for heavy, structured tool-output streams such as Terraform plans, git diffs, or JSON logs, because it filters line-by-line and offers fine-grained retention controls. For general conversation context reduction, aggressive or ultra are more appropriate.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →