MCP plan §10 + lane M7: the lean catalogue (nine tools, ≤3 500 model-visible bytes, no dry_run/paging, short answers)
ci / checks (push) Successful in 1m25s
ci / corpus (push) Successful in 32s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-23 23:55:04 -07:00
1 parent 77b3a2370b
commit edad66947f
2 files changed
+139

No files matched your search

+92
View File
@@ -473,3 +473,95 @@ are serial (same crate, same registry). M6 closes the block with a release.
Roles per CLAUDE.md: one Opus dev then one Sonnet QA per lane, in a worktree
branched from trunk; the lead reviews and merges; the block ships as a minor
release (`0.56.0` if it lands before anything else does).
## 10. The lean catalogue (0.58 — the owner's steer of 2026-09-23)
The census (`mcp_analysis.md`) showed the server correct on every run and
dearer than plain file reads on every small task, for three reasons: a
5 400-token catalogue read every session, answers that carry more than the
question needs, and an agent that dry-runs and re-checks what it was told
to trust. The owner's ruling: **accuracy over breadth.** The server's
distinct value is the *hierarchy* of the project — where things are, as
`file:line`, with a way to peek at the code — and bulk edits that a file
write cannot do safely. So: nine tools, the whole model-visible catalogue
(`name` + `description` + `inputSchema` of every tool, compact JSON) **under
3 500 bytes** (≈ 1 000 tokens) and `instructions` under 400 bytes, both
pinned by test; short answers by default; no `dry_run`, no paging arguments;
edits are file writes the agent is told to trust.
### 10.1 The nine tools
Arguments carry no per-argument descriptions — the one-sentence tool
description names them. Each schema is `{type, properties, required,
additionalProperties: false}` with `type` alone per property (an `enum`
where one applies). `title` and `structuredContent` are gone; a result is
its text. The `annotations` stay (`readOnlyHint`, `destructiveHint: false`)
— hosts use them, the model never sees them.
| tool | arguments | answers |
|---|---|---|
| `hierarchy` | `root?`, `up?` (bool), `depth?` (1–20, default 1), `peek?` (bool) | Without `root`: one line `N files, M modules, K top` then the top modules as `name file:line`. With `root`, down: the instance tree, one line per instance, two spaces per level: `instance: module file:line` where `file:line` is the **instantiation site**. `up`: every instantiation of `root`, `parent.instance file:line`, all levels up to `depth`. `peek: true` appends each instantiation statement's source under its line (indented, as written, at most 12 lines each then `…`). Cap 300 lines then `… and N more`. Unknown `root`: a refusal that lists up to 10 contains-matches. |
| `find` | `name`, `refs?` (bool) | Every declaration of `name` (whole-name, any case-exact): `kind name file:line`, then, with `refs`, per declaration its uses as `file:line` (one file per line, lines joined with `,` when several are in one file: `ip/uart/rtl/uart.sv:120,133,140`), then `unresolved:` and the textual mentions (strings, comments, macro text) the same way. No declaration: up to 20 contains-matches of declarations as a refusal (`no declaration named X; similar: …`). Cap 300 lines. |
| `outline` | `file?` **or** `unit?` (exactly one) | `file`: its declarations as a tree with line ranges, two spaces per level: `kind name start–end`, parse errors first as `error line: message`. `unit`: its `file:line`, then parameters `param name = default` and ports `dir type[range] name` in declaration order, one per line; interfaces add modports, packages their exports. No template, no counts. Cap 300 lines. |
| `read` | `item`, `file?` | The item's source, exact bytes, preceded by one line `file:start–end`. Selector as today's `read_item` (`name`, `kind:name`, `name@LINE`, `always@LINE`). Without `file` the item is looked up design-wide; several matches → a refusal listing them as `file:line`. |
| `check` | `file?` | Parse errors, missing closers and lint findings of `file` or the whole design, `file:line:col severity message [rule]`, errors first, cap 200 lines then `… and N more`. Clean: `ok` (one word). |
| `rename` | `name`, `new_name`, `file?` | Renames the declaration `name` (in `file` when the name is declared in more than one place; ambiguity without `file` is a refusal that lists the declarations) and every resolved use, `.name`/`.*` shorthand included (M3.5). Answer: `renamed N sites in M files` and, only when any, `unresolved:` lines as in `find`. |
| `port` | `module`, `add?` (a port declaration), `after?`, `remove?` (a port name) | Exactly one of `add`/`remove`. `add` inserts the ANSI port (after port `after`, else last) and connects it by name in every instantiation; `remove` deletes the port and its connection everywhere, refused while the module body uses it. Answer: `added|removed port X in module M: N instantiations in K files` and any `unresolved:` lines. |
| `edit_item` | `file`, `op` (`replace` / `insert_before` / `insert_after` / `delete`), `item`, `text?` | The M4 structural edits under one name, same verifier, same rules: `replace` keeps kind and names; `insert_*` anchors on `item` (or `end` / `end@UNIT`); `delete` takes the item and its leading comments and is refused while its names are used (sites listed) or it holds a `` `define ``. No `force`, no `rename`. Answer: `replaced|inserted|deleted ITEM file:start–end` (the new lines). |
| `format` | `files` (a path or a glob), `fix?` (bool) | Formats every matching file; `fix` applies the safe lint fixes first. Answer: `formatted N files (M unchanged)`; a refusal per file the safety net rejects, the rest still written. |
Dropped from the catalogue (the engines stay in the CLI and the LSP):
`project_overview`, `list_units`, `unit_interface`, `read_item`,
`search_symbols`, `defines`, `definition`, `references`, `diagnostics`,
`fix_lint`, `expand_wildcard`, `convert_ports`, `organize_imports`,
`inline_module`, `propagate_ports`, `remove_port`, `add_port`,
`extract_module`, `replace_item`, `insert_item`, `delete_item`,
`instantiate`. A `\`define` is found by `find` like any declaration
(`macro NAME file:line`).
### 10.2 Rendering rules (replacing §4.5)
- One line per fact, root-relative paths, `file:line`, no headers, no
blank lines, no trailing hints (`check:` is gone — the instructions say
when to check).
- Fixed caps per tool (300 / 200 lines) with one `… and N more` line; no
`limit`/`offset`. Narrowing is by a better question (`root`, `file`,
`depth`).
- Counts only where they are the answer (`hierarchy` without `root`,
`rename`, `port`, `format`).
- Refusals are one sentence, `isError: true`, and when a name is unknown
they list the near matches so the next call is right.
### 10.3 Instructions (≤ 400 bytes)
> lucisv-mcp answers from the SystemVerilog sources on disk (save first).
> Use it before reading files: hierarchy for the instance tree and top
> modules, find for where a name is declared and used, outline for a file
> or a unit's ports, read for one item's source, check after edits. Edits
> (rename, port, edit_item, format) are verified, all-or-nothing writes to
> disk: call them like a file write, no dry run. Paths are root-relative,
> lines 1-based.
### 10.4 What stays
Transport, freshness, roots, the filelist, the cache reader, the resources
(`lucisv://overview`, `unit/{name}`, `file/{path}/outline` render through the
new renderers; `lucisv://rules` stays), the apply path (all-or-nothing,
re-read before write, atomic inside the roots), the M4 verifier and its
attack tests, the unresolved-mentions scan, the extension provider and the
packaging. `mcp_smoke.js --tool-table` keeps working and regenerates the
Agents guide's table.
### 10.5 Acceptance
- `tools/list`: exactly the nine names above, in that order; the
model-visible bytes ≤ 3 500, `instructions` ≤ 400 — a test in `wire.rs`
computes both.
- No `dry_run`, `limit`, `offset`, `in`, `template`, `overrides`, `force`
argument anywhere.
- The eval tasks a–d (`~/.cache/lucisv-eval/tasks`) re-run as census round
4 on the lean binary, all four correct, and the mcp arm at or under the
base arm on a and d; b and c within +10 %.
- The M4 attack suite green unchanged; `check` on the fixtures identical to
the old `diagnostics` line set; `hierarchy` on opentitan's `top_earlgrey`
identical instance set to the old tool.