Round 3 of the census (mcp_analysis.md): with feedback-1/2 the whole-design question is one call and 15 % cheaper than plain file tools (47/47 in 9 calls); the small edits stay 4–19 % dearer; the cross-file rename is complete every time; a 71-instance hierarchy question costs a third of the tool calls but the same tokens because every unit_interface answer carried a 30-line template. Verdict: helpful, not a toy — no wrong answer in 20 runs, one-call whole-design answers, completeness on cross-file edits, verified writes — with a fixed catalogue tax and verbose answers as the cost. Feedback-3 (crates/lucisv_mcp/src/tools/{interface,hierarchy}.rs): `unit_interface` renders the template only with `template: true` (−40 % bytes), `hierarchy` renders `#(…)` only with `overrides: true` (−55…66 %), `ports (N):`/`parameters (N):` headers; QA proved the opt-in output byte-identical to the previous binary over every fixture and the opentitan clone. Docs: the Agents guide's tool table regenerated from the binary and the site rebuilt; CHANGELOG 0.57.0 section and the extension notes drafted for the closing release; TODO-MCP's M6 items closed; docs/mcp/census-runs.txt holds the raw run log. Gates through tools/guard.sh: fmt, clippy, workspace 4 953 passed.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
mcp-feedback-3
Lane feedback-3 of the MCP block, the last census lane: the changes the
third token-census round asked for (mcp_analysis.md, Round 3 →
Observations and "Still to do"). Tracked in TODO-MCP.md → "Feedback
rounds".
Goal
Round 3's task d (the entropy_src instance tree with 20 port counts) came
out at +4 % tokens with a third of the tool calls. Most of the server's
overhead there was twenty unit_interface answers, each carrying a
30-line instantiation template the task never used. hierarchy lines had
the same problem: every line carried the instance's #( … ) overrides,
which a census rarely reads. This lane makes both opt-in:
unit_interface gains template and hierarchy gains overrides, both
default false. The JSON of hierarchy keeps overrides on every node,
because it costs little there. unit_interface's section headers now carry
their counts (parameters (6):, ports (12):), so a port count can be
read without counting lines.
Assumptions
unit_interfacewithouttemplate(or withtemplate: false): the text is the head line,parameters (N):(if any),ports (N):(if any),modports:(if any), then thewarning:lines. There is notemplate:section. The JSON has notemplatekey at all (notnull). Withtemplate: truethe text ends withtemplate:and the rendered plan, and the JSON hastemplateas before. Otherwise the JSON is identical key for key (pinned by a wire test). The plan is still built either way: ports and parameters come from it. Only therenderstep is skipped.- Packages and classes take the
templateflag and ignore it: they have no template. The member answer is unchanged, and itsmembers:header gets no count, because the brief named only ports and parameters. modports:keeps its header without a count, for the same reason.hierarchywithoutoverrides: each line is exactly the old line without the#( … )segment:instance : module(down),parent.instance file:line(up), and root lines as before. A note ((recursive),(not indexed),(declared N times)) still ends the line. Withoverrides: truethe line is byte-identical to the old default, capped atOVERRIDES_CAP(200) as before. The JSON is the same with or without the flag:overridesis on every node (nullwhere the site has none).- The brief wrote the
upline as "instance : module file:line". The line has beenparent.instance file:linesince M2, and the brief also says "exactly as today minus the overrides". I kept today's shape. - Census task a asks for "both params on every row", so it now needs
overrides: true. Thehierarchyparameter description andINSTRUCTIONSboth say so. A re-run of task a should be read with this in mind.
Handshakes
- Consumed: unchanged:
instantiation_planandInstantiationPlan::render(vlog_refactor),Args::flag(tools/mod.rs). - Promised, changed (answer shapes):
unit_interface's default text no longer ends withtemplate:, and its default JSON has notemplatekey. Its headers readparameters (N):/ports (N):. A new optional boolean argument,template.hierarchy's default text lines drop the#( … )segment. There is a new optional boolean argument,overrides. The JSON is unchanged.- The resources (
lucisv://…) do not call either tool; nothing else in the crate consumes these texts.
- Out-of-ownership edit (flagged for the lead's ruling):
crates/lucisv_mcp/src/tools/edit.rs:30. The sharedDRY_RUNparameter description changed from "Return the diff only." to "Diff only.". The two new parameters tooktools/listto 18 273 B. Trimming every description in this lane's files as far as it would go, without losing meaning, got it to 18 074 B, still over the 18 000 B pinned bythe_tool_catalogue_stays_under_18_kbandqa_the_catalogue_is_small_fully_described_and_spec_shaped.dry_runappears 14 times, so this one edit saves 154 B. The catalogue is now 17 943 B. The brief allowed "trim a description if needed" and did not say whose. To revert: restore the string and trim ~75 B elsewhere. - Request (not done, outside ownership): the Agents guide
docs/site/src/content/docs/guides/agents.md:102still promises "a ready-to-paste instantiation" by default. Line 109 still showsinstance : module #(overrides)lines. Both need "ontemplate: true" / "onoverrides: true".docs/mcp/PLAN.md:146,263describe the original design and can stay as history.
Status / TODO
unit_interface:template(Bool, default false); text and JSON without the template by default;parameters (N):/ports (N):; description namestemplate: truehierarchy:overrides(Bool, default false) on the text line; JSON unchanged; description updatedINSTRUCTIONS: the hierarchy clause namesoverrides: true(896 characters, unchanged length).template: truedoes not fit (940 with both); theunit_interfacedescription carries it- wire tests: both defaults and both opt-ins, text and JSON; existing pins moved to the opt-in (listed in the work log); catalogue ≤ 18 000 B
- measured on the eval clone (below)
- QA — PASS 2026-09-23 (see QA log)
Work log
2026-09-23 (dev, Opus).
-
src/tools/interface.rs:UNIT_INTERFACEgains thetemplateparam (l.36–41). The description is "A unit's parameters, ports (direction, type, range), modports or members;template: trueadds an instantiation." The brief's "paste-ready" wording was trimmed for the catalogue budget. The handler readsargs.flag("template", false)(l.67).instantiabletakeswith_templateand renders the plan only then (l.144).templateis added to the JSON only when present (l.156–157).interface_texttakesOption<&str>and writes the counted headers (l.183, l.189) and the template section only on request (l.205). The module doc says the template is on request. -
src/tools/hierarchy.rs:HIERARCHYgains theoverridesparam (l.81–86, "Add each#(…)to the text lines."). The description no longer lists overrides: "Who instantiates a module (up, with file:line) or what it instantiates (down, default). Textual."renderreads the flag (l.341) and passes it toLine::text, which shows the overrides only then (l.394–400). The JSON'sLine::jsonis untouched. Trimmed for the budget:depth→ "Default 3." (the schema'smaximum: 20says the rest),in→ "Path glob on the instantiating file (up) or the module's (down), e.g.ip/**/rtl/*.sv.". -
src/rpc.rsINSTRUCTIONS: "Who instantiates module X (instances, overrides): hierarchy with direction up, not references." → "Who instantiates module X: hierarchy direction up (overrides: true adds #(…)), not references." (896 → 896 characters). The old clause promised overrides in the default answer, which is no longer true. Addingtemplate: trueas well measured 940 characters, so it was left out. -
src/tools/mod.rs: no change needed (Ty::BoolandArgs::flagalready existed). -
src/tools/edit.rs:30:DRY_RUNdescription "Diff only." (see Handshakes: an out-of-ownership edit, flagged). -
Tests (
tests/wire.rs):- New:
unit_interface_template_is_opt_in. It checks that the default text ends at the last port, the JSON has notemplatekey, andtemplate: falseequals the default. Withtemplate: truethe template section comes after the ports and the JSON equals the default plustemplate. It also covers an interface's template after its modports, the refusal of"template": "yes", and a package ignoring the flag. - New:
hierarchy_overrides_are_opt_in_on_the_text_and_always_in_the_json. It checks thatupwithoverrides: trueis byte-identical to the old default, the JSON is equal with and without the flag,falseequals the default, anddownand a recursive line work with the flag. It also covers the refusal of"overrides": 1.
- New:
-
Existing assertions changed (they pinned the old default output):
wire.rs:unit_interface_answers_ports_parameters_modports_and_members: the header prefix now readsparameters (2):…ports (4):, and the template assertion now asserts thattemplate:is absent.hierarchy_walks_down_and_up_and_terminates_on_recursion: the three literals (tops,tree,coreup) lose their overrides. The JSON node assertion still has"overrides": "#( .W (8) )".
qa_m1.rs:qa_an_escaped_identifier_unit_is_listed_described_and_instantiablenow passestemplate: true.qa_a_typed_parameter_keeps_its_default_and_a_localparam_is_not_offerednow passestemplate: true(it readsstructuredContent.template).
qa_m2.rs:qa_hierarchy_terminates_on_self_and_mutual_recursion: theselfmcall now passesoverrides: true.qa_finding_4_every_instance_of_one_statement_shows_only_the_overrides: the textupcall now passesoverrides: true.qa_recheck_overrides_split_across_lines_and_comments_between_instances: both calls now passoverrides: true.
opentitan.rs(ignored without the checkout): thetop_earlgreycall that assertsu_aes : aes #(now passesoverrides: true.
-
Measured on the eval clone, read-only (
target/release/lucisv-mcp --root ~/.cache/lucisv-eval/ot/hw, no--index-cache, so nothing is written;git status --porcelainin the clone was empty before and after). Bytes ofcontent[0].textand of the compactstructuredContent:call text B (lines) JSON B unit_interface prim_fifo_sync596 (21) 1 284 … template: true999 (43) 1 710 hierarchy up prim_fifo_sync in ip/**/rtl/*.sv(default depth 3)22 163 (349) 102 939 … overrides: true64 783 (349) 102 939 same, depth: 1(task a's 47 rows)3 238 (49) — … overrides: true7 230 (49) — So
unit_interfaceis −40 % by default (403 B saved per call; round 3's task d made 20 such calls; the saving grows with the port count), and thehierarchy uptext is −66 % at depth 3 and −55 % at depth 1. The JSON ofhierarchydoes not change.tools/listis 17 943 B, down from 18 273 B with the two new parameters before the trims. Catalogue atc2e42b8: 17 993 B, per mcp-feedback-2. -
Gates (through
tools/guard.sh, one at a time):cargo fmt --allclean;cargo clippy --all-targetsFinished, no warnings;cargo test -p lucisv_mcp390 passed, 0 failed, 4 ignored (wire 55 → 57);cargo test --workspace4 946 passed, 0 failed, 51 ignored. -
Production lines (non-blank, non-comment, before
mod tests):interface.rs334,hierarchy.rs364,mod.rs181,rpc.rs265,edit.rs288.
QA log
2026-09-23 (QA) — verdict: PASS, no findings against the lane.
Read CLAUDE.md, this README, git diff of src/tools/{interface,hierarchy,edit}.rs,
src/rpc.rs and tests/{wire,qa_m1,qa_m2,opentitan}.rs.
- Baseline binary, not a re-derivation. HEAD (
c2e42b8) was exported withgit archive HEADinto the scratchpad (no worktree, repo untouched) and built there (--target-dirin the scratchpad), so "template: true/overrides: trueequals the old default" was checked against the old binary's own bytes.vlog_parser,vlog_refactor,vlog_formatterandvlog_semantichave no diff since v0.56.0, so the template renderer is the 0.56.0 one; the 0.56.0 vsixlucisv-mcpagreed on everyunit_interfacetoo (itshierarchypredates feedback-2's count line, so only HEAD's is a valid hierarchy baseline). - Differential, all six fixture trees (
tests/fixtures/*, every unit fromlist_units; every moduledownandupat depth 20): 50/50unit_interface—template: truetext = old text with onlyparameters:/ports:→(N); JSON = old JSON key for key; default text = that text cut attemplate:\n; default JSON = old minus thetemplatekey (absent, notnull); counts = rows = JSON array lengths; packages/classes identical with and without the flag. 78/78hierarchy—overrides: truetext byte-identical to the old text (refusals too), JSON identical across old/flag/default, no default line holds#(, every node has anoverrideskey. - Same differential on the eval clone (
~/.cache/lucisv-eval/ot/hw, read-only, no--index-cache;git status --porcelainempty before and after): 12 units (prim_fifo_sync,aes,entropy_src,top_earlgrey,uart,tl_if, …, two declared-twice refusals identical) and 5 hierarchy calls (top_earlgreydepth 2,prim_fifo_syncup within/depth 1,aesup,entropy_srcdepth 3): all equal. Default text (characters) is 17–45 % smaller forunit_interface(tl_ifleast, few ports) and 48–83 % forhierarchy. tests/qa_f3.rs(new, 7 tests, all pass), pinned against literals thec2e42b8binary produced on the same tree:template: truebyte-identical for an interface with modports, a module withifdef'd lists (warnings, then the template), an empty module, multi-declarator/unpacked ports; JSONtemplate= the old section; default ends beforetemplate:with notemplatekey.- a
programis instantiable (template on request); a package's answer is identical withtemplate: true. - counts:
parameters (N):/ports (N):= indented rows = JSON length for 5 shapes. Zero parameters or zero ports: the header is absent, not(0)— the pre-lane rule (an empty section is left out), and sensible: the JSON still has[], and a(0)header would cost tokens to say nothing.modports:keeps no count; rows complete. hierarchyupanddownover an instance whose overrides exceed the 200-char cap, one without, one with a comment inside#(…):overrides: true= old text (cap and…kept); default = each old line minus exactly<capped overrides>of that node; JSON equal with/without flag, full uncapped overrides present.- default vs
overrides: trueunderlimit/offset,in,depth: 1and the no-root listing: same count line, same line count, same JSON, no#(in the default. "true",1,[true],{}refused for both flags naming the field and "true or false";nullis taken as the default (as for everyTy::Boolflag —Args::flagusesas_bool); each flag is refused on the other tool as an unknown argument.- catalogue ≤ 18 000 B (measured 17 943 B, 57 B headroom), both
flags
booleanand not required;unit_interface's description names`template: true`,hierarchy's no longer promises#(;INSTRUCTIONS896 chars, saysoverrides: true, dropped "(instances, overrides)", names only existing tools.
- Changed existing assertions — every hunk read:
wire.rs(header prefix gains the counts andports (4):, the template assertion becomes its absence; threehierarchyliterals lose exactly their#(…)segments, the JSON node assertion is unchanged),qa_m1.rs(2 calls addtemplate: true),qa_m2.rs(4 calls addoverrides: true, literals unchanged),opentitan.rs(1 call addsoverrides: true). Each is a flag addition or a literal minus the overrides/template; nothing weakened.opentitan_navigation_matches_the_language_serverrun (--ignored, read-only over /Users/guoliangchen/repo/opentitan): ok, 83 s; checkout status unchanged. - Out-of-ownership
edit.rs:30(DRY_RUN→ "Diff only."): no test or consumer depends on the old string; meaning survives next todry_run: true shows the diff firstinINSTRUCTIONS. Left for the lead's ruling as flagged. - Size/style: production lines
interface.rs334,hierarchy.rs364,edit.rs288,rpc.rs265; the changed functions (instantiable,interface_text,render,Line::text) are all under 50 lines. Nounwrap/expectadded to library code. - Gates (through
tools/guard.sh, one at a time):cargo fmt --all --checkclean;cargo clippy --all-targetsFinished, no warnings;cargo test -p lucisv_mcp397 passed, 0 failed, 4 ignored (390 + 7);cargo test --workspace4 953 passed, 0 failed, 51 ignored (4 946 + 7). - Not done here (lead's list): the Agents guide request in Handshakes; the census re-measure of tasks a/d.
Review
Lead, 2026-09-23 (feedback-3). The last census lesson was answer
weight: twenty unit_interface answers each carrying a template the task
never used. Both the template and the hierarchy overrides are now opt-in,
the ports and parameters headers carry their counts, and QA proved the
opt-in text byte-identical to the old output over every fixture and the
opentitan clone. The dry_run wording trim in edit.rs is accepted. The
Agents guide's tool table was regenerated from the binary by the lead.
Committed; the release binary is this one.