# mcp-transport TODO-MCP.md **M1** (first half) — the `lucisv-mcp` binary, its argument contract, the stdio JSON-RPC transport, the MCP handshake and the `Project` behind every tool. Design: `docs/mcp/PLAN.md` §4.1, §4.2, §4.4. The read tools that sit on this transport are `docs/features/mcp-read-tools`. ## Goal Give coding agents (Claude Code, Cursor, VS Code's agent mode) lucisv's project understanding over the Model Context Protocol, as a third binary that shares no code path with `lucisv-server` or the `lucisv` CLI. This feature is the plumbing every MCP tool stands on: a process an agent host can spawn, a handshake it recognises, a tool-call envelope, and a `Project` — roots, config, file set, workspace index, per-file analyses — that never answers from a file older than the disk was when the call arrived. ## Assumptions - **No `rmcp`, no tokio, no new dependency.** MCP's stdio transport is one JSON-RPC message per line; `serde_json` (already pinned by the workspace) reads and writes it, and the envelope is a few `serde` structs in `rpc.rs`. The official Rust SDK brings an async runtime and a large transitive tree to what is one synchronous loop — the same reasoning that picked `lsp-server` over `tower-lsp` for the LSP. `serde` is used with its `derive` feature, which the lock already carried (no new crate in `Cargo.lock` beyond `lucisv_mcp` itself). - **Synchronous, one request at a time.** A request is answered before the next line is read, so pipelined requests are answered strictly in order. `notifications/cancelled` is accepted and ignored: a call cannot be interrupted, and the longest one is the first call's index build (1.6 s for all of opentitan, below). - **Protocol revisions pinned: `2025-11-25` (newest), `2025-06-18`.** Verified against modelcontextprotocol.io on 2026-09-23: the current revision is **`2026-07-28`**, and it is a different *era* — it removes the `initialize` handshake and carries the protocol version in every request's `_meta` (with `server/discover` and error `-32022`). The spec names everything up to `2025-11-25` "legacy" and says a legacy server answers the modern probe with any non-modern error, after which a dual-era client falls back to `initialize`. So this server is a legacy-era server by design: it echoes a client's `protocolVersion` when it is one of the two above and otherwise offers `2025-11-25`, and a `server/discover` probe (or any request before `initialize`) gets `-32002` "server not initialized", which is exactly the fallback signal. Serving the modern era is a separate piece of work (see Handshakes, *MCP-4*). - **Answers are from disk.** No unsaved editor buffer is ever seen. Every `tools/call` starts with a freshness sweep: one `stat` per indexed file (size + mtime); a file whose stamp moved is re-read and re-hashed, and only a changed hash re-indexes it; a missing file is removed and triggers a re-walk; the roots are re-walked when the last walk is older than 5 s and on every `project_overview`, so new files appear. All changes go into the index with one `absorb` (one merge). A file any of whose trusted timestamps — its mtime, and on Unix its ctime — is within 3 s of the moment it was read is re-read on every sweep until it settles — git's "racy clean" rule, applied to every timestamp the stamp trusts since 0.65.9 (it covered the mtime alone before, and a same-tick rewrite on Linux was served stale) — so an edit that keeps a file's size inside one timestamp tick is still seen. On Unix the stamp also holds the file's ctime and inode (the same `stat`), so a same-size rewrite that puts the old mtime back (`cp -p`, `rsync -t`, `touch -r`) is seen too. Elsewhere (Windows) there is no ctime or inode: size, mtime and the racy rule are all there is, so a same-size rewrite that restores the old mtime more than 3 s after a read is NOT seen. Not seen anywhere: a store through a writable mmap that the kernel has not yet reflected in the file's timestamps (`docs/features/linux-test-portability`, Round 2). A by-name lookup that finds nothing (`unit_interface`, `list_units` with a `glob`, `search_symbols`) walks once more before it answers, unless this call already walked (`Project::ensure_walked_for_miss`) — so a file the agent wrote a moment ago is found by name without waiting for the 5 s walk. - **The file set** is the editor's ladder minus the editor: `--filelist`, else the first root's configured `filelist`, else a walk of every root with `.gitignore` honoured, each root's `exclude` patterns, and a 1 MiB per-file cap. A filelist that does not read falls back to the walk with a warning. Every path is canonicalized (symlinks resolved) and deduplicated. A walked file whose canonical path lies outside every root (a symlink leading out) is dropped with one warning naming it — the same containment rule a path argument meets in `Project::resolve`; a `--filelist` entry is the user's own choice and stays. A file that is not UTF-8 is skipped, as the language server skips it, and named (root-relative) in `project_overview`'s warnings; that list is recomputed by every walk, so a file fixed later drops out of it and one broken later enters it. - **Roots** are canonicalized and deduplicated (the same directory given twice is one root, in first-given order); nested roots stay two roots. - **Columns**: every column the server prints or accepts is a **1-based byte column** — what `LineIndex::line_col` and the parser's diagnostics give. There is no second unit: `search_symbols` prints no column rather than the index's UTF-16 one, and M2's `file,line,col` selectors take byte columns too. - **Paths**: a path argument is absolute or relative to the first root that holds it; after canonicalization it must be a file inside some root, else the tool refuses naming the argument. Answers print paths relative to the first root holding them, `/`-separated. - **The index is built lazily** — on the first `tools/call`, not at `initialize` — so a host's startup handshake is instant however large the tree. The build line (`lucisv-mcp: indexed N files in M ms`) is always written to stderr; `--verbose` adds one timing line per request and the freshness report per call. - **`--index-cache DIR`** names the directory holding the language server's `index-cache` store, read read-only at startup (M6, 2026-09-23: `docs/features/mcp-cache-and-census`), beside which this server writes its own `index-cache-mcp` once at exit. A missing directory is a cold start. - **Argument validation is a tool error, not a protocol error.** A call whose `arguments` do not fit the tool's schema (unknown argument, wrong type, missing required one) is answered `isError: true` with a sentence naming the argument. `2025-11-25` states this explicitly (SEP-1303: "input validation errors should be returned as Tool Execution Errors rather than Protocol Errors to enable model self-correction") — a host shows the model a tool error, but often not a protocol one. Only an envelope `tools/call` cannot read at all (params not an object, no string `name`, `arguments` not an object) or an **unknown tool** is `-32602`. This deviates from the brief's "invalid params → -32602"; see the work log. - `resources/list`, `resources/templates/list` and `prompts/list` answer empty lists (the capabilities are advertised, per PLAN §4.2, so hosts will ask); `resources/read` is `-32002` "resource not found" and `prompts/get` `-32602` until M2/M6 fill them. - **`structuredContent` beside a compact text.** The spec says a tool with structured output SHOULD also serialize that JSON into a text block; this server deliberately sends its own compact rendering as the text instead (PLAN §4.5 — the token budget is the product). Whether a given host feeds the model the text or the JSON is not something this server controls; the M6 token census is where that shows. ## Handshakes Consumed (public APIs only; no library crate was modified): | crate | items | |---|---| | `lucisv_core` | `config::{Discovery::{new, for_dir}, FileConfig}`, `walk::collect_files_with`, `filelist::read`, `cache::content_hash` | | `vlog_parser` | `PARSE_STACK_SIZE`, `tokenize`, `parse_tolerant`, `parse_source_tolerant`, `LineIndex::{new, line_col}`, `ParseDiagnostic`, `ast::{SourceFile, Item, ItemKind, GenBlock, GenElse, GenIf}`, `span::TextRange` | | `vlog_semantic` | `analyze`, `Semantics::{symbols, symbol, symbols_named, document_symbols}`, `Symbol`, `SymbolKind`, `ScopeId`, `DocumentSymbol`, `IndexBuilder::{new, add_file, finish}`, `FileFacts::of`, `WorkspaceIndex::{absorb, fingerprint, files, path, units, units_of, instantiable_units, member, members_of, base_of, instantiations_of, workspace_symbols, build}`, `Def`, `DeclLines` | | `vlog_refactor` | `instantiation_plan`, `InstantiationPlan::render`, `Layout` | | `vlog_formatter`, `vlog_linter` | declared dependencies (PLAN §4.1); nothing called in M1 | Promised to later lanes and to M5 (packaging): the binary name `lucisv-mcp`; the arguments `--root DIR` (repeatable, default cwd; a root that is not a directory is a usage error), `--filelist FILE`, `--index-cache DIR`, `--verbose`; anything else → `error: …` + `usage: …` on stderr, exit 2; stdout carries protocol lines only; EOF on stdin exits 0. `tools::Tool` (name, title, description, params, rewalk, handler) is the registry entry shape M2–M4 add to; `tools::read_item::select` is the item slicer M4's structural edits are specified to share. Requests: - **MCP-4 (new, to the lead):** the modern MCP era (`2026-07-28`: per-request `_meta` version, `server/discover`, no `initialize`). Not needed for any host this block targets today, but a dual-era server is the spec's recommended shape; a later lane, not M1. ## Status / TODO - [x] crate skeleton, argument contract, `PARSE_STACK_SIZE` thread, ordered loop - [x] `transport.rs`: newline-delimited JSON-RPC; `-32700` for non-JSON and non-UTF-8 lines; EOF ends cleanly - [x] `rpc.rs`: `initialize` negotiation, `notifications/initialized`, `ping`, `tools/list`, `tools/call`, `-32002` before `initialize`, `-32601`, `-32602`, `-32600` for a malformed envelope (null id, wrong `jsonrpc`, a batch array) - [x] `project.rs`: roots, config, filelist-or-walk, 1 MiB cap, index build, lazy per-file analyses keyed by content hash, per-call freshness sweep, path refusal outside the roots - [x] fingerprint-equals-rebuild after update / add / remove / recreate (`project/tests.rs`) - [x] wire tests over the real binary (`tests/wire.rs`) - [x] gates through `tools/guard.sh` ## Work log **2026-09-23 (dev, M1).** Built `crates/lucisv_mcp` (binary `lucisv-mcp`), added to the workspace `members`. Modules: `main.rs` (arguments, root canonicalization, the stack-sized thread), `transport.rs`, `rpc.rs`, `project/{mod,files,analysis}.rs` (+ `project/tests.rs`), `render.rs`, `tools/{mod,read,interface,read_item}.rs`. The plan's single `tools/read.rs` was split three ways before it reached 600 lines (`interface.rs` = `unit_interface`, `read_item.rs` = the item slicer, which M4 will share), and `project.rs` became a directory for the same reason (`files.rs` = discovery + stamps, `analysis.rs` = the per-file analysis cache). Decisions and deviations: 1. **Protocol revisions.** The brief said pin `2025-06-18` plus the newest revision if verifiable. The newest (`2026-07-28`) was verified and is *not* an initialize-based protocol, so pinning it in `initialize` would have been a lie; the newest handshake-based revision, `2025-11-25`, is pinned instead, first. Filed MCP-4 for the modern era. 2. **Invalid arguments are `isError: true`, not `-32602`** (Assumptions: SEP-1303 in `2025-11-25`). Unknown tool and unreadable envelopes stay `-32602`, and the message names the offending field or tool. 3. **Lazy index build** on the first `tools/call`, so `initialize` is instant; not in the plan, which said "at startup". 4. **The per-file analysis omits the `` `define`` table and the `resolve_external` overlay** of the server's `Document::new` sequence — nothing in M1 reads them, and the overlay depends on the index (it would need invalidating on every refresh). M2 adds both where `defines` and `definition` need them. 5. **Racy-stamp rule** (Assumptions) — added beyond the plan's size+mtime, because a same-size rewrite within one mtime tick is exactly QA's "rename-then-recreate within one second" attack. 6. **`-32002` for `resources/read`** is MCP's "resource not found"; the same number LSP uses for "server not initialized". Both meanings are the spec's. 7. **`tools/list` ignores `cursor`** and never sends `nextCursor`. Measured (release build, `--verbose`, read-only on opentitan; the checkout's `git status` was the same before and after — three files already modified by the owner, untouched here): | root | files | index build (stderr line) | wall, 4 messages | RSS | |---|---|---|---|---| | `hw/ip/aes` | 124 | 64 ms | 1.07 s (incl. guard startup) | — | | `hw/` | 3 944 | 1 813 ms | 2.15 s | 332 MB | | whole checkout | 3 944 (3 over 1 MiB skipped) | 1 556–1 601 ms | 2.12 s | 331 MB | Per-call cost on the whole checkout after the build: 7–12 ms for a call whose sweep changed nothing (3 944 `stat`s + the tool), 222 ms for a call that re-walked the tree (`project_overview`). Gates (all through `tools/guard.sh`): `cargo fmt -p lucisv_mcp -- --check` clean; `cargo clippy -p lucisv_mcp --all-targets` clean, no `#[allow]`; `cargo test -p lucisv_mcp` 27 unit + 11 wire tests green; `cargo test --workspace` 4 497 passed, 0 failed, 46 ignored (4 459 before + 38 new). **Guard finding:** the first `cargo test --workspace` run was killed at the default 1 800 s wall clock, sitting in `vlog_semantic/tests/semantics.rs` (4 341 tests had passed, none failed). That binary takes 0.00 s on its own and in the re-run; the identical command re-run immediately afterwards finished green in 3 min 08 s. Most likely cause: a second `cargo test -p lucisv_mcp` the dev started during the first run, contending for the build directory lock. Not reproduced; recorded rather than explained away. Production lines (non-blank, non-comment, before `#[cfg(test)]`): `main.rs` 67, `transport.rs` 38, `rpc.rs` 222, `render.rs` 97, `project/mod.rs` 212, `project/files.rs` 130, `project/analysis.rs` 52, `tools/mod.rs` 129, `tools/read.rs` 397, `tools/interface.rs` 285, `tools/read_item.rs` 199; tests `project/tests.rs` 91, `tests/wire.rs` 390. None over 600; no function over 50 lines. **2026-09-23 (dev, M1 rework after QA).** The lead's rulings on the QA findings, transport and `Project` half (the read-tools half — findings 1, 3's tool hooks, 4, 5 — is in `docs/features/mcp-read-tools`'s work log). Every ruled `qa_*` test in `crates/lucisv_mcp/tests/qa_m1.rs` is un-ignored and green; nothing in that file was renamed. - **2 — fixed.** `project/files.rs::walk_root` now takes every root and drops a canonical path that `starts_with` none of them, with a warning `: outside every root (reached through a symlink); not indexed`. `resolve` unchanged. `qa_the_walk_does_not_index_files_outside_the_roots_through_symlinks`. - **3 — fixed.** `Project::ensure_walked_for_miss` + a `walked_in_call` flag (set by `open`, cleared at the top of `refresh`, set by any walk); called on a miss by the three by-name tools (read-tools log). `qa_a_unit_written_just_now_is_found_by_name_without_a_walk_first`. - **7 — fixed.** `rpc.rs::classify` answers an invalid message with its id whenever the id is readable (a string or an integer) — the missing or non-string `method` branch as well as the wrong-`jsonrpc` one; `null` only when the id itself is unreadable. `qa_an_invalid_request_with_a_readable_id_keeps_that_id`. - **8 — fixed.** The not-UTF-8 warnings are rendered with the new free function `relative_to` (what `Project::relative` now calls) and rebuilt by every `rewalk` from the files it could not read. `qa_an_unreadable_file_warning_is_root_relative_and_current`. - **9 — fixed.** `canonical_roots` keeps each canonical directory once. `qa_a_root_given_twice_is_one_root`. - **10 — fixed.** `Stamp::identity` = (ctime s, ctime ns, inode) under `cfg(unix)` via `std::os::unix::fs::MetadataExt`, `(0, 0, 0)` elsewhere; `Stamp::check` is suspect when it moves. `qa_a_same_size_rewrite_that_restores_an_old_mtime_is_seen`. Gates after the rework (all through `tools/guard.sh`, one cargo at a time): fmt `--check` exit 0; clippy `--all-targets` exit 0, no warnings; `cargo test -p lucisv_mcp` unit 28 passed, `qa_m1` 40 passed / 0 ignored, `wire` 11 passed; `cargo test --workspace` exit 0 in 3 min 51 s, **4 538 passed, 0 failed, 46 ignored**. Production lines now: `main.rs` 67, `transport.rs` 38, `rpc.rs` 225, `render.rs` 128, `project/mod.rs` 237, `project/files.rs` 149, `project/analysis.rs` 52, `tools/mod.rs` 129, `tools/read.rs` 405, `tools/interface.rs` 322, `tools/read_item.rs` 204. ## QA log **2026-09-23 (QA, M1 — transport, protocol, `Project`).** Verdict: **rework needed** — for read-tools finding 1 (a wrong answer; see `docs/features/mcp-read-tools` QA log). Nothing in this half blocks. How: read `PLAN.md` §4, both READMEs and every file under `crates/lucisv_mcp/src`; drove the debug and release binaries by hand (Python over stdin/stdout, scratch trees only); then pinned every attack as a `qa_*` test in `crates/lucisv_mcp/tests/qa_m1.rs` (40 tests: 30 pass and pin correct behaviour, 10 assert the correct behaviour of a finding and are `#[ignore = "QA finding N"]` — each confirmed failing today with `cargo test -p lucisv_mcp --test qa_m1 -- --ignored`, for the stated reason). Findings are numbered across both READMEs; 1, 4, 5 and 6 are the read tools' and are logged there. Verified correct (pinned by passing `qa_*` tests): - Protocol: a string id (non-ASCII) echoed verbatim; `null`, fractional and object ids → `-32600` with id `null`, server goes on; a notification method sent *with* an id is answered as a request (`-32601`, that id) and a real notification is never answered; a 10 MiB valid line (a `search_symbols` query) is answered and a 10 MiB non-JSON line is `-32700`, and the next `ping` is answered (0.16 s for both); every method but `initialize`/`ping` before the handshake → `-32002` (`server/discover` included, the dev's modern-era fallback signal); an unsupported `protocolVersion` (a string, a number, `null`) → `2025-11-25`; missing / extra / wrong-type / fractional / out-of-enum arguments are `isError: true` and every sentence names the argument (the SEP-1303 deviation holds as documented); `arguments` not an object → `-32602`; a `_meta` beside the call is accepted; an unknown tool → `-32602` naming it; two messages on one line → one `-32700`, no second answer, no crash; empty, whitespace-only and bare `\r` lines ignored; EOF after a complete message without its newline answers it and exits 0; EOF mid-message → `-32700` then exit 0; under `--verbose`, stdout of a 16-message session (including a lex-error file and a non-UTF-8 file) parses line by line as JSON-RPC while the log goes to stderr. - Freshness: rename a file away and recreate it with different content and the *old* mtime (a 1-second-mtime filesystem's view) — the next call answers the new content (the racy rule, `files.rs:157`); a same-size rewrite with the mtime put back inside the racy window is caught; a file in a new two-level subdirectory appears after `project_overview`'s walk (and, by hand, after the 5 s re-walk with no overview); a file growing past 1 MiB drops out at the next call and is counted in `skipped_large`; a `.gitignore` added after startup drops its files at the next walk. - Roots: `link.sv` and `linkdir/secret.sv` (symlinks leaving the root), a `../sibling/…` path and an absolute outside path are all refused "outside every root"; `--root A --root A/sub` indexes each file once and `b.sv` resolves against the inner root; a relative `--root` resolves against the working directory. - `rpc.rs`, `transport.rs`, `project/*`: no `unwrap`/`expect`/`panic!` outside `#[cfg(test)]`; no `#[allow]`; no `unsafe`; no `println!` in any library crate the binary calls (stdout is held by one lock for the loop). Findings (this half): - **2 — non-blocking (medium): the walk is not contained, the arguments are.** `project/files.rs:98` canonicalizes each walked path and keeps it wherever it lands, so a symlink inside a root to a file (or directory) outside it indexes the outside file: `list_units` prints its absolute path and `unit_interface secret_mod` answers its ports, while `outline` on the same file is refused "outside every root" (`Project::resolve`). Repro: `qa_the_walk_does_not_index_files_outside_the_roots_through_symlinks`. Suggested fix: in `walk_root`, drop (and count in a warning) a canonical path that `starts_with` no root; a `--filelist` entry stays allowed as the README says. Alternatively the lead rules that indexed files are readable and `resolve` accepts them — either way one posture. - **3 — non-blocking (medium; plan-conformant): a file written in the last 5 s is invisible to every name lookup.** `project/mod.rs:131` walks only when a file went, on `project_overview`, or after `REWALK_AFTER` (5 s). The common agent flow — write `new_mod.sv`, then `unit_interface new_mod` — is refused with "search_symbols finds near names" (`tools/interface.rs:84`), which cannot find it either. Repro: `qa_a_unit_written_just_now_is_found_by_name_without_a_walk_first`. Suggested fix: when a by-name lookup (`unit_interface`, `list_units` with a glob, `search_symbols`) finds nothing and the last walk is more than, say, 100 ms old, walk once and retry (opentitan walk: 157 ms release). PLAN §4.4 permits today's behaviour; this is for the lead. - **7 — non-blocking (low): an invalid request loses a readable id.** `rpc.rs:107` answers `{"jsonrpc":"2.0","id":15}` and `{"jsonrpc":"2.0","id":15,"method":5}` with id `null`; JSON-RPC 2.0 §5 wants `null` only when the id could not be detected. Repro: `qa_an_invalid_request_with_a_readable_id_keeps_that_id`. Fix: in that branch use `id` when `valid_id` (two lines). - **8 — non-blocking (low): the unreadable-file warning is absolute and never refreshed.** `project/mod.rs:88` records `path.display()` (PLAN §4.5: root-relative), only at `open`; `rewalk` (`project/mod.rs:173`) skips an unreadable file silently, so a file fixed later is indexed yet still warned about, and one broken later is never warned about. Repro: `qa_an_unreadable_file_warning_is_root_relative_and_current`. Fix: keep the unreadable set in `FileSet`/the rewalk, rendered with `Project::relative`. - **9 — non-blocking (cosmetic): a root given twice is listed twice** in `project_overview` (`project/mod.rs:56` does not dedup; files are not duplicated). Repro: `qa_a_root_given_twice_is_one_root`. Fix: dedup the canonical roots keeping first order. - **10 — non-blocking (low): a same-size rewrite that restores an old mtime is never seen.** `Stamp::check` (`project/files.rs:145-157`) compares size + mtime only; `cp -p`, `rsync -t`, `touch -r` and archive extraction restore mtimes. Repro: `qa_a_same_size_rewrite_that_restores_an_old_mtime_is_seen` (mtime set an hour back before startup, rewritten, set back). Fix: add `ctime` and `ino` (`std::os::unix::fs::MetadataExt`, same `stat`) to `Stamp` — git's own answer to the same problem. Notes (no action asked): stdin lines have no length cap — a host that never sends a newline grows one buffer without bound (10 MiB costs nothing; the process is the host's child). `initialize` twice is accepted and re-negotiates. No `catch_unwind` around a tool call — the LSP has none either, and no panic was found. Opentitan (read-only, checkout `0098135`; `git status --porcelain` byte-identical before and after — the owner's three modified files, untouched): | root | build (stderr line) | first `tools/call` (build + call) | later calls | `project_overview` (re-walk) | |---|---|---|---|---| | `hw/ip/aes` (debug binary) | — | 329 ms (`unit_interface aes_core`) | 0–1 ms | — | | `hw/` (release) | 3 944 files in 1 584 ms | 1 791 ms (`list_units`) | 5–11 ms | 157 ms | `initialize` answered in 0 ms (129 ms wall including process start). Gates (all through `tools/guard.sh`): see the read-tools QA log entry of the same date (one run for the crate). **2026-09-23 (QA, M1 re-check after the rework).** Verdict: **pass** — every ruled finding is fixed; one new non-blocking finding (11, read tools). Re-derived by hand (scratch trees, debug and release binaries), not only by the tests: - **2** — a root holding `vendor -> ../out` (a directory outside, two files), `rtl/loop -> ..`, `alias.sv -> rtl/in.sv`, and `out/back -> root`: the walk ends, indexes one file, and `project_overview` carries two warnings `: outside every root (reached through a symlink); not indexed`; `unit_interface secret2` refuses (after its miss walk), `outline vendor/s1.sv` refuses. Note only: the warning names the resolved outside file, not the link inside the root that led there. - **3** — written just before each call: `unit_interface fresh1` (root), `list_units glob=fresh2`, `search_symbols fresh3` (a new two-level subdirectory) and `unit_interface fp::fc` all answer. Walk count, timed on opentitan `hw/` (release; `git status` identical before and after): hits 6–10 ms; `unit_interface no_such_mod`, `list_units glob=no_such*` and `search_symbols zzqqxx` each 140–150 ms, three times running — one walk per miss call (two would be ~290 ms, since one walk is ~145 ms); hits right after the misses 5–8 ms, so a legitimate miss does not make later calls walk. By design (the ruling) every repeated miss re-walks: ~145 ms each on 3 944 files. `list_units` with a `kind` and no `glob` never walks on a miss. The miss walk is not in the `--verbose` refresh line (`ensure_walked_for_miss` calls `refresh` without logging) — note only. - **10** — `cp -p` of a same-size file with a 2020 mtime over the indexed one (also 2020): the next call answers the new module; `mv` of a prepared same-size, old-mtime file over it: likewise; `read_item` slices the new bytes. - 7, 8, 9 by their tests (un-ignored, unchanged, green), plus `qa_rework_a_file_that_stops_being_utf8_is_warned_and_leaves_the_index` for the half of 8 the first test did not reach. Checked that the dev's edit to `qa_m1.rs` is what the ruling says: the ten `#[ignore]` attributes are gone, and in `qa_columns_are_counted_in_one_unit_across_tools` only the last assertion changed (`col == 17` → `line == 1` and no `col` key, with a two-line comment citing the ruling); the parse-error assertion (`1:28`, bytes) and every other test body read as written (the ten formerly ignored ones compared line by line; key assertions of the other thirty spot-checked). New tests this round (`qa_rework_*` in `crates/lucisv_mcp/tests/qa_m1.rs`, 11: 10 pass, 1 ignored for finding 11) — see the read-tools QA log for the list. Sizes after the rework (production lines, measured by QA): `main.rs` 67, `transport.rs` 38, `rpc.rs` 225, `render.rs` 128, `project/mod.rs` 237, `project/files.rs` 149, `project/analysis.rs` 52, `tools/mod.rs` 129, `tools/read.rs` 405, `tools/interface.rs` 322, `tools/read_item.rs` 204 — the dev's numbers; no function over 45 lines; no `unwrap`/`expect`/ `panic!` outside tests, no `#[allow]`, no `unsafe`. Gates (verbatim, all through `tools/guard.sh`, one cargo invocation at a time): `cargo fmt -p lucisv_mcp -- --check` exit 0; `cargo clippy -p lucisv_mcp --all-targets` `Finished`, no warnings; `cargo test -p lucisv_mcp` unit `28 passed; 0 failed`, `qa_m1` `50 passed; 0 failed; 1 ignored`, `wire` `11 passed; 0 failed`; `cargo test --workspace` (default guard) exit 0 in 242 s, **4 548 passed, 0 failed, 47 ignored** (the dev's 4 538 / 46 plus this round's 10 / 1). No guard kill. ## Review **Lead, 2026-09-23.** Read every source file. The block is what PLAN §4 asked for and nothing more: no library crate touched, no new dependency, one synchronous loop, `PARSE_STACK_SIZE` on the parsing thread, no `unwrap` on a library path. Rulings recorded here so nobody re-litigates them: invalid tool arguments are tool errors (`isError`), not protocol errors — the 2025-11-25 spec's own guidance and the better shape for an agent that has to correct itself; the server is a legacy-era (`initialize`) server by design, MCP-4 filed for the modern era; columns are 1-based bytes everywhere, and `search_symbols` reports no column rather than a second unit; a by-name miss walks once per call. The guard kill the dev saw was two concurrent cargo invocations and did not reproduce under either QA run. QA finding 11 (an escaped identifier ending in `@digits` cannot be selected bare) is carried into M2 as a small item. Committed as M1.