⚡ PLTC — Psycho-Linguistic AI Prompt Compressor
Shrink prompts, docs and specs before you paste them into an AI assistant.
PLTC removes low-information filler words using the same idea that makes MP3 files small —
psychoacoustic masking — and it does it offline, in under a millisecond, with zero GPU.
Works with any AI tool you paste into: GitHub Copilot Chat, Cursor, Cline, Continue,
ChatGPT, Claude, Gemini, or your own LLM pipeline.
|
|
| Typical savings |
25–45% fewer words on natural-language prose |
| Speed |
~0.02–0.2 ms for a paragraph, entirely inside VS Code |
| Meaning retained |
96.18% Sentence-BERT semantic similarity on our benchmark set |
| Privacy |
No network calls, no telemetry, no model download |
Features
1. Compress Selected Text (Replace) — Ctrl+Alt+C / Cmd+Alt+C
Highlight text and press the shortcut (or right-click → Compress Selected Text (Replace)).
The selection is replaced in place. Works with multiple cursors, and one Ctrl+Z undoes it.
2. Compress Selection & Copy to Clipboard
Right-click → Compress Selection & Copy to Clipboard. Your file is not modified — the
compressed prompt goes straight to your clipboard, ready to paste into AI chat:
⚡ PLTC: Copied! Saved 26% words in 0.2ms (96.2% meaning retained)
With nothing selected, it compresses and copies the whole file.
3. Compress Entire Markdown / Text File
Command Palette → PLTC: Compress Entire Markdown / Text File. Great for README files,
system prompts and specification docs. By default the result opens in a new tab beside the
original so your file is untouched; set pltc.compressFileMode to replace to compress in place.
4. Live status bar
The bottom-right status bar shows ⚡ PLTC Ready. Highlight text and it previews the savings
live — ⚡ PLTC: ~24% savable. Click it to compress & copy.
Example
Before (41 words)
Large language models are currently transforming the way that developers build software. These
models are trained on very large datasets of text and code, and they are able to generate
functions, explain complex algorithms, and actually detect subtle bugs in seconds.
After (26 words — 37% saved)
Large language models transforming way developers build software. These models trained large
datasets text code, they able generate functions, explain complex algorithms, detect subtle bugs
seconds.
Every fact survives; only the grammatical glue the model doesn't need is gone.
How it works: MP3 psychoacoustics, applied to words
An MP3 encoder drops sounds you can't hear: a quiet tone right next to a loud one is
masked by it. PLTC applies the same principle to language.
Tokenize the text into words and sentence punctuation (. , ! ? ;).
Measure each word's energy — how much information it carries:
energy = (0.6 × information entropy + 0.4 × length weight) × band multiplier
- Information entropy
-log2(p): rare words carry more information than frequent ones.
- Length weight
min(len / 5, 1.5): longer words tend to be content words.
- Band multiplier: 0.30 for a small set of "weak" function words (
the, of, is, very, actually, …), 1.40 for everything else — like the quiet vs. loud frequency bands of a sound.
Energies are normalised to 0–1.
Keep the loud words. The first and last words, all punctuation, and any non-weak word
with energy above 0.45 are always kept.
Test the quiet words for masking. For every other word:
audibility = energy − α × (energy of previous token + energy of next token)
If audibility ≥ threshold the word is still "audible" and stays; otherwise its loud
neighbours mask it and it is dropped.
The engine is a byte-for-byte port of the reference Python implementation and is verified
against it on every build (npm run test:parity).
Benchmark: 96.18% meaning retention
On our benchmark set, the Sentence-BERT cosine similarity between each original passage and its
PLTC-compressed version averaged 96.18% at the default settings (α = 0.40, threshold = 0.25).
In practice that means an LLM reading the compressed prompt receives almost the same meaning for
noticeably fewer tokens.
Settings
| Setting |
Default |
Range |
What it does |
pltc.alpha |
0.40 |
0.10 – 0.80 |
MP3 Psychoacoustic Masking Strength — how strongly loud neighbours mask a quiet word. Higher = more aggressive. |
pltc.threshold |
0.25 |
0.05 – 0.50 |
Cognitive Audibility Threshold — the minimum audibility a quiet word needs to survive. |
pltc.compressFileMode |
newTab |
newTab, replace |
Whether "Compress Entire File" opens the result in a new tab or replaces the document. |
Tip: most of the tuning range is at the low end of the threshold slider — with the reference
algorithm, quiet words almost always score below ~0.17, so thresholds above that behave the same.
Commands & shortcuts
| Command |
Shortcut |
Where |
PLTC: Compress Selected Text (Replace) |
Ctrl+Alt+C (Win/Linux), Cmd+Alt+C (Mac) |
Palette, editor right-click |
PLTC: Compress Selection & Copy to Clipboard |
click the status bar item |
Palette, editor right-click |
PLTC: Compress Entire Markdown / Text File |
— |
Palette, editor right-click (no selection) |
Change shortcuts under File → Preferences → Keyboard Shortcuts and search for pltc.
Good to know
- PLTC is built for natural-language prose: prompts, docs, specs, comments, tickets.
It is not meant for source code.
- Like the reference algorithm, the tokenizer keeps only
. , ! ? ; — other symbols
(Markdown #, backticks, quotes, brackets, hyphens, apostrophes) are removed and line breaks
are joined into one paragraph. Use Copy mode or the default new-tab mode if you want to keep
your original file intact.
- "Compress Entire File" in
replace mode asks for confirmation before compressing a code file.
Privacy
PLTC runs entirely inside VS Code. It makes no network requests, collects no telemetry and stores
nothing besides your own settings.
License
MIT — the full license text ships with the extension (LICENSE file).
Feedback
Found a bug or have an idea? Use the Q & A tab on the Visual Studio Marketplace listing,
or leave a review.