ax: the machine surface
AX = agent experience: how much a machine can do with this repo before reading a line of rust. The kit maximizes it by construction — every surface below is GENERATED from the code it describes, so it cannot drift.
¶the surfaces
| surface | what an agent does with it |
|---|---|
mrsn schema --json | every verb + flag as JSON, walked from the clap structs |
GET /health | {"status","sha","docs","verbs"} — serve exposes its own CLI verbs |
GET /docs/{slug}.md | RAW markdown per doc — the lane agents should prefer |
GET /llms.txt | guidance genre: verbs, routes, doc index — built from schema_verbs() |
GET /llms-full.txt | the whole corpus as markdown, one response |
GET /sitemap.xml /robots.txt | the crawl surface (absolute URLs via MRSN_BASE_URL or Host); robots names the bot lanes (search / ai / archive) + declares the usage posture (Content-Signal) |
GET /schema.json | the CLI contract over HTTP — the same walk schema --json prints, one source |
GET /.well-known/agent.json | the A2A agent card: every verb as a skill, built from schema_verbs() |
GET /auth.md | the auth posture (none = nothing to bypass) at the conventional probed path; alias of the corpus auth doc |
Link: headers | discovery pointers on every response: </llms.txt>; rel="describedby", </schema.json>; rel="api-catalog" |
¶the SEO half of AX
Machines that read pages (not APIs) get: meta description (frontmatter description, else derived from the body's first paragraph), canonical, Open Graph + twitter card, JSON-LD (WebSite on the landing, TechArticle per doc), and an <link rel="alternate" type="text/markdown"> pointing at the raw lane. All of it rides the ctx Seo flatten — and a page fed no desc/canonical/jsonld ships NO tag: an empty meta or empty ld+json block is a machine lane that lies (the 404 passes its empties explicitly).
¶the pins that keep it honest
The battery (tests/ — one file per folder of the tree, named #[test]s, nextest runs them like any test) guards the surface against silent rot:
- every verb named in README (docs drift = red battery)
- every template registered; every
icon("x")vendored; every@font-facesrc on disk - llms.txt really carries every verb; seo text fns keep their shapes
- the agent lanes: named-bot robots + Content-Signal, the A2A card carries every verb,
schema_docis the one contract both tongues print
The house rule of thumb: a machine should be able to verify anything about this repo with schema --json + just test + one GET. If you extend the kit and that stops being true, extend the battery too.
¶for the agent forking this kit
Read internal/fork.md first. The rename ritual is mechanical (cp, sed, 3-touch verb). Trust the battery: after every step, just test exit 0 means you haven't broken the contract. Don't relax a pin to get green — fix the thing the pin is pointing at.
api: the HTTP conventions
The serve answers humans (html) and machines (json, markdown, plain text) from one router. This page is the conventions; /openapi.json is the contract — they are written to agree, and the battery holds them to it.
¶the registry is the truth
openapi.rs carries ONE route registry — the MACHINE lanes: method, path, summary, content type. /openapi.json is generated from it at boot — zero new deps, preserve_order keeps the document byte-stable. Scope law: openapi.json is the machine contract (lanes a client calls); the human pages ride sitemap.xml instead — two maps, two audiences. A machine route that serves but is not registered is a battery-red bug: the wire test walks REGISTRY and asserts every GET row answers. A fork adds a machine lane = adds a registry row + a handler; the contract cannot drift.
¶the error envelope
Every machine-lane refusal is {"error":{"code","message"}} — written by web::json_err, the only error writer on the wire. Clients react to code (cross_site, bad_press, …), never string-sniff message. It is the CLI's typed-exit law carried across HTTP: the failure mode is a typed, documented lane, not a prose accident. The envelope is a shared schema in the document (components/schemas).
¶markdown twins
Every page answers raw at .md (/docs/{slug}.md, /auth.md): agents parse one file instead of scraping html. New pages ship the twin — it is one query against body_raw, and the <link rel="alternate"> + Link: headers advertise it.
¶the machine lanes
/schema.json— the CLI contract over HTTP (the same JSONschema --jsonprints; error lanes included)./openapi.json— the HTTP contract (this page's registry)./.well-known/agent.json— the A2A card; skills = the CLI verbs./llms.txt,/llms-full.txt— guidance + the whole corpus as markdown.Link:headers on every page —describedby→ llms.txt,api-catalog→ schema.json,service-desc→ openapi.json. Agents probe headers before bodies; the pointers ride both.
¶the posture is inherited, not chosen
CSP default-src 'none', the drive-by guard (cross-site write riders → 403), body caps derived from the parse contract, typed refusals — every new route gets the same default posture. A fork widening CSP (a form, a script) edits the header comment where the decision lives; it is never a per-page afterthought. The kit ships NO forms today — form-action 'self' stays as the guard rail a fork's first form inherits.
¶the calc press, as a worked write
POST /calc/press is the reference browser-write: state rides the representation (no sessions), the boundary validates it like hostile input (state must be the calc's own to_json, key whitelisted — every malformed shape dies at 400 bad_press, never healed), and one POST replaces ONE region — the fragment's root id names what it replaces. Copy its shape for the next browser-write you add.