OmniRoute Compression Engines: Lite, Standard, Aggressive, Ultra, RTK, and Stacked Explained

OmniRoute provides six distinct compression engines—Lite, Standard (Caveman), Aggressive, Ultra, RTK, and Stacked—that can be configured via updateCompressionSettings() in src/lib/db/compression.ts to reduce token usage through whitespace cleanup, rule-based filtering, summarization, token pruning, or chained pipelines.

OmniRoute ships with a sophisticated prompt-compression pipeline located in the open-sse workspace of the diegosouzapw/OmniRoute repository. These specialized engines allow developers to switch between lightweight formatting cleanup and advanced context pruning strategies on a per-request or global basis. Understanding how to configure each OmniRoute compression engine enables precise control over the trade-off between context retention and token economy.

Understanding the Six OmniRoute Compression Engines

The engine catalog is declared in ENGINE_CATALOG at open-sse/services/compression/engineCatalog.ts (lines 10-34), while the allowed mode values are defined in the CompressionMode enum at open-sse/services/compression/types.ts (lines 27-28). Each engine targets specific compression strategies, from simple formatting to AI-assisted token pruning.

Lite Engine

The Lite engine performs simple whitespace and format cleanup, such as collapsing repeated line breaks and normalizing indentation. It requires no additional per-engine configuration beyond enabling the mode itself, as implemented in open-sse/services/compression/lite.ts.

Standard (Caveman) Engine

The Standard engine (internally codenamed Caveman) applies rule-based prose compression using regex rules to delete filler text, deduplicate content, and preserve code blocks. Configuration is handled via the cavemanConfig object defined in open-sse/services/compression/types.ts (lines 54-61), which supports an intensity setting of "lite", "full", or "ultra", and an optional skipRules array. The default configuration (DEFAULT_CAVEMAN_CONFIG) sets enabled: false and intensity: "lite".

Aggressive Engine

The Aggressive engine operates in three phases: summarization, tool-result compression, and aging of old conversation turns. It is configured through the aggressive object (lines 98-104 in types.ts), which includes thresholds for different summary levels, toolStrategies for specific output types (file content, grep search, shell output, JSON, error messages), and flags like summarizerEnabled and maxTokensPerMessage.

Ultra Engine

The Ultra engine implements token-pruning heuristics (Tier-A) and optional SLM-based pruning (Tier-B), with the ability to pre-warm an ONNX model. Configuration uses the ultra object (lines 34-41 in types.ts), supporting parameters such as compressionRate (keep percentage), minScoreThreshold, modelPath, and ultraSlmPrewarm. By default, DEFAULT_ULTRA_CONFIG disables the engine and uses a 50% keep rate with the heuristic tier only.

RTK Engine

The RTK engine filters command output by removing noisy lines, deduplicating results, and stripping code comments. It is configured via rtkConfig (lines 79-93 in types.ts), accepting intensity levels of "minimal", "standard", or "aggressive", plus boolean flags for applyToToolResults, customFiltersEnabled, and enableRenderers, along with numeric thresholds like maxLinesPerResult and deduplicateThreshold.

Stacked Pipeline

The Stacked engine chains multiple single-mode engines into a custom pipeline using the stackedPipeline configuration. This accepts an array of CompressionPipelineStep objects (lines 32-38 in types.ts), allowing sequences such as RTK followed by Caveman. The default stacked configuration runs {engine:"rtk",intensity:"standard"} followed by {engine:"caveman",intensity:"full"}.

How to Configure OmniRoute Compression Engines

All compression settings persist in the SQLite database namespace handled by src/lib/db/compression.ts. Use the getCompressionSettings() and updateCompressionSettings() helpers (lines 25-34) to programmatically read and write configurations.

Enabling Lite Mode

To activate basic whitespace cleanup:

import { updateCompressionSettings } from "@omniroute/lib/db/compression";

await updateCompressionSettings({
  enabled: true,
  defaultMode: "lite",
});

Configuring Standard (Caveman) Mode

Enable with custom intensity and rule exclusions:

await updateCompressionSettings({
  cavemanConfig: {
    enabled: true,
    intensity: "full",
    skipRules: ["remove-redundant-whitespace"],
  },
});

Tuning Aggressive Compression

Configure summarization thresholds and tool strategies:

await updateCompressionSettings({
  aggressive: {
    thresholds: { fullSummary: 5, moderate: 3, light: 2, verbatim: 2 },
    toolStrategies: {
      fileContent: true,
      grepSearch: true,
      shellOutput: true,
      json: true,
      errorMessage: true,
    },
    summarizerEnabled: true,
    maxTokensPerMessage: 2048,
    minSavingsThreshold: 0.08,
  },
});

Setting Up Ultra Mode with SLM Support

Enable heuristic pruning and optionally load an ONNX model:

await updateCompressionSettings({
  ultra: {
    enabled: true,
    compressionRate: 0.4,
    minScoreThreshold: 0.25,
    modelPath: "/opt/llmlingua/model.onnx",
    ultraSlmPrewarm: true,
  },
});

Configuring RTK Filters

Apply aggressive filtering to tool results:

await updateCompressionSettings({
  rtkConfig: {
    enabled: true,
    intensity: "aggressive",
    applyToToolResults: true,
    maxLinesPerResult: 200,
    deduplicateThreshold: 5,
    customFiltersEnabled: true,
    enableRenderers: false,
  },
});

Building a Stacked Pipeline

Combine multiple engines in sequence:

await updateCompressionSettings({
  defaultMode: "stacked",
  stackedPipeline: [
    { engine: "rtk", intensity: "standard" },
    { engine: "caveman", intensity: "full" },
    { engine: "ultra", intensity: "ultra" },
  ],
});

Reading Current Configuration

Retrieve the full configuration object for debugging or UI display:

import { getCompressionSettings } from "@omniroute/lib/db/compression";

const cfg = await getCompressionSettings();
console.log("Current compression config:", JSON.stringify(cfg, null, 2));

The complete configuration shape is defined by the CompressionConfig type at open-sse/services/compression/types.ts (lines 46-78).

Summary

  • OmniRoute provides six compression engines—Lite, Standard (Caveman), Aggressive, Ultra, RTK, and Stacked—each optimized for different token reduction strategies in the open-sse workspace.
  • Engine selection and tuning are controlled via updateCompressionSettings() in src/lib/db/compression.ts, with type definitions in open-sse/services/compression/types.ts and the catalog defined in open-sse/services/compression/engineCatalog.ts.
  • Lite requires no configuration, while Standard, Aggressive, Ultra, and RTK offer granular intensity levels, thresholds, and filtering options defined in their respective config types.
  • Stacked pipelines allow chaining multiple engines sequentially using CompressionPipelineStep arrays to achieve compound compression effects.
  • All settings persist to SQLite and can be previewed via the HTTP endpoint at src/app/api/compression/preview/route.ts.

Frequently Asked Questions

What is the difference between Lite and Standard compression in OmniRoute?

Lite performs only basic whitespace and formatting cleanup, such as collapsing line breaks and normalizing indentation, with no additional configuration required. Standard (Caveman) applies rule-based prose compression using regex to remove filler words and deduplicate content while preserving code blocks, offering configurable intensity levels of "lite", "full", or "ultra" via the cavemanConfig object.

How do I enable the Ultra engine with SLM-based pruning?

Set enabled: true in the ultra configuration object and provide a valid modelPath to your ONNX model. Set ultraSlmPrewarm: true to initialize the model on first use, and adjust compressionRate to control the percentage of tokens retained (e.g., 0.4 keeps the top 40% of tokens according to the scoring heuristic).

Can I combine multiple compression engines in OmniRoute?

Yes, use the Stacked pipeline mode by setting defaultMode: "stacked" and defining a stackedPipeline array containing CompressionPipelineStep objects. Each step specifies an engine name and intensity, allowing you to chain engines such as RTK followed by Caveman or Ultra for progressive compression.

Where are compression settings stored in OmniRoute?

Compression settings persist in the SQLite database within the compression namespace, managed by src/lib/db/compression.ts. The helper functions getCompressionSettings() and updateCompressionSettings() provide the programmatic interface for reading and writing these values, while src/app/api/compression/preview/route.ts exposes an HTTP endpoint for debugging the effective configuration.

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 →