Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(compression): align seeded standard savings combo with stacked default

diegosouzapwd8baf4434dc0
diff --git a/README.md b/README.md
index c80fde019e..90af73193d 100644
--- a/README.md
+++ b/README.md
@@ -460,7 +460,7 @@ Every request passes through the compression pipeline **transparently** — no c
| **🪨 Standard (Caveman)** | ~30% | 30+ regex rules: filler removal, context condensation, structural compression, multi-turn dedup | Daily coding with Claude/Codex |
| **⚡ Aggressive** | ~50% | All standard + progressive message aging + tool result summarization + LLM-based compression | Long sessions with many tool calls |
| **🔥 Ultra** | ~75% | All aggressive + heuristic token pruning + stopword removal + score-based filtering | Maximum savings when tokens are scarce |
-| **🧰 RTK** | 20-70% | 39 command-aware filters, RTK-style JSON DSL, verify gate, trust-gated custom filters | Shell/test/build/git output in agents |
+| **🧰 RTK** | 20-70% | 49 command-aware filters, RTK-style JSON DSL, verify gate, trust-gated custom filters | Shell/test/build/git output in agents |
| **🔗 Stacked** | 30-80% | Ordered engine pipeline, usually RTK first then Caveman | Mixed prompts with tool logs + prose |
### Before & After (Standard/Caveman Mode)
@@ -518,7 +518,7 @@ Compression combos can also assign a named compression pipeline to routing combo
> 🪨 **Fun fact:** The standard/caveman mode is inspired by [Caveman](https://github.com/JuliusBrussee/caveman) — the viral project that proved "caveman speak" cuts 65% of tokens while keeping 100% technical accuracy. OmniRoute takes this further with a **7-option pipeline** that goes from gentle whitespace cleanup through RTK tool-output filters and stacked multi-engine compression.
-📖 **Full compression documentation:** [`docs/COMPRESSION_GUIDE.md`](docs/COMPRESSION_GUIDE.md) • [`docs/rtk-compression.md`](docs/rtk-compression.md) • [`docs/compression-engines.md`](docs/compression-engines.md) • [`docs/compression-rules-format.md`](docs/compression-rules-format.md) • [`docs/compression-language-packs.md`](docs/compression-language-packs.md)
+📖 **Full compression documentation:** [`docs/COMPRESSION_GUIDE.md`](docs/COMPRESSION_GUIDE.md) • [`docs/RTK_COMPRESSION.md`](docs/RTK_COMPRESSION.md) • [`docs/COMPRESSION_ENGINES.md`](docs/COMPRESSION_ENGINES.md) • [`docs/COMPRESSION_RULES_FORMAT.md`](docs/COMPRESSION_RULES_FORMAT.md) • [`docs/COMPRESSION_LANGUAGE_PACKS.md`](docs/COMPRESSION_LANGUAGE_PACKS.md)
---
@@ -1337,10 +1337,10 @@ See the [Proxy Guide](docs/PROXY_GUIDE.md) for setup instructions.
| ---------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [Architecture](docs/ARCHITECTURE.md) | System architecture, data flow, and internals |
| [Compression Guide](docs/COMPRESSION_GUIDE.md) | 7-option pipeline: off / lite / standard / aggressive / ultra / RTK / stacked |
-| [RTK Compression](docs/rtk-compression.md) | Command-output compression, filters, trust, verify, raw-output recovery |
-| [Compression Engines](docs/compression-engines.md) | Caveman, RTK, stacked pipelines, dashboard/API/MCP surfaces |
-| [Compression Rules Format](docs/compression-rules-format.md) | JSON rule-pack schemas for Caveman and RTK filters |
-| [Compression Language Packs](docs/compression-language-packs.md) | Language detection and Caveman rule-pack authoring |
+| [RTK Compression](docs/RTK_COMPRESSION.md) | Command-output compression, filters, trust, verify, raw-output recovery |
+| [Compression Engines](docs/COMPRESSION_ENGINES.md) | Caveman, RTK, stacked pipelines, dashboard/API/MCP surfaces |
+| [Compression Rules Format](docs/COMPRESSION_RULES_FORMAT.md) | JSON rule-pack schemas for Caveman and RTK filters |
+| [Compression Language Packs](docs/COMPRESSION_LANGUAGE_PACKS.md) | Language detection and Caveman rule-pack authoring |
| [Resilience Guide](docs/RESILIENCE_GUIDE.md) | Circuit breakers, cooldowns, queue, anti-thundering herd, TLS spoofing |
| [Auto-Combo Engine](docs/AUTO-COMBO.md) | 6-factor scoring, mode packs, self-healing |
| [Proxy Guide](docs/PROXY_GUIDE.md) | 3-level proxy system, 1proxy marketplace, registry CRUD |
@@ -1471,10 +1471,12 @@ gh release create v2.0.0 --title "v2.0.0" --generate-notes
Special thanks to **[9router](https://github.com/decolua/9router)** by **[decolua](https://github.com/decolua)** — the original project that inspired this fork. OmniRoute builds upon that incredible foundation with additional features, multi-modal APIs, and a full TypeScript rewrite.
-Special thanks to **[CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)** — the original Go implementation that inspired this JavaScript port.
+Special thanks to **[CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)** by **[router-for-me](https://github.com/router-for-me)** — the original Go implementation that inspired this JavaScript port.
Special thanks to **[Caveman](https://github.com/JuliusBrussee/caveman)** by **[JuliusBrussee](https://github.com/JuliusBrussee)** (⭐ 51K+) — the viral "why use many token when few token do trick" project whose caveman-speak compression philosophy inspired OmniRoute's standard compression mode and 30+ filler/condensation regex rules.
+Special thanks to **[RTK - Rust Token Killer](https://github.com/rtk-ai/rtk)** by **[RTK AI](https://github.com/rtk-ai)** — the high-performance command-output compression project whose terminal, build, test, git, and tool-output filtering model inspired OmniRoute's RTK engine, JSON filter DSL, raw-output recovery, and stacked RTK → Caveman compression pipeline.
+
---
## 📄 License
diff --git a/docs/compression-engines.md b/docs/COMPRESSION_ENGINES.md
similarity index 98%
rename from docs/compression-engines.md
rename to docs/COMPRESSION_ENGINES.md
index 12e18d60c6..da5c934cfb 100644
--- a/docs/compression-engines.md
+++ b/docs/COMPRESSION_ENGINES.md
@@ -46,7 +46,7 @@ RTK mode focuses on command and tool output:
- detects output classes such as `git status`, `git branch`, `git diff`, Vitest/Jest/Pytest,
Cargo/Go tests, TypeScript/Vite/Webpack builds, ESLint, npm audit/installs, Docker logs,
shell `find`/`grep`, stack traces, and generic logs
-- applies 39 JSON filters from `open-sse/services/compression/engines/rtk/filters/`
+- applies 49 JSON filters from `open-sse/services/compression/engines/rtk/filters/`
- supports the RTK-style declarative pipeline: ANSI stripping, replace, match-output short-circuit,
strip/keep lines, per-line truncation, head/tail/max-line truncation, and on-empty fallback
- supports trust-gated project filters in `.rtk/filters.json` and global filters in
@@ -59,7 +59,7 @@ RTK mode focuses on command and tool output:
The dashboard surface is `Dashboard -> Context & Cache -> RTK`.
Operational details for custom filters, trust, verify, and raw-output recovery live in
-[`rtk-compression.md`](rtk-compression.md).
+[`RTK_COMPRESSION.md`](RTK_COMPRESSION.md).
## Stacked Pipelines
diff --git a/docs/COMPRESSION_GUIDE.md b/docs/COMPRESSION_GUIDE.md
index f3fd118fa0..9cfe6c8a15 100644
--- a/docs/COMPRESSION_GUIDE.md
+++ b/docs/COMPRESSION_GUIDE.md
@@ -87,7 +87,7 @@ RTK mode is optimized for verbose tool outputs that appear in coding-agent sessi
TypeScript/Vite/Webpack builds, ESLint/Biome/Prettier, npm audit/installs, Docker logs, infra
output, and generic shell output
- Applies JSON filter packs from `open-sse/services/compression/engines/rtk/filters/`
-- Ships 39 built-in filters with inline verify samples
+- Ships 49 built-in filters with inline verify samples
- Removes ANSI control sequences, progress bars, repeated lines, and non-actionable noise
- Preserves failures, errors, warnings, changed files, summaries, and the tail of long output
- Supports trust-gated project filters, global filters, and optional redacted raw-output recovery
@@ -231,6 +231,8 @@ Every compressed request includes stats in the server logs:
Standard mode compression rules are inspired by **[Caveman](https://github.com/JuliusBrussee/caveman)** by **[JuliusBrussee](https://github.com/JuliusBrussee)** (⭐ 51K+) — the viral "why use many token when few token do trick" project.
+RTK mode is inspired by **[RTK - Rust Token Killer](https://github.com/rtk-ai/rtk)** by **[RTK AI](https://github.com/rtk-ai)** — the high-performance command-output compression project for terminal, build, test, git, and tool-output filtering.
+
---
## See Also
@@ -238,7 +240,7 @@ Standard mode compression rules are inspired by **[Caveman](https://github.com/J
- [Environment Config](ENVIRONMENT.md) — Compression environment variables
- [Architecture Guide](ARCHITECTURE.md) — Compression pipeline internals
- [User Guide](USER_GUIDE.md) — Getting started with compression
-- [RTK Compression](rtk-compression.md) — RTK filters, trust model, verify gate, raw-output recovery
-- [Compression Engines](compression-engines.md) — Caveman, RTK, stacked, APIs, MCP, dashboard
-- [Compression Rules Format](compression-rules-format.md) — JSON rule-pack format
-- [Compression Language Packs](compression-language-packs.md) — Language-specific Caveman rules
+- [RTK Compression](RTK_COMPRESSION.md) — RTK filters, trust model, verify gate, raw-output recovery
+- [Compression Engines](COMPRESSION_ENGINES.md) — Caveman, RTK, stacked, APIs, MCP, dashboard
+- [Compression Rules Format](COMPRESSION_RULES_FORMAT.md) — JSON rule-pack format
+- [Compression Language Packs](COMPRESSION_LANGUAGE_PACKS.md) — Language-specific Caveman rules
diff --git a/docs/compression-language-packs.md b/docs/COMPRESSION_LANGUAGE_PACKS.md
similarity index 97%
rename from docs/compression-language-packs.md
rename to docs/COMPRESSION_LANGUAGE_PACKS.md
index f797865697..805a7db1fc 100644
--- a/docs/compression-language-packs.md
+++ b/docs/COMPRESSION_LANGUAGE_PACKS.md
@@ -58,7 +58,7 @@ used when Caveman compresses message text.
## Adding a Language Pack
1. Create `open-sse/services/compression/rules/<language>/<pack>.json`.
-2. Use the Caveman rule format from `docs/compression-rules-format.md`.
+2. Use the Caveman rule format from `docs/COMPRESSION_RULES_FORMAT.md`.
3. Keep replacements conservative and avoid changing code, identifiers, URLs, or JSON.
4. Add or update tests for language selection and replacement behavior.
5. Expose new dashboard/i18n labels if the language appears in UI selectors.
diff --git a/docs/compression-rules-format.md b/docs/COMPRESSION_RULES_FORMAT.md
similarity index 100%
rename from docs/compression-rules-format.md
rename to docs/COMPRESSION_RULES_FORMAT.md
diff --git a/docs/FEATURES.md b/docs/FEATURES.md
index ff2ec2e3c8..ff86c872f1 100644
--- a/docs/FEATURES.md
+++ b/docs/FEATURES.md
@@ -1,6 +1,6 @@
# OmniRoute — Dashboard Features Gallery
-🌐 **Languages:** 🇺🇸 [English](FEATURES.md) | 🇧🇷 [Português (Brasil)](i18n/pt-BR/FEATURES.md) | 🇪🇸 [Español](i18n/es/FEATURES.md) | 🇫🇷 [Français](i18n/fr/FEATURES.md) | 🇮🇹 [Italiano](i18n/it/FEATURES.md) | 🇷🇺 [Русский](i18n/ru/FEATURES.md) | 🇨🇳 [中文 (简体)](i18n/zh-CN/FEATURES.md) | 🇩🇪 [Deutsch](i18n/de/FEATURES.md) | 🇮🇳 [हिन्दी](i18n/in/FEATURES.md) | 🇹🇭 [ไทย](i18n/th/FEATURES.md) | 🇺🇦 [Українська](i18n/uk-UA/FEATURES.md) | 🇸🇦 [العربية](i18n/ar/FEATURES.md) | 🇯🇵 [日本語](i18n/ja/FEATURES.md) | 🇻🇳 [Tiếng Việt](i18n/vi/FEATURES.md) | 🇧🇬 [Български](i18n/bg/FEATURES.md) | 🇩🇰 [Dansk](i18n/da/FEATURES.md) | 🇫🇮 [Suomi](i18n/fi/FEATURES.md) | 🇮🇱 [עברית](i18n/he/FEATURES.md) | 🇭🇺 [Magyar](i18n/hu/FEATURES.md) | 🇮🇩 [Bahasa Indonesia](i18n/id/FEATURES.md) | 🇰🇷 [한국어](i18n/ko/FEATURES.md) | 🇲🇾 [Bahasa Melayu](i18n/ms/FEATURES.md) | 🇳🇱 [Nederlands](i18n/nl/FEATURES.md) | 🇳🇴 [Norsk](i18n/no/FEATURES.md) | 🇵🇹 [Português (Portugal)](i18n/pt/FEATURES.md) | 🇷🇴 [Română](i18n/ro/FEATURES.md) | 🇵🇱 [Polski](i18n/pl/FEATURES.md) | 🇸🇰 [Slovenčina](i18n/sk/FEATURES.md) | 🇸🇪 [Svenska](i18n/sv/FEATURES.md) | 🇵🇭 [Filipino](i18n/phi/FEATURES.md) | 🇨🇿 [Čeština](i18n/cs/FEATURES.md)
+🌐 **Main README translations:** 🇺🇸 [English](../README.md) | 🇧🇷 [Português (Brasil)](i18n/pt-BR/README.md) | 🇪🇸 [Español](i18n/es/README.md) | 🇫🇷 [Français](i18n/fr/README.md) | 🇮🇹 [Italiano](i18n/it/README.md) | 🇷🇺 [Русский](i18n/ru/README.md) | 🇨🇳 [中文 (简体)](i18n/zh-CN/README.md) | 🇩🇪 [Deutsch](i18n/de/README.md) | 🇮🇳 [हिन्दी](i18n/in/README.md) | 🇹🇭 [ไทย](i18n/th/README.md) | 🇺🇦 [Українська](i18n/uk-UA/README.md) | 🇸🇦 [العربية](i18n/ar/README.md) | 🇯🇵 [日本語](i18n/ja/README.md) | 🇻🇳 [Tiếng Việt](i18n/vi/README.md) | 🇧🇬 [Български](i18n/bg/README.md) | 🇩🇰 [Dansk](i18n/da/README.md) | 🇫🇮 [Suomi](i18n/fi/README.md) | 🇮🇱 [עברית](i18n/he/README.md) | 🇭🇺 [Magyar](i18n/hu/README.md) | 🇮🇩 [Bahasa Indonesia](i18n/id/README.md) | 🇰🇷 [한국어](i18n/ko/README.md) | 🇲🇾 [Bahasa Melayu](i18n/ms/README.md) | 🇳🇱 [Nederlands](i18n/nl/README.md) | 🇳🇴 [Norsk](i18n/no/README.md) | 🇵🇹 [Português (Portugal)](i18n/pt/README.md) | 🇷🇴 [Română](i18n/ro/README.md) | 🇵🇱 [Polski](i18n/pl/README.md) | 🇸🇰 [Slovenčina](i18n/sk/README.md) | 🇸🇪 [Svenska](i18n/sv/README.md) | 🇵🇭 [Filipino](i18n/phi/README.md) | 🇨🇿 [Čeština](i18n/cs/README.md)
Visual guide to every section of the OmniRoute dashboard.
@@ -109,7 +109,7 @@ Configurable via combo-level or global settings:
- **Max Messages For Summary** — How much recent history to condense
- **Summary Model** — Optional override model for generating the handoff summary
-Currently supports Codex account rotation. See [Context Relay documentation](features/context-relay.md).
+Currently supports Codex account rotation. See [Context Relay documentation](ARCHITECTURE.md).
---
@@ -122,8 +122,8 @@ Context & Cache now exposes dedicated pages for Caveman, RTK, and Compression Co
- **Compression Combos** — named pipelines such as `rtk -> caveman` assigned to routing combos
- **Raw-output recovery** — optional redacted RTK raw-output pointers for debugging compressed failures
-See [Compression Guide](COMPRESSION_GUIDE.md), [RTK Compression](rtk-compression.md), and
-[Compression Engines](compression-engines.md).
+See [Compression Guide](COMPRESSION_GUIDE.md), [RTK Compression](RTK_COMPRESSION.md), and
+[Compression Engines](COMPRESSION_ENGINES.md).
---
diff --git a/docs/MCP-SERVER.md b/docs/MCP-SERVER.md
index 54039690eb..4312fb0f12 100644
--- a/docs/MCP-SERVER.md
+++ b/docs/MCP-SERVER.md
@@ -19,7 +19,8 @@ omniroute --dev # MCP auto-starts on /mcp endpoint
## IDE Configuration
-See [IDE Configs](integrations/ide-configs.md) for Antigravity, Cursor, Copilot, and Claude Desktop setup.
+See [MCP Client Configuration](SETUP_GUIDE.md#mcp-client-configuration) for Claude Desktop,
+Cursor, Cline, and compatible MCP client setup.
---
@@ -71,7 +72,7 @@ See [IDE Configs](integrations/ide-configs.md) for Antigravity, Cursor, Copilot,
descriptions (`tools`, `prompts`, `resources`, and `resourceTemplates`); they are not provider usage
receipts and are marked with `source: "mcp_metadata_estimate"`.
-See [Compression Engines](compression-engines.md) and [RTK Compression](rtk-compression.md) for
+See [Compression Engines](COMPRESSION_ENGINES.md) and [RTK Compression](RTK_COMPRESSION.md) for
the runtime compression model behind these tools.
## Other Tool Groups
diff --git a/docs/rtk-compression.md b/docs/RTK_COMPRESSION.md
similarity index 99%
rename from docs/rtk-compression.md
rename to docs/RTK_COMPRESSION.md
index 20feebef65..9f24139df3 100644
--- a/docs/rtk-compression.md
+++ b/docs/RTK_COMPRESSION.md
@@ -59,7 +59,7 @@ skipped and reported by `/api/context/rtk/filters` diagnostics. Invalid built-in
## Filter DSL
-Filters use the JSON schema described in [Compression Rules Format](compression-rules-format.md).
+Filters use the JSON schema described in [Compression Rules Format](COMPRESSION_RULES_FORMAT.md).
The runtime applies these stages in order:
```txt
diff --git a/src/lib/db/compressionCombos.ts b/src/lib/db/compressionCombos.ts
index 646f5e3415..940cb3a908 100644
--- a/src/lib/db/compressionCombos.ts
+++ b/src/lib/db/compressionCombos.ts
@@ -1,7 +1,8 @@
import { v4 as uuidv4 } from "uuid";
+import type { CompressionPipelineStep } from "@omniroute/open-sse/services/compression/types.ts";
+
import { backupDbFile } from "./backup";
import { getDbInstance, rowToCamel } from "./core";
-import type { CompressionPipelineStep } from "@omniroute/open-sse/services/compression/types.ts";
export interface CompressionCombo {
id: string;
@@ -25,6 +26,18 @@ export interface CompressionComboAssignment {
type JsonRecord = Record<string, unknown>;
+const DEFAULT_COMPRESSION_COMBO_ID = "default-caveman";
+const DEFAULT_COMPRESSION_COMBO_NAME = "Standard Savings";
+const DEFAULT_COMPRESSION_COMBO_DESCRIPTION = "Default RTK + Caveman compression pipeline";
+const LEGACY_DEFAULT_COMPRESSION_COMBO_DESCRIPTION = "Default Caveman compression pipeline";
+
+function defaultCompressionComboPipeline(): CompressionPipelineStep[] {
+ return [
+ { engine: "rtk", intensity: "standard" },
+ { engine: "caveman", intensity: "full" },
+ ];
+}
+
function toRecord(value: unknown): JsonRecord {
return value && typeof value === "object" && !Array.isArray(value) ? (value as JsonRecord) : {};
}
@@ -57,6 +70,44 @@ function normalizeLanguagePacks(value: unknown): string[] {
return [...new Set(packs.length > 0 ? packs.map((pack) => pack.trim()) : ["en"])];
}
+function isLegacySeededDefaultPipeline(pipeline: CompressionPipelineStep[]): boolean {
+ if (pipeline.length !== 1) return false;
+ const [step] = pipeline;
+ return step.engine === "caveman" && (step.intensity === undefined || step.intensity === "full");
+}
+
+function upgradeLegacySeededDefaultCompressionCombo(): void {
+ const db = getDbInstance();
+ const row = db
+ .prepare("SELECT name, description, pipeline FROM compression_combos WHERE id = ?")
+ .get(DEFAULT_COMPRESSION_COMBO_ID) as
+ | { name?: string; description?: string; pipeline?: string }
+ | undefined;
+
+ if (!row) return;
+
+ const description = String(row.description ?? "");
+ const isSeededMetadata =
+ String(row.name ?? "") === DEFAULT_COMPRESSION_COMBO_NAME &&
+ (description === LEGACY_DEFAULT_COMPRESSION_COMBO_DESCRIPTION ||
+ description === DEFAULT_COMPRESSION_COMBO_DESCRIPTION);
+
+ if (!isSeededMetadata || !isLegacySeededDefaultPipeline(normalizePipeline(row.pipeline))) return;
+
+ db.prepare(
+ `
+ UPDATE compression_combos
+ SET description = ?, pipeline = ?, updated_at = ?
+ WHERE id = ?
+ `
+ ).run(
+ DEFAULT_COMPRESSION_COMBO_DESCRIPTION,
+ JSON.stringify(defaultCompressionComboPipeline()),
+ new Date().toISOString(),
+ DEFAULT_COMPRESSION_COMBO_ID
+ );
+}
+
function ensureCompressionComboTables(): void {
const db = getDbInstance();
db.exec(`
@@ -96,15 +147,16 @@ function ensureCompressionComboTables(): void {
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
`
).run(
- "default-caveman",
- "Standard Savings",
- "Default Caveman compression pipeline",
- JSON.stringify([{ engine: "caveman", intensity: "full" }]),
+ DEFAULT_COMPRESSION_COMBO_ID,
+ DEFAULT_COMPRESSION_COMBO_NAME,
+ DEFAULT_COMPRESSION_COMBO_DESCRIPTION,
+ JSON.stringify(defaultCompressionComboPipeline()),
JSON.stringify(["en"]),
0,
"full",
1
);
+ upgradeLegacySeededDefaultCompressionCombo();
}
function rowToCompressionCombo(row: unknown): CompressionCombo | null {
@@ -146,7 +198,7 @@ function buildComboPayload(data: Partial<CompressionCombo>, existing?: Compressi
? data.pipeline
: existing?.pipeline && existing.pipeline.length > 0
? existing.pipeline
- : [{ engine: "caveman" as const, intensity: "full" as const }],
+ : defaultCompressionComboPipeline(),
languagePacks:
data.languagePacks && data.languagePacks.length > 0
? data.languagePacks
diff --git a/src/lib/db/migrations/042_compression_combos.sql b/src/lib/db/migrations/042_compression_combos.sql
index a8abca0d84..1358124c0b 100644
--- a/src/lib/db/migrations/042_compression_combos.sql
+++ b/src/lib/db/migrations/042_compression_combos.sql
@@ -34,11 +34,10 @@ INSERT OR IGNORE INTO compression_combos (
VALUES (
'default-caveman',
'Standard Savings',
- 'Default Caveman compression pipeline',
- '[{"engine":"caveman","intensity":"full"}]',
+ 'Default RTK + Caveman compression pipeline',
+ '[{"engine":"rtk","intensity":"standard"},{"engine":"caveman","intensity":"full"}]',
'["en"]',
0,
'full',
1
);
-
diff --git a/src/lib/db/migrations/043_default_compression_combo_pipeline.sql b/src/lib/db/migrations/043_default_compression_combo_pipeline.sql
new file mode 100644
index 0000000000..f0c60cda98
--- /dev/null
+++ b/src/lib/db/migrations/043_default_compression_combo_pipeline.sql
@@ -0,0 +1,12 @@
+-- 043: Upgrade the seeded default compression combo from Caveman-only to RTK + Caveman.
+
+UPDATE compression_combos
+SET
+ description = 'Default RTK + Caveman compression pipeline',
+ pipeline = '[{"engine":"rtk","intensity":"standard"},{"engine":"caveman","intensity":"full"}]',
+ updated_at = datetime('now')
+WHERE
+ id = 'default-caveman'
+ AND name = 'Standard Savings'
+ AND description = 'Default Caveman compression pipeline'
+ AND pipeline = '[{"engine":"caveman","intensity":"full"}]';
diff --git a/tests/integration/chatcore-compression-integration.test.ts b/tests/integration/chatcore-compression-integration.test.ts
index d1a7919260..d917a46979 100644
--- a/tests/integration/chatcore-compression-integration.test.ts
+++ b/tests/integration/chatcore-compression-integration.test.ts
@@ -110,6 +110,12 @@ test("chatCore integration: compressContext called proactively when context exce
},
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
@@ -207,6 +213,11 @@ test("chatCore integration: disabled prompt compression leaves combo override re
connectionId: connection.id,
isCombo: true,
comboName: "disabled-compression-combo",
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
});
assert.ok(result.success, "Request should succeed");
@@ -287,6 +298,12 @@ test("chatCore integration: compressContext NOT called when context is below 85%
log: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
@@ -368,6 +385,12 @@ test("chatCore integration: compression preserves message structure", async () =
},
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
@@ -436,6 +459,12 @@ test("chatCore integration: compression handles tool messages", async () => {
log: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
@@ -527,6 +556,11 @@ test("chatCore integration: combo requests run proactive compression before Kiro
connectionId,
isCombo: true,
comboName: "test-kiro-compression-combo",
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
});
// Kiro response translation in this integration harness may fail depending on upstream
@@ -606,7 +640,10 @@ test("chatCore integration: assigned compression combo applies language packs an
outputMode: true,
outputModeIntensity: "lite",
});
- assert.equal(compressionCombosDb.assignRoutingCombo(compressionCombo.id, routingCombo.id), true);
+ assert.equal(
+ compressionCombosDb.assignRoutingCombo(compressionCombo.id, routingCombo.id as string),
+ true
+ );
let capturedBody: any = null;
globalThis.fetch = async (_url: string | URL | Request, init?: RequestInit) => {
@@ -639,6 +676,11 @@ test("chatCore integration: assigned compression combo applies language packs an
connectionId: connection.id,
isCombo: true,
comboName: "assigned-compression-combo",
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
});
assert.ok(result.success, "Request should succeed");
@@ -728,6 +770,12 @@ test("chatCore integration: default stacked compression combo applies for unassi
log: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId: connection.id,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
@@ -753,7 +801,7 @@ test("chatCore integration: default stacked compression combo applies for unassi
}
});
-test("chatCore integration: seeded Caveman default does not replace builtin stacked pipeline", async () => {
+test("chatCore integration: seeded default combo runs RTK before Caveman", async () => {
const provider = "openai";
const model = "gpt-4";
@@ -814,6 +862,12 @@ test("chatCore integration: seeded Caveman default does not replace builtin stac
log: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId: connection.id,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
@@ -825,7 +879,8 @@ test("chatCore integration: seeded Caveman default does not replace builtin stac
for (
let attempt = 0;
attempt < 100 &&
- (summary.totalRequests === 0 || summary.realUsage.requestsWithReceipts === 0);
+ (summary.byCompressionCombo["default-caveman"]?.count !== 1 ||
+ summary.realUsage.requestsWithReceipts === 0);
attempt += 1
) {
await new Promise((resolve) => setTimeout(resolve, 20));
@@ -833,7 +888,7 @@ test("chatCore integration: seeded Caveman default does not replace builtin stac
}
assert.equal(summary.totalRequests, 1);
- assert.equal(summary.byCompressionCombo["default-caveman"], undefined);
+ assert.equal(summary.byCompressionCombo["default-caveman"].count, 1);
} finally {
globalThis.fetch = originalFetch;
}
@@ -886,6 +941,12 @@ test("chatCore integration: modular compression records analytics row best-effor
log: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId: connection.id,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
@@ -962,6 +1023,12 @@ test("chatCore integration: caveman output mode records analytics and receipts w
log: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
clientRawRequest: { endpoint: "/v1/chat/completions", headers: new Map() },
connectionId: connection.id,
+ onCredentialsRefreshed: () => {},
+ onRequestSuccess: () => {},
+ onStreamFailure: () => {},
+ onDisconnect: () => {},
+ userAgent: "test-agent",
+ comboName: null,
});
assert.ok(result.success, "Request should succeed");
diff --git a/tests/unit/compression/compression-combos-db.test.ts b/tests/unit/compression/compression-combos-db.test.ts
index 61ac58f263..0b58800334 100644
--- a/tests/unit/compression/compression-combos-db.test.ts
+++ b/tests/unit/compression/compression-combos-db.test.ts
@@ -33,7 +33,59 @@ test.after(() => {
test("creates default compression combo automatically", () => {
const combos = combosDb.listCompressionCombos();
- assert.ok(combos.some((combo) => combo.id === "default-caveman" && combo.isDefault));
+ const combo = combos.find((item) => item.id === "default-caveman");
+
+ assert.equal(combo?.isDefault, true);
+ assert.equal(combo?.description, "Default RTK + Caveman compression pipeline");
+ assert.deepEqual(combo?.pipeline, [
+ { engine: "rtk", intensity: "standard" },
+ { engine: "caveman", intensity: "full" },
+ ]);
+});
+
+test("upgrades the legacy seeded default compression combo pipeline", () => {
+ const db = core.getDbInstance();
+ db.prepare(
+ `
+ UPDATE compression_combos
+ SET description = ?, pipeline = ?
+ WHERE id = ?
+ `
+ ).run(
+ "Default Caveman compression pipeline",
+ JSON.stringify([{ engine: "caveman", intensity: "full" }]),
+ "default-caveman"
+ );
+
+ const combo = combosDb.getDefaultCompressionCombo();
+ assert.equal(combo?.id, "default-caveman");
+ assert.equal(combo?.description, "Default RTK + Caveman compression pipeline");
+ assert.deepEqual(combo?.pipeline, [
+ { engine: "rtk", intensity: "standard" },
+ { engine: "caveman", intensity: "full" },
+ ]);
+});
+
+test("does not overwrite a customized default compression combo", () => {
+ const db = core.getDbInstance();
+ db.prepare(
+ `
+ UPDATE compression_combos
+ SET name = ?, description = ?, pipeline = ?
+ WHERE id = ?
+ `
+ ).run(
+ "Custom Default",
+ "User changed",
+ JSON.stringify([{ engine: "caveman", intensity: "lite" }]),
+ "default-caveman"
+ );
+
+ const combo = combosDb.getDefaultCompressionCombo();
+ assert.equal(combo?.id, "default-caveman");
+ assert.equal(combo?.name, "Custom Default");
+ assert.equal(combo?.description, "User changed");
+ assert.deepEqual(combo?.pipeline, [{ engine: "caveman", intensity: "lite" }]);
});
test("creates, updates and protects default compression combos", () => {