Round 5 found `hierarchy up` + `peek` cut to 20 of 77 instantiations by the 300-line cap. Same-day base controls put read-only mode at parity with file tools (a +8 %, d −8 %) and show the base arm itself moved 22–29 % in six days. Co-Authored-By: Claude Fable 5.1 <[email protected]>
mcp-read-only
Lane M8 of the MCP block (TODO-MCP.md, docs/mcp/PLAN.md §11).
Goal
One binary, two modes. lucisv-mcp --read-only offers only the five read
tools (hierarchy, find, outline, read, check) and shorter
instructions, so an agent that only needs to understand a design reads a
catalogue half the size and talks to a server that cannot change it: no file
inside a root is created, written, renamed or removed, whatever is called.
Without the flag nothing changes — full mode is byte-identical to 0.58.0 on
the wire. The VS Code extension chooses the mode by a setting
(lucisv.mcp.mode), and its copy-config command keys a read-only server
lucisv-ro so a host can carry both side by side.
Assumptions
Where §11 is silent, the simplest thing, recorded:
- The mode is a registry filter.
tools::Mode { Full, ReadOnly }lives intools/mod.rs;Mode::offers(Effect)admitsReadtools in read-only mode and every tool in full mode.tools::list(mode)andtools::find(name, mode)both go through the one filter, so the listed set and the callable set cannot disagree. No handler checks the mode. Options.modecarries the mode (defaultFull);--read-onlysets it. The flag takes no value and may be repeated harmlessly.- Resources run their read tools through
tools::find(name, Mode::ReadOnly)— the strictest registry that has them — so a resource can never reach an edit tool in either mode and answers the same in both. - The unknown-tool message carries the
(the server runs --read-only)suffix for any unknown name in read-only mode, not only the four edit names: the sentence is true either way and the rule is one line. Full mode keepsunknown tool: NAMEexactly. check's description is shared. The shipped description ("Parse errors and lint findings offileor the whole design, …") never said "after edits" — only the full-mode instructions do — so it reads right in both modes and there is one description (§11.1 allows this). The read tools' descriptions, schemas and annotations are identical in both modes (pinned by test).- The instructions text deviates from §11.1 by one phrase. The quoted text is 302 bytes, over its own 300-byte budget; "check for diagnostics" became "check for issues" (297 bytes). Nothing else changed.
- The promise covers the roots. The index store under
--index-cacheis still written on exit. The extension passes VS Code's workspace storage, which is outside the folder. A user who points--index-cacheat a directory inside a root gets that directory written (the store, its.gitignore); that is the user's own choice of store location, not a tool call, and is not guarded against. - Extension: only an unset
lucisv.mcp.modeor exactly"full"is full mode; exactly"read-only"is read-only, and any other value fails safe to read-only with one line in the lucisv output channel (lead ruling on QA finding 2; was: anything but"read-only"is full). The change event already fires for everylucisv.mcp.*change (affectsConfiguration('lucisv.mcp')), so the mode needed no new listener — only a test.--read-onlyis appended last in the definition's args (after--index-cache) and in the snippet's args. The copy-config message names the mode in both modes ((full mode)/(read-only mode)), a wording change for full mode too. mcp_smoke.js --read-onlyadditionally checks the tiny project's two files are byte-identical after the session; with--tool-tableit prints whatever the mode lists (the full-mode table is unchanged, compared byte for byte against the 0.58.0 script).
Handshakes
- Consumes from the tool registry (M7): the
Effectper tool inTOOLS. A new tool must be given the rightEffect— anEdittool markedReadwould be offered in read-only mode. The five-name tests intools/mod.rsandtests/read_only.rspin the current set. - Promises to hosts:
--read-only→ exactlyhierarchy, find, outline, read, checkin that order, catalogue ≤ 1 800 model-visible bytes (1 797 shipped), instructions ≤ 300 (297 shipped);tools/callof an edit name → JSON-RPC-32602unknown tool: NAME (the server runs --read-only); no write inside a root. Full mode:initializeandtools/listbyte-identical to 0.58.0 (checked against the 0.58.0 release binary; the full catalogue stays 3 440 bytes, instructions 398). - Promises to the extension's users and to
release.sh: settinglucisv.mcp.mode("full"/"read-only"), labellucisv read-only (<folder>), args[…, "--read-only"], copy-config keylucisv-ro;mcp_smoke.js <binary> --read-onlyas the second MCP gate at bothrelease.shsites. Recorded indocs/topo.md§2.8. - Requests: none. Every file touched is on the lane's list.
Status / TODO
- server:
--read-onlyparsed and in the usage line;Modefilters the registry (tools/list,tools/call); read-only instructions; the unknown-tool message - tests:
tests/read_only.rs(names and order, both budgets, the five identical to full mode's, the four edit names unknown, full mode's nine names and 0.58.0 instructions, the no-write snapshot with every tool name and every resource, the full-mode control that the edit arguments do write); unit tests intools/mod.rs,rpc.rs,main.rs - extension:
lucisv.mcp.modeinpackage.json;mcp.jsargs, label, copy-config key/args/message;mcp_test.js mcp_smoke.js --read-only;tools/release.shruns both smokes at both sites;tools/RELEASING.md- docs: Agents guide "Read-only mode" section, settings table and
arguments line; extension README and CHANGELOG;
CHANGELOG.md0.59.0 (unreleased);docs/topo.md§2.8; manual-acceptance rows 26–27
Work log
2026-09-29 — dev (Opus)
- Captured the 0.58.0 wire (
initialize+tools/listovertests/fixtures/design) from a release build of HEAD before any change; after the change the full-mode output iscmp-identical to it. tools/mod.rs:Mode,Mode::offers,offered(mode);listandfindtake the mode.rpc.rs:INSTRUCTIONS_READ_ONLY,instructions(mode),unknown_tool(name, mode).main.rs:Options.mode,--read-only, the usage line.resources.rs: reads throughMode::ReadOnly.- Deviation: §11.1's instructions text measured 302 bytes against its own ≤ 300 budget; "check for diagnostics" → "check for issues" (297).
- Figures (release build): read-only catalogue 1 797 bytes, instructions 297; full catalogue 3 440, instructions 398 (unchanged). The read-only catalogue is 3 bytes under its ceiling: any growth of the five read tools' descriptions or schemas now needs a trim elsewhere.
tests/read_only.rscopies the smallTree/Sessionhelpers fromwire.rsrather than sharing them (brief). The no-write test snapshots path → (size, mtime) for files and mtime for directories (so a temp file created and removed is caught), runs with--index-cacheoutside the tree, closes stdin and waits for exit before the second snapshot, and asserts the cache directory did get the store.- Extension: setting, provider args/label, copy-config snippet key and
message;
mcp_smoke.js --read-only(five tools,hierarchy,rename→ the exact-32602error, files untouched). Against the 0.58.0 binary--read-onlyfails as it should (unknown option). - Gates:
cargo fmt --all;cargo clippy --all-targets -- -D warningsclean (guard exit 0);cargo test -p lucisv_mcp14 suites, 373 passed, 0 failed, 4 ignored (guard exit 0);node --test editors/vscode/*_test.js6/6;mcp_smoke.js target/release/lucisv-mcpOK in both modes.
2026-09-29 — dev (Opus), QA rework
- QA finding 2 (lead ruling 1):
mcp.jsreadOnlyMode(log)— unset or exactly"full"→ full; exactly"read-only"→ read-only; anything else ("Read-Only","readonly","Full",null,true, a number) → read-only plus one line,lucisv: lucisv.mcp.mode is "<value>", not "full" or "read-only"; using read-only., throughactivate'slog(now passed toserverDefinitionsandcopyConfig, which share the rule).mcp_test.jsanUnknownModeFailsSafeToReadOnlycovers the three cases and the line;theReadOnlySnippetscovers copy-config with"readonly". One clause ("any other value is treated as read-only") in thepackage.jsondescription, the extension README settings table and the Agents guide settings table. - QA finding 4 (lead ruling 2):
mcp_smoke.js --read-onlynow checks the tool list (count and names) before therenamerefusal; against a wrapper that drops--read-onlyit fails withtools/list is 9 tools […], expected 5 […]. - No Rust changed.
node --test editors/vscode/*_test.js6/6; both smokes OK againsttarget/release/lucisv-mcp.
2026-09-29 — dev (Opus), rework 2
- The
hierarchycap now counts instances, not peek lines (census round 5 finding onprim_fifo_syncup + peek). The change and its tests are logged indocs/features/mcp-lean-catalogue/README.md(work log, 2026-09-29); tool descriptions and both modes' byte figures unchanged.
2026-09-29 — dev (Opus), rework 3
- QA finding 6: the
hierarchycap is 300 instances withoutpeek, 100 with it (lead ruling). Logged in the M7 README (work log, rework 3). QA's boundary test inqa_m8.rsis renamedqa_the_node_cap_is_exact_at_300_and_301_plain_and_100_and_101_with_peek(the QA log below still names it by its old name). Descriptions and both modes' byte figures unchanged.
QA log
2026-09-29 — QA (Opus)
Verdict: PASS with findings (two low, three informational; no corruption, no write, no reachable edit handler).
What was verified, and how:
- No-write promise, fixture.
tests/qa_m8.rsqa_read_only_never_changes_a_byte_whatever_arrives: snapshot of every entry under a copy offixtures/edit(file size + mtime + bytes, directory mtime so a temp file created and removed is caught), then one session with: 13 edit shapes (rename ×2, port add / add-after / remove, edit_item replace / insert_before / insert_after / delete, format with and withoutfix,**/*.sv,rtl) sent beforeinitialize(all-32002), after it as requests (all-32602with the exact message), as notifications (tools/callwith no id) and asnotifications/<name>; 12 near-miss names (Rename," rename","rename ",rename\n,rename\0,edit-item,editItem, fullwidthrename,format\t, …);nameas number / array / object / null / bool (-32602"need a stringname"); edit names with null / array / string / smuggledmodearguments and a_meta/modein params; a batch array (-32600); a duplicatenamekey (checkthenformat: last key wins → refused); a secondinitializeasking forexperimental.mode: fullfollowed byformat(still refused); eight resource URIs (the four real ones pluslucisv://format/…,lucisv://unit/..%2F..%2Fetc); three stray notifications. Snapshot identical after exit. Controlqa_every_edit_shape_writes_in_full_mode: each of the 13 shapes writes in full mode. MutationMode::offers→(Mode::ReadOnly, _): three QA tests fail; reverted,cmp-identical. - No-write promise, opentitan (
~/.cache/lucisv-eval/ot/hw, release binary,--read-only, no--index-cache):format **/*.sv fixbeforeinitialize, then renameuart_rx, port add/remove onuart_rx, edit_item insert/delete inip/uart/rtl/uart_rx.sv, format**/*.svandip/uart/rtl,Format, a notification-form format, the five reads and three resources (3 944 files indexed). Every edit answered-32602;git status --shortempty before and after,--ignoredset unchanged, no file newer than the run outside.git./Users/…/repo/opentitannot touched. - Reachability.
tools::findis the only way from a name to a handler; callers:rpc.rs:247(self.options.mode) andresources.rs:116(Mode::ReadOnly, and onlyhierarchy/outlineare named). No cachedToolreference;apply::runis called only fromedit.rs,format.rs,item.rs(andportthrough them).Optionsis built only byOptions::default()inparse_args(main.rs:82) and inrpc.rs's unit tests;Server.optionsis never reassigned. - Arguments (
qa_argument_order_and_repetition_cannot_undo_read_only): flag first, last, repeated, mixed with--verbose→ five tools;--read-only=false,--read-only false,--read-only=true,--readonly,--no-read-only→ exit 2,unknown option, usage line naming[--read-only], no server. - Budgets, recomputed in Python from the wire (compact JSON of name +
description + inputSchema): read-only 1 797 bytes, 5 tools, all
readOnlyHint: true, instructions 297; full 3 440, instructions 398. Sum of name + description + schema alone: 1 576 / 3 043. Mutation: 4 bytes appended tohierarchy's description →read_only.rsfails ("the read-only catalogue is 1801 bytes"); reverted,cmp-identical. - Full-mode identity.
initialize+notifications/initialized+tools/list+resources/list+resources/templates/list+ an unknown tool, overfixtures/design: current release binary vs~/.cache/lucisv-eval/bin/lucisv-mcp-r5— identical exceptserverInfo.version(finding 3). - Read answers across modes
(
qa_the_read_tools_and_resources_answer_identically_in_both_modes): 12 read calls (incl. a refusal) + 4 resource reads (incl. not-found) + the three list methods ondesignandedit: identical text in both modes. - Extension.
node --test editors/vscode/*_test.js6/6. The change event:mcp.js:176-177fires onaffectsConfiguration('lucisv.mcp'), which VS Code answers true forlucisv.mcp.mode(pinned by the dev's test). Copy-config per host per mode pinned bytheThreeSnippets/theReadOnlySnippets.mcp_smoke.jsagainst the release binary: OK in both modes;--read-onlyagainst r5 (refuses the flag, exit 2) → smoke exit 1; against a wrapper that drops--read-only(a server listing nine tools) → smoke exit 1 (finding 4). - Release script.
bash -n tools/release.shOK;set -eu(line 32); both new invocations (host$dist/lucisv-mcp-$version-$host, embedded$unpacked/$inner/lucisv-mcp) are plain statements, so a failing smoke aborts the script. - Docs. The guide's two-key example parses as JSON and each entry has
the shape copy-config emits for Claude Code / Cursor (
command,args;lucisv-roargs end--read-only). Arguments line and usage line name the same five flags in the same order. - Gates.
cargo fmt --allclean;cargo clippy --all-targets -- -D warningsclean (guard exit 0);cargo test -p lucisv_mcp15 suites, 378 passed, 0 failed, 4 ignored (guard exit 0, noguard.sh:line).
Findings, by severity:
- Low (docs, fixed). The Agents guide
(
docs/site/src/content/docs/guides/agents.md, "Read-only mode", last paragraph) andCHANGELOG.md0.59.0 said the index store "is outside the roots" — true only as the extension passes it. Repro:lucisv-mcp --root R --index-cache R/.cache --read-only, callcheck, close stdin →R/.cache/.gitignoreandR/.cache/index-cache-mcpappear (the dev's recorded deviation). Reworded both to say the store is written where--index-cachepoints. PLAN §11.1 carries the same sentence; left for the lead. - Low (design, recorded).
editors/vscode/mcp.js:57: anylucisv.mcp.modeother than exactly"read-only"—"Read-Only","readonly",null,true— is full mode, silently. That is the brief's rule and nothing dangerous is said, but a typo lands on the permissive mode; VS Code's only hint is the enum warning insettings.json. No change made. - Info.
~/.cache/lucisv-eval/bin/lucisv-mcp-r5reportsserverInfo.version0.57.0(built before the 0.58.0 bump); the wire is otherwise byte-identical to the current full mode. - Info.
mcp_smoke.js --read-onlyagainst a server that ignores the flag fails on therenamecheck (rename in read-only mode answered undefined) before the tool-list check — it fails, but the message does not say "nine tools". Against r5 it fails the same way (the server exited 2 with its usage line on stderr). - Info.
tools/release.shsmoke_embedded_mcp: a failing smoke aborts beforerm -rf "$unpacked", leavingtarget/vsix-check(pre-existing pattern; the next run removes it first).
Tests added: crates/lucisv_mcp/tests/qa_m8.rs (5 tests, all green).
2026-09-29 — QA (Opus), re-check: hierarchy cap counts nodes
Rework under test: tools/hierarchy.rs render_nodes caps at 300 nodes
(the down root line included), peek lines never count. Verdict: PASS with
one finding.
- No-peek identity with
b757e82(lucisv-mcp-r6vs a fresh release build): 43 calls onfixtures/designand 85 onfixtures/edit(every unit down / down depth 20 / up / up depth 20, with and without peek) — 0 differ. Eval clone, 9 calls —top_earlgreydepth 2 (50 lines) and depth 3 (… and 165 more),prim_fifo_syncup (77) and up depth 3 (… and 1421 more),top_darjeelingdepth 3 (… and 174 more),prim_flopup (… and 176 more) and up depth 4 (… and 45166 more),uartdepth 20, the overview (… and 69 more) — byte-identical, and identical again under--read-only. prim_fifo_syncup + peek (eval clone): 1 078 lines, no cut. Its lines that are neither statement lines (4-space indent) nor blank are exactly the 77 lines of the no-peek answer, in order; every node is followed by at least one statement line; no block exceeds 12 lines +…(69 blocks end in…). r6 gave 21 of them then… and 56 more.qa_m7.rsdiff vs HEAD: one expected tuple(299, 251)→(599, 101)(root + 299 two-line blocks, 401 − 300 = 101 — what the rule requires) and the peek assertion now pins two lines (peek[597]the 299th instance's node line,peek[598]its statement) where it pinned one; no other assertion touched.- Boundaries (
qa_m8.rsqa_the_node_cap_is_exact_at_300_and_301_down_and_up_with_and_without_peek, 14-line statements so every block is cut to 12 +…): down 299 instances (300 nodes) → 300 lines, no cut; down 300 → root + 299 and… and 1 more; up 300 → 300, no cut; up 301 → 300 and… and 1 more. With peek: the same node lines and cut line in the same order, exactly 14 lines per instance node, the line before the cut is the last block's…(never split). The down count counts the root as a node consistently: 401 nodes →… and 101 more= the 101 instances not shown. - Modes: every text above is identical in full and
--read-onlymode (asserted in the test, and on the eval clone with and without peek). - Gates:
cargo test -p lucisv_mcp16 suites, 381 passed, 0 failed, 4 ignored (guard exit 0, noguard.sh:line); clippy-p lucisv_mcp --all-targets -D warningsclean. Eval clonegit statusempty.
Finding:
- Medium (answer size, design consequence). A peeked answer is no
longer bounded by ~300 lines but by 300 × 14 lines. Repro on the eval
clone:
hierarchy {"root":"top_earlgrey","depth":3,"peek":true}→ 3 759 lines, 151 224 bytes (r6: 295 lines, 10 152 bytes);{"root":"prim_fifo_sync","up":true,"depth":3,"peek":true}→ 4 154 lines, 152 356 bytes (r6: 10 457);prim_flopup peek → 2 984 lines, 89 972 bytes. That is roughly 40 k tokens in one answer, against the lean catalogue's short-answer goal (PLAN §10). The fix the brief asked for (77 of 77) needs only ~31 KB; whether a byte ceiling on peek belongs beside the node cap is the lead's call. Not changed.
Tests added: qa_m8.rs qa_the_node_cap_is_exact_at_300_and_301_down_and_up_with_and_without_peek.
Review
2026-09-29 (lead). Examined the diff, the registry filter, the QA log and
the live wire in both modes. Accepted. --read-only lists five tools in
1 797 model-visible bytes with 297-byte instructions; full mode is
byte-identical to 0.58.0. QA could not make the read-only server write
inside a root or reach an edit handler. Rulings: the dev's deviations 1–5
stand (instructions say "check for issues"; any unknown tool name carries
the read-only suffix); an unknown lucisv.mcp.mode value selects
read-only and is logged (QA finding 2); the smoke checks the tool list
first (finding 4); PLAN §11 now says the index store is written wherever
--index-cache points. Gates at commit: lucisv_mcp 378 passed / 4
ignored (15 suites), node tests 6/6, both smokes OK. Census round 5
follows on this binary.