aiui build publishes each docs page twice: the page people read, and the
aiui build
same page as clean Markdown for AI agents. Nothing to configure, and it works
on any static host.
| URL | What it holds |
|---|---|
| /docs/<page>.md | the page as agent-ready Markdown (below) |
/docs/<page>.md
| /llms.txt | the llmstxt.org index: one ## section per nav group, each page linked as its .md |
/llms.txt
##
.md
| /llms-full.txt | every indexed page's agent-ready Markdown in one file |
/llms-full.txt
| /.well-known/llms.txt, /.well-known/llms-full.txt | copies, where some agents look first |
/.well-known/llms.txt
/.well-known/llms-full.txt
Each page's HTML names its Markdown (<link rel="alternate" type="text/markdown" href="…/docs/guide/install.md">).
<link rel="alternate" type="text/markdown" href="…/docs/guide/install.md">
Links are absolute with a site URL (seo.siteUrl or a CNAME, see
seo.siteUrl
CNAME
SEO), root-relative otherwise. Hidden and noindex pages stay out
noindex
of the llms files. An llms.txt or llms-full.txt next to aiui.yaml is
llms.txt
llms-full.txt
aiui.yaml
published as it is.
| In the source | In the .md |
| front matter | # Title, then > description |
# Title
> description
| <Note>, <Warning title="…">, … | a blockquote with a bold label: > Note: … |
<Note>
<Warning title="…">
> Note: …
| <Tabs> / <Tab title="pip"> | one heading per tab, a level under the heading above |
<Tabs>
<Tab title="pip">
| <Steps> / <Step title="Install"> | a numbered list: 1. Install |
<Steps>
<Step title="Install">
1. Install
| <Card title="Guide" href="guide.md"> | a list item: - Guide |
<Card title="Guide" href="guide.md">
- Guide
| <ParamField>, <ResponseField> (in <Expandable>), <RequestExample>, <Panel> | ` - user_id (path, string, required): … ` (nested one level); a bold "Request example" over its fences; the content |
<ParamField>
<ResponseField>
<Expandable>
<RequestExample>
<Panel>
-
(path, string, required): …
| <Accordion>, <Frame>, other tags, comments | their content (a bold title, an italic caption); comments removed |
<Accordion>
<Frame>
| links to pages (setup.md, /docs/setup) | absolute .md URLs; other links absolute URLs |
setup.md
/docs/setup
Code is never changed. Copy page, View as Markdown and **Open in
ChatGPT / Claude** use this version; the browser renders the untouched source,
published as /docs/<page>.source.md. .mdx pages work the same way, and are
/docs/<page>.source.md
.mdx
in search and llms-full.txt.
Every .md, llms.txt and llms-full.txt then carries, under the title, a
> ## Agent instructions quote block with these lines.
> ## Agent instructions
for="humans" shows on the page and in site search only; for="agents" only
for="humans"
for="agents"
in the .md and the llms files.
aiui serve answers a page URL with its Markdown when Accept ranks
aiui serve
Accept
text/markdown at least as high as text/html (browsers still get the page):
text/markdown
text/html
aiui serve and aiui dev also run an
aiui dev
MCP server for the site at /mcp, so an
/mcp
editor's agent can search and read the docs while it works, and tell you when
a page let it down. Nothing to install or configure:
| Tool | What it returns |
| search_docs(query, limit=10) | the best matching pages and sections (ranked as the search dialog ranks them), each with its path, URL and a snippet |
search_docs(query, limit=10)
| read_page(path) | one page's agent-ready Markdown; path is a page path (/docs/guide/install) or URL |
read_page(path)
path
/docs/guide/install
| list_pages() | every page by nav group (llms.txt) |
list_pages()
| submit_feedback(path, helpful, comment?) | stores a vote on a page, like a reader's "Was this page helpful?", with source: agent |
submit_feedback(path, helpful, comment?)
source: agent
The first three are read-only. submit_feedback lets an agent report a page
submit_feedback
that is wrong, outdated, unclear or missing what it needed, so docs problems
reach you from the agents reading them. Reports land in the same
store as readers' votes, so aiui docs feedback counts them together (in the
aiui docs feedback
CSV and JSON exports source tells them apart), under the same limits as the page's vote
source
button: 20 a minute per client (shared with /api/docs/feedback), 4 KiB, a
/api/docs/feedback
1,000-character comment, and only for pages that exist. The tool is not
listed when page feedback is off
(feedback: false) or posted to your own endpoint.
feedback: false
endpoint
Connect from the page menu (Copy MCP server URL, Connect to Cursor,
Connect to VS Code), or add it by hand:
Agents also find it on their own: /.well-known/mcp (also mcp.json and
/.well-known/mcp
mcp.json
mcp/server-card.json) serves a server card with the endpoint and the tools,
mcp/server-card.json
and llms.txt ends with an "MCP server" section linking it.
The transport is Streamable HTTP (JSON-RPC over POST, protocol versions
POST
2025-03-26 to 2025-11-25) and stateless. Requests whose Host is
Host
not a name the server answers to (DNS rebinding; behind a reverse proxy on the
same machine list the public name in AIUI_ALLOWED_HOSTS) or that come from
AIUI_ALLOWED_HOSTS
another site's page (Origin; allow one with --cors-origins or
Origin
--cors-origins
AIUI_ALLOWED_ORIGINS) are refused. To turn the server off:
AIUI_ALLOWED_ORIGINS
A static host (GitHub Pages, any CDN) runs no server, so it has no /mcp
and the menu shows no MCP items; the .md pages and llms files above still
work there.
aiui serve and aiui dev also answer questions about the docs, with the
sections each answer came from. Set a model key in the environment and
serve; there is nothing to configure:
The server ranks the build's sections for the question (the same ranking as
search, widened so a long question still finds its pages), sends the best six
to the model and streams a Markdown answer that cites them as [1], [2].
[1]
[2]
Your key stays on the server: it is read from the environment and never logged
or sent to the browser.
| Model setting | Where |
| content.docs.assistant.model, else AIUI_ASSISTANT_MODEL, else OPENAI_MODEL_NAME, else gpt-4o-mini | which model answers |
content.docs.assistant.model
AIUI_ASSISTANT_MODEL
OPENAI_MODEL_NAME
gpt-4o-mini
| OPENAI_API_KEY, OPENAI_BASE_URL | any OpenAI-compatible API, including a local server (OPENAI_BASE_URL=http://localhost:11434/v1 needs no key) |
OPENAI_API_KEY
OPENAI_BASE_URL
OPENAI_BASE_URL=http://localhost:11434/v1
| a provider/model name such as anthropic/claude-sonnet-4-5 | goes through LiteLLM when it is installed, with that provider's key |
provider/model
anthropic/claude-sonnet-4-5
Without a key the endpoint still answers: it returns the best matching
sections and says AI answers are not set up, so readers never hit an error.
| Key | Default | What it does |
|---|---|---|
| starters | none | up to six questions offered before the reader asks |
starters
| instructions | none | extra rules for every answer (tone, names, scope); up to 4,000 characters |
instructions
| model | see above | the model |
model
| endpoint | none | on a static host, the ask URL of an aiui serve running the same build |
assistant: false turns it off. The build writes these settings into
assistant: false
ui-config.json, which is public: keep secrets out of instructions.
ui-config.json
When the server has a model, the docs header shows Ask AI. It opens a
side panel with your starter questions; answers stream in, cite their
sections as [1] links that open the page at that section, list the sections
under the answer, and can be copied or stopped. Follow-up questions keep the
conversation. Other ways in:
| Entry point | What it does |
| ⌘I / Ctrl+I | opens the panel |
| ?assistant=<question> on any page URL | opens the panel and asks; the parameter leaves the address bar |
?assistant=<question>
| select a passage in a page | an Ask about this chip quotes it in the question |
| search (⌘K) | an Ask AI: <query> row under the results |
| a page with mode: assistant | the page's text, then the panel inline: a full "Ask the docs" page |
mode: assistant
| window.dispatchEvent(new CustomEvent('aiui:docs-ask', { detail: { question, context } })) | from your own JavaScript |
window.dispatchEvent(new CustomEvent('aiui:docs-ask', { detail: { question, context } }))
A server without a key shows none of this (the API above still returns the
best sections). A static host shows it only when endpoint names an
aiui serve running the same build; allow the site's origin there with
--cors-origins https://docs.acme.dev.
--cors-origins https://docs.acme.dev
POST /api/docs/ask with {"question": "...", "context": "...", "page": "/docs/x", "history": [{"role": "user", "content": "..."}]}
POST /api/docs/ask
{"question": "...", "context": "...", "page": "/docs/x", "history": [{"role": "user", "content": "..."}]}
(only question is required; context is a quoted passage, history the
question
context
history
earlier turns) answers with Server-Sent Events:
| Event | Data |
| sources | [{"n": 1, "title", "heading", "path", "url", "snippet"}], the sections the answer may cite as [n] |
sources
[{"n": 1, "title", "heading", "path", "url", "snippet"}]
[n]
| text | {"text": "..."}, the next piece of the Markdown answer |
text
{"text": "..."}
| done | {} |
done
{}
| unavailable | {"message": "..."} instead of text when no model is set up |
unavailable
{"message": "..."}
| error | {"message": "..."} when the model call failed |
error
GET /api/docs/search?q=install&limit=10 returns {"results": [{"title", "heading", "anchor", "path", "url", "snippet"}]},
GET /api/docs/search?q=install&limit=10
{"results": [{"title", "heading", "anchor", "path", "url", "snippet"}]}
ranked as the search dialog ranks them, and each page's Markdown is at
/docs/<page>.md, so another app can embed docs search and answers.
The endpoints are public like the site, so they are guarded: 10 questions a
minute per client, a 32 KiB body, a 2,000-character question, the same Host
and Origin checks as the MCP server, and application/json or text/plain
application/json
text/plain
bodies (a static site on another origin posts text/plain, allowed with
--cors-origins or AIUI_ALLOWED_ORIGINS). Answers spend your key, so put a
public site behind your own rate limits too.