diff --git a/TODO-MCP.md b/TODO-MCP.md index 2fac756..b9fa8ab 100644 --- a/TODO-MCP.md +++ b/TODO-MCP.md @@ -448,6 +448,33 @@ Feature README `docs/features/mcp-lean-catalogue`. One dev (Opus), one QA (a −1 %, d parity, b +10 %, c +9 % vs the base re-run; 6/6 correct); gates: 4 922 tests / 0 failed, corpus 814/820 +## M8. Read-only mode (0.59; PLAN §11 — owner's request 2026-09-29) + +`lucisv-mcp --read-only`: five tools, ≤ 1 800 model-visible bytes, +instructions ≤ 300, never writes inside a root; full mode unchanged. +Feature README `docs/features/mcp-read-only`. One dev (Opus), one QA +(Opus), on trunk. + +- [ ] server: `--read-only` parsed, in the usage line; the registry + filtered by mode (`tools/list`, `tools/call`); read-only + instructions; the unknown-tool message for the four edit tools +- [ ] tests (`tests/wire.rs` or a new `tests/read_only.rs`): names and + order, both budgets, full mode unchanged byte for byte, every + full-catalogue tool name called in read-only mode leaves the tree + untouched (sizes, mtimes, names) +- [ ] extension: `lucisv.mcp.mode` setting, label, args, change event, + copy-config (`lucisv-ro` key, `--read-only`), node tests; + `mcp_smoke.js --read-only`; `tools/release.sh` runs both smokes +- [ ] docs: feature README; Agents guide (a "Read-only mode" section, the + table's `writes` column already tells the five); extension + README/CHANGELOG; `CHANGELOG.md` 0.59.0 (unreleased); + `docs/topo.md` §2.8; `tools/RELEASING.md`; manual-acceptance rows +- [ ] QA: attack the no-write promise (every edit tool name, resources, + malformed calls, a call racing a mode it does not have), the budgets, + full-mode identity against the 0.58.0 binary, the extension tests +- [ ] census round 5 (lead): tasks a and d on `--read-only` +- [ ] release 0.59.0 + ## Open questions for the owner (answer before the lane that needs it) 1. **Engine bump** (M5): if `vsce` accepts the contribution point on diff --git a/docs/mcp/PLAN.md b/docs/mcp/PLAN.md index 3d16863..9e839d3 100644 --- a/docs/mcp/PLAN.md +++ b/docs/mcp/PLAN.md @@ -568,3 +568,66 @@ Agents guide's table. - The M4 attack suite green unchanged; `check` on the fixtures identical to the old `diagnostics` line set; `hierarchy` on opentitan's `top_earlgrey` identical instance set to the old tool. + +## 11. Read-only mode (0.59 — the owner's request of 2026-09-29) + +One binary, two modes. `lucisv-mcp --read-only` offers only the five read +tools and shorter instructions; without the flag nothing changes (the nine +tools of §10). The two co-exist: a host may configure both side by side +under two names, and the extension chooses by a setting. + +### 11.1 The server + +- **Flag** `--read-only` (no value). Usage line: + `usage: lucisv-mcp [--root DIR]... [--filelist FILE] [--index-cache DIR] [--read-only] [--verbose]`. +- **`tools/list`** in read-only mode: exactly `hierarchy, find, outline, + read, check`, in that order, the same descriptions and schemas as in full + mode except `check`, whose words "after edits" do not apply (one + description for both modes if it reads right in both; otherwise a + read-only wording). Model-visible bytes (compact JSON of name + + description + inputSchema) **≤ 1 800**, pinned by test. +- **`tools/call`** of `rename`, `port`, `edit_item` or `format` in + read-only mode is the unknown-tool error (`-32602`), message + `unknown tool: rename (the server runs --read-only)`. The edit handlers + are not reachable: the mode filters the registry, it does not flag + inside each handler. +- **Instructions** in read-only mode, **≤ 300 bytes**, pinned by test: + + > lucisv-mcp reads the SystemVerilog on disk (save first); it never + > edits. Use it before reading files: hierarchy for instance trees and + > top modules, find for a name's declarations and uses, outline for a + > file or unit's ports, read for one item, check for diagnostics. Paths + > root-relative, lines 1-based. + +- **The promise:** in read-only mode no file inside a root is created, + written, renamed or removed, whatever is called. The server's own index + store under `--index-cache` is outside the roots and is still written + (it is what makes the next start warm). A test walks the fixture tree's + sizes, mtimes and names before and after calling every tool name of the + full catalogue. +- Resources, transport, freshness, annotations: unchanged. + +### 11.2 The extension + +- Setting **`lucisv.mcp.mode`**: `"full"` (default) or `"read-only"`. In + read-only mode the definition's args gain `--read-only` and its label is + `lucisv read-only ()`; a change of the setting fires the + provider's change event, like `lucisv.mcp.enabled`. +- **lucisv: Copy MCP server config** follows the setting: in read-only + mode the snippet's args end with `--read-only`, the server key is + `lucisv-ro`, and the message says which mode was copied. (Two keys, so a + user can paste both.) +- `mcp_smoke.js --read-only` smokes that mode (five tools in + order, one `hierarchy`, and `rename` answered with the unknown-tool + error); `tools/release.sh` runs both smokes on the host binary and on + the embedded one. + +### 11.3 Acceptance + +- Full mode byte-identical on the wire to 0.58.0 (`tools/list`, + `instructions`), except the usage line. +- Read-only budgets met and pinned; the no-write test green; the + extension's node tests cover the setting, the label, the args and the + snippet. +- Census round 5 (lead): tasks a and d on the read-only mode, against + round 4's full-mode figures.