Lens — Prompt ImproverTurn rough AI prompts into specific, structured, constrained ones. One keystroke. Lens is a VS Code extension that sits between you and your AI coding assistant (Copilot, Cursor, Codex, Claude Code, ChatGPT). Select a rough prompt, press Opt-in per action. Never intercepts silently. Works with any OpenAI-compatible API. WhyBad prompts cause expensive retries. You ask vaguely, get a mediocre answer, refine, ask again. That's three LLM calls where one would have sufficed. Lens fixes the prompt before it hits the expensive model. Before:
After (
Same intent. Vastly better answer downstream. Roughly 15–30% cheaper in downstream LLM spend once you factor in avoided retries. InstallInstall from the VS Code Marketplace or:
On first use, Lens will prompt you to paste an API key. Any OpenAI-compatible key works. The key is stored in VS Code's UsageImprove a prompt in place —
|
| Setting | Default | Purpose |
|---|---|---|
lens.model |
gpt-4o-mini |
Model for rewriting. Cheap + fast is best. |
lens.baseUrl |
OpenAI | Change for Azure OpenAI, local proxies, other providers |
lens.showDiffAfterRewrite |
true |
Brief status about what changed |
lens.autoDetectTaskType |
true |
Tailor the rewrite to task type |
lens.includeEditorContext |
true |
Include language and filename (never file contents) |
lens.temperature |
0.2 |
Keep low for consistent rewrites |
lens.sendToChatAfterCompose |
clipboard |
copilot, clipboard, or none |
lens.enableTelemetry |
false |
Off. Anonymous counts only if enabled. |
Commands
Lens: Improve Selected Prompt— the main rewrite actionLens: Compose New Prompt— panel for chat-panel workflowsLens: Set API Key— securely store your API keyLens: Clear Stored API Key— remove the stored keyLens: Show Session Stats— how many rewrites, acceptance rate, tokens
Cost
Lens uses a small model for rewrites (default gpt-4o-mini). Each rewrite is roughly $0.0001 — one hundredth of a cent. The downstream model call is where the real money is, and that's where you save 15–30% by having a better prompt.
Privacy
- Prompts you rewrite are sent to the API endpoint you configure (default: OpenAI). Lens is a client — it does not proxy anything through any Lens-owned server.
- File contents are never sent. Lens only sends the prompt text you selected, plus optional metadata (current file language, workspace-relative filename) if
lens.includeEditorContextis on. - API key is stored in VS Code's
SecretStorage(OS keychain on Mac/Linux, Windows Credential Manager on Windows). - Telemetry is opt-in and off by default. When enabled, only anonymous counts (rewrite attempted, accepted, rejected) are sent — never prompt contents.
What Lens is NOT
- Not automatic. It only fires when you press the hotkey. Predictable > clever.
- Not a code assistant. It doesn't answer your prompt — it just improves it before you send it somewhere that will.
- Not proprietary to any provider. Any OpenAI-compatible endpoint works.
Building from source
git clone <this-repo>
cd prompt-lens
npm install
npm run compile
To try it locally: open the folder in VS Code, press F5. This launches an Extension Development Host with Lens loaded.
To package a .vsix:
npm run vsce:package
# → prompt-lens-0.1.0.vsix
code --install-extension prompt-lens-0.1.0.vsix
Testing
npm test
License
MIT. See LICENSE.