Files
OmniRoute/docs/compression/COMPRESSION_LANGUAGE_PACKS.md
diegosouzapw 52f29f2347 fix(docs): rewrite 270 broken internal markdown links after subfolder restructure
The FASE 3 /docs restructure moved files into 8 subfolders (architecture,
guides, reference, frameworks, routing, security, compression, ops) but left
several link categories with stale relative paths. The new check:doc-links
gate (FASE 8) surfaced these and produced this exhaustive fix sweep.

Categories repaired (counts before → after, total broken: 270 → 0):

  i18n-relative (241 → 0): docs in subfolders now reference translations
    under docs/i18n/<locale>/docs/<subfolder>/<FILE>.md (one extra "../"
    plus the docs/<subfolder>/ segment). Affects ARCHITECTURE, FEATURES,
    USER_GUIDE, TROUBLESHOOTING, UNINSTALL, VM_DEPLOYMENT_GUIDE,
    API_REFERENCE, and the I18N.md self-reference table.

  parent-relative (14 → 0): refs like ../CLAUDE.md, ../CONTRIBUTING.md,
    ../AGENTS.md, ../Tuto_Qdrant.md, ../open-sse/..., ../electron/...,
    ../src/... promoted from one to two parent hops (../ → ../../) to
    reach repo root from docs/<subfolder>/.

  screenshots (9 → 0): FEATURES.md PNG refs rewritten to ../screenshots/
    (assets live at docs/screenshots/ unchanged).

  missing-rfc (2 → 0): RFC-AUTO-ASSESSMENT.md was deleted earlier in the
    overhaul; replaced refs in EVALS.md with pointers to the live
    AUTO-COMBO.md scoring doc plus an in-prose mention of
    src/domain/assessment/.

  other (4 → 0): ENVIRONMENT.md → ../../.env.example,
    SETUP_GUIDE.md → ../../{open-sse/mcp-server,src/lib/a2a}/README.md,
    PROVIDER_REFERENCE.md → ../../src/shared/... and ../../open-sse/...,
    VM_DEPLOYMENT_GUIDE.md omnirouteCloud reference replaced with a
    pointer to in-repo TUNNELS_GUIDE.md (omnirouteCloud lives in a
    separate companion repo).

Validation:
  npm run check:doc-links → PASS (501 internal links, 0 broken)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:52:04 -03:00

3.9 KiB

title, version, lastUpdated
title version lastUpdated
Compression Language Packs 3.8.0 2026-05-13

Compression Language Packs

Caveman compression can load language-specific rule packs in addition to the built-in English rules. This keeps the core engine stable while allowing Portuguese, Spanish, German, French, Japanese, and future language packs to evolve independently.

Location

Language packs live under:

open-sse/services/compression/rules/<language>/

Current shipped packs (verified against rules/ directory contents):

Language Directory Rule categories present
English rules/en/ context, dedup, filler, structural, ultra
Spanish rules/es/ context, dedup, filler, structural, ultra
Portuguese (Brazil) rules/pt-BR/ context, filler, structural
German rules/de/ context, filler, structural
French rules/fr/ context, filler, structural
Japanese rules/ja/ context, filler, structural

Parity note: en and es packs have the full 5 categories; pt-BR, de, fr, ja ship 3 categories. The missing dedup and ultra categories silently fall back to the English built-ins. Contributions welcome to add dedup.json and ultra.json for the smaller packs.

The canonical category list and per-category schema live in open-sse/services/compression/rules/_schema.json (JSON Schema draft 2020-12).

Language Detection

languageDetector.ts uses lightweight heuristics to infer the language from prompt text. The configured default language is still respected, and detection can be disabled by config when exact control is required.

Detection output is used only to choose rule packs. It does not change provider routing, locale selection, or UI language.

Config Shape

Compression settings can include:

{
  "languageConfig": {
    "enabled": true,
    "defaultLanguage": "en",
    "autoDetect": true,
    "enabledPacks": ["en", "pt-BR", "es", "de", "fr", "ja"]
  },
  "cavemanConfig": {
    "language": "en",
    "autoDetectLanguage": true,
    "enabledLanguagePacks": ["en", "pt-BR", "es", "de", "fr", "ja"]
  }
}

languageConfig controls dashboard/preview defaults. cavemanConfig is the runtime engine config 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/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.

API

Available packs can be queried with:

curl http://localhost:20128/api/compression/language-packs

The preview endpoint accepts language config overrides:

curl -X POST http://localhost:20128/api/compression/preview \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "standard",
    "text": "Por favor, eu gostaria que voce basicamente resumisse isso.",
    "config": {
      "languageConfig": {
        "defaultLanguage": "pt-BR",
        "autoDetect": true
      }
    }
  }'

Operational Notes

  • English built-in rules remain the fallback when a language pack is missing.
  • Invalid built-in JSON packs fail validation so release assets do not silently degrade.
  • Rule packs are data-only and should not import code or run arbitrary logic.
  • The compression analytics layer records the selected mode and engine, not full prompt text.