Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>PLTC — AI Prompt & Token CompressorNew to Visual Studio Code? Get it now.
PLTC — AI Prompt & Token Compressor

PLTC — AI Prompt & Token Compressor

Vanshil Jain

|
3 installs
| (1) | Free
Compress AI prompts by ~30% in <0.5ms using MP3 psychoacoustic physics with 95.34% semantic retention.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

⚡ PLTC — AI Prompt & Token Compressor

Shrink 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)

Token reduction 30.0% fewer tokens on the PLTC v4 benchmark set
Meaning retained 95.34% Sentence-BERT semantic similarity
Latency < 0.25 ms per paragraph, zero GPU, entirely inside VS Code
Privacy No network calls, no telemetry, no model download

Features

1. PLTC Compressor sidebar: no file needed

Open the Prompt Compressor panel in any of these ways:

  • Click the ⚡ button in the editor title bar (top right, next to other AI assistants).
  • Click the ⚡ PLTC Compressor icon in the Activity Bar (left edge of VS Code).
  • Command Palette → PLTC: Open PLTC Compressor.

Tip: drag the ⚡ Activity Bar icon to the right-hand Secondary Side Bar to keep PLTC open next to your AI chat.

  • Paste a prompt or context into the box, or click Grab Selection from Editor to pull in whatever is highlighted in the active editor.
  • Adjust Alpha and Threshold with the sliders (they start at your settings).
  • Click ⚡ Compress & Copy (or press Ctrl+Enter). The result appears below, is copied to your clipboard, and a green badge shows the savings:

    ✓ Saved 46% words in 0.1ms (95.34% meaning retained)

  • Tick Show masked (deleted) words to see exactly which words and phrases were removed.

2. 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.

3. 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 v4: Copied! Saved 30% words in 0.2ms (95.34% meaning retained)

With nothing selected, it compresses and copies the whole file.

4. 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.

5. Live status bar

The bottom-right status bar shows ⚡ PLTC v4. Highlight text and it previews the savings live, for example ⚡ PLTC: ~30% savable. Click it to compress & copy.


Example

Before (52 words)

In order to ship faster, it is important to note that 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 (29 words, 44% saved, Smart mode)

To ship faster, large language models transforming way developers build software. Models trained large datasets text and 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.

Smart mode (default): compressed prompts that stay clear

Plain masking can blur a prompt: lists collapse into one paragraph, and small words such as or and only can carry the whole meaning of an instruction. Smart mode runs the same v4 engine but keeps what an AI needs to follow your prompt:

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.

  1. 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).

  2. Tokenize the text into words and sentence punctuation (. , ! ? ;).

  3. 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.

  4. Keep the loud words. The first and last tokens, all punctuation, and any non-weak word with energy above 0.42 are always kept.

  5. 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.

  6. 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 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.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft