chuanqz40 downloadsSelect a prompt and refine it with an LLM. Two modes: template-driven structured optimization, and template-free light polishing (disambiguate / dedupe / mark missing info with placeholders).
Select a prompt and refine it with an LLM, streaming the result back into the selection. Built for prompt engineering — not a general writing assistant.
Ctrl+Z / Cmd+Z.md files in your vault or HTTP links as optimization standards and switch on the fly while writing[TODO: ...] placeholder for manual completionreasoning_effort / Anthropic thinking budget), temperature / top_p / stop / seed, extraBody / extraHeaders passthrough, request timeoutoptimizer.log in the plugin directory; one-click viewer on the settings pageThis plugin sends network requests to third-party LLM providers you configure (e.g. OpenAI, Anthropic, DeepSeek, OpenRouter, or any OpenAI-compatible endpoint). Be aware:
data.json inside the plugin folder (synced with your vault). It will be migrated to Obsidian SecretStorage (per-device, non-synced) in a future version.http-source template, the plugin fetches that URL when you select/refresh it. The URL and its content are under your control.local-source template, the plugin lists your vault's .md file paths in a picker so you can choose one. Only the path you pick is read (to load that template); no other file content is accessed, transmitted, or stored outside your vault.No analytics, telemetry, or vault content collection is performed.
Requires Node.js (recommend >= 18) and npm.
Clone the repo
git clone https://github.com/chuanqq/user-prompt-optimizer.git
cd user-prompt-optimizer
Install dependencies and build (run inside plugin/)
cd plugin
npm install
npm run build # production build, produces plugin/main.js
# for development, use npm run dev to enter watch mode
Copy the build artifacts into the target vault's plugin directory
<vault>/.obsidian/plugins/user-prompt-optimizer/
Files needed: main.js, manifest.json, styles.css
In Obsidian: Settings -> Community plugins -> enable "Community plugins" -> enable "User Prompt Optimizer"
Ctrl+Z / Cmd+ZCommand list:
| Command | ID | Description |
|---|---|---|
| Optimize prompt | optimize-prompt |
Stream a structured optimization of the selection against the active template |
| Optimize prompt (lite, no template) | optimize-prompt-lite |
No template; only disambiguate / dedupe / sharpen wording; mark missing info with [TODO: ...] |
| Switch optimization template | switch-template |
Open a picker to switch the active optimization template |
What the "Optimize prompt" command optimizes against is decided by a "template". Templates come from three sources:
.md file in the vault; read fresh on every optimization (no cache; the file is the source of truth).md link; the full text is fetched and cached; refresh manuallyThe settings page can list all templates, activate, refresh (http), delete, and add them. The "Switch optimization template" command lets you switch the active template quickly while writing. The "Optimize prompt (lite)" command does not read any template.
The full text of the built-in template is at src/engine/default-template.md.
The developer console (Ctrl+Shift+I / Cmd+Option+I) or the "Open log" button on the settings page shows the time, model, template, input/output char counts, elapsed time, and status of each request.
MIT — see LICENSE.