Documentation π‘ BETA
Documentation is traceable to code: a claim that cannot be verified against the repository is deleted.
Overview
BotBook is a MkDocs site built from botbook/src/SUMMARY.md; a page absent from that navigation is never rendered, so link checks must be made against the published set (botbook AGENTS.md).
Documentation Structure
| Area | Authority |
|---|---|
| App titles and categories | botserver/src/apps/registry/ |
| Dependency versions | botserver/3rdparty.toml |
| Product version | root Cargo.toml |
| BASIC keywords | botserver/crates/botbasic_*/src/keywords/ |
| Crate layout | botserver/crates/*/ |
| Generated reference | gen_*.py scripts; never edited by hand |
Repository Documentation
Root AGENTS.md is the operating standard; DESIGN-SYSTEM.md is the mandatory UI standard. BotBook documents what the product does today.
mdBook Documentation
mkdocs.yml uses MkDocs Material with use_directory_urls: false; the theme mirrors the --id-* tokens and uses local fonts and SVGs only.
Code Documentation
Rust doc comments explain public APIs; inline comments explain a non-obvious mechanism. A comment that restates the code is deleted.
Rust Doc Comments
Document the contract, not the implementation detail that may drift.
Module Documentation
A module README describes responsibility and boundaries; module-level docs should point to the authority for any versioned claim.
Inline Comments
Comments are used sparingly and must not encode a version, port or date that the code does not expose.
API Documentation
The REST and WebSocket reference is generated from route sources; write prose that points at it, not a second copy of the schema.
Endpoint Documentation
A route is documented only if it is registered in a router in source (botbook AGENTS.md, Fabricated keywords and endpoints).
Create User
Example payloads belong in the generated reference. Prose must not invent a request field.
Request
Request fields come from the handler type in source.
Response
Response shapes come from the handler and its serializers.
Errors
Error responses are sanitised; raw provider strings are not returned to clients.
WebSocket Documentation
WebSocket behaviour is documented from the handler in botserver/src/core/bot/ws/; message types are defined there.
WebSocket Protocol
A connection creates a user session and resolves identity; type 6 is TOOL_EXEC and bypasses the LLM (root AGENTS.md, Chat Flow).
Connection
Identity is resolved from a token, a user id or a new guest, in that order (root AGENTS.md, gbgov Edition).
Message Format
Message types and their meanings are listed in root AGENTS.md; do not invent a new type.
BASIC Script Documentation
The generated BASIC reference is authoritative for keyword syntax. Local keyword pages explain one registered keyword at a time.
Keyword Documentation
- Confirm the keyword is registered in
botserver/crates/botbasic_*/src/keywords/or local keywords. - Write from the signature in source.
- State the limits explicitly.
- Add a Related section.
TALK Keyword
TALK sends text to the conversation; its exact registered form belongs to the generated reference.
Syntax
Use the syntax printed by the generator, not an inferred variant.
Parameters
Parameters are positional unless the registration says otherwise.
Examples
Examples use only registered keywords and real file layouts.
Script Examples
A .bas example lives in the bot repository .gbdialog/; the work-dir copy is materialized.
Markdown Best Practices
| Practice | Rule |
|---|---|
| Lead | One sentence after the H1 |
| Sections | Short, with a table or step list |
| Limits | State what is not implemented |
| Links | Relative, to a published page and real anchor |
| Images | Local SVG, alt text on its own line |
Structure
Keep H1 and existing headings so published anchors keep working. Add a ## Related section at the end of every page.
Code Blocks
Use a language tag; do not paste unverified commands or endpoints into a code block.
Tables
Prefer a table over a list of claims; name the source of each version or limit.
Links
Never link directly at README.md as the book cover; link to the chapter overview instead.
Writing Style
Formal language. Name the mechanism and the trade-off; delete what cannot be traced.
Be Clear and Concise
One claim per sentence, one section per topic.
Use Active Voice
Write "the crate registers" rather than "it is registered" where the actor is known.
Provide Context
State which source file a fact comes from before relying on it.
Documentation Process
- Open a tracking issue with scope and measured numbers.
- Locate the authority and read the file.
- Write from the source, not from the existing page.
- Run
python3 scripts/botbook_guards.py --check. - Build and read the rendered page.
When to Document
When user-facing behaviour changes, or when a claim in the book no longer matches the code.
Documentation Checklist
- One-sentence lead
- Short sections with a table or flow
- Verified limits
## Relatedsection- No inline style, CDN or ad-hoc colour
- Guards clean for edited paths
Tools
botbook_guards.py --check validates links, anchors, versions and ports. gen_*.py --check validates generated pages. build_botbook_docs.sh regenerates, verifies and builds.
Documentation Generation
Generated pages are owned by scripts and must not be edited by hand.
Documentation Serving
The site is static, served by Caddy in the proxy container; a status 200 can be the fallback page.
Spell Checking
No spell-check script is documented here; review the rendered page instead.
Common Mistakes
Fabricated keywords, stale versions, dead code described as a feature and links checked against the filesystem instead of SUMMARY.md (botbook AGENTS.md, Failure modes).
Missing Context
A claim without a source is removed, not softened.
Outdated Documentation
Check versioned claims against the manifest whenever a component changes.
Unclear Examples
An example that uses an unregistered keyword is wrong; search for it first.
Contributing Documentation
Edit only the files you own in a parallel batch; leave generated pages and the navigation to their owners.
Where to Contribute
User-facing behaviour goes into BotBook; developer-facing detail goes into module READMEs and inline comments.
Documentation PRs
Commit per issue with the measured numbers in the message; the driver pushes and CI publishes.
Summary
Documentation is a traceability exercise: every sentence must be reproducible from a repository file.
Limits
- No guard listed as missing from #2082 may be cited as available.
- Generated pages and
SUMMARY.mdare not hand-edited in this batch. - No component version, port or model name is invented for an example.
- The book cover
README.mdis not a link target; use the chapter overview.