Compress your prompts before they hit the LLM. Remove polite filler, redundant phrases, and verbosity automatically β saving tokens and reducing latency.
Troglodyte sits between you and the LLM, compressing prompts in real-time:
| Removes | Examples |
|---|---|
| Polite fillers | "please", "thank you", "I would appreciate" |
| Redundant phrases | "in order to" β "to", "due to the fact that" β "because" |
| Excessive verbosity | "I was wondering if you could" β "" |
| Articles & pronouns | (Balanced/Aggressive modes) β Pronouns preserved in Balanced mode β |
Issue: Short technical prompts like const config = { ... } failed to trigger Smart Mode because the threshold was too high (> 0.25). A prompt with 8 tokens and 1 keyword scored only 0.125, bypassing Smart Mode entirely.
Fix: Lowered threshold from 0.25 to 0.15:
Impact: Short code snippets now correctly trigger Smart Mode, reducing synonym replacement ratio from 100% β 30% as intended.
Issue: phrases.ts contained ~75 build-log/MSVC/compiler output phrases (e.g., "Build started", "Fehler") that had zero relevance to prompt compression but inflated regex alternation size.
Fix: Removed all build-log entries from src/dictionaries/phrases.ts.
Impact: Regex alternation reduced by ~35% (~125 β ~85 entries). Faster matching, less memory.
The word tokenization regex character class now properly escapes the hyphen: [^\w\u00C0-\u024F\u1E00-\u1EFF\-] β preventing unexpected behavior with certain Unicode characters.
Test Group 2 now includes real assertions for English/German output validity and explicit language overrides (previously a no-op).
Deeply nested JSON/XML structures (>10 levels) are now safely aborted to prevent potential ReDoS attacks.
Sliding window rate limiter added: 10 requests/second per session. Exceeded limits return original text without compression.
Issue: All pronouns (he, she, it, er, ihn, etc.) were stripped in balanced mode, breaking reference tracking across sentences.
Fix: Added effectiveBlacklist that filters out core pronouns only when level === 'aggressive'. In balanced mode, essential pronouns are preserved:
Impact: Multi-sentence context tracking now works correctly. LLMs receive prompts where "John said he would fix it" isn't corrupted to "John said would fix."
Issue: The phrase "step by step": "steps" created broken grammar ("debug this steps").
Fix: Changed replacement to preserve semantic intent without breaking syntax:
!,? β Clean Ending)Issue: Orphaned punctuation like ?,! or !,? survived filtering, creating visual noise.
Fix: Robust cleanup that strips non-alphanumeric trailing symbols and preserves question/exclamation intent:
Issue: baseUrl and custom path aliases (@dictionaries/*, @engine) triggered TS5101 deprecation warnings in TypeScript 6.x.
Fix: Reverted to relative imports (./troglodyte, ../dictionaries/phrases). No functional change β cleaner, future-proof configuration.
Ensures LM Studio's bundled SDK takes precedence over local node_modules.
Recent updates introduce significant performance improvements:
Recent updates introduce significant performance improvements:
incremental and isolatedModules in tsconfig.json for faster development builds.Over the LM Studio Hub:
Or manually:
That's it! The plugin is now permanently installed. No terminal needs to stay open.
Simply run the same command again:
LM Studio will automatically reload the updated plugin.
For active development with hot-reload:
Leave this terminal open. The plugin will appear in LM Studio's plugins list.
Click the gear icon next to the plugin to access settings:
| Setting | Options | Default |
|---|---|---|
| Compression Level | Gentle / Balanced / Aggressive | Balanced |
| Smart Mode (Context-Aware) | On/Off | On |
| Protect URLs & Links | On/Off | On |
| Protect Version Numbers & IDs | On/Off | On |
| Protect Markdown Headers | On/Off | On |
| Protect File Paths | On/Off | On |
| Protect JSON/XML Structures | On/Off | On |
| Language Mode | Auto-Detect (EN/DE) / English / German | Auto-Detect |
| Show Statistics in Console |
Note: Smart Mode threshold was lowered to
0.15(v1.3.1) for better detection of short code snippets.
Only removes polite filler and courtesy words:
Removes articles, basic prepositions. Pronouns preserved for context tracking:
Maximum compression β removes almost all function words including pronouns:
Send this verbose prompt:
"Hello there! I was wondering if you could possibly help me out? I would really appreciate it if you could explain how to install Node.js on Windows step by step. Thank you so much for your time and assistance!"
Expected compressed output (Balanced):
(Note: "step by step" β "sequential", not the broken "steps")
Send this verbose prompt:
"Hallo! Ich wΓΌrde mich sehr freuen, wenn du mir bei dieser Aufgabe helfen kΓΆnntest, bitte und danke!"
Expected compressed output (Balanced):
Send this prompt to verify file paths are preserved:
"check C:\Source Code\ServiceMonitor for issues."
Expected: Path stays as C:\Source Code\... (not corrupted to C:\src Code\...)
Send this prompt to verify both path types work:
"Bitte analysiere den Code in /home/user/project/src/main.ts und ./lib/utils.py."
Expected: Both paths preserved intact:
Send this prompt to verify German compression works correctly and version numbers aren't fragmented:
"Hallo! Ich wΓΌrde mich sehr freuen, wenn du mir bei dieser Aufgabe helfen kΓΆnntest, bitte und danke! ErklΓ€re mir bitte Schritt fΓΌr Schritt, wie man Node.js unter Windows installiert. Vielen Dank!"
Expected: Clean German output with "Node.js" intact and proper phrase replacement:
β Wrong (old buggy behavior):
These elements are never modified, regardless of compression level:
| Element | Example | Protection Method |
|---|---|---|
| Code blocks | `code` and blocks``` ```` | PUA placeholder (min 15 chars) |
| URLs | https://example.com/path?id=123 | PUA placeholder (min 20 chars) |
| Version numbers | v1.0.0, 2.1.3-beta | Regex match + protect |
| Software names with dots | Node.js, TypeScript | Regex match + protect |
| Issue/PR refs | #456 | Regex match + protect |
| UUIDs | 550e8400-e29b-41d4-a716-446655440000 | Regex match + protect |
Runs tsc --noEmit for fast validation without generating output files.
Current Test Results: β 12/12 assertions pass (v1.3.1)
lms dev --install completed successfullydist/index.js exists after buildCheck LM Studio's console (F12 β Console tab) for error messages.
Try Gentle mode or disable specific protections in settings.
This was a known bug fixed on May 16, 2026. Ensure you have the latest version with path protection enabled.
For detailed architecture and technical documentation, see:
| Issue | Status |
|---|---|
| Placeholder overhead causing negative compression | β
Fixed - compact Unicode placeholders (\uE000+) now used |
| "source" β "src" synonym corrupting file paths | β Fixed - Windows path protection added before synonym phase |
| Phrase replacement order causing partial matches | β Fixed - phrases sorted by length (longest first) |
Punctuation spacing broken (out?explain, Node. js) | β Fixed - smart cleanup chain with CAPITAL-aware spacing |
Logic symbols breaking natural language (and β &&) | β Fixed - all logic symbol replacements removed |
protectFilePaths config field unused | β Fixed - now wired up and functional (May 18, 2026) |
| Placeholder overflow risk (~1M items) | β Fixed - MAX_PLACEHOLDERS check added (May 18, 2026) |
| Duplicate entries in de-filler.ts | β Fixed - ~90 duplicates removed (May 18, 2026) |
| Error handling lacking user feedback | β Fixed - stack trace + truncated error message shown (May 18, 2026) |
Path extensions stripped (main.ts β main) | β
Fixed - regex includes / and uses lookahead boundaries (May 18, 2026) |
| Placeholder counter duplication (50% waste) | β Fixed - removed unused generatePlaceholder() function (May 18, 2026) |
| Language detection O(nΒ²) performance | β Fixed - converted indicator arrays to Sets for O(1) lookup (May 18, 2026) |
| Regex compilation per compression call | β Fixed - pre-compiled all phrase regexes in constructor (May 18, 2026) |
| String concatenation O(nΒ²) memory | β Fixed - use array join pattern for reconstruction (May 18, 2026) |
MIT
Last Updated: June 24, 2026 β v1.3.1 Release
.match() + .split() calls with unified .matchAll(/([^\s\w]+)|(\w+)/gu) loop. ~50% reduction in memory allocations during word filtering./\\b(?:const|...)\b|[{}]/g. ~30% faster technical context detection./\b[a-zÀâüΓ]{3,}\b/g to module scope so V8 caches compiled bytecode. Eliminates redundant compilation overhead per call.Record<string, string> to Map<string, string> for O(1) direct access without prototype chain traversal. ~20% faster synonym lookups..trim() calls and branch mispredictions in the hot loop.| On/Off |
| On |
| Markdown headers |
## My Header |
| PUA placeholder (min 12 chars) |
| Windows file paths | C:\Source Code\... | Regex match + protect |
| Placeholder restoration O(nΒ²) time | β Fixed - single-pass Map-based replacement (May 18, 2026) |
| "Node.js" fragmented into parts | β
Fixed - added . to word pattern regex (May 18, 2026) |
Orphaned punctuation scattered (!, .!) | β Fixed - cleanup step removes standalone punctuation (May 18, 2026) |
| No input validation (security risk) | β Fixed - added null/empty check + 1MB limit warning (May 18, 2026) |
| PUA restoration regex broken | β
Fixed - proper \uE000-\uF8FF Unicode escapes used (May 24, 2026) |
| Dead synonym entries (no-ops) | β Fixed - 17 no-op entries removed (May 24, 2026) |
detectTechnicalContext double-call | β Fixed - result cached in variable (May 24, 2026) |
| escapeRegex cascading double-escaping | β Fixed - single-pass regex replacement used (May 31, 2026) |
| Word filtering reconstruction misalignment | β Fixed - separate filtered word array prevents delimiter shift (May 31, 2026) |
| XML depth tracking matching unrelated tags | β
Fixed - proper searchPos skip logic added (May 31, 2026) |
| Technical context over-counting overlapping patterns | β Fixed - simplified keyword/brace counting eliminates overlap (May 31, 2026) |
return totalTokens > 0 && (codeScore / totalTokens) > 0.15; // was 0.25
const protectedPronouns = new Set([
// English
'he', 'him', 'his', 'she', 'her', 'it', 'they', 'them', 'their',
// German
'er', 'ihn', 'ihm', 'sein', 'sie', 'ihr', 'es', 'wir', 'uns', 'euch', 'mein', 'dein',
]);
'step by step': 'sequential', // instead of 'steps'
'Schritt fΓΌr Schritt': 'sequenziell', // German equivalent
.replace(/[^\p{L}\p{N}\p{So}\p{Sk}\p{Sc}\p{Sm}\uE000-\uF8FF]+$/, ''); // Strip mixed punctuation with emoji support
if (['?', '!'].includes(lastChar)) { text = text + lastChar; } // Re-add if original ended in ? or !
"peerDependencies": { "@lmstudio/sdk": "^1.5.0" }
lms get crunch3r/troglodyte
cd "C:\Source Code\LM Studio Plugins\troglodyte"
lms dev --install
lms dev --install
cd "C:\Source Code\LM Studio Plugins\troglodyte"
npm run dev
Input: "Hello! Could you please help me? Thank you so much!"
Output: "Help me"
Input: "John said he would fix it. He needs to call me tomorrow."
Output: "John said he fix it. He needs tomorrow." β
(pronouns kept!)
Input: "Please explain step by step how to solve this issue."
Output: "sequential how solve issue." β
(grammar intact!)
Input: "I would really appreciate it if you could provide a detailed
explanation of the implementation process."
Output: "Provide detailed explanation implementation process"
possibly help me out? explain sequential install Node.js Windows. β
wΓΌrde freuen mir Aufgabe helfen, kΓΆnntest β
analysiere Code /home/user/project/src/main.ts ./lib/utils.py. β
wΓΌrde freuen mir Aufgabe helfen, kΓΆnntest sequenziell Node.js Windows installiert. β
! wΓΌrde freuen Aufgabe helfen kΓΆnntest, ErklΓ€re steps Windows installiert,!, Node.js.! β
npm install
npm run build
npm run typecheck
npx ts-node src/tests/compression.test.ts
# or via npm script:
npm test
npm run dev
troglodyte/
βββ src/
β βββ index.ts # Entry point
β βββ promptPreprocessor.ts # Pipeline orchestrator + rate limiting
β βββ troglodyte.ts # Compression engine (main logic)
β βββ config.ts # UI configuration
β βββ dictionaries/
β βββ en-filler.ts # English blacklists
β βββ de-filler.ts # German blacklists
β βββ phrases.ts # Multi-word replacements (~125 entries, v1.3.1)
β βββ synonyms.ts # Single-word abbreviations
βββ dist/ # Compiled output
βββ package.json # v1.3.0: peerDependencies added, typecheck script
βββ tsconfig.json # v1.3.0: deprecated baseUrl removed
βββ PROJECT_SUMMARY.md # Comprehensive documentation
βββ CHANGELOG.md # Version history
βββ README.md # This file