Files
lucisv/TODO-MCP.md
lucioandClaude Fable 5.1 5316c0b127
ci / checks (push) Successful in 1m27s
ci / corpus (push) Successful in 34s
release / build-and-publish (push) Successful in 7m16s
Release 0.59.0: MCP read-only mode (--read-only, five tools, 1 797 bytes) and the hierarchy instance cap
Version bump; the notes are in CHANGELOG.md (## 0.59.0) and
editors/vscode/CHANGELOG.md. Gates: fmt and clippy -D warnings clean,
72 suites + 6 doc suites (4937 passed, 0 failed), corpus 814/820,
node tests 6/6.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-29 02:12:33 -07:00

501 lines
30 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TODO-MCP — the Model Context Protocol block
Planned 2026-09-23 by the lead at 0.55.0. The analysis and design are in
[`docs/mcp/PLAN.md`](docs/mcp/PLAN.md); read it before touching any lane.
This file is the tracking sheet for the block and stays separate from
`TODO.md` on purpose: the block is independent of the LSP and CLI lanes, and
its lanes collide with nothing in `docs/topo.md` except where a lane below
says so.
Rules that apply to every lane, restated once: CLAUDE.md in full (guard
every suite and sweep through `tools/guard.sh`; no `git commit`/`push`; a
feature README kept current as you work; no file outside the lane's list;
cross-module wants are Handshake requests, not edits); opentitan is
read-only; no `sleep` over 60 s; `cargo fmt -p` per package while another
lane is live. Each lane is one Opus dev then one Opus QA (owner's ruling
2026-09-23: both Opus 5.5), working directly on trunk, then the lead's
self-inspection and a commit; no release until every lane is done. A QA
"rework" loops inside its lane.
## Fixed names (the wire shapes every lane pins by test)
| thing | name |
|---|---|
| crate / binary | `crates/lucisv_mcp` / `lucisv-mcp` |
| arguments | `--root DIR` (repeatable; default cwd), `--filelist FILE`, `--index-cache DIR`, `--verbose`; anything else → `usage:` on stderr, exit 2 (the server's posture) |
| vsix entry | `extension/bin/lucisv-mcp[.exe]` (platform), `extension/bin/<vsce-target>/lucisv-mcp[.exe]` (all) |
| VS Code provider id | `lucisv.mcp`; settings `lucisv.mcp.enabled` (true), `lucisv.mcp.path` (""); command `lucisv.mcp.copyConfig` |
| feature READMEs | `docs/features/mcp-transport`, `mcp-read-tools`, `mcp-navigation`, `mcp-edit-tools`, `mcp-structural-edits`, `mcp-packaging`, `mcp-cache-and-census` |
## M1. Transport and the read tools
**Files:** `Cargo.toml` (workspace `members` += `crates/lucisv_mcp`),
`Cargo.lock`, everything under `crates/lucisv_mcp/` (`src/main.rs`,
`transport.rs`, `rpc.rs`, `project.rs`, `render.rs`, `tools/mod.rs`,
`tools/read.rs`, `tests/wire.rs`, `tests/fixtures/`), the two feature
READMEs. Nothing else — in particular no change to any library crate; a
missing public query is a Handshake entry.
- [x] crate skeleton: `main.rs` argument contract (table above), the
`PARSE_STACK_SIZE` main thread, the ordered loop; `transport.rs`
newline-delimited JSON-RPC over stdio (stdout protocol-only, stderr
log-only; a line that is not JSON → `-32700`, never a crash)
- [x] `rpc.rs`: `initialize` (version negotiation over a listed set, the
pinned current revision first; `serverInfo`; `capabilities`;
`instructions`), `notifications/initialized`, `ping`, `tools/list`,
`tools/call` envelope (`content` text + `structuredContent`,
`isError` for refusals), `notifications/cancelled` accepted, unknown
method/tool/params → `-32601`/`-32602`
- [x] `project.rs`: roots, `Discovery`, filelist-or-walk file set with the
1 MiB cap, `IndexBuilder` build, lazy per-file `Semantics`, the
per-call stat sweep + `update_file`/`remove_file` + re-walk policy
(PLAN §4.4); a path outside every root is refused by name
- [x] tools `project_overview`, `list_units`, `unit_interface` (ports,
parameters, template via `instantiation_plan`; modports for an
interface; exports for a package), `outline`, `read_item` (incl. the
`always@<line>` spelling for unlabelled blocks), `search_symbols` —
each with `inputSchema`, `annotations` (`readOnlyHint: true`), a
one-sentence description written for the agent, and the compact
rendering rules of PLAN §4.5
- [x] `tests/wire.rs`: spawns the built binary; the handshake; every tool
over a fixture tree of ≥ 6 files (a package, two modules with a
`.*` instance, an interface with a modport, a class, a file with a
parse error); a freshness test (edit a fixture on disk between two
calls, second answer reflects it; delete one, it disappears;
fingerprint equals a rebuild after each); a malformed-line test; a
`--root` outside-path refusal
- [x] README `mcp-transport`: Goal, Assumptions (why no `rmcp`; the pinned
protocol revisions; sync one-at-a-time), Handshakes (none consumed
beyond public APIs — list them), work log; README `mcp-read-tools`
likewise, with the rendering rules as its contract
- [x] gates through `tools/guard.sh`; sizes reported per file
- [x] QA: protocol attacks (an `id` that is a string, a null `id`, a
notification with an `id`, a 10 MB line, a request before
`initialize`, an unsupported `protocolVersion`), rendering attacks
(a unit named with an escaped identifier, a port with a packed and
unpacked range, a file with CRLF line endings — line numbers must
still be right), the freshness promise under a rename-then-recreate
of a file within one second; verdict in the QA logs
## M2. Navigation, diagnostics, resources
**Files:** `crates/lucisv_mcp/src/tools/nav.rs`, `resources.rs`,
`tools/mod.rs` (registry entries only), `rpc.rs` (the three `resources/*`
methods), `tests/wire.rs` (additions), the `mcp-navigation` README.
Depends on M1 merged.
- [x] `definition` (selector: `file,line,col` or `name,unit?`; local via
`Semantics::definition_of`, cross-file via `resolve_external`;
ambiguity is a list), `references` (`vlog_refactor::find_references`,
grouped by file, capped with `limit`/`offset`), `hierarchy` (down from
`root` or every top-level module; `up` lists parents; parameter
overrides as written; `depth`), `diagnostics` (parse errors,
missing-closer warnings via the tolerant tree, lint through
`select_rules` + the project's `[lint]` config + external waivers +
an index-backed `MentionOracle`; the CLI's JSON field names), `defines`
(table; one-step expansion when called with `name` + `args`)
- [x] resources `lucisv://overview`, `lucisv://unit/{name}`,
`lucisv://rules` (`rules_markdown()`), `lucisv://file/{path}/outline`;
`resources/templates/list` for the two parameterised ones
- [x] the opentitan parity census as an `#[ignore]` test taking the
checkout path from an env var: `references`/`definition` on the
`references-nav` symbols and `hierarchy` down from `top_earlgrey`
compared with the LSP's answers recorded in that README (read-only;
`git status` of the checkout identical before and after)
- [x] README `mcp-navigation`; work log; gates; sizes
- [x] QA: a `bind` connection's bare name, a `u_x.sig` tail, a name that
is both a port and an internal net (must list both, not pick), a
class member, a macro-only name (`files_naming_in_macros`), a
`hierarchy` over a recursive/generate-instantiated module (must
terminate with the depth cap), lint options from `lucisv.toml`
honoured; verdict
## M3. Edit tools (wrapping the verified engines)
**Files:** `crates/lucisv_mcp/src/tools/edit.rs`, `apply.rs`, `tools/mod.rs`
(entries), `tests/wire.rs` (additions), `tests/fixtures/` (additions), the
`mcp-edit-tools` README. Depends on M2 merged and on the ruling for
Handshake MCP-1 (the diff lift) — until MCP-1 lands, `apply.rs` carries a
private copy of `unified` marked `// TODO(MCP-1)` and the README says so.
- [x] `apply.rs`: `RefactorEdit` → (`dry_run`) unified diff per file | the
all-computed-then-written loop over `write_atomic`, refusing before
the first write on any verifier failure; the summary (files, +/-
lines, warnings, created); the "written N of M then failed" report
- [x] `format` (`files[]` or `file` + `lines`, `dry_run`), `fix_lint`
(`apply_fixes` through `fence::protected_regions`, safe fixes only),
`rename`, `expand_wildcard`, `convert_ports`, `organize_imports`,
`inline_module`, `propagate_ports`, `remove_port`, `add_port`,
`extract_module` (`home`: new file / same file; the created file is
written too), `instantiate` (text only; `style`) — every one with
`destructiveHint: false`, `idempotentHint` where true
- [x] the source-set rule: each refactor gets the whole in-scope file set
(PLAN §2.1 — the server narrows; MCP does not, so it can never be
narrower than the engine needs); the README states the cost on
opentitan and M6 measures it
- [x] tests: every tool `dry_run` then real on the fixtures; run twice →
second run is a no-op with an empty diff; a refusal leaves the
fixture tree byte-identical (hash the tree before/after); an
`extract_module` into a new file; a rename that touches three files;
a `fix_lint` whose finding sits in a format fence (must not touch it)
- [x] README `mcp-edit-tools`; Handshake MCP-1 filed there with the exact
move; work log; gates; sizes
- [x] QA: an edit whose target file changed on disk between the stat
sweep and the write (the freshness promise vs the write — the write
must be refused, not applied over the newer bytes; the dev states the
mechanism); a read-only file; a path through a symlink leaving the
root; concurrent `lucisv --check` on the same tree; a CRLF file
through `format`; verdict
— done 2026-09-23 (Opus, two rounds + lead fixes): pass for the lane;
the write path held under a 50 ms writer race, chmod 444, symlinked
escapes and a concurrent CLI; `format`/`fix_lint` byte-identical to
the CLI. Findings ruled: skipped files refuse a whole-word match;
whole-set tools re-walk first. **Open, out of lane:** the engine's
rename breaks `.*`/`.name` shorthand connections → M3.5 below.
## M3.5. Rename vs implicit connections (inserted 2026-09-23 after M3 QA)
**Files:** `crates/vlog_refactor/src/rename/**`, `crates/vlog_refactor/src/check/**`
only if the verifier must learn the shape, `crates/vlog_refactor/tests/`
(or the crate's test modules), `docs/features/refactor-rename/README.md`
(a dated section), `crates/lucisv_mcp/src/tools/edit.rs` (drop the
known-limit sentence) + `tests/qa_m3.rs` (un-ignore finding 1), `TODO.md`
(one line under the §8 rope-port refactorings noting the fix). An engine
lane: the LSP's rename inherits the fix.
- [x] `vlog_refactor::rename` rewrites implicit connections: renaming a port
`p` → `q` turns `.p` into `.q(p)` and adds `.q(p)` beside a `.*` that
bound it (explicit connections beside `.*` are legal); renaming a net
`n` → `m` in a module whose instantiations bind it through `.n` or `.*`
turns `.n` into `.n(m)` and adds `.n(m)` beside the `.*`; comments and
layout of the connection list preserved (append after the last
connection, before the closing paren, on its own line when the list is
one-per-line); every such rewrite listed in `warnings` so the user
sees it; refuse (never guess) when the instantiation's port list
cannot be read (`ifdef`-split, error element)
- [x] the verifier sees the new edits as intended (no false "moved"
refusal); attack tests: `.*` + explicit of the same port; nested
instances; a `.name` whose net and port differ; a bind instance
- [x] QA: attack the rewrite on opentitan copies (`prim_fifo_sync` ports
under `.*` users); LSP parity via `vlog_refactor::rename` directly
## M4. Structural edits (the one new verifier in the block)
**Files:** `crates/lucisv_mcp/src/tools/item.rs`, `tools/mod.rs` (entries),
`tests/wire.rs` and `tests/attacks.rs` (new), fixtures, the
`mcp-structural-edits` README. Depends on M3 merged.
- [x] `replace_item`, `insert_item`, `delete_item` with the PLAN §4.3
contracts: bytes outside the span untouched (asserted by the test,
not trusted), strict re-parse of the whole file (or no growth in
tolerant error count when it did not parse before), one item at the
position, the declared name matches unless `rename: true`,
`delete_item` refuses over surviving references unless `force`
- [x] `tests/attacks.rs`, written by the dev, every case asserted
**refused with the tree byte-identical**: a `text` opening a block it
does not close; one that closes the enclosing module; one that
re-declares a port; a UTF-8 boundary inside the span; an item inside
a format fence; a file with an unterminated string; an `insert_item`
after `end` — the CLAUDE.md invariant-4 discipline applied to the
block's own verifier
- [x] README `mcp-structural-edits`: the contract as a table, the attack
list, what the tool deliberately does not check (semantic sense of
the new text)
- [x] gates; sizes (`item.rs` is expected to be the largest file in the
crate; if it passes 600 lines the verifier moves to `item/verify.rs`)
- [x] QA: re-attack with at least eight new cases (a `text` that is two
items; an empty `text`; a `text` equal to the old bytes — must be a
no-op, not a refusal; a macro-bracketed item; a `generate` block
target; an item whose leading comment is shared with the previous
item's trailing one; a 40 000-line file for timing; `delete_item` on
the last item of a module); verdict
## M5. Packaging and the extension (parallel with M2–M4)
**Files:** `tools/release.sh`, `tools/audit_artifacts.sh`,
`tools/RELEASING.md`, `.gitea/workflows/ci.yml` (two lines: the MCP wire
test is already in `cargo test`; add `node --test editors/vscode/*_test.js`),
`editors/vscode/{package.json,package-lock.json,extension.js,mcp.js,
mcp_test.js,mcp_smoke.js,.vscodeignore,README.md,CHANGELOG.md}`,
`docs/site/src/content/docs/guides/agents.md` (new) and the guides index,
`README.md` (an "Agents (MCP)" paragraph under Editor setup), the
`mcp-packaging` README. May start once M1's binary answers `initialize` on
trunk; touches no Rust. `extension.js` changes are limited to requiring
`mcp.js` and calling its `activate(context)`.
- [x] `release.sh`: stage `lucisv-mcp[.exe]` into `bin/` (platform) and
`bin/<target>/` (all); `expect_vsix_bins` lists grow to three;
`mcp_smoke.js` run against the host binary and against the one
unzipped from the host vsix and the all-platforms vsix (mirror
`smoke_embedded_server`); `audit_artifacts.sh` accepts the third name;
the universal vsix still asserts no `extension/bin/*`
- [x] `mcp.js`: the three-rung binary ladder reusing `bundledBinary`;
the guarded `registerMcpServerDefinitionProvider("lucisv.mcp", …)`
with one `McpStdioServerDefinition` per workspace folder (`--root`,
`--index-cache <storagePath>`, `cwd`, `version` from `package.json`),
re-fired on folder changes; `lucisv.mcp.enabled` / `lucisv.mcp.path`
read like `serverPath` (`inspect()`, blank = unset); the
`lucisv.mcp.copyConfig` command with the three dialects (Claude Code
`.mcp.json`, Cursor, VS Code `.vscode/mcp.json`) naming the resolved
binary; `mcp_test.js` with a stubbed `vscode` (the `hierarchyView_test`
pattern) covering the ladder, the guard on an old VS Code (no `lm`),
and the three snippets
- [x] `package.json`: `contributes.mcpServerDefinitionProviders`, the two
settings, the command + palette entry; engine stays `^1.82.0` unless
`vsce package` refuses — then bump to `^1.101.0` and record why in the
README and CHANGELOG
- [x] docs: the site guide page (install via vsix → nothing to do; Claude
Code / Cursor snippets; the standalone `cargo build` line; the tool
list generated from `tools/list` output, checked in); `README.md`
paragraph; `tools/RELEASING.md` (three binaries; the smoke); the
extension README and CHANGELOG
- [x] CI: `node --test editors/vscode/*_test.js` in `ci.yml`
- [x] README `mcp-packaging`; work log; `node --test` green; a local
`tools/release.sh` (host only) producing a darwin-arm64 vsix with the
three binaries, unzipped and checked
- [x] QA: install the vsix into a clean VS Code profile: the server listed
under **MCP: List Servers**, trusted, `project_overview` answered in
agent mode; `lucisv.mcp.enabled: false` removes it; a multi-root
workspace registers one server per folder; the universal vsix on a
machine without `lucisv-mcp` on PATH degrades to a clear output-channel
line, not an error dialog; the Claude Code snippet pasted into a
`.mcp.json` works from a terminal; rows in `docs/manual-acceptance.md`;
verdict
## M6. Cache reuse, census, closing release
**Files:** `crates/lucisv_mcp/src/{project.rs,cache.rs}` (new `cache.rs`),
`tests/` additions, `docs/mcp/census.md` (new), `docs/perf/README.md` (an
MCP section), `docs/topo.md` (§1.1 node + §2.8 rows for `lucisv_mcp`, an
§1.4 touch-set row), `docs/manual-acceptance.md`, `CHANGELOG.md`,
`docs/repository-analysis.md` (the crate count and map row), the
`mcp-cache-and-census` README, `TODO-MCP.md` (this file's closing entries).
Depends on M4 and M5 merged.
- [x] `cache.rs`: the read-only reader of the LSP's `index-cache` (header
check on `CACHE_FORMAT`/`FACTS_FORMAT`/version, per-line checksum,
`FileFacts::decode`, `record_path`); on `--index-cache DIR` a file
whose `content_hash` has a record is `add_facts`'d instead of parsed;
MCP's own `index-cache-mcp` written with the same codec on exit and
read on start; never a write to the LSP's file (a test opens the
store read-only and asserts its bytes after a full MCP session)
— done 2026-09-23 (dev): `src/cache.rs`, `tests/cache.rs`; the M4
rule-6 ruling (`force` on `delete_item`) and the first `instructions`
revision delivered in the same lane (`docs/features/mcp-cache-and-census`)
- [x] startup timing on opentitan cold / warm-from-LSP-store /
warm-from-own-store, and the per-call stat sweep, recorded in
`docs/perf/README.md` next to the LSP's scan trace numbers; the
whole-set refactor cost from M3 measured on `rename` in `aes`
— done 2026-09-23 (dev): cold 1.87 s, warm 0.83–0.85 s from either
store, sweep 5.6–6.1 ms, `rename` dry run 2.23–2.28 s
- [x] the token census (PLAN §8): four tasks over three rounds, 20 runs
(Sonnet arms, one Opus pair), base vs mcp on a clean opentitan clone,
graded against lead-computed ground truths — written up in
`mcp_analysis.md` (repo root; the owner's name for it) with the raw
run log in `docs/mcp/census-runs.txt`. Verdict: no wrong answer in
20 runs; −15 % tokens on the whole-design question, +4…+19 % on small
edits, completeness won on the rename
- [x] `instructions` and tool descriptions revised from what the census
transcripts showed (feedback-1/2/3); no `prompts/*` — the census
showed no repeated multi-tool sequence worth one
- [x] `docs/topo.md`: the `lucisv_mcp` node and six edges, the §2.8 rows,
MCP-1 delivered in M3, §2.9 rows 35–42 for the engine findings —
done 2026-09-23 with the M6 commit
- [x] `CHANGELOG.md` section (0.57.0), `README.md` architecture table row
(nine crates), `docs/repository-analysis.md` map row, CLAUDE.md
measurement line — done with the M6 commit and the closing release
- [x] release **0.56.0** (or the next minor free at the time): tag, CI
— done: 0.56.0 (72ff5df, M1–M3.5) and the closing **0.57.0**
(522ae70, tag v0.57.0, 2026-09-23): CI green, 8 assets, the
darwin-arm64 vsix holds bin/{lucisv,lucisv-server,lucisv-mcp} +
mcp.js, the bundled server answers `initialize` as 0.57.0
green, 8 assets, the darwin-arm64 vsix unzipped and checked for three
binaries, the MCP smoke in the release log; the install line and the
`claude mcp add` line given to the owner
- [x] QA: the read-only promise on the LSP store attacked (a store with a
torn last line; one from a different version; one whose record hash
matches but whose facts checksum does not — each must be skipped, not
trusted, and the file left byte-identical); a cold start with no
store directory permission (must still answer, warn on stderr);
the census transcripts spot-checked for a tool answer the agent had
to correct by reading the file anyway (each is a finding against a
tool's rendering); verdict
— done 2026-09-23 (Opus; interrupted by the owner moving the
machine, verdict pass-so-far with no blocking finding, recorded in
the README's QA log; the lead reviewed and committed; the temp-file
sweep QA asked for landed in feedback-1 and the census exercised the
warm-start path across 20 runs)
## Feedback rounds (the token census → the server)
### Round 1 → lane feedback-1 (`docs/features/mcp-feedback-1`)
- [x] unresolved mentions (`src/tools/mentions.rs`): every whole-word
spelling of the name in strings, comments, macro text, `define bodies
and macro-rooted paths that no engine answer accounted for, capped at
50; `references` ends with the section, `rename`/`remove_port`/
`add_port` warn with it; `unresolved_mentions` in the JSON; opentitan
cost recorded — done 2026-09-23 (dev)
- [x] descriptions and `instructions`: `hierarchy` leads with "who
instantiates a module", `references` points a module name at
`hierarchy up`; every description trimmed; `tools/list` 30 221 B →
17 981 B (≤ 18 kB, pinned by a wire test) — done 2026-09-23 (dev)
- [x] `add_port` `after`: the port placed after a named one in its line's
layout, each named connection after `.after(…)`; verified against the
engine's appending edit (`src/tools/place.rs`) — done 2026-09-23 (dev)
- [x] stale `index-cache-mcp.*.tmp` swept before the own store is written;
M6 QA's ignored test un-ignored — done 2026-09-23 (dev)
- [x] wire tests: mentions on `references` and `rename`, `after` byte-exact
on an `aes_core`-shaped fixture, catalogue size, sweep — done
2026-09-23 (dev)
- [x] QA: attack the mentions scanner (false positives and misses) and the
`after` verifier; verdict
### Round 2 → lane feedback-2 (`docs/features/mcp-feedback-2`)
- [x] paging header: every paged answer opens `N <noun>` or
`N <noun> (showing a–b)`; `shown` in the JSON; `DEFAULT_LIMIT` 500;
`hierarchy up` from one root counts instantiations (`render.rs`,
the seven paging tools) — done 2026-09-23 (dev)
- [x] `in` path glob (`*`, `**`, `?`, root-relative, before paging) on
`list_units`, `search_symbols`, `references`, `hierarchy`,
`diagnostics`, `defines`; ``0 <noun> (none match `in`)``
(`read.rs::path_match`) — done 2026-09-23 (dev)
- [x] post-edit line `check: diagnostics on …` (`check after writing:` on a
dry run) on `rename`, `add_port`, `remove_port`, `expand_wildcard`,
`extract_module`, `inline_module` (`edit.rs::with_check`) — done
2026-09-23 (dev)
- [x] `INSTRUCTIONS` names `in` (896 characters); catalogue 17 993 B
(≤ 18 000) — done 2026-09-23 (dev)
- [x] wire tests (header cut and whole per tool, `in` per tool with `**`,
`?`, no-match and an escaped name, the check line); fixture
`tests/fixtures/paths/` — done 2026-09-23 (dev)
- [x] QA: attack the path matcher, the "none match" rule and the
`hierarchy` counting; verdict — PASS 2026-09-23 (QA,
`tests/qa_f2.rs`, 14 tests; four low notes in the QA log)
### Round 3 → lane feedback-3 (`docs/features/mcp-feedback-3`)
- [x] `unit_interface`: the instantiation template opt-in (`template`,
default false; text and JSON); `parameters (N):` / `ports (N):`
headers — done 2026-09-23 (dev)
- [x] `hierarchy`: the `#( … )` overrides on the text line opt-in
(`overrides`, default false); the JSON keeps them — done 2026-09-23
(dev)
- [x] `INSTRUCTIONS` names `overrides: true` (896 characters; `template:
true` did not fit); catalogue 17 943 B (≤ 18 000; `dry_run`'s
description trimmed in `edit.rs`, flagged) — done 2026-09-23 (dev)
- [x] wire tests for both defaults and both opt-ins; old pins moved to the
opt-in; measured on the eval clone (`unit_interface prim_fifo_sync`
596 B vs 999 B; `hierarchy up … in ip/**/rtl/*.sv` 22 163 B vs
64 783 B) — done 2026-09-23 (dev)
- [x] QA: attack both flags (defaults, `false`, wrong types, packages,
recursive/noted lines, JSON equality); verdict — PASS 2026-09-23 (QA;
`tests/qa_f3.rs`, 7 tests; differential vs the c2e42b8 binary)
- [x] re-measure census task d (and a, which now needs `overrides: true`)
— done 2026-09-23 as round 3b (d 96k, −10 % vs base; a 111k, the
opt-in was not discovered), written up in `mcp_analysis.md` (aba39e5)
## M7. The lean catalogue (0.58; PLAN §10 — owner's steer 2026-09-23)
Nine tools, the model-visible catalogue under 3 500 bytes, instructions
under 400, short answers, no dry_run/paging, edits told to be trusted.
Feature README `docs/features/mcp-lean-catalogue`. One dev (Opus), one QA
(Opus), on trunk.
- [x] registry: `TOOLS` holds exactly `hierarchy, find, outline, read,
check, rename, port, edit_item, format` in that order; `title` and
`structuredContent` removed from the wire (`Answer` is text only);
`Param.description` gone; `wire.rs` pins the names, the order, the
byte budgets (≤ 3 500 model-visible, ≤ 400 instructions) and that no
schema names `dry_run`, `limit`, `offset`, `in`, `template`,
`overrides`, `force`
- [x] `hierarchy`: no root → counts line + top modules; down = instance
tree with instantiation `file:line`; `up`; `peek`; cap 300;
unknown-root refusal with near matches; opentitan instance set
identical to the old tool (test against `tests/opentitan.rs` truth)
- [x] `find`: declarations + `refs` uses grouped one file per line +
`unresolved:`; macros found; near-match refusal
- [x] `outline` (`file` xor `unit`), `read` (design-wide lookup, ambiguity
refusal), `check` (`ok` when clean; old `diagnostics` line set
preserved on the fixtures)
- [x] `rename` (name-based, `file` disambiguates), `port` (add xor remove),
`edit_item` (four ops, the M4 verifier unchanged, `attacks.rs` green
unchanged), `format` (path or glob, `fix`)
- [x] instructions ≤ 400 bytes per PLAN §10.3; resources render through
the new renderers
- [x] tests: the old suites that exercise dropped tools are ported to the
surviving tool or deleted with a line in the README saying which;
every kept invariant (verifier attacks, all-or-nothing writes, roots,
freshness, cache read-only) keeps its test
- [x] docs: feature README; `docs/site/.../guides/agents.md` table
regenerated by `mcp_smoke.js --tool-table` (+ the promises paragraph:
no dry_run); extension README/CHANGELOG; `CHANGELOG.md` 0.58.0 notes
(unreleased); `docs/topo.md` §2.8 rows; PLAN §4.3/§4.5 marked
superseded by §10
- [x] QA: attack the byte budget (a description that grows), the caps, the
ambiguity refusals, `peek` on a multi-line instantiation with
comments, `port add` after a non-existent port, `edit_item delete`
of a used item, `format` with a glob that matches nothing; differential
`hierarchy`/`check` against the 0.57.0 binary on the fixtures and the
eval clone
- [x] census round 4 (lead): tasks a–d on the lean binary (`bin/lucisv-mcp-r5`),
base arm reused from round 3; written up in `mcp_analysis.md` — done
2026-09-24 (9242594): 6/6 correct incl. one Opus run; a −1 %, d parity
over two runs, b +10 %, c +9 % vs the base re-run
- [x] release 0.58.0 when round 4 meets PLAN §10.5 — tagged 2026-09-24
(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.
- [x] 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
- [x] 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)
- [x] 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
- [x] 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
- [x] 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
- [x] census round 5 (lead): tasks a and d on `--read-only` — done
2026-09-29 (74c5631): 7 runs, all correct; with same-day base controls
a +8 %, d −8 % (parity); found and fixed the `peek` cap defect
(`hierarchy` caps at 300 instances, 100 with `peek`)
- [x] release 0.59.0 — tagged 2026-09-29; gates: clippy -D warnings, fmt,
72 suites + 6 doc suites (4 937 passed, 0 failed), corpus 814/820,
node tests 6/6. The first suite run stalled 25 min in the vlog_linter
doc-test and was cut by the guard; the doc-tests passed in under a
minute as their own gate
## Open questions for the owner (answer before the lane that needs it)
1. **Engine bump** (M5): if `vsce` accepts the contribution point on
`^1.82.0`, keep it; if not, bump to `^1.101.0` and drop VS Code < 1.101
users. The lane records which happened; no ruling needed unless the
bump is unwelcome.
2. **Whole-set refactors** (M3): MCP hands every refactor the full in-scope
set. On opentitan that is a parse of ~3 000 files per `rename` unless
`KnownFacts` from the cache is threaded through (M6 can). Acceptable for
the first release, or should M3 already narrow with
`files_mentioning` the way the server does?
3. **Structural edits and the formatter** (M4): after `replace_item`, the
agent's text is left as written. The alternative — format the replaced
item's lines through `format_range` automatically — costs a refusal
path when the safety net objects. Default in this plan: not automatic;
the agent calls `format` with `lines`.