@infosuweb/prompt-rewriter 0.14.5 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ - No changes yet.
11
+
12
+ ## [0.16.0] - 2026-11-30
13
+
14
+ - GitLab CI job `publish-npm` publishes to npm from git tags with `NPM_TOKEN` (branch pipelines stay package/Pages only); architecture and distribution docs match that path.
15
+ - F6/F7: when analysis selects no project-doc sections, research still attaches related excerpts via keyword/path fallback (including Speckit/constitution paths when the questions name them); `no-related-docs` only when nothing matches.
16
+ - F6/F7: domain rules and Limits that settle open question conditions (for example “must not fork” when that was only a `sin`/`without` condition) are rejected so the unsettled point stays under Abierto / Evidence limits.
17
+ - F6/F7 web research on OpenAI now sets `tool_choice` to `required`, so the model must run `web_search` instead of answering from memory with no sources. A search that returns pages clears the single-source gap when project docs were also selected.
18
+ - F6/F7 research fidelity: open questions and gaps must not be rewritten as settled domain rules or Limits. Analysis is normalized to **Preguntado** / **Asumido** / **Falta** / **Decidir**. Evidence limits always come from real gaps when present; Hallazgos stay `ninguno` when there are no source-backed findings (no paraphrasing the request).
19
+ - F6/F7: when the model writes free prose in process learning without the four labels, the extension fills **Hallazgos** / **Contradicciones** / **Límites de la evidencia** / **Abierto** (or English) from evidence or "ninguno", so small local models no longer fail validation on that section. Repair rules now show the exact bullet template.
20
+ - F6/F7 research modes use XML user-prompt framing (like F8/F12) and lean F8-style project context, so local models no longer fail by echoing `## User request`. A leading echoed framing block that only restates the operator input is stripped. Framing errors say "Research prompt" instead of "Rewrite". New setting `promptRewriter.ollamaNumCtx` (default 8192) is sent to Ollama as `options.num_ctx` for every Ollama command.
21
+ - **Breaking:** F6 and F7 no longer write a Spec Kit `/speckit-plan`. They are now research commands, **Research Current Input (Prompt)** (F6, six F8 parts) and **Research Current Input (Spec)** (F7, eight F9 parts). Both start from the operator's questions, consult the related project docs and the backend's native web search in parallel, and append a research record (`## Investigación` / `## Research`): starting questions, analysis of the request, sources consulted, and process learning (findings, contradictions, evidence limits, open items). Only the questions are sent to web search, with URLs, e-mail addresses, mentions, chip tokens and the project's own names removed. Questions and sources are written by the extension, so no URL is invented; unknown URLs, plan sections, JSON, and added role lines are rejected or removed. Command ids and the F6/F7 keys are unchanged. New settings `promptRewriter.researchPromptSystemPromptRules` and `promptRewriter.researchSpecSystemPromptRules`; `loopSystemPromptRules` and `loopJsonSystemPromptRules` are deprecated and ignored.
22
+ - F9 Specify and F10 Specify JSON write the same eight-part specification (Introducción, Objetivos del Negocio, Escenarios de Usuario y Pruebas, Requisitos Funcionales `RF#`, Requisitos No Funcionales `RNF#`, Suposiciones, Entidades Clave, Límites); F8 stays six-part; F10 has no `expert_role`.
23
+ - F8 writes the six-part clarified request without a persona, and the method note goes to the output log.
24
+ - Rules panel and setting descriptions for F8/F9/F10 match the six-part / eight-part contracts (no persona; method note to the Output log).
25
+ - Raise the default completion budget to 8192 and retry once when gpt-5-class models return empty text after spending `max_completion_tokens` on reasoning (F9 empty rewrite).
26
+ - F9 accepts numbered/Spanish/level-3 part headings and names the missing part in the repair error instead of rejecting a complete specification for heading shape alone.
27
+ - F8 surfaces a failure after a second failed repair (except unchanged refinements); named limit technologies stay under Limits; part order is enforced; Specify strict rules no longer mention persona; empty research source titles log as URL-only.
28
+
29
+ ## [0.15.0] - 2026-11-27
30
+
31
+ ### Added
32
+
33
+ - F8 analyzes the request against the project docs before rewriting it. It indexes the workspace rules, README/AGENTS/CLAUDE, the extension manifest (commands with their keys, settings, npm scripts), `specs/`, the docs folder and the CHANGELOG by section; one model call picks the sections the input concerns (shared with the expert-research subject detection), and the rewrite reads those sections in full instead of the first 6,000 characters of the root docs. The rewrite may now name what the input refers to with the project's exact term (for example "F12 (Suggest Next Prompt)" or `promptRewriter.model`), without adding tasks. The selected sections are listed in the Output log. If the analysis fails, F8 falls back to the previous lean context. Setting: `promptRewriter.rewriteProjectAnalysis` (default on).
34
+ - F8 detects the subject of the request (from the operator text, the last chat reply and the project summary) and uses the backend's native web search (OpenAI Responses `web_search`, Anthropic web search, Gemini Google Search grounding) to find how practitioners of that subject approach the task and which tools they use. It appends a short block ("Cómo lo abordaría un experto en …" / "How an expert in … would approach it") with the method and only the tools the workspace already has. The sources and the recommended tools the workspace lacks go to the Output log only. The method is tailored to the project: a local profile (project type, publish settings, whether CI publishes, public stack names, and npm scripts with their commands, with the project's own package names, URLs and e-mail addresses removed) goes with the research, so steps name the project's own scripts and tools (for example `npm run publish:npm` instead of generic `npm publish` advice). The operator text is never sent, and search queries carry only the general practice for the stack. When the input asks how this project does something ("¿cómo se despliega este proyecto en npm?"), the analysis marks it as project-scoped: the research also receives the selected doc sections (own package name redacted, then restored in the result) as the primary source, and the block is titled "Cómo se hace en este proyecto (…)" / "How this project does it (…)" and follows the documented procedure, with web sources only adding checks the docs leave out. The last reply is read from the most recently active Cursor or Claude Code chat of the workspace. If the backend has no web search (Ollama, OpenAI-compatible, Cursor Agents), the search finds no sources, or it fails, the block is omitted. Results are cached per subject for 24 hours. Pressing F8 again replaces the block instead of duplicating it. Even a single word is researched when it names a task ("tests", "despliega"), resolved against the last chat reply; conversational input (status questions, acknowledgements, reactions) gets no block. The block follows the operator language as judged by the detector. Setting: `promptRewriter.rewriteExpertResearch` (default on).
35
+
36
+ ### Changed
37
+
38
+ - F8 no longer adds an expert role or persona line (`Act as …`). A role line the operator wrote is kept as their text; one the model adds is removed.
39
+ - When the prompt is already clear and the model returns it unchanged, F8 now keeps the operator text instead of failing.
40
+
41
+ ### Fixed
42
+
43
+ - F6–F12 no longer treat a normal sentence that mentions an error ("me ha dado este error", "the error message is wrong") as a pasted console log. Such lines were hidden from the model as a placeholder, so F8 could return an invented request ("Address the request identified by …"). Only log-shaped text (`Error:`, `TypeError`, stack frames, timestamps, `[error]`, error codes) is protected now, and F8 stops with a message when the input is only attachments, mentions, or pasted logs.
44
+ - F6–F12 recognize Spanish role lines (`Actúa como …`), so a prompt that already has a role no longer gets a second one; when two role lines appear, the operator's own is kept.
45
+ - F6–F12 no longer overwrite another field when focus moves during a transform: the result is left on the clipboard with a warning instead (only when the captured chat input can be fingerprinted; otherwise behavior is unchanged).
46
+ - F6–F12 no longer rewrite stale clipboard content when Cmd+C copies nothing; the user's clipboard is restored in that case.
47
+ - Pressing F6–F12 again while a transform is running is ignored with a warning instead of starting a second, racing transform.
48
+
10
49
  ## [0.14.5] - 2026-11-01
11
50
 
12
51
  ### Added
package/README.md CHANGED
@@ -11,11 +11,11 @@ Independent commands:
11
11
 
12
12
  | Command | Shortcut | Description |
13
13
  | --- | --- | --- |
14
- | **Rewrite Current Input** | **F8** | Turns the input into one coherent statement of the same idea, without a new task, 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. |
15
- | **Specify Current Input** | **F9** | Writes a complete Spec Kit `/speckit-specify` feature specification (`spec.md`: user story with Why/Independent Test/Given/When/Then, `FR-###`, `SC-###`, Assumptions) after F8 clarifies the intent. Starts with a context-grounded `Act as a …` expert role. Uses rules/docs/architecture as bounds; **always skips chat history**. Does not write plan, tasks, or implementation. |
16
- | **Specify Current Input (JSON)** | **F10** | Same `/speckit-specify` content as F9 Specify, as structured JSON (`expert_role`, stories, `FR-###`, `SC-###`, assumptions). Also skips chat history. |
17
- | **Expand Current Input (Plan)** | **F7** | Writes a Spec Kit `/speckit-plan` implementation plan (`Summary`, `Technical Context`, `Constitution Check`). Does not write tasks or execute the plan. |
18
- | **Expand Current Input (Plan JSON)** | **F6** | Same `/speckit-plan` as F7, as structured JSON. |
14
+ | **Rewrite Current Input** | **F8** | Clarifies the same task into six parts in order (system context, what it does, actor, use cases, domain rules, limits). Adds no persona line. APIs and a main entity appear only when the draft already supports them. 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. Method research goes to the Output log, not the chat field. Repeating F8 must produce a material refinement rather than the same result. |
15
+ | **Specify Current Input** | **F9** | Writes an eight-part feature specification (introduction, business objectives, user scenarios and testing, functional requirements `RF#`, non-functional requirements `RNF#`, assumptions, key entities, limits). Does not run F8 and does not start with `Act as …`. Uses rules/docs as bounds; **always skips chat history** and built-in architecture defaults. Does not write plan, tasks, or implementation. |
16
+ | **Specify Current Input (JSON)** | **F10** | Same eight parts as F9 Specify, as structured JSON (no `expert_role`). Also skips chat history. |
17
+ | **Research Current Input (Spec)** | **F7** | Researches the questions in the input (related project docs, web search, model knowledge) and writes the eight-part F9 specification plus a research record: starting questions, analysis of the request, sources consulted, and process learning. Does not plan, send, or run anything. |
18
+ | **Research Current Input (Prompt)** | **F6** | Same research as F7, written as the six F8 prompt parts plus the research record. |
19
19
  | **Suggest Next Prompt** | **F12** | Uses chat history plus bounded project identity to propose the next ready-to-send agent prompt (Spec Kit plan/tasks/implement/converge when the chat is in SDD; otherwise a concrete repo action). |
20
20
  | **Rewrite Prompt** | — | Rewrites the current editor selection and shows a diff before replacing it. |
21
21
  | **Rewrite Clipboard Prompt** | — | Rewrites the current clipboard text and copies the result back for a manual paste. |
@@ -25,7 +25,7 @@ Independent commands:
25
25
  | **Select Ollama Model** | — | Lists local Ollama models only (same `GET /api/tags` catalog Hermes uses) and saves `promptRewriter.ollamaModel`. |
26
26
  | **Import Hermes Model Settings** | — | Copies Hermes Agent’s primary local model (`hermes config get model.*`) into Prompt Rewriter Ollama settings. |
27
27
 
28
- 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.
28
+ F12 enforces a specific expert role. F6/F7, F8 and F9/F10 do not add a persona. Every F6–F12 transformation 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.
29
29
 
30
30
  ## Prerequisites
31
31
 
@@ -179,19 +179,21 @@ Open **Settings** and set:
179
179
  | `promptRewriter.ollamaBaseUrl` | Local Ollama server used when `backend` is `ollama`. Default: `http://localhost:11434` |
180
180
  | `promptRewriter.ollamaModel` | Ollama model used by those commands. Default: `qwen2.5-coder:7b` |
181
181
  | `promptRewriter.ollamaTimeoutMs` | Ollama request timeout in ms. Default: `180000` (3 minutes) |
182
+ | `promptRewriter.ollamaNumCtx` | Context window sent to Ollama as `options.num_ctx` for every Ollama command. Default: `8192`. Raise it if local models truncate long prompts. |
182
183
  | `promptRewriter.contextFolder` | Workspace-relative folder of rules/context for **F6-F12**. Default: `.cursor/rules` |
183
- | `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` |
184
+ | `promptRewriter.includeGlobalCursorRules` | When true, **F9/F10** load Cursor global/user rules from `~/.cursor/rules`. **F6/F7 Research** and **F8/F12** always skip global rules (lean context). Default: `true` |
184
185
  | `promptRewriter.disabledGlobalCursorRuleFiles` | Global rule file names under `~/.cursor/rules` excluded from F6/F7/F9/F10 even when global rules are enabled. Default: `[]` |
185
186
  | `promptRewriter.disabledContextRuleFiles` | Workspace rule file names (relative to `contextFolder`) excluded from F6-F12. Default: `[]` |
186
- | `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` |
187
- | `promptRewriter.docsFolder` | Docs folder for **F6/F7/F9/F10** (`.md`/`.mdc`/`.txt`). Default: `docs`. Empty disables it. **F8/F12** always skip the docs folder. |
188
- | `promptRewriter.includeArchitectureDefaults` | When true, F6-F12 inject built-in SOLID + hexagonal constraints for software work. Default: `true` |
189
- | `promptRewriter.includeLastChatResponse` | When true, **F6/F7 Plan** include full chat history from Cursor agent transcripts (current conversation turns + older transcripts when budget allows). **F9/F10 Specify** always skip chat history. **F8** always skips chat history (lean rewrite). **F12** always loads it. Default: `true` |
190
- | `promptRewriter.rewriteSystemPromptRules` | Custom system prompt for **F8 Rewrite**. Empty uses the built-in rules (one coherent statement of the same idea, without a new task) and always prefixes a context-grounded expert agent persona. Editable in the Rules tab. |
191
- | `promptRewriter.expandSystemPromptRules` | Custom system prompt for **F9 Specify**. Empty uses the built-in complete `/speckit-specify` feature specification (after F8) with a context-grounded `Act as a …` expert role line. Editable in the Rules tab. |
192
- | `promptRewriter.expandJsonSystemPromptRules` | Custom system prompt for **F10 Specify JSON**. Empty uses built-in Spec Kit `/speckit-specify` JSON rules with required `expert_role` (`Act as a …`). Editable in the Rules tab. |
193
- | `promptRewriter.loopSystemPromptRules` | Custom system prompt for **F7 Plan**. Empty uses built-in Spec Kit `/speckit-plan` rules with a context-grounded `Act as a …` expert role line. Editable in the Rules tab. |
194
- | `promptRewriter.loopJsonSystemPromptRules` | Custom system prompt for **F6 Plan JSON**. Empty uses built-in Spec Kit `/speckit-plan` JSON rules with required `expert_role` (`Act as a …`). Editable in the Rules tab. |
187
+ | `promptRewriter.includeRootDocs` | When true, current-input modes load `AGENTS.md`, `README.md`, and `.cursorrules`; **F6/F7 Research** and **F8/F12** include them only within their bounded 6,000-character lean context. Default: `true` |
188
+ | `promptRewriter.docsFolder` | Docs folder for **F9/F10** (`.md`/`.mdc`/`.txt`). Default: `docs`. Empty disables it. **F6/F7 Research** and **F8/F12** always skip the docs folder (F6/F7 still load related sections through research evidence). |
189
+ | `promptRewriter.includeArchitectureDefaults` | When true, F8 and F12 inject built-in SOLID + hexagonal constraints for software work. **F6/F7 Research** and **F9/F10 Specify** skip them. Default: `true` |
190
+ | `promptRewriter.includeLastChatResponse` | Chat history from Cursor agent transcripts. **F6/F7 Research** and **F9/F10 Specify** always skip chat history. **F8** always skips chat history (lean rewrite). **F12** always loads it. Default: `true` |
191
+ | `promptRewriter.rewriteSystemPromptRules` | Custom system prompt for **F8 Rewrite**. Empty uses the built-in six-part clarified request (no persona). Custom rules still must pass the six-part and mechanism checks. Editable in the Rules tab. |
192
+ | `promptRewriter.expandSystemPromptRules` | Custom system prompt for **F9 Specify**. Empty uses the built-in eight-part specification without a persona and without running F8 first. Custom rules still must pass the eight-part checks. Editable in the Rules tab. |
193
+ | `promptRewriter.expandJsonSystemPromptRules` | Custom system prompt for **F10 Specify JSON**. Empty uses built-in JSON for the same ten parts as F9 (no `expert_role`). Editable in the Rules tab. |
194
+ | `promptRewriter.researchSpecSystemPromptRules` | Custom system prompt for **F7 Research Spec**. Empty uses the built-in rules (eight F9 parts plus the research record, no persona line). Editable in the Rules tab. |
195
+ | `promptRewriter.researchPromptSystemPromptRules` | Custom system prompt for **F6 Research Prompt**. Empty uses the built-in rules (six F8 parts plus the research record, no persona line). Editable in the Rules tab. |
196
+ | `promptRewriter.loopSystemPromptRules`, `promptRewriter.loopJsonSystemPromptRules` | **Deprecated and ignored** since 0.16.0 (they configured the old F7/F6 Spec Kit plan). Each F6/F7 run notes in the Output channel when they still hold a value. |
195
197
 
196
198
  - Prefer **User** settings over **Workspace** settings so the API key is not stored in the repository.
197
199
  - **Save & apply** writes User settings and clears any Workspace overrides for the same keys, so F6–F12 match the panel.
@@ -222,7 +224,7 @@ The simplest way to get F6–F12 working with the model you want:
222
224
  - **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/models` catalog.
223
225
  - **Cursor Agents** — Cursor Agent CLI (`agent`) in ask/print mode (Composer and account models).
224
226
  - **Compatible** — Hermes proxy / any OpenAI-compatible endpoint (free routes can be slow).
225
- - **Rules** — configure agent context settings; edit **F8 Rewrite / F9 Specify / F10 Specify JSON / F7 Plan / F6 Plan 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.
227
+ - **Rules** — configure agent context settings; edit **F8 Rewrite / F9 Specify / F10 Specify JSON / F7 Research Spec / F6 Research Prompt** 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.
226
228
  4. On **Setup**, pick a **Model** from the icon list (or type a custom id), then **Save & apply**.
227
229
  5. Use **F6** / **F7** / **F8** / **F9** / **F10** / **F12** in Cursor chat.
228
230
 
@@ -325,6 +327,8 @@ npm run typecheck
325
327
  npm test
326
328
  ```
327
329
 
330
+ `npm test` also runs `check:inventory`, which fails when a command, shortcut, or setting is not listed in [`specs/inventory.md`](specs/inventory.md).
331
+
328
332
  Watch mode for compilation:
329
333
 
330
334
  ```bash
@@ -349,6 +353,9 @@ Release flow:
349
353
  2. Commit that changelog edit (working tree must be clean before the bump).
350
354
  3. Run `npm run release:patch`, `npm run release:minor`, or `npm run release:major`.
351
355
  4. That runs typecheck/tests, bumps `package.json` + `package-lock.json`, verifies the changelog section, creates commit `chore(release): X.Y.Z` and tag `vX.Y.Z`, then packages the `.vsix` under `versions/`.
356
+ 5. Push the commit and tag. GitLab CI job `publish-npm` publishes `@infosuweb/prompt-rewriter` to npm from the tag using the masked CI/CD variable `NPM_TOKEN` (prerelease versions → dist-tag `rc`; stable → `latest`). Branch pipelines do not publish to npm.
357
+
358
+ Set `NPM_TOKEN` once in GitLab → Settings → CI/CD → Variables (masked, protected if tags are protected). No laptop `npm login` is required for the tag publish path.
352
359
 
353
360
  Do not edit `version` by hand in feature commits. Use the release scripts only.
354
361
 
@@ -358,7 +365,9 @@ Do not edit `version` by hand in feature commits. Use the release scripts only.
358
365
 
359
366
  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.
360
367
 
361
- 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.
368
+ It rewrites **only the prompt text** into the six parts (system context, what it does, actor, use cases, domain rules, limits) and adds no persona (`Act as …`) line. Before rewriting, F8 analyzes the request against the project docs: it indexes the workspace rules, `README.md`/`AGENTS.md`/`CLAUDE.md`, the extension manifest (commands with their keys, settings, npm scripts), `specs/`, the docs folder and `CHANGELOG.md` by section, and one model call picks the sections the input concerns. The rewrite reads those sections in full, so it can name what the input refers to with the project's exact term (for example "F12 (Suggest Next Prompt)" or `promptRewriter.model`) without adding tasks. Chat history is never used as the task; the last chat reply only helps resolve references. `@` mentions, attachment placeholders and pasted console logs are preserved; slash skills are kept on leading lines after replace.
369
+
370
+ After the rewrite, F8 can research how a practitioner would approach the subject (native web search on OpenAI Responses, Anthropic, or Gemini). The method note and its sources go to the **Prompt Rewriter Output log** only — they are absent from the chat field. Conversational input gets no note. Backends without native search omit it. Settings: `promptRewriter.rewriteProjectAnalysis`, `promptRewriter.rewriteExpertResearch`.
362
371
 
363
372
  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.
364
373
 
@@ -382,17 +391,17 @@ F6–F12 replace the focused chat input in place (Accessibility write, or Cmd+A
382
391
 
383
392
  ### Specify the current input (Spec Kit `/speckit-specify`, macOS)
384
393
 
385
- Same capture/replace flow as **Rewrite Current Input**, optimized as the F8→product-contract step for Cursor agents:
394
+ Same capture/replace flow as **Rewrite Current Input**, writing the specification directly (F9 does not run F8):
386
395
 
387
- - Output format: a complete Spec Kit `/speckit-specify` feature specification (`# Feature Specification`, non-empty `**Input**`, user story with **Why this priority**, **Independent Test**, Given/When/Then, `FR-###`, `SC-###`, `## Assumptions`). When the input is already an F8 rewrite (`Act as …` + coherent request), that request becomes `**Input**` and is specified — not re-compressed. No plan, tasks, or implementation.
388
- - Loads **bounds** context, in order: Cursor global rules (`~/.cursor/rules`), `promptRewriter.contextFolder` (default `.cursor/rules`), root docs (`AGENTS.md`, `README.md`, `.cursorrules`), then `promptRewriter.docsFolder` (default `docs`). Rules/docs/architecture go into Assumptions (or phrasing bounds) — not new product scope.
389
- - **Always skips chat history** (unlike F6/F7 Plan). F9/F10 ignore `promptRewriter.includeLastChatResponse`.
396
+ - Output format: an eight-part feature specification (`# Especificación de …`, Introducción, Objetivos del Negocio, Escenarios de Usuario y Pruebas with Actor/Precondición/steps/Postcondición, Requisitos Funcionales `RF#`, Requisitos No Funcionales `RNF#`, Suposiciones, Entidades Clave, Límites). An F8 six-part result used as input is specified as behavior — not compressed into one sentence. No persona line, plan, tasks, or implementation.
397
+ - Loads **bounds** context, in order: Cursor global rules (`~/.cursor/rules`), `promptRewriter.contextFolder` (default `.cursor/rules`), root docs (`AGENTS.md`, `README.md`, `.cursorrules`), then `promptRewriter.docsFolder` (default `docs`). Rules/docs go into Assumptions or Limits (or phrasing bounds) — not new product scope.
398
+ - **Always skips chat history**, like F6/F7 Research. F9/F10 ignore `promptRewriter.includeLastChatResponse`.
390
399
  - When the input includes slash skills (for example `/speckit-specify`), Specify loads matching `SKILL.md` files from workspace/user skill folders — including Hermes `~/.hermes/skills` — and nested `/skill` references, then builds the prompt from what those skills expect.
391
400
  - Slash skills are kept on leading lines of the specified text so the invocation remains visible after replace.
392
- - Always injects built-in **SOLID + hexagonal** defaults for software tasks into Assumptions (disable with `promptRewriter.includeArchitectureDefaults: false`).
393
- - Forbids inventing stacks, features, examples, or speculative gaps. Derive GWT/FR/SC only from `**Input**` plus bounds.
401
+ - Does **not** inject built-in architecture defaults (those remain for plan commands).
402
+ - Forbids inventing stacks, features, examples, or speculative gaps. Derive scenarios/RF/RNF/entities only from the input plus bounds.
394
403
 
395
- 1. Prefer F8 first so the chat input is a clarified request.
404
+ 1. Optional: run F8 first so the chat input is a six-part clarified request; F9 also accepts a rough one-task draft.
396
405
  2. Put global Cursor rules in `~/.cursor/rules`; put project rules in `.cursor/rules` and optional docs in `docs/` / `AGENTS.md` / `README.md`.
397
406
  3. Optionally include a slash skill such as `/speckit-specify` (skills live under `.agents/skills`, `.cursor/skills`, `~/.agents/skills`, or Hermes `~/.hermes/skills`).
398
407
  4. Focus the Cursor chat input. Do not send it.
@@ -400,7 +409,7 @@ Same capture/replace flow as **Rewrite Current Input**, optimized as the F8→pr
400
409
  6. Review the specification in the input. The message is not sent.
401
410
  7. 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.
402
411
 
403
- Use **Rewrite** (F8) when you only want a coherent statement of the same idea. Use **Specify** (F9) when you want a complete Spec Kit specification ready for a later `/speckit-plan` (F7) step.
412
+ Use **Rewrite** (F8) when you want the six-part clarified request. Use **Specify** (F9) when you want the eight-part specification. Use **Research** (F6/F7) when the input carries open questions that should be investigated first.
404
413
 
405
414
  ### Suggest the next prompt from chat context (macOS)
406
415
 
@@ -415,18 +424,21 @@ If Ollama times out, raise `promptRewriter.ollamaTimeoutMs` or switch `promptRew
415
424
 
416
425
  ### Specify the current input as JSON (macOS)
417
426
 
418
- Same `/speckit-specify` content as **Specify Current Input** (F9), but pretty-printed JSON:
427
+ Same eight parts as **Specify Current Input** (F9), but pretty-printed JSON (no `expert_role`):
419
428
 
420
429
  ```json
421
430
  {
422
- "expert_role": "Act as a …",
423
431
  "feature_name": "...",
424
432
  "status": "Draft",
425
433
  "input": "...",
426
- "user_stories": [{ "title": "...", "priority": "P1", "why": "...", "independent_test": "...", "acceptance_scenarios": ["Given … When … Then …"] }],
427
- "functional_requirements": ["FR-001: …"],
428
- "success_criteria": ["SC-001: …"],
429
- "assumptions": ["…"]
434
+ "introduction": "...",
435
+ "business_objectives": ["…"],
436
+ "user_scenarios": [{ "title": "...", "actor": "...", "precondition": "...", "steps": ["…"], "postcondition": "..." }],
437
+ "functional_requirements": ["RF1: …"],
438
+ "non_functional_requirements": ["RNF1: …"],
439
+ "assumptions": ["…"],
440
+ "key_entities": ["…"],
441
+ "limits": ["…"]
430
442
  }
431
443
  ```
432
444
 
@@ -434,35 +446,23 @@ Same `/speckit-specify` content as **Specify Current Input** (F9), but pretty-pr
434
446
  2. Press **Ctrl+Shift+Alt+J** or **F10**.
435
447
  3. Review the JSON in the input. The message is not sent.
436
448
 
437
- ### Expand the current input as a plan (macOS)
449
+ ### Research the current input (macOS)
438
450
 
439
- Same capture/replace flow as **Specify Current Input** (F9), plus chat history when enabled, but the result is a Spec Kit **`/speckit-plan`** implementation plan. It writes the plan into the chat input; it does not create `tasks.md` or execute the plan.
451
+ **F6** and **F7** start from the questions in the chat input (sentences ending in `?`, or lines such as `Dudas:` / `No sé …`). When there is no explicit question, the whole input is treated as the request.
440
452
 
441
- - Output format: `# Implementation Plan`, `## Summary`, `## Technical Context`, `## Constitution Check` (optional `## Project Structure`).
453
+ 1. Related project docs are selected with the same section analysis F8 uses.
454
+ 2. In parallel, the backend's native web search (OpenAI, Anthropic, Google) researches the questions. **Only the questions are sent**, after removing URLs, e-mail addresses, `@` mentions, chip tokens, and the project's own names. Backends without web search skip this step and the record says so.
455
+ 3. The model writes the artifact from that evidence:
456
+ - **F7 Research Spec**: the eight F9 parts plus `## Investigación` / `## Research`.
457
+ - **F6 Research Prompt**: the six F8 parts plus the same record.
442
458
 
443
- 1. Focus the Cursor chat input and type a rough request or paste an F9 specification. Do not send it.
444
- 2. Press **F7**.
445
- 3. Review the plan in the input. The message is not sent.
459
+ The research record has four subsections: starting questions and sources consulted (written by the extension, so no URL is invented), analysis of the request (what is asked, assumed, missing, and to be decided), and process learning (**Hallazgos**, **Contradicciones**, **Límites de la evidencia**, **Abierto**). Conflicting sources and unanswered questions stay open instead of being presented as settled. Findings shape the parts; they never become new tasks.
446
460
 
447
- ### Expand the current input as a JSON plan (macOS)
448
-
449
- Same behavior as **Expand Current Input (Plan)** (F7), but pretty-printed JSON:
450
-
451
- ```json
452
- {
453
- "expert_role": "Act as a …",
454
- "plan_name": "...",
455
- "status": "Draft",
456
- "input": "...",
457
- "summary": "...",
458
- "technical_context": ["…"],
459
- "constitution_check": ["…"]
460
- }
461
- ```
461
+ Both commands use lean project context like F8 (root docs within 6,000 characters; no chat history, no global rules, no docs folder as a bulk dump — related doc sections still arrive through research evidence), skip built-in architecture defaults, add no `Act as …` line, write no plan and no JSON, and never send the message or start an agent turn. The user prompt uses XML framing (not `## User request`) so local models are less likely to echo scaffolding. With Ollama, raise `promptRewriter.ollamaNumCtx` if long prompts are truncated.
462
462
 
463
- 1. Focus the Cursor chat input and type a rough request. Do not send it.
464
- 2. Press **F6**.
465
- 3. Review the JSON plan in the input. The message is not sent.
463
+ 1. Focus the Cursor chat input and type the request with your questions. Do not send it.
464
+ 2. Press **F7** (spec) or **F6** (prompt).
465
+ 3. Review the artifact in the input. The message is not sent.
466
466
 
467
467
  ### Rewrite a selection in the editor
468
468
 
@@ -495,8 +495,8 @@ If the clipboard is empty, the extension shows an error and does not call Ollama
495
495
  | **Rewrite Current Input** | `Ctrl+Shift+Alt+P` or `F8` | Global. Makes the same idea coherent |
496
496
  | **Specify Current Input** | `Ctrl+Shift+Alt+E` or `F9` | Global. Spec Kit specify (markdown) |
497
497
  | **Specify Current Input (JSON)** | `Ctrl+Shift+Alt+J` or `F10` | Global. Spec Kit specify (JSON) |
498
- | **Expand Current Input (Plan)** | `F7` | Global. Spec Kit plan (markdown) |
499
- | **Expand Current Input (Plan JSON)** | `F6` | Global. Spec Kit plan (JSON) |
498
+ | **Research Current Input (Spec)** | `F7` | Global. Research spec (eight parts + research record) |
499
+ | **Research Current Input (Prompt)** | `F6` | Global. Research prompt (six parts + research record) |
500
500
  | **Suggest Next Prompt** | `Ctrl+Shift+Alt+N` or `F12` | Global. Next Spec Kit–aware prompt from last chat |
501
501
  | **Rewrite Prompt** | `Ctrl+Alt+Shift+R` (macOS: `Cmd+Alt+Shift+R`) | Editor focused |
502
502
  | **Rewrite Clipboard Prompt** | `Ctrl+Alt+Shift+C` (macOS: `Cmd+Alt+Shift+C`) | Global |
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@infosuweb/prompt-rewriter",
3
3
  "displayName": "Prompt Rewriter",
4
4
  "description": "Rewrite a selected prompt so it is clearer and more precise, without adding new ideas.",
5
- "version": "0.14.5",
5
+ "version": "0.16.0",
6
6
  "publisher": "suweb",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -108,12 +108,12 @@
108
108
  },
109
109
  {
110
110
  "command": "promptRewriter.expandLoopCurrentInput",
111
- "title": "Expand Current Input (Plan)",
111
+ "title": "Research Current Input (Spec)",
112
112
  "category": "Prompt Rewriter"
113
113
  },
114
114
  {
115
115
  "command": "promptRewriter.expandLoopJsonCurrentInput",
116
- "title": "Expand Current Input (Plan JSON)",
116
+ "title": "Research Current Input (Prompt)",
117
117
  "category": "Prompt Rewriter"
118
118
  },
119
119
  {
@@ -289,7 +289,7 @@
289
289
  "promptRewriter.anthropicWorkspaceId": {
290
290
  "type": "string",
291
291
  "default": "",
292
- "description": "Anthropic workspace ID (wrkspc_…) required for identity-linked / multi-workspace API keys. Sent as the anthropic-workspace-id header."
292
+ "description": "Anthropic workspace ID (wrkspc_\u2026) required for identity-linked / multi-workspace API keys. Sent as the anthropic-workspace-id header."
293
293
  },
294
294
  "promptRewriter.googleApiKey": {
295
295
  "type": "string",
@@ -328,6 +328,13 @@
328
328
  "maximum": 600000,
329
329
  "description": "Timeout in milliseconds for Ollama requests used by current-input and clipboard commands. Default: 180000 (3 minutes)."
330
330
  },
331
+ "promptRewriter.ollamaNumCtx": {
332
+ "type": "number",
333
+ "default": 8192,
334
+ "minimum": 2048,
335
+ "maximum": 131072,
336
+ "description": "Context window size sent to Ollama as options.num_ctx for every Ollama command (F6\u2013F12, clipboard, selection). Default: 8192. Raise it if local models truncate long prompts."
337
+ },
331
338
  "promptRewriter.contextFolder": {
332
339
  "type": "string",
333
340
  "default": ".cursor/rules",
@@ -336,12 +343,12 @@
336
343
  "promptRewriter.includeRootDocs": {
337
344
  "type": "boolean",
338
345
  "default": true,
339
- "description": "When true, current-input transforms load AGENTS.md, README.md, and .cursorrules when present. F8/F12 include them only within their bounded lean context."
346
+ "description": "When true, current-input transforms load AGENTS.md, README.md, and .cursorrules when present. F6/F7 Research and F8/F12 include them only within their bounded lean context."
340
347
  },
341
348
  "promptRewriter.includeGlobalCursorRules": {
342
349
  "type": "boolean",
343
350
  "default": true,
344
- "description": "When true, F6/F7/F9/F10 load Cursor global/user rules from ~/.cursor/rules. F8/F12 always skip global rules."
351
+ "description": "When true, F9/F10 load Cursor global/user rules from ~/.cursor/rules. F6/F7 Research and F8/F12 always skip global rules."
345
352
  },
346
353
  "promptRewriter.disabledGlobalCursorRuleFiles": {
347
354
  "type": "array",
@@ -362,47 +369,71 @@
362
369
  "promptRewriter.docsFolder": {
363
370
  "type": "string",
364
371
  "default": "docs",
365
- "description": "Workspace-relative docs folder loaded by F6/F7/F9/F10 (.md/.mdc/.txt). Set empty to disable. F8/F12 always skip it."
372
+ "description": "Workspace-relative docs folder loaded by F9/F10 (.md/.mdc/.txt). Set empty to disable. F6/F7 Research and F8/F12 always skip it (F6/F7 still load related doc sections through research evidence)."
366
373
  },
367
374
  "promptRewriter.includeArchitectureDefaults": {
368
375
  "type": "boolean",
369
376
  "default": true,
370
- "description": "When true, F6-F12 include built-in SOLID and hexagonal architecture constraints for software tasks."
377
+ "description": "When true, F8 and F12 include built-in SOLID and hexagonal architecture constraints for software tasks. F6/F7 Research and F9/F10 Specify skip them."
371
378
  },
372
379
  "promptRewriter.includeLastChatResponse": {
373
380
  "type": "boolean",
374
381
  "default": true,
375
- "description": "When true, Plan modes (F6/F7) include chat history from Cursor agent transcripts: the current conversation (user + assistant turns) plus older project transcripts when the character budget allows. F9/F10 Specify always skip chat history. F8 Rewrite always skips chat history. F12 Suggest Next always loads it."
382
+ "description": "Chat history from Cursor agent transcripts. F6/F7 Research and F9/F10 Specify always skip chat history. F8 Rewrite always skips chat history. F12 Suggest Next always loads it."
383
+ },
384
+ "promptRewriter.rewriteProjectAnalysis": {
385
+ "type": "boolean",
386
+ "default": true,
387
+ "description": "F8 analyzes the request before rewriting it: it indexes the project docs (workspace rules, README/AGENTS/CLAUDE, the extension manifest, specs/, the docs folder, CHANGELOG), asks the model which sections the input concerns, and rewrites with those sections in full instead of the first part of the root docs. Adds one model call (shared with the expert research subject detection)."
388
+ },
389
+ "promptRewriter.rewriteExpertResearch": {
390
+ "type": "boolean",
391
+ "default": true,
392
+ "description": "When true, Rewrite Current Input (F8) detects the subject of the request (also using the last chat reply), searches the web with the backend's native search (OpenAI, Anthropic or Gemini) for how an expert in that subject approaches the task and which tools they use, and writes the method note to the Prompt Rewriter Output log (not the chat field). Only tools present in the workspace are listed. Only the detected subject is sent to the search, never the prompt text. Skipped when the backend has no web search."
376
393
  },
377
394
  "promptRewriter.rewriteSystemPromptRules": {
378
395
  "type": "string",
379
396
  "default": "",
380
397
  "editPresentation": "multilineText",
381
- "description": "Custom system prompt for Rewrite Current Input (F8). When empty, the built-in rules make the same idea coherent without a new task, and always prefix a context-grounded expert agent persona. Editable from the Rules tab."
398
+ "description": "Custom system prompt for Rewrite Current Input (F8). When empty, the built-in rules write the six-part clarified request (system context, what it does, actor, use cases, domain rules, limits) with no persona line. Editable from the Rules tab."
382
399
  },
383
400
  "promptRewriter.expandSystemPromptRules": {
384
401
  "type": "string",
385
402
  "default": "",
386
403
  "editPresentation": "multilineText",
387
- "description": "Custom system prompt for Specify Current Input (F9). When empty, the built-in rules write a complete spec-kit /speckit-specify feature specification (spec.md) after F8, with a context-grounded Act as a … expert role line. Editable from the Rules tab."
404
+ "description": "Custom system prompt for Specify Current Input (F9). When empty, the built-in rules write the eight-part feature specification without running F8 and without a persona line. Editable from the Rules tab."
388
405
  },
389
406
  "promptRewriter.expandJsonSystemPromptRules": {
390
407
  "type": "string",
391
408
  "default": "",
392
409
  "editPresentation": "multilineText",
393
- "description": "Custom system prompt for Specify Current Input (JSON) (F10). When empty, the built-in Spec Kit /speckit-specify JSON rules are used, including a required expert_role (Act as a …). Editable from the Rules tab."
410
+ "description": "Custom system prompt for Specify Current Input (JSON) (F10). When empty, the built-in JSON rules write the same eight parts as F9 with no expert_role field. Editable from the Rules tab."
411
+ },
412
+ "promptRewriter.researchSpecSystemPromptRules": {
413
+ "type": "string",
414
+ "default": "",
415
+ "editPresentation": "multilineText",
416
+ "description": "Custom system prompt for Research Current Input (Spec) (F7). When empty, the built-in rules write the eight-part specification plus the research record, with no persona line. Editable from the Rules tab."
417
+ },
418
+ "promptRewriter.researchPromptSystemPromptRules": {
419
+ "type": "string",
420
+ "default": "",
421
+ "editPresentation": "multilineText",
422
+ "description": "Custom system prompt for Research Current Input (Prompt) (F6). When empty, the built-in rules write the six F8 parts plus the research record, with no persona line. Editable from the Rules tab."
394
423
  },
395
424
  "promptRewriter.loopSystemPromptRules": {
396
425
  "type": "string",
397
426
  "default": "",
398
427
  "editPresentation": "multilineText",
399
- "description": "Custom system prompt for Expand Current Input (Plan) (F7). When empty, the built-in Spec Kit /speckit-plan rules are used, including a context-grounded Act as a … expert role line. Editable from the Rules tab."
428
+ "description": "Deprecated and ignored. F7 no longer writes a Spec Kit plan; use promptRewriter.researchSpecSystemPromptRules.",
429
+ "deprecationMessage": "Ignored since 0.16.0: F7 is now Research Current Input (Spec). Use promptRewriter.researchSpecSystemPromptRules."
400
430
  },
401
431
  "promptRewriter.loopJsonSystemPromptRules": {
402
432
  "type": "string",
403
433
  "default": "",
404
434
  "editPresentation": "multilineText",
405
- "description": "Custom system prompt for Expand Current Input (Plan JSON) (F6). When empty, the built-in Spec Kit /speckit-plan JSON rules are used, including a required expert_role (Act as a …). Editable from the Rules tab."
435
+ "description": "Deprecated and ignored. F6 no longer writes a Spec Kit plan as JSON; use promptRewriter.researchPromptSystemPromptRules.",
436
+ "deprecationMessage": "Ignored since 0.16.0: F6 is now Research Current Input (Prompt). Use promptRewriter.researchPromptSystemPromptRules."
406
437
  },
407
438
  "promptRewriter.shareUsageMetrics": {
408
439
  "type": "boolean",
@@ -425,7 +456,11 @@
425
456
  "typecheck": "tsc --noEmit -p ./",
426
457
  "check:version": "node scripts/check-version-sync.mjs",
427
458
  "check:changelog": "node scripts/check-changelog-has-version.mjs",
428
- "test": "npm run check:version && vitest run",
459
+ "check:inventory": "node scripts/check-spec-inventory.mjs",
460
+ "diagram": "node scripts/architecture-diagram.mjs --write",
461
+ "check:architecture": "node scripts/architecture-diagram.mjs --check",
462
+ "test:acceptance": "vitest run --config tests/acceptance/vitest.config.ts",
463
+ "test": "npm run check:version && npm run check:inventory && npm run check:architecture && vitest run && npm run test:acceptance",
429
464
  "preversion": "npm run check:version && npm run typecheck && npm run test",
430
465
  "version": "npm run check:changelog",
431
466
  "postversion": "npm run package",