A lightweight VS Code extension that transforms rough ideas into execution-ready prompts with a built-in model router and an optional on-demand local GGUF model.
Install
From VS Code Marketplace (Recommended)
Search "Prompt Optimizer Mini" in VS Code Extensions, or install via CLI:
code --install-extension fullstack1ape.prompt-optimizer-mini
From Source
- Clone and open this repo in VS Code.
- Install dependencies and compile:
npm install
npm run compile
python3 -B -m unittest scripts/test_promptopt_stability.py scripts/test_agent_promptopt_contract.py scripts/test_local_model_manager.py
- Press
F5to launch Extension Development Host.
From Homebrew Tap
After the v1.0.0 release and tap are published:
brew tap Lab-Overflow/prompt-optimizer
brew install prompt-optimizer-mini
promptopt install-extension
Homebrew also exposes the longer prompt-optimizer-mini command.
Build and Install VSIX
npm run package
code --install-extension prompt-optimizer-mini-1.0.0.vsix
Features
- Zero Configuration — Install and start optimizing. If no remote model is available, a compact local model can be prepared on demand.
- Lightweight Package — Model weights are not bundled in the VSIX.
- Model Router GUI — Choose Auto, VS Code Chat, OpenAI-compatible API, Local Model, or Offline Template.
- Visible Optimization Trace — Chat and preview views show the optimized prompt plus an expandable before/after route panel.
- Bring Your Best Model — Configure your own base URL, API key, and model name. API keys are stored in VS Code SecretStorage.
- Local GGUF Model — Reuses Ollama or
llama-cli, or downloads allama.cppruntime and the officialQwen/Qwen3-1.7B-GGUFQ8_0model (about 1.83 GB). - Few-Shot Templates — General, variable-driven, red-team review, and text-to-image prompt patterns are built in.
- Chat Participant — Type
@promptoptin VS Code Chat to optimize prompts conversationally. - Editor Command — Select text and run
Prompt Optimizer Mini: Optimize Promptfrom the command palette, or right-click for the context menu option. - Manual Input — No selection needed. Run the command without selecting text and a prompt input box will appear.
- Multiple Output Options — Replace selection, insert at cursor, copy to clipboard, or open as a Markdown preview.
- Resilient Fallback — OpenAI-compatible API → VS Code Chat → Local GGUF model → Local Python formatter → Built-in template.
- Codex / Claude Code Adapters — Confirm once to add managed workspace adapters, then use
@promptopt ...in reopened Codex or Claude Code chats.
How to Use
Method 1: Chat Participant
Open VS Code Chat and type:
@promptopt Optimize this into an execution-ready prompt: build a customer service chatbot
The extension uses the current chat model (Copilot, Codex, Claude, etc.) to optimize your prompt.
Method 2: Editor Command
- With selection: Select rough prompt text in your editor -> Run
Prompt Optimizer Mini: Optimize Promptfrom command palette (Ctrl+Shift+P/Cmd+Shift+P), or right-click and select from the context menu. - Without selection: Run the same command → A prompt input box appears for you to type or paste your rough prompt.
- Choose an output action:
Replace Selection— Overwrite the selected text with the optimized promptInsert At Cursor— Insert the optimized prompt at the current cursor positionCopy To Clipboard— Copy to clipboard for use anywhereOpen Preview— Open as a Markdown document for review
Typical Use Cases
- Turn product requirement notes into execution-ready prompts
- Turn coding task ideas into structured coding-agent prompts
- Turn writing outlines into prompts with output format and acceptance criteria
- Turn ambiguous requests into prompts with assumptions, constraints, and verification checks
Model Router
Use the command palette:
| Command | Purpose |
|---|---|
Prompt Optimizer Mini: Choose Model Route |
Pick Auto, VS Code Chat, OpenAI-compatible API, Local Model, or Offline Template |
Prompt Optimizer Mini: Configure OpenAI-compatible Model |
Save base URL, model name, and API key |
Prompt Optimizer Mini: Setup Local Model |
Prepare the local runtime and GGUF before first use |
Prompt Optimizer Mini: Show Model Status |
Inspect route and local model readiness |
The default auto route uses:
| Priority | Method | When |
|---|---|---|
| 1st | OpenAI-compatible API | When configured |
| 2nd | VS Code chat model | When exposed by VS Code extension APIs |
| 3rd | Local GGUF model | Reuses Ollama or llama-cli; otherwise prepares runtime and model on demand |
| 4th | Local Python formatter | Fast dependency-free structured fallback |
| 5th | Built-in template | When Python is unavailable |
The local model is the official Qwen/Qwen3-1.7B-GGUF Q8_0 file. It is compact enough for common 8 GB Apple Silicon Macs and laptops with 6 GB or more VRAM.
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
promptOptimizerLite.replaceSelection |
boolean | false |
When true, automatically replace selected text with the optimized result. When false, show an action picker to choose the output destination. |
promptOptimizerLite.fallbackPythonCommand |
string | "" |
Custom Python command for fallback execution (e.g., /usr/bin/python3). Leave empty to auto-detect python3 or python. |
promptOptimizerLite.modelRoute |
string | "auto" |
Model router strategy. |
promptOptimizerLite.externalBaseUrl |
string | "" |
OpenAI-compatible API base URL. |
promptOptimizerLite.externalModel |
string | "" |
OpenAI-compatible model name. |
promptOptimizerLite.autoDownloadLocalModel |
boolean | true |
Prepare local runtime and GGUF on demand. |
promptOptimizerLite.localTemplate |
string | "auto" |
Few-shot template selection. |
promptOptimizerLite.showOptimizationTrace |
boolean | true |
Show original prompt and model route alongside the optimized prompt in chat and preview. |
promptOptimizerLite.offerAgentAdapterSetup |
boolean | true |
Offer to add managed Codex and Claude Code workspace adapters. |
Requirements
- VS Code
1.105.0or later - Python
3.xfor local model bootstrap and local formatter fallback - Network access during the first local model setup