A page is public only when four things are true: the file exists under docs/, mkdocs.yml
un-excludes it, the nav: lists it, and just docs builds strictly with it in place. Everything
else in the repository -- ADRs, plans, agent instructions, receipts -- stays source-only on
purpose. Three checks share the work: the strict build proves structure, nav and links; the drift
tests pin commands, paths, anchors and a few source-backed facts; a human reviewer reads the prose
for truth — no test does that for you.
- Write
docs/<page>.md. Start with the answer (see the checklist below), not the history. - Add
!/<page>.mdto theexclude_docsblock inmkdocs.yml. That block is an allowlist: its first line is**, so a new file is excluded until named. Keep the comment above it true. - Add the page to
nav:under the group it belongs to. A page outside the nav builds but is unreachable; a nav entry without a page fails the strict build. - Build.
--strictturns every warning -- a missing nav page, a broken relative link, an unreadable file -- into a failure:
just docs- Link the page once from the page that owns the reader's previous step. The router links each guide page from the step it belongs to; do not add a second route to the same page.
Documentation here is tested like code, with no network in the default tier and only a bounded
allowlist of read-only commands actually executed (--version, --help, git log -1); every
other fenced command is resolved against the justfile, the Click tree or the filesystem.
Three files do it, all under packages/studyloop/tests/:
test_docs_drift.py-- every fenced line beginningstudyloop …inREADME.md,CONTRIBUTING.mdand every top-leveldocs/*.mdpage (_STUDYLOOP_EXAMPLE_DOCS, derived from the filesystem minus the reasoned_DRIFT_ALLOWLIST) must resolve against the real Click command tree (a renamed option or subcommand fails the page that still shows it);--sinceexamples must parse; YAML blocks on the same pages may use only known keys (a block whose top-level keys mark it as a playbook, a note's frontmatter or a workflow is skipped); and five tests pin single sentences against the source they describe.test_contributor_guide_drift.py-- the twenty guide pages: fencedjustrecipes exist, fencedpytestpaths exist, backticked repository paths exist, links and anchors resolve, the page has one H1, an answer-first block, a numbered list and no more than its line cap (150; the router 200, the testing cookbook 220;acceptance-testing.mdis exempt until it is split), and any sentence about harness tiers, test markers, branch prefixes or commit types matches the source.test_contributor_docs.py-- the guide pages are allowlisted and in the nav, the cookbook links real collected examples, and the module guide keeps its proposal/execution boundary.
Run them together whenever you touch docs/ or mkdocs.yml:
uv run --group dev pytest packages/studyloop/tests/test_docs_drift.py packages/studyloop/tests/test_contributor_docs.py -qTo pin a new command example: put it in a fenced block on any top-level docs/ page (or
README.md / CONTRIBUTING.md) and the Click-tree test picks it up with no test code -- a new page
is covered the moment it exists; a page whose commands are deliberately not the product's goes in
_DRIFT_ALLOWLIST with its reason. To pin a new sentence (a tier, a count, a default): add one
test beside the five pinned-claim tests in test_docs_drift.py that reads the sentence and the
source symbol and compares them -- parse the sentence, never copy it into the test. A documented
command you have not run is a defect, not a draft.
exclude_docs starts with ** so that docs/adr/, docs/architecture/, openspec/, agents/
and every audit, plan, receipt and handoff stay in the repository but off the public site. They
are written for the people changing the code, change without a learner-facing review, and often
describe intent rather than behaviour. A public page describes what the installed program does
today; if a statement belongs to a decision record, write the ADR and have the page link to the
behaviour instead. A public page that links an excluded file still builds: mkdocs only reports it
at INFO level and the link is dead on the site, so read the build log, not just its exit code.
Every page in this guide is held to this checklist, by the drift test where a rule is mechanical and by review where it is not. Check each item before you open the pull request:
- One job per page. The title names it; a second job is a second page, linked once.
- Answer first. The first block after the title is a paragraph of at most three sentences or a numbered list, and it tells the reader what to do or what is true. Context comes after.
- Numbered steps for anything done in order. Bullets only for sets with no order.
- At most 150 lines. If the page is longer, it has two jobs; split it. Three pages carry a larger cap for a stated reason (the router's fifteen anchors, the cookbook's pinned examples, the pre-existing acceptance page) and the drift test names them.
- No "see elsewhere" loops. Link the owning page once, at the point the reader needs it, and never send them to a page that sends them back.
- Define a term where it is used. The first use of adapter, tier, allowlist or any repository word carries its one-line meaning; do not make the reader hold it from another page.
- One idea per paragraph, one command per fenced block, with the expected result stated in the sentence before or after it.
- Say what is true now. Proposed or future things are prose labelled proposed; never a fenced command that does not run today.
- Name the file. A claim about the code names the path in backticks so the reader -- and the drift test -- can check it; a claim nobody can check is cut.
- Say what you ran. Every command on the page was run by its author and its first lines of output were kept as evidence; a reader following the page gets the same result.