Documentation Process
This page documents the documentation itself: the tooling, the publish pipeline, and the discipline that keeps it from rotting.
Tooling
Section titled “Tooling”- docs-kit — the shared generator of
the Branes.AI sites, pinned in
docs-site/package.json. It generates this site (Astro + Starlight) from the documents indocs/, authored in Markdown/MDX, and checks every relative link and anchor in them.docs-site/docs-kit.config.mjsholds what is cortex’s own: group labels, the accent, math, the API reference’s settings. - Doxygen — the C++ API reference, generated from the
///comments inmath/,sdk/, andcv/headers intopublic/api/, served at<base>api/next to the prose site, with the doxygen-awesome theme.
Local development
Section titled “Local development”cd docs-sitenpm install # first timenpm run gen:benchmarks # extract benchmark gates into src/data/benchmarks.jsonnpm run api # generate the Doxygen API into public/api/npm run dev # live-reloading site from ../docs (runs gen:benchmarks first)npm run build # production build into dist/ (runs gen:benchmarks first)npm run check # every internal link and anchor in dist/npm run build:full # api + build, the full local equivalent of the deploygen:benchmarks runs automatically before dev and build (via the predev /
prebuild hooks), and docs-kit generates the pages and the sidebar from docs/ before
both. The generated pages (src/content/docs/, src/generated/), the Doxygen output
(public/api/), the generated src/data/benchmarks.json, node_modules/, dist/,
and .astro/ are gitignored — all generated, never committed.
Publishing
Section titled “Publishing”.github/workflows/deploy-docs.yml builds and deploys to GitHub Pages at
https://branes-ai.github.io/cortex/ on every push to main that touches docs/**,
docs-site/**, the documented headers (math|sdk|cv/include/**), or the sources of
the benchmark gates. It calls docs-kit’s shared deploy workflow: npm ci →
npm run api (Doxygen) → npm run build (with DEPLOY_TARGET=github-pages) →
npm run check → actions/deploy-pages. CI’s Docs site job builds and checks the
site on every PR, so a broken link fails the PR rather than the deploy.
One-time setup (a repo admin must do this once): Settings → Pages → Build and deployment → Source = GitHub Actions. Until that is set, the workflow runs but the deploy step has nowhere to publish.
The maintenance discipline
Section titled “The maintenance discipline”Documentation stays accurate only if updating it is part of shipping code, not a separate chore:
- Per-PR docs rule. A PR that adds or changes a subsystem updates its page in
docs/(algorithm description, and any benchmark number it moves). The PR template carries a checkbox for it. This is the single most important habit — it’s why the site reflects the code instead of drifting from it. - Single source of truth for numbers — pinned, not copied. The benchmark
gates (latency budget, EuRoC ATE gate, coverage floor) live in the code
(
FrameLatencyBudget, the EuRoC test threshold, the CI--fail-under-linesvalue).docs-site/scripts/gen-benchmarks.mjsextracts them intosrc/data/benchmarks.jsonon every build (via theprebuild/predevhooks), and the Benchmarks pages (.mdx) render from that JSON — so the gate numbers on the site cannot drift from the code, and the generator hard-fails the build if a constant is renamed. (Observed measurements like “~38 ms median” are reference numbers, not gates, and stay as labeled prose.) - Per-phase retrospective. At each epic’s close, add or finalize its
phases/phase-Npage (paired with thedocs/sessions/log and the project-memory entry). Phases 0–3 are done; Phase 4 (SLAM) gets a page when it closes. - API reference is automatic. Because Doxygen reads the headers, the C++ API page
stays current for free — the maintenance cost is keeping the header
///comments good, which review already enforces.
Adding a page
Section titled “Adding a page”- Create
docs/<section>/<slug>.mdwithtitle+descriptionfront matter (or a first#heading for the title). Use.mdxonly when the page imports a component; import the site’s code as@site/components/…or@site/data/…. - Add a link to it in its folder’s row of the documentation map: the
sidebar lists a folder’s pages in the order of that row, and its groups in the
order of the rows.
sidebar.labelin the front matter sets a shorter label. - Link to other documents and figures by relative path (
../vio/overview.md,../assessments/figures/s0/imu_drift.svg). The build turns them into site links and fails on one that does not resolve, naming the file and line.