Documentation
¶
Overview ¶
Package lint is the name lint of spec section 13.5.
It reads **the catalogue the server actually serves** -- tool names, tool descriptions, argument names and descriptions, enum values, and the `initialize` instructions block -- plus every markdown page under `docs/`, and fails on a Matrix vocabulary asserted as a live contract.
The point is not tidiness. Agent GM is a rewrite of an Agent MX design (spec sections 1.3, 18.3), and the failure it guards against is a word from the old system reaching a cold agent as though it were part of this one's contract. A model that reads `event_id` in a tool description will send an `event_id`, and the refusal it gets back will be a mystery to whoever reads the transcript.
Three scoping rules, all load-bearing, because a lint that fails its own spec is a lint nobody will keep:
- **The served catalogue is checked for every banned word.** Those are the things a cold agent reads.
- **Markdown is checked under `docs/` only**, and only outside fenced code blocks and block quotes. `plans/AGENT_GM_SPEC.md` is exempt in full: it has to say what Agent MX called things, name upstream files such as `connector/handlematrix.go`, and use ordinary English like "exit-code matrix" and "log redaction".
- **The banned `mode` is an argument name**, matched whole against a deny list, never as a substring. `send_mode` never reaches a surface (section 4.6), and `search`'s `mode` is `words|exact` -- a search vocabulary rather than a switch between destructive behaviours, which is the thing Agent MX retired.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BannedArgumentNames = []string{"mode"}
BannedArgumentNames is the deny list of section 13.5's third rule. It is matched **whole**: an argument called `send_mode` or `delivery_state` is not on it, because it is not `mode`.
var BannedPrefixes = []string{"room_"}
BannedPrefixes are prefixes no identifier may carry.
var BannedWords = []string{
"room",
"portal",
"event_id",
"provider",
"redact",
"generation",
"outbox",
"tombstone",
}
BannedWords is the Matrix vocabulary, as words. Each is matched case-insensitively on a word boundary, so `bedroom` is not `room` and `Provider` is `provider`.
var SearchModeValues = []string{"exact", "words"}
SearchModeValues is the one vocabulary that redeems an argument named `mode`.
Section 13.5 exempts `search`'s `mode` by name, and the reason it gives is what the values are: `words|exact` is a search vocabulary, not a switch between destructive behaviours. So the exemption is written as that reason rather than as the tool's name -- a second tool that grew a `mode` meaning something else would be caught, and this one goes on passing only for as long as its values stay what they are.
Functions ¶
func IsBareModeArgument ¶
IsBareModeArgument reports whether an argument is the `mode` section 13.5 bans: one named `mode` whose values are anything other than the search vocabulary.
It is exported because it is the rule, and a rule the meta-test can only reach through a whole catalogue is a rule the meta-test can only test in one direction.
Types ¶
type Finding ¶
type Finding struct {
// Where names the thing that carries it: a served surface, or a file and
// line.
Where string
// Word is the banned word, prefix or argument name found.
Word string
// Context is the text it was found in, trimmed.
Context string
// Reason says why it is banned here, for a reader who has not read
// section 13.5.
Reason string
}
Finding is one violation.
func CheckCatalogue ¶
func CheckCatalogue() []Finding
CheckCatalogue reads the catalogue the server actually serves.
It reads mcp.Tools and mcp.Instructions rather than a copy, so a description edited into a violation fails here without anybody having to remember to update a fixture -- which is exactly the reviewer's planted-mutation case of section 13.5: putting a wrong sentence back into a served tool description must be caught by a lint test.
func CheckMarkdown ¶
CheckMarkdown scans every markdown page under dir, outside fenced code blocks and block quotes.
A fenced block is exempt because a page has to be able to quote an upstream file, a Matrix payload or a log line in order to explain it; a block quote is exempt for the same reason. What is checked is the page's own prose, which is where a word becomes a claim about Agent GM rather than a quotation.
func CheckMarkdownText ¶
CheckMarkdownText scans one page's text, for a test that would rather not write a file.
func CheckText ¶
CheckText scans one piece of served or documented text for every banned word and prefix.