⚡ PLTC — AI Prompt & Token CompressorShrink prompts, docs and specs before you paste them into an AI assistant. PLTC v4 removes low-information filler words using the same idea that makes MP3 files small: psychoacoustic masking. It runs offline, in a fraction of 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. Benchmarks (PLTC v4)
Features1. PLTC Compressor sidebar: no file neededOpen the Prompt Compressor panel in any of these ways:
Tip: drag the ⚡ Activity Bar icon to the right-hand Secondary Side Bar to keep PLTC open next to your AI chat.
2. Compress Selected Text (Replace):
|
| Kept in Smart mode | Example |
|---|---|
| Line breaks, blank lines, numbered and bulleted lists, headings | 1. Please … stays on its own line |
Label: colons |
Backend: NestJS, TypeORM |
| Logic words: or, only, but, either, can, could | "frontend only loads visible customers", "SQL query or running balance" |
| "and" between kept words | "filtering and sorting" |
| Hyphenated words, contractions, versions | full-stack, don't, Node.js, v1.2, and/or |
inline code, fenced code blocks, URLs, paths, e-mails |
left exactly as written |
| Sentence starts | re-capitalised after leading filler is removed |
On a typical multi-paragraph prompt Smart mode saves about 40–45% of words (Exact mode
about 45%). Set pltc.mode to exact, or untick Smart mode in the sidebar, for the plain
v4 output.
Testing tip: if you ask a chatbot "which prompt is better?", it will usually prefer the longer original, because it reads more naturally to a human. A fairer test is to send both prompts and compare the answers: the compressed prompt should produce the same plan and code while costing fewer tokens.
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.
Phrase masking. Wordy phrases are shortened first: in order to → to, due to the fact that → because, a large number of → many, with the help of → using, and it is important to note that is dropped entirely (12 rules, case-insensitive).
Tokenize the text into words and sentence punctuation (
. , ! ? ;).Measure each word's energy, i.e. how much information it carries:
energy = (0.6 × information entropy + 0.4 × length weight) × band multiplier × echo decay- 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.25 for ~70 "weak" function words (
the, of, is, this, however, actually, …), 1.45 for everything else, like the quiet vs. loud frequency bands of a sound. - Echo decay: 0.85 for every repeat of a word. A word you have already heard is quieter.
Energies are normalised to 0–1.
- Information entropy
Keep the loud words. The first and last tokens, all punctuation, and any non-weak word with energy above 0.42 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 ≥ thresholdthe word is still "audible" and stays; otherwise its loud neighbours mask it and it is dropped.Tidy punctuation: no space before
. , ! ? ;, and stray commas left behind by removed discourse markers (However, …) are cleaned up.
The engine is a byte-for-byte port of the reference Python PsychoLinguisticCompressorV4
and is verified against it on every build (npm run test:parity, 390 cases including Unicode
and whitespace edge cases).
Settings
| Setting | Default | Range | What it does |
|---|---|---|---|
pltc.alpha |
0.45 |
0.10 – 0.80 | MP3 Psychoacoustic Masking Strength: how strongly loud neighbours mask a quiet word. Higher = more aggressive. |
pltc.threshold |
0.28 |
0.05 – 0.50 | Cognitive Audibility Threshold: the minimum audibility a quiet word needs to survive. |
pltc.mode |
smart |
smart, exact |
Smart keeps formatting, protected text and logic words (see above). Exact is the plain PLTC v4 algorithm. |
pltc.compressFileMode |
newTab |
newTab, replace |
Whether "Compress Entire File" opens the result in a new tab or replaces the document. |
Tip: in v4 the phrase map and the weak-word band already decide almost every word, so the defaults are close to the strongest compression. To keep more words, move to the gentle end (α ≈ 0.10 and threshold ≈ 0.05). Raising either value further rarely changes the result.
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 |
none | Palette, editor right-click (no selection) |
PLTC: Open PLTC Compressor |
click ⚡ in the editor title bar or the Activity Bar | Palette, editor title bar, Activity Bar |
Open the Command Palette with Ctrl+Shift+P (Cmd+Shift+P on Mac) and type PLTC.
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.
- Inside a sentence, the tokenizer keeps only
. , ! ? ;. Other loose symbols (quotes, brackets, dashes) are removed. Smart mode protects the symbols that matter (see above); in Exact mode everything, including line breaks, is joined into one paragraph. Use Copy mode, the sidebar, or the default new-tab mode if you want to keep your original file intact. - "Compress Entire File" in
replacemode 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.