@infosuweb/prompt-rewriter
v0.14.4
Published
Rewrite a selected prompt so it is clearer and more precise, without adding new ideas.
Maintainers
Readme
Features
Independent commands:
| Command | Shortcut | Description |
| --- | --- | --- |
| Rewrite Current Input | F8 | Cleans and iteratively improves wording without inventing ideas, and prefixes a task/project-grounded expert persona (Act as a …). Uses skills plus a bounded 6,000-character view of workspace rules and configured root docs; skips chat history, the docs folder, and global rules. Repeating F8 must produce a material refinement rather than the same result. |
| Expand Current Input | F9 | Formats a Cursor-agent-ready Grill-with-Docs prompt starting with a context-grounded Act as a … expert role, then Goal / Constraints / Non-Goals / Acceptance Criteria, using the full shared context stack (including root docs when enabled). |
| Expand Current Input (JSON) | F10 | Same expand behavior, but the output is a JSON object (expert_role, goal, constraints, non_goals, acceptance_criteria). |
| Expand Current Input (Loop) | F7 | Same expand flow as F9, but writes a Grill-with-Docs loop (iteration structure to repeat work until done), not a one-shot prompt. Adds an optional ### Loop section from iteration details already in the input; does not execute the loop. |
| Expand Current Input (Loop JSON) | F6 | Same loop behavior as F7, but the output is a JSON object (expert_role, goal, loop, constraints, non_goals, acceptance_criteria). |
| Suggest Next Prompt | F12 | Uses chat history plus bounded project identity to propose the next ready-to-send agent prompt with a grounded expert role (Grill-with-Docs is used only as internal reasoning, not written into the input). |
| Rewrite Prompt | — | Rewrites the current editor selection and shows a diff before replacing it. |
| Rewrite Clipboard Prompt | — | Rewrites the current clipboard text and copies the result back for a manual paste. |
| Open Configuration | — | Opens the sidebar panel to pick backend + model and save. |
| Select LLM Backend | — | Chooses ollama, openai, anthropic, google, cursorAgents, or openaiCompatible for F6–F12 and clipboard. |
| Select Active Model | — | Lists models for the current backend (Ollama /api/tags, Cursor agent models, Hermes/OpenAI GET /models, curated ids when live listing is unavailable). |
| Select Ollama Model | — | Lists local Ollama models only (same GET /api/tags catalog Hermes uses) and saves promptRewriter.ollamaModel. |
| Import Hermes Model Settings | — | Copies Hermes Agent’s primary local model (hermes config get model.*) into Prompt Rewriter Ollama settings. |
Every F6-F12 transformation enforces a specific expert role, validates its output format and scope, rejects invented operational work or file paths, and makes one focused repair attempt when a model response fails those checks. API keys, prompts, file contents, file names, and generated text are never sent to usage metrics.
Prerequisites
- Visual Studio Code 1.80+ or Cursor (any recent build that installs standard VS Code extensions)
- To build the
.vsixfrom source (not required if you already have the installer file): Node.js 22 or later and npm 10 or later - For Rewrite Current Input, Expand Current Input, and Rewrite Clipboard Prompt: a configured backend (Ollama with a pulled model, cloud API key, or Cursor Agent CLI on PATH)
- For Cursor Agents backend: Cursor Agent CLI (
agent/cursor-agent) onPATH, authenticated viaagent loginorCURSOR_API_KEY - For current-input commands on macOS: Accessibility permission for Cursor (or VS Code) so
osascriptcan send Cmd+A / Cmd+C / Cmd+V to the focused field
Install locally (no Marketplace)
This extension is not on the VS Code Marketplace. The installer is the .vsix file releases/prompt-rewriter-latest.vsix. Prefer npm (no GitLab login). GitLab Pages / raw links remain available.
Package on npm: @infosuweb/prompt-rewriter (org packages: https://www.npmjs.com/settings/infosuweb/packages).
From npm (recommended)
Downloads the published package (includes the .vsix), then sideloads it into Cursor or VS Code. No GitLab token.
Cursor — macOS / Linux:
npm pack @infosuweb/prompt-rewriter@rc
tar -xzf infosuweb-prompt-rewriter-*.tgz
cursor --install-extension "$(pwd)/package/releases/prompt-rewriter-latest.vsix" --forceVS Code — macOS / Linux:
npm pack @infosuweb/prompt-rewriter@rc
tar -xzf infosuweb-prompt-rewriter-*.tgz
code --install-extension "$(pwd)/package/releases/prompt-rewriter-latest.vsix" --forceCursor — Windows (PowerShell):
npm pack @infosuweb/prompt-rewriter@rc
tar -xzf (Get-Item infosuweb-prompt-rewriter-*.tgz).FullName
cursor --install-extension "$(Join-Path (Get-Location) 'package\releases\prompt-rewriter-latest.vsix')" --forceVS Code — Windows (PowerShell):
npm pack @infosuweb/prompt-rewriter@rc
tar -xzf (Get-Item infosuweb-prompt-rewriter-*.tgz).FullName
code --install-extension "$(Join-Path (Get-Location) 'package\releases\prompt-rewriter-latest.vsix')" --forceAfter install: Command Palette → Developer: Reload Window → Prompt Rewriter: Open Configuration.
Pinned version (example): npm pack @infosuweb/[email protected] instead of @rc.
From GitLab Pages / raw .vsix
No GitLab token is required once the project is Public (one-time: Settings → General → Visibility → Public).
Public installer URL (same file, two mirrors):
- Pages: https://suweb1.gitlab.io/llm-extension/prompt-rewriter-latest.vsix
- Raw file on
main: https://gitlab.com/suweb1/llm-extension/-/raw/main/releases/prompt-rewriter-latest.vsix
Cursor (macOS / Linux) — curl from GitLab
curl --fail --location --output "$HOME/Downloads/prompt-rewriter-latest.vsix" \
"https://suweb1.gitlab.io/llm-extension/prompt-rewriter-latest.vsix"
cursor --install-extension "$HOME/Downloads/prompt-rewriter-latest.vsix" --forceThen: Command Palette → Developer: Reload Window → Prompt Rewriter: Open Configuration.
VS Code (macOS / Linux) — curl from GitLab
curl --fail --location --output "$HOME/Downloads/prompt-rewriter-latest.vsix" \
"https://suweb1.gitlab.io/llm-extension/prompt-rewriter-latest.vsix"
code --install-extension "$HOME/Downloads/prompt-rewriter-latest.vsix" --forceThen: Command Palette → Developer: Reload Window → Prompt Rewriter: Open Configuration.
Windows (PowerShell) — Cursor — curl from GitLab
curl.exe --fail --location --output "$env:USERPROFILE\Downloads\prompt-rewriter-latest.vsix" `
"https://suweb1.gitlab.io/llm-extension/prompt-rewriter-latest.vsix"
cursor --install-extension "$env:USERPROFILE\Downloads\prompt-rewriter-latest.vsix" --forceWindows (PowerShell) — VS Code — curl from GitLab
curl.exe --fail --location --output "$env:USERPROFILE\Downloads\prompt-rewriter-latest.vsix" `
"https://suweb1.gitlab.io/llm-extension/prompt-rewriter-latest.vsix"
code --install-extension "$env:USERPROFILE\Downloads\prompt-rewriter-latest.vsix" --forceBrowser (no terminal)
- Open https://suweb1.gitlab.io/llm-extension/ and download prompt-rewriter-latest.vsix (or use the raw link above), or download the npm tarball from https://www.npmjs.com/package/@infosuweb/prompt-rewriter and extract
package/releases/prompt-rewriter-latest.vsix. - Command Palette → Extensions: Install from VSIX… → select the
.vsixfile. - Developer: Reload Window.
If Pages is not ready yet, use the raw main URL or the npm method above.
Build from source (optional)
Needs Node.js 22+:
git clone [email protected]:suweb1/llm-extension.git
cd llm-extension
npm install
npm run package
cursor --install-extension "$(pwd)/releases/prompt-rewriter-latest.vsix" --forceTo uninstall: Extensions view → Prompt Rewriter → Uninstall.
The extension uses only the standard VS Code extension API. It does not depend on Cursor-specific APIs or GitHub Copilot.
Install dependencies (from source)
npm installConfigure the LLM provider
Open Settings and set:
| Setting | Purpose |
| --- | --- |
| promptRewriter.backend | ollama (local), openai (official API), anthropic (Claude API), google (Gemini), cursorAgents (Cursor Agent CLI), or openaiCompatible (Hermes/custom). Default: ollama |
| promptRewriter.worker.enabled | Opt-in context worker for F6/F7/F9/F10. Oversized context is summarized before the main model call. F8/F12 never delegate. Default: false |
| promptRewriter.worker.backend | Worker backend, independent from the main backend: ollama, openai, anthropic, google, or openaiCompatible. It reuses that backend's existing credentials, URL, and timeout. Default: ollama |
| promptRewriter.worker.model | Worker model id, independent from the main model. Required when the worker is enabled. |
| promptRewriter.worker.maxContextChars | Character threshold above which expand context is summarized. Default: 12000 |
| promptRewriter.worker.maxOutputTokens | Maximum worker context-selection output tokens. Default: 768 |
| promptRewriter.apiKey | API key for OpenAI / Hermes / openaiCompatible. Do not commit. |
| promptRewriter.cursorApiKey | Optional Cursor API key when backend is cursorAgents. Prefer agent login / CURSOR_API_KEY when unset. |
| promptRewriter.anthropicApiKey | Anthropic/Claude API key when backend is anthropic. |
| promptRewriter.anthropicWorkspaceId | Workspace ID (wrkspc_…) for identity-linked / multi-workspace Anthropic keys. Sent as anthropic-workspace-id on each request. |
| promptRewriter.googleApiKey | Google AI Studio API key when backend is google. Used to list models available to that key and to call :generateContent. |
| promptRewriter.googleBaseUrl | Gemini API host (OpenAI-compat form). Used to derive the native :generateContent / /models endpoints. Default: https://generativelanguage.googleapis.com/v1beta/openai/ |
| promptRewriter.googleModel | Preferred Gemini model id. Default: gemini-3.6-flash. Retired ids such as gemini-2.5-flash are remapped automatically. |
| promptRewriter.baseUrl | OpenAI-compatible base URL. OpenAI preset uses https://api.openai.com/v1. |
| promptRewriter.ollamaBaseUrl | Local Ollama server used when backend is ollama. Default: http://localhost:11434 |
| promptRewriter.ollamaModel | Ollama model used by those commands. Default: qwen2.5-coder:7b |
| promptRewriter.ollamaTimeoutMs | Ollama request timeout in ms. Default: 180000 (3 minutes) |
| promptRewriter.contextFolder | Workspace-relative folder of rules/context for F6-F12. Default: .cursor/rules |
| promptRewriter.includeGlobalCursorRules | When true, F6/F7/F9/F10 load Cursor global/user rules from ~/.cursor/rules. F8/F12 always skip global rules (lean context). Default: true |
| promptRewriter.disabledGlobalCursorRuleFiles | Global rule file names under ~/.cursor/rules excluded from F6/F7/F9/F10 even when global rules are enabled. Default: [] |
| promptRewriter.disabledContextRuleFiles | Workspace rule file names (relative to contextFolder) excluded from F6-F12. Default: [] |
| promptRewriter.includeRootDocs | When true, F6/F7/F9/F10 load AGENTS.md, README.md, and .cursorrules; F8/F12 include them only within their bounded 6,000-character lean context. Default: true |
| promptRewriter.docsFolder | Docs folder for F6/F7/F9/F10 (.md/.mdc/.txt). Default: docs. Empty disables it. F8/F12 always skip the docs folder. |
| promptRewriter.includeArchitectureDefaults | When true, F6-F12 inject built-in SOLID + hexagonal constraints for software work. Default: true |
| promptRewriter.includeLastChatResponse | When true, F6/F7/F9/F10 include full chat history from Cursor agent transcripts (current conversation turns + older transcripts when budget allows). F8 always skips chat history (lean rewrite). F12 always loads it. Default: true |
| promptRewriter.rewriteSystemPromptRules | Custom system prompt for F8 Rewrite. Empty uses the built-in strict defaults (no inference, preserve ambiguity) and always prefixes a context-grounded expert agent persona. Editable in the Rules tab. |
| promptRewriter.expandSystemPromptRules | Custom system prompt for F9 Expand. Empty uses built-in Grill-with-Docs expand rules with a context-grounded Act as a … expert role line. Editable in the Rules tab. |
| promptRewriter.expandJsonSystemPromptRules | Custom system prompt for F10 Expand JSON. Empty uses built-in JSON expand rules with required expert_role (Act as a …). Editable in the Rules tab. |
| promptRewriter.loopSystemPromptRules | Custom system prompt for F7 Loop. Empty uses built-in Grill-with-Docs loop rules with a context-grounded Act as a … expert role line. Editable in the Rules tab. |
| promptRewriter.loopJsonSystemPromptRules | Custom system prompt for F6 Loop JSON. Empty uses built-in JSON loop rules with required expert_role (Act as a …). Editable in the Rules tab. |
- Prefer User settings over Workspace settings so the API key is not stored in the repository.
- Save & apply writes User settings and clears any Workspace overrides for the same keys, so F6–F12 match the panel.
The original operator prompt, project/global rules, referenced skills, and architecture defaults bypass the worker and stay exact. The worker sees only reducible project documentation and chat context. To keep that reduced context grounded, it returns context-unit identifiers and the extension reconstructs each source channel from bounded, verbatim excerpts; worker-generated prose never reaches the main model. The selection is deliberately lossy and instructs the main model to require direct source reads for debugging, architecture, security, or exact line-level work. On an invalid selection or worker failure, the command logs a sanitized fallback notice and sends the original context to the main model.
Rewrite Prompt uses any OpenAI-compatible endpoint that accepts POST {baseUrl}/chat/completions.
Rewrite Clipboard Prompt uses the same promptRewriter.backend as F6–F12 (Ollama /api/chat or OpenAI-compatible / Hermes proxy). For local Ollama, pull a model first:
ollama pull qwen2.5-coder:7bPrefer User settings for promptRewriter.ollamaModel so it works in every project, not only this workspace.
Configure from the sidebar panel
The simplest way to get F6–F12 working with the model you want:
- Press F5 (Extension Development Host), or install the
.vsix. - Click the Prompt Rewriter icon in the Activity Bar (left), or run Prompt Rewriter: Open Configuration.
- Use the top tabs:
- Setup — choose a Provider:
- Ollama — fastest on-machine option.
- OpenAI — set your API key + model (
gpt-4o-mini, …). - Claude — set your Anthropic API key + Claude model.
- Google — set your Google AI Studio key + Gemini model (default gemini-3.6-flash). The Setup model list is loaded from that API key via the native
/v1beta/modelscatalog. - Cursor Agents — Cursor Agent CLI (
agent) in ask/print mode (Composer and account models). - Compatible — Hermes proxy / any OpenAI-compatible endpoint (free routes can be slow).
- Rules — configure agent context settings; edit F8 Rewrite / F9 Expand / F10 Expand JSON / F7 Loop / F6 Loop JSON system prompts (labeled by purpose in the panel); toggle individual global (
~/.cursor/rules) and workspace rule files on/off; create or edit rule files in-panel; create/edit skill files (SKILL.md); assign named task prompts to skills (stored as## Task:sections). Click Save settings after toggling includes or editing prompt rules.
- Setup — choose a Provider:
- On Setup, pick a Model from the icon list (or type a custom id), then Save & apply.
- Use F6 / F7 / F8 / F9 / F10 / F12 in Cursor chat.
Performance tip: Hermes free models are often slow. For everyday use prefer Ollama, OpenAI, Claude, Google, or Cursor Agents.
That panel writes the same promptRewriter.* User settings as the Command Palette helpers.
Cursor Agent CLI integration
This extension reuses the Cursor Agent CLI already on the machine (agent / cursor-agent). It does not call Cursor HTTP APIs directly and does not add @cursor/sdk.
| Cursor CLI capability reused | How Prompt Rewriter uses it |
| --- | --- |
| agent models | Live model catalog for Cursor Agents in Setup / Select Active Model |
| agent -p --mode ask --model … | F6–F12 / clipboard rewrite-expand completions (read-only ask mode) |
Prerequisites:
- Install Cursor CLI so
agentis onPATH(Cursor CLI docs). - Authenticate once:
agent login(or setCURSOR_API_KEY/ optionalpromptRewriter.cursorApiKey). - Setup → Cursor Agents → Refresh models → pick e.g.
composer-2.5→ Save & apply.
The extension never runs agent login itself (that can open a browser).
Hermes Agent integration
This extension reuses existing Hermes Agent solutions already on the machine. It does not vendor Hermes source, add npm dependencies, or call Hermes cloud APIs.
| Hermes solution reused | How Prompt Rewriter uses it |
| --- | --- |
| Local Ollama model catalog (GET /api/tags) | Command Select Ollama Model — same listing path Hermes uses for local Ollama |
| hermes config get model.default / model.provider / model.base_url | Command Import Hermes Model Settings — syncs Hermes primary Ollama/custom model into promptRewriter.ollamaModel and promptRewriter.ollamaBaseUrl |
| ~/.hermes/skills/<name>/SKILL.md | Slash-skill resolution also searches Hermes user skills (after workspace / ~/.agents / ~/.cursor / ~/.claude skills) |
Select Ollama Model
- Ensure Ollama is running (
ollama list). - Command Palette → Prompt Rewriter: Select Ollama Model.
- Pick a model. It is stored in User settings as
promptRewriter.ollamaModel.
Import Hermes Model Settings
Prerequisites: Hermes Agent CLI on PATH (hermes --version), with a local primary model (provider: custom or ollama, typically http://localhost:11434/v1).
- Command Palette → Prompt Rewriter: Import Hermes Model Settings.
- The extension runs
hermes config getformodel.default,model.provider, andmodel.base_url. - It strips Hermes’ OpenAI-compatible
/v1suffix so the rewriter can keep using Ollama’s native/api/chat. - Values are written to User settings (
promptRewriter.ollamaModel,promptRewriter.ollamaBaseUrl).
If Hermes primary provider is cloud-only (for example nvidia / Nous), import is refused — switch Hermes to Ollama with hermes model first, or use Select Ollama Model.
The extension never reads ~/.hermes/.env or auth.json.
Test free Hermes/Nous models (Longcat, etc.)
Hermes can expose Nous Portal models through a local OpenAI-compatible proxy. With promptRewriter.backend set to openaiCompatible, F6/F7/F8/F9/F10/F12, Rewrite Clipboard, and Rewrite Prompt all use that endpoint.
- Ensure Nous Portal is logged in (
hermes status→ Nous Portal ✓). - Start the proxy (leave it running):
hermes proxy start --provider nous --host 127.0.0.1 --port 8645- Command Palette → Prompt Rewriter: Select LLM Backend →
openaiCompatible. - Command Palette → Prompt Rewriter: Select Active Model → pick e.g.
meituan/longcat-2.0:free(lists:freeids from the proxy). - Or set settings directly:
| Setting | Example |
| --- | --- |
| promptRewriter.backend | openaiCompatible |
| promptRewriter.baseUrl | http://127.0.0.1:8645/v1 |
| promptRewriter.model | meituan/longcat-2.0:free |
| promptRewriter.apiKey | unused (the proxy attaches the real Nous credential) |
Other free IDs: stepfun/step-3.7-flash:free, upstage/solar-pro4:free.
- Use F6 / F7 / F8 / F9 / F10 / F12 in Cursor chat, or Rewrite Prompt on a selection.
To go back to local Ollama: Select LLM Backend → ollama, then Select Active Model (or Select Ollama Model).
Note: promptRewriter.ollamaTimeoutMs is the shared request timeout for both backends.
Architecture note: model discovery is a ModelCatalog port (src/application/ModelCatalog.ts) with an Ollama adapter (src/llm/listOllamaModels.ts). Hermes config mapping lives in src/hermes/ (pure map + CLI adapter) so application commands stay free of Hermes/HTTP details.
Run locally (Extension Development Host)
npm install
npm run compileThen, in VS Code or Cursor, open this folder and start Run Extension from the Run and Debug view (F5). A new Extension Development Host window opens with Prompt Rewriter loaded.
Run lint, typecheck, and tests
npm run lint
npm run typecheck
npm testWatch mode for compilation:
npm run watchVersioning and release
This project uses Semantic Versioning with package.json as the single source of truth. Notable changes go in CHANGELOG.md (Keep a Changelog).
While the major version is 0, treat breaking command/setting changes as a minor bump (or major if you prefer a hard break). Otherwise:
| Change | Command |
| --- | --- |
| Fix / docs / tests only | npm run release:patch |
| New compatible command, setting, or capability | npm run release:minor |
| Breaking change | npm run release:major |
Release flow:
- Move notes from
## [Unreleased]inCHANGELOG.mdinto## [X.Y.Z] - YYYY-MM-DDfor the next version (the one the bump will create). - Commit that changelog edit (working tree must be clean before the bump).
- Run
npm run release:patch,npm run release:minor, ornpm run release:major. - That runs typecheck/tests, bumps
package.json+package-lock.json, verifies the changelog section, creates commitchore(release): X.Y.Zand tagvX.Y.Z, then packages the.vsixunderversions/.
Do not edit version by hand in feature commits. Use the release scripts only.
How to use
Rewrite the current input (Cursor chat, macOS)
This is the main flow. It uses the standard clipboard API plus macOS keystrokes (osascript). It does not use Cursor-internal APIs and never presses Enter.
It rewrites only the prompt text. F8 uses slash skills (SKILL.md), architecture defaults, and a bounded 6,000-character view of workspace .cursor/rules plus configured root docs to ground the expert role and wording. It deliberately skips chat history, the docs folder, and global rules so transcripts or heavy documentation cannot replace the operator's task. @ mentions and attachment placeholders are preserved; slash skills are kept on leading lines after replace.
Pressing F8 again on its own output starts a refinement pass. If the model returns the same prompt, the extension performs one compact repair that improves precision, traceability, actionability, or verifiability without changing scope.
- Start Ollama. This workspace is configured for
qwen2.5-coder:7b. - Grant Accessibility access if macOS asks: System Settings → Privacy & Security → Accessibility → enable Cursor.
- Focus the Cursor chat input and type a prompt. Do not send it.
- Keep the cursor in the chat input and press Ctrl+Shift+Alt+P or F8.
- Wait until the input text is replaced. A notification confirms it. The message is not sent.
The Cursor chat input often swallows regular shortcuts, including Ctrl+Cmd+H. That is why the default is now Ctrl+Shift+Alt+P (and F8 as a fallback).
Cmd+H is not used: on macOS that shortcut hides the application. Cmd+Shift+H is Replace in Files.
If nothing happens, open View → Output, choose Prompt Rewriter, and check the log. Also enable System Settings → Privacy & Security → Accessibility → Cursor.
Do not run this command from the Command Palette while testing the chat: the palette steals focus, so the extension can no longer see the chat text.
If the focused input is empty, the extension shows an error and does not call Ollama. If Ollama or the keystroke step fails, the original input text is left in place.
F6–F12 replace the focused chat input in place (Accessibility write, or Cmd+A / Cmd+V paste). Keep the chat input focused while the model runs for best results.
Expand the current input (faithful prompt engineer, macOS)
Same capture/replace flow as Rewrite Current Input, with the same shared context stack (last chat, skills, rules/docs, architecture defaults), but optimized for Cursor agents:
- Output format: Grill-with-Docs sections (
### Goal,### Constraints,### Non-Goals,### Acceptance Criteria). - Loads project context, in order: Cursor global rules (
~/.cursor/rules),promptRewriter.contextFolder(default.cursor/rules), root docs (AGENTS.md,README.md,.cursorrules), thenpromptRewriter.docsFolder(defaultdocs). - When the input includes slash skills (for example
/grill-with-docs), Expand loads matchingSKILL.mdfiles from workspace/user skill folders — including Hermes~/.hermes/skills— and nested/skillreferences, then builds the prompt from what those skills expect. - Slash skills are kept on leading lines of the expanded text so the invocation remains visible after replace.
- Also loads chat history from Cursor agent transcripts — the current conversation in full (user + assistant turns) plus older project transcripts when the character budget allows (toggle with
promptRewriter.includeLastChatResponse) so follow-up prompts can reference prior context. - Cursor global rules are injected into the Expand LLM context and must be reflected as Constraints so expanded prompts carry them implicitly.
- When project documentation is present, Expand instructs the model to put relevant doc requirements into Constraints / Acceptance Criteria (without inventing product scope from the docs).
- Always injects built-in SOLID + hexagonal defaults for software tasks (disable with
promptRewriter.includeArchitectureDefaults: false). - Forbids inventing stacks, features, examples, or speculative gaps.
- Put global Cursor rules in
~/.cursor/rules; put project rules in.cursor/rulesand optional docs indocs//AGENTS.md/README.md. - Optionally include a slash skill such as
/grill-with-docs(skills live under.agents/skills,.cursor/skills,~/.agents/skills, or Hermes~/.hermes/skills). - Focus the Cursor chat input and type a rough prompt. Do not send it.
- Press Ctrl+Shift+Alt+E or F9.
- Review the expanded text in the input. The message is not sent.
- If a slash skill appears as plain text (not a teal chip), re-select it from Cursor’s skill menu so it is marked again — the extension cannot recreate Cursor’s chip UI.
Use Rewrite when you only want cleaner wording. Use Expand when you want a longer agent-ready Grill-with-Docs prompt.
Suggest the next prompt from chat context (macOS)
Uses chat history from agent transcripts plus the same bounded project identity as F8, then replaces the input with only the ready-to-send next prompt. F12 includes workspace .cursor/rules, configured root docs, and architecture defaults within 6,000 characters; it skips the docs folder and Cursor global rules. F8 additionally skips chat history so rewrite cannot invent a different task from transcripts.
- Have at least one prior assistant reply in the current Cursor chat.
- Focus the chat input (it may be empty, or contain a short continue hint).
- Press Ctrl+Shift+Alt+N or F12.
- Review the suggested next prompt in the input. The message is not sent.
If Ollama times out, raise promptRewriter.ollamaTimeoutMs or switch promptRewriter.ollamaModel to qwen2.5-coder:7b (large models like 32b often exceed 60s with long context).
Expand the current input as JSON (macOS)
Same behavior as Expand Current Input (Cursor global rules, rules folder, root docs, docs folder, SOLID/hexagonal defaults, faithful expansion), but the result is pretty-printed JSON:
{
"expert_role": "Act as a …",
"goal": "...",
"constraints": ["..."],
"non_goals": ["..."],
"acceptance_criteria": ["..."]
}- Focus the Cursor chat input and type a rough prompt. Do not send it.
- Press Ctrl+Shift+Alt+J or F10.
- Review the JSON in the input. The message is not sent.
Expand the current input as a loop (macOS)
Same capture/replace flow and shared context stack as Expand Current Input (F9), but the result is a loop structure (iteration instructions to repeat work until done), not a one-shot prompt. It writes the loop into the chat input; it does not execute the loop.
- Output format: Grill-with-Docs sections (
### Goal,### Loop,### Constraints,### Non-Goals,### Acceptance Criteria). ### Loopis included only when the input already has iteration details (what to repeat, when to stop, cadence). Interval, cadence, and stop conditions are not invented.
- Focus the Cursor chat input and type a rough request. Do not send it.
- Press F7.
- Review the loop in the input. The message is not sent.
Expand the current input as a JSON loop (macOS)
Same behavior as Expand Current Input (Loop) (F7), but the result is pretty-printed JSON:
{
"expert_role": "Act as a …",
"goal": "...",
"loop": ["..."],
"constraints": ["..."],
"non_goals": ["..."],
"acceptance_criteria": ["..."]
}loop is omitted when the input has no iteration details.
- Focus the Cursor chat input and type a rough request. Do not send it.
- Press F6.
- Review the JSON loop in the input. The message is not sent.
Rewrite a selection in the editor
- Configure
promptRewriter.apiKey,promptRewriter.baseUrl, andpromptRewriter.model. - Select the prompt text in the editor.
- Run Rewrite Prompt from the Command Palette, or press
Ctrl+Alt+Shift+R(Cmd+Alt+Shift+Ron macOS). - Review the original vs rewritten diff.
- Choose Accept to replace the selection, or Cancel to keep the original text.
If nothing is selected, the extension shows a warning and does not call the LLM.
Rewrite a prompt from any text field, including Cursor chat
This command uses only the standard VS Code clipboard API. It does not use Cursor-internal APIs and does not type into the chat input.
- Start Ollama and pull a Qwen model if needed (
ollama pull qwen2.5-coder:7b). - Optionally set
promptRewriter.ollamaBaseUrlandpromptRewriter.ollamaModel. - Write the prompt in any text field, including the Cursor chat input.
- Copy the text to the clipboard (
Cmd+CorCtrl+C). - Run Rewrite Clipboard Prompt from the Command Palette, or press
Ctrl+Alt+Shift+C(Cmd+Alt+Shift+Con macOS). - Wait for the notification that the rewritten prompt is ready.
- Paste it manually (
Cmd+VorCtrl+V).
If the clipboard is empty, the extension shows an error and does not call Ollama. If Ollama fails, the original clipboard text is left unchanged.
Keyboard shortcuts
| Command | Default shortcut | Context |
| --- | --- | --- |
| Rewrite Current Input | Ctrl+Shift+Alt+P or F8 | Global. Strict cleaner |
| Expand Current Input | Ctrl+Shift+Alt+E or F9 | Global. Faithful prompt engineer (markdown) |
| Expand Current Input (JSON) | Ctrl+Shift+Alt+J or F10 | Global. Same expand, JSON output |
| Expand Current Input (Loop) | F7 | Global. Same expand as F9, writes a loop structure |
| Expand Current Input (Loop JSON) | F6 | Global. Same loop as F7, JSON output |
| Suggest Next Prompt | Ctrl+Shift+Alt+N or F12 | Global. Next ready-to-send prompt from last chat |
| Rewrite Prompt | Ctrl+Alt+Shift+R (macOS: Cmd+Alt+Shift+R) | Editor focused |
| Rewrite Clipboard Prompt | Ctrl+Alt+Shift+C (macOS: Cmd+Alt+Shift+C) | Global |
To change a shortcut:
- Open Keyboard Shortcuts.
- Search for
Rewrite PromptorRewrite Clipboard Prompt. - Assign a new keybinding.
Environment variables and secrets
This extension does not read .env files or environment variables. Configure the API key through promptRewriter.apiKey in editor settings. Never commit real secrets.
License
MIT
