Files
lucioandClaude Fable 5.1 c2e42b8840
ci / checks (push) Successful in 1m39s
ci / corpus (push) Successful in 33s
MCP feedback-2: the count line leads every paged answer, default limit 500, in path-glob filter on the listing tools, post-edit check hint; census round 2 written up
Census round 2 (mcp_analysis.md): with feedback-1 the rename task became complete (the unresolved-mentions list surfaced the DV string path) at a token cost inside the base arm's run-to-run variance; the port task was unchanged; the census task regressed — the agent chose `hierarchy up` (right) but paged the 77-row answer with a small limit and never read the trailing "… and N more". Fixes: every paged text answer opens with `N <noun> (showing a–b)` (JSON gains `shown`), DEFAULT_LIMIT 500; `list_units`, `search_symbols`, `references`, `hierarchy`, `diagnostics` and `defines` take `in`, a root-relative path glob (`*` within a component, `**` across, `?`; a bare directory means everything below it) applied before paging — `hierarchy up prim_fifo_sync` with `in: "ip/**/rtl/*.sv"` answers the census's 47 in one call; the six design-wide edits end with `check: diagnostics on <files>`. Catalogue 17 993 B, instructions 896 chars. QA (Opus): 14 qa_f2 tests, four notes. Gates through tools/guard.sh: fmt, clippy, workspace 4 943 passed (+1 lead test).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-23 21:50:34 -07:00
..

mcp-feedback-2

Lane feedback-2 of the MCP block: the changes the second token-census round asked for (mcp_analysis.md, Round 2 → "Changes for round 3"). Tracked in TODO-MCP.md → "Feedback rounds".

Goal

Round 2's task a regressed: the agent reached for hierarchy up, paged the 77-row answer with a small limit, never read the trailing … and 28 more line and reported 35 of 47 instantiations as complete. Every census task also spent turns dropping dv/, fpv/ and template rows by hand. This lane puts the total first on every paged answer (77 instantiations (showing 1–50)), raises the default page to 500, gives the listing tools a path glob in applied to root-relative paths before paging, and ends the design-wide edits with the one line that names the files to run diagnostics on.

Assumptions

  • The header. Every paged text answer opens with N <noun> when the list is whole and N <noun> (showing a–b) when it is cut — (showing a) for a one-entry window, (showing none: `offset` is past the end) past the end; singular for 1 (1 unit). The trailing … and N more stays. Nouns: units (list_units), entries (outline), symbols (search_symbols), hits (references), findings (diagnostics), defines (defines, `undef rows of the file form included), instantiations (hierarchy up with one root line), nodes (every other hierarchy walk). An empty list keeps its old one-line answer (no units match, no references, no findings, no defines, no modules), except hierarchy up from one root, which always has its root line and now says 0 instantiations. project_overview is not a paged tool: its top: line keeps its own cap of 200 (read.rs::TOPS_CAP), so the overview did not grow with DEFAULT_LIMIT.
  • hierarchy up from one root. The window counts the instantiation lines only; the root line heads every page, offset/limit skip and cap instantiation lines, and the JSON's total/shown count them too (nodes still starts with the root). Lines deeper than 1 are instantiations of the ancestors and are counted. A root declared twice (two root lines) is counted as nodes, all lines paged, as before.
  • JSON. Every paged answer's structuredContent gains "shown": [a, b] (1-based, inclusive; [0, 0] for an empty window) next to total, which is the count after in.
  • in. A glob over the root-relative path (Project::relative, /-separated): * and ? within one component (the existing glob_match), ** as a whole component for any run of components, none included; **/** collapses to **; a leading ./ is dropped; a trailing / means everything below. Anchored at the root: ip/** does not match hw/ip/x.sv (write **/ip/**). ** inside a component (a**b) is two *s. An empty in filters nothing. The glob only ever sees paths — names, escaped ones included (\esc*w ), are never matched against it. A file outside every root is shown absolute, and matches only a glob starting with / or with **. A bare directory (ip/aes, no wildcard) means everything below it, as for .gitignore (lead, after QA note 2).
  • What in filters, per tool. list_units, search_symbols: the declaring file. references: each hit's file, and the unresolved mentions are searched only in matching files (the engine still runs over the whole set — a use can resolve through any file). defines: the defining file (both forms). diagnostics: the whole-project form lints only matching files; the file form keeps its findings only when the file matches; a filtered whole-project run does not report unused external waivers (only a complete run knows a waiver matched nothing). hierarchy: up keeps an instance when the file holding it matches (the walk does not climb through a dropped instance); down keeps a child when any declaration of its module lies in a matching file (a module that is not indexed has no file and is dropped; a dropped child's subtree is not walked); with no root, top modules are kept by their own file. An explicit root line is always shown.
  • "none match". 0 <noun> (none match `in`) is said only when the glob removed every entry there was; a list that was empty before the glob keeps its old empty answer (no symbols match), and so does a whole-project diagnostics whose matching files are clean (no findings); 0 findings (none match `in`) means no file matched. hierarchy: up from one root when the module has instantiations and none is kept (root line still shown); no-root down when no top module is kept.
  • The check line. rename, add_port, remove_port, expand_wildcard, extract_module and inline_module end their text with check: diagnostics on <files> (check after writing: … for a dry run): the changed and created files, root-relative, in path order, the first 5 then and N more. An unchanged answer and a refusal get none. The line is appended after apply::run (below the diff on a dry run); the JSON is unchanged. convert_ports, organize_imports, propagate_ports, the item tools, format and fix_lint do not carry it (not in the brief).
  • Catalogue. tools/list measured as the test measures it (result.to_string().len()): 17 981 B at 4671b91; with the in arguments and the brief's wording it was 18 696 B; after the trims below it is 17 993 B (≤ 18 000, pinned by the_tool_catalogue_stays_under_18_kb and qa_the_catalogue_is_small_fully_described_and_spec_shaped). The generic in description is "Path glob the file must match, e.g. ip/**/rtl/*.sv." — the brief's longer wording did not fit five times; hierarchy's says which file per direction. Trimmed, in this lane's files only: every limit description to "Default 500."; include_ declaration to "Default true."; direction/depth/home to their defaults; the descriptions of project_overview, list_units, search_symbols, definition, references, hierarchy (it still starts "Who instantiates a module (up"; "all branches" dropped), diagnostics, defines, rename, organize_imports, propagate_ports, remove_port, add_port, extract_module, instantiate; titles List units, Definition, Rename, Inline an instance, Extract a module; defines.name lost "(backtick optional)" (still accepted).
  • INSTRUCTIONS (896 characters): "; in filters by path glob" after the finder tools; the edit sentence now says each edit "names files for diagnostics" and the separate "Run diagnostics after an edit." is gone; "Verilog/SystemVerilog" → "SystemVerilog", "from the files on disk (never unsaved editor buffers)" → "from disk, never unsaved buffers" to stay under 900.

Handshakes

  • Consumed: unchanged — Project::{relative, index, files}, WorkspaceIndex, apply::run's structuredContent (changed/created arrays of {file}), which the check line reads.
  • Promised (answer shapes, changed): the first line of every paged text answer is the count line above; structuredContent.shown on every paged answer; hierarchy up from one root pages and counts instantiation lines (the root line repeated per page); six tools take in; six edit answers end with the check line. The MCP resources (lucisv://file/…/outline) run outline and so start with its count line too (resources.rs untouched).
  • Flag for the lead (docs outside the lane): docs/mcp/PLAN.md and docs/features/mcp-navigation/README.md still say "default 200"; the Agents guide, if it quotes answers, shows them without the count line.

Status / TODO

  • render.rs: Page (window, header, shown_json, rest), Noun, none_match; DEFAULT_LIMIT 500
  • header + shown on list_units, outline, search_symbols, references, hierarchy, diagnostics, defines
  • in: read.rs::{path_match, in_glob, only_in, IN}; wired into the six tools
  • check line: edit.rs::with_check on the six edits
  • INSTRUCTIONS clause; catalogue ≤ 18 000 B
  • tests: unit (header, path glob, check cap), wire (8), existing first-line pins updated
  • QA — PASS 2026-09-23 (see QA log)

Work log

2026-09-23 (dev, Opus).

  • render.rs: Page::of wraps the old page; header puts the total first; none_match. page and more stay (the overview's top: and warnings lines use them).
  • read.rs: IN, in_glob, path_match/components_match (split on /, ** recursion, glob_match per component), only_in (filter + "emptied"); list_units filters before the walk-on-miss check, so a glob or an in that misses walks once; search_symbols computes a hit's relative path only when in is given; outline header; TOPS_CAP.
  • nav.rs: references filters hits with only_in and passes only matching files to mentions::find.
  • hierarchy.rs: Walk holds the project and the glob; keeps(file); down skips a child whose module has no matching declaration, up skips an edge in a non-matching file, no-root tops are filtered; Shape (up, single_up, emptied) drives render, which pages the counted slice and prints the lead root line on every page.
  • diagnostics.rs: project_findings (the whole-project form, filtering paths before linting, no unused-waiver report under in); file-form findings go through only_in.
  • defines.rs: both forms filter with only_in; a small Listing carries the page facts out of either form.
  • edit.rs/refactor.rs: with_check wraps rename, remove_port, expand_wildcard, inline_module, add_port, extract_module (the bodies moved to rename_at, remove_port_at, add_port_to, extract_lines).
  • Fixture tests/fixtures/paths/ (ip/aes/{rtl,dv}, ip/uart/rtl/sub, top, an escaped \esc*w parameter and \esc*name net, a lucisv.toml selecting unused-signal).
  • Existing assertions updated (the brief's allowance: they pinned the old first line of a paged answer, or a line count that now includes it): qa_m1 — the list_units/outline/search_symbols literals gain 1 unit\n etc. (16 tests), one outline starts_with; qa_m2 — defines, diagnostics, hierarchy literals, two lines().count() 21 → 22, the escaped-path resource loop reads past the count line; wire — the defines, diagnostics, hierarchy, references, outline, search_symbols literals and the outline resource check.
  • Measured on the opentitan checkout (debug build, read-only): hierarchy up prim_fifo_sync depth 1 → 77 instantiations, the same with in: "hw/ip/**/rtl/*.sv" → 47 instantiations (round 2's 47); list_units in hw/ip/aes/** → 129 units in 32 ms.
  • Gates (all through tools/guard.sh, one at a time): cargo fmt --all -- --check exit 0; cargo clippy --workspace --all-targets Finished, no warnings; cargo test -p lucisv_mcp 373 passed, 0 failed, 4 ignored (unit 76, wire 55); cargo test --workspace exit 0, 4 929 passed, 0 failed, 51 ignored (4 918 before: +8 wire, +3 unit); the ignored opentitan tests (LUCISV_OPENTITAN default path, --ignored) 2 passed, the checkout only read. No guard kill.

QA log

2026-09-23 (QA, Opus) — verdict: PASS. No correctness finding; four low-severity notes for the lead (none blocks round 3). New file crates/lucisv_mcp/tests/qa_f2.rs (14 tests, all passing, none ignored); no source touched.

  • Count line, one rule over every paged tool. qa_every_paged_tool_agrees_with_its_json_over_every_window runs 18 base calls (list_units, search_symbols, outline, references, diagnostics, defines both forms, hierarchy up/down/no-root, with and without in) × 11 windows each (limit 1, 2, n; offset 0, 1, n−1, n, n+3; default) and checks: the first line's number is the JSON total; its window is the JSON shown ([1, n] whole, [0, 0] past the end or empty); the JSON list holds exactly the window (+1 root line for hierarchy up from one root); … and N more equals total − b and is absent when nothing follows; singular only for 1; (showing a) only for a one-entry window; no window on a whole list. All hold. Literal pins for whole / cut / (showing a) / past the end (outline keeps its file line past the end) / 1 unit, 1 entry, 1 hit, 1 finding, 1 define, 1 symbol, 1 instantiation.
  • hierarchy counting. up from one root: the root line heads every page (13 offsets, limit 2) exactly once, past the end included; total counts the depth-2/3 lines too (11 = 13 lines − count − root); a root with no instantiations 0 instantiations + root line; a root declared twice falls back to nodes with every line paged; no-root down from five tops counts nodes (9 nodes (showing 4–6)).
  • in. * stays in one component (ip/aes/rtl/*.sv does not reach rtl/sub/deep.sv, rtl/** does); ** spans zero components (ip/**/x.sv ↔ ip/x.sv, **/x.sv); anchored (ip/** excludes hw/ip/y.sv, **/ip/** and */ip/* reach it); ? is one character and never /; ./, trailing /, **/**; a whole-path glob is no substring search (aes, *.sv at depth). A * in a directory name and a space in one match literally. Names are never matched: the unit \esc*mod is not found by in: "\esc*mod " or esc*, only by its path. "None match" only when the glob removed something — the old empty answers stay for list_units, search_symbols, both defines forms, file-form diagnostics; whole-project diagnostics over clean matched files says no findings. in + offset + limit: total is the filtered count. references: a mention outside the glob is dropped (JSON unresolved_mentions too); hits emptied with a mention kept says both. hierarchy down: a dropped child's subtree is not walked (tb with in: "lib/*" shows u_d : leaf but not lib/mid.sv under the dropped aes); up does not climb through a dropped instance. Whole-project diagnostics with in never reports the unused waiver (**/*.sv, hw/**, *.waiver, w.waiver), without in it does.
  • Check line. All six edits, dry run (check after writing:, after the diff, tree byte-identical, JSON without a new key) and real (check:); repeated → unchanged/refusal with no line; convert_ports carries none; 8 files → five in byte order (B/ < a.x/ < a/b/ < a/ < c/) and 3 more, dry and real.
  • Changed assertions (qa_m1.rs 16 literals + 1 starts_with, qa_m2.rs, wire.rs): every hunk read — each only prepends the count line or adds 1 to a line count (21 → 22 with the count line). Two resource checks are marginally looser: wire.rs:758 went from starts_with("rtl/top.sv\n…") to contains("entries\nrtl/top.sv\n…"), and the qa_m2.rs:749 loop skips the first line unchecked; both still pin the file line and the first entry. Not a weakening worth a finding.
  • Budgets. Catalogue 17 993 B (≤ 18 000); INSTRUCTIONS 896 chars (≤ 900); every tool name in it exists; every argument described; in on exactly the six tools; every limit says 500. Production lines after the lane: read.rs 454, hierarchy.rs 357, nav.rs 370, diagnostics.rs 348, edit.rs 288, render.rs 172 — all under 600.
  • opentitan (eval clone ~/.cache/lucisv-eval/ot/hw, --root …/hw as round 3 runs it, release binary, read-only, git status clean after): hierarchy up prim_fifo_sync depth 1 → 77 instantiations; with in: "ip/**/rtl/*.sv" → 47 instantiations (round 2's 47); limit 50 → 77 instantiations (showing 1–50), offset 50 → (showing 51–77). references clk_i (aes_core.sv:30) 2.60 / 2.69 s, 24 hits — the same as feedback-1's recorded 2.60–2.69 s; with in: "ip/aes/**" 2.42 / 2.44 s. search_symbols "" with in 0.11 s (95 237 → 2 671), a pathological **/*/**/*/…/zzz glob 0.22 s. The ignored opentitan tests (--ignored, default checkout, read-only) 2 passed.
  • Gates (all through tools/guard.sh, one at a time): cargo fmt --all -- --check exit 0; cargo clippy --workspace --all-targets Finished, 0 warnings; cargo test -p lucisv_mcp 387 passed, 0 failed, 4 ignored (qa_f2 14); cargo test --workspace exit 0, 4 943 passed, 0 failed, 51 ignored (4 929 + 14). No guard kill.

Notes for the lead (low; no ignored test — each is a wording or design call, not a spec violation):

  1. Doc inaccuracy (Assumptions, "in"): "A file outside every root … matches only a glob starting with /" — a leading ** matches it too (** spans the empty first component of /abs/…). Repro: a --filelist naming /…/ext/outer.sv, list_units {"in": "**/*.sv"} lists it. Behaviour is reasonable; reword to "a glob starting with / or **".
  2. A bare directory matches nothing: in: "ip/aes" or "ip/uart/rtl" → 0 units (none match `in`); only ip/aes/ or ip/aes/** work. The answer lets an agent recover, at the cost of a turn; gitignore/rg -g treat a pattern naming a directory as its subtree. Either do that (a glob that matches a proper directory prefix of the path keeps it) or say "a directory needs /**" — the catalogue has 7 bytes left, so INSTRUCTIONS (4 chars left) cannot carry it either without a trim.
  3. diagnostics in: "**" keeps every file yet suppresses the unused-waiver report; paths.len() == all.len() would be the exact "complete run" test (diagnostics.rs::project_findings). As briefed, kept.
  4. hierarchy down with an explicit root whose glob drops every child says 1 node with no "none match" signal (as specified — the root line is always shown), while up says 0 instantiations (none match `in`). The work-log example in: "hw/ip/**/rtl/*.sv" → 47 is right for a server rooted at the checkout top; round 3 roots at hw, where that glob answers 0 instantiations (none match `in`) and the one to quote is ip/**/rtl/*.sv (verified 47 above).

Review

Lead, 2026-09-24 (feedback-2). Round 2's regression on the census task was a rendering fault, not an engine one: a 77-row answer paged with a small limit and a count at the bottom the agent never read. The count line now leads every paged answer, the default limit is 500, and the in path glob returns exactly the rows a "under ip/, RTL only" question asks for — on opentitan, hierarchy up prim_fifo_sync with in: "ip/**/rtl/*.sv" answers 47 instantiations in one call, the round-1 ground truth. QA passed it with 14 tests and four notes; the lead took note 2 (a bare directory glob means everything below it, as .gitignore reads it) and the README's outside-root sentence, and left notes 3 and 4 as documented behaviour. Committed; the round-3 binary is frozen from this commit.