Documentation

Writing docs

Write a project's docs as plain markdown pages, each statement citing the code behind it.

View Markdown

You want docs your teammates and your agents can trust. In Rundesk you write them as plain markdown in your project, and every statement on a page points at the code that does it, so anyone can check a claim, and an agent can write and check the page as it works. A project's docs say what the project does and why, for anyone who will never read its code: you, your teammates, your customers and the agents working beside you.

Rundesk reads them in the Docs tab of Files & Docs, and the same files read just as well on GitHub, in an editor or to an agent. This page shows where the files go, why and how they cite the code, how to lay them out, how to run the docs check, and how to give your agents the rules.

Where docs live

Each project has one docs folder. It is the folder the project's desk.yml names under docs:, and docs/ when there is no desk.yml or it names none. To put docs somewhere else, add one line to desk.yml:

docs: documentation

Only the docs folder counts. Its pages are the ones the Docs tab lists, the ones the docs check reads, and the ones that need citations. Markdown anywhere else in the project, such as a root README.md, a CONTRIBUTING.md or a changelog, opens in Files as an ordinary file: it gets no citation marks and no findings, and the rules on this page do not apply to it.

Docs are plain markdown files. Nothing is built or generated, so one file reads the same everywhere.

Each page states what the project does now, and changes in the same change as the code. Plans, task lists, meeting notes and changelogs belong wherever the project tracks its work, or in a folder of the docs that desk.yml lists as unchecked, never mixed in with the docs pages.

Why docs cite their sources

An agent writing docs can state things that sound right and are not true: a limit it guessed, a default typical of such code, a step the project never had. On the page, that sentence looks exactly like one somebody checked, and whoever trusts it, you or the next agent, builds on a guess. A citation makes each claim point at its source, the code that does what the sentence says, so anyone can open that code and check it. A claim with no code behind it has nothing to cite, so it is not written.

Here is a sentence an agent might write about a refunds module it never read:

Refunds are allowed within 30 days and paid out within 24 hours.

Both figures are plausible, and nothing says where either came from. Written with a citation, the sentence can say only what the code does:

A refund is refused ninety days after its charge.[^window]

[^window]: [`refund_window()`](../../src/billing/refund.py) refuses a charge older than `WINDOW_DAYS` (90).

The window is ninety days, not thirty, and the 24 hours is gone, because no code sets it and no footnote could back it.

Citations are how the docs stay true after they are written. When the code changes, its footnotes show which pages may have become false, and the docs check gives a hint on a page whose cited code changed, committed or not, after the page last did.

That is why a project's docs can be its source of truth: you and your agents read a page instead of the code, and an agent about to change the project starts from what the project really does, not from guesses.

Rundesk holds agents to this in three places. The writing-docs skill tells them to cite each sentence as they write it. The docs check flags every statement with no citation, which the Docs tab marks with a red [citation needed]. And an agent runs docs_check before calling docs work done, and finishes with no warnings.

Cite the code

Every sentence on a page in the docs folder that states what the project does cites the code that does it, and that includes the folder's home page, its README.md.

A citation is a footnote placed after the sentence it backs, as in the refund example. It links the code file, relative to the page, names the function in the link, and says in a few words what that code does. Link a function or constant by name, never by line number, which goes wrong after the next edit. An instruction to the reader, such as "Open Settings.", needs no citation, unless it gives a figure or says what the step does.

In Rundesk a citation shows as a number in brackets, such as [3], and the footnotes gather under a References heading, in a bordered card at the end of the page. Clicking a number scrolls to its footnote, and its ↩ scrolls back.

Organize pages into folders and sections

  • Folders are sections, files are pages, and a folder inside a section is a group.
  • An NN- prefix sets the order: one to three digits and a dash or underscore, as in 02-payments. It never shows, and each word starts with a capital, so that folder reads as "Payments".
  • README.md is a folder's home page. It comes first, and the breadcrumbs above a page open it.
  • Front matter at the top of a page gives its title, a subtitle, an intent saying what the subject is for, and an infobox of the facts a reader scans for. The Docs tab draws them as the page's header, with the infobox beside the text on a wide window. The infobox carries no citations of its own, so every value in it is also stated, with its citation, in the page's text; the docs check warns on a value the text never backs.
---
title: Refunds
subtitle: full and partial refunds, their limits and the customer's receipt
intent: |
  Refunds exist so that a customer charged wrongly gets their money back without asking twice.
infobox:
  - group: Limits
    rows:
      - { label: Window, value: 90 days, note: after the charge }
---

Add diagrams, callouts and images

Pages can use GitHub's tables, task lists and callouts, and a fenced mermaid block is drawn as its diagram or chart, such as a flowchart, a sequence diagram, a pie or a bar chart. A block that does not parse shows its code with the error under it. For a project with a database, the writing-docs skill has agents write one page that draws its whole schema as an erDiagram, every table and column, with its tables grouped into areas by class lines after them; Rundesk draws each table as a card and colors each area. Leave colors out of a diagram, since Rundesk draws it in its own theme, and leave out horizontal rules (--- between paragraphs): a page sets its sections apart by headings and space alone. A callout is written like this:

> [!WARNING]
> A refund cannot be undone.

Images are files in the project, in docs/assets/, linked relatively with alt text saying what they show. An image git ignores is not shown, and HTML written into a page is not drawn.

Write pages a reader can follow from top to bottom

Citations make a page true, and the writing-docs skill also asks that a person can follow a page from top to bottom.

A page's sections come in the order a reader meets the thing: what it does in ordinary use, then its limits, then how it fails. Each sentence names who acts, you or a part of the project, never an abstraction such as "the functionality". A page calls its reader one thing throughout, and explains a term the first time it uses it, then uses that exact term again. Sentences run as long as the rule they explain needs, and the fact a reader must not miss gets a short one of its own.

Before calling a page done, the agent checks whether its sections could be reordered with nothing lost. If the page would read just as well in another order, it is a pile of true facts rather than a page that builds, and the agent reorders it.

Check your docs

The docs check reads every page in the docs folder and lists what needs fixing, each finding with its page and line. It only reads: nothing is ever written into your pages.

  • A warning marks what a page cannot back or will not draw:
    • a statement with no citation, or an infobox value no cited sentence states
    • a citation that links no file, a file that is not there or that git ignores, another document (unless desk.yml counts it as code, as check.code does) or a line number, or that names code its file no longer holds, such as a renamed function
    • a footnote defined and never used, or used and never defined
    • a dead link, to a page, a heading on it or on the same page
    • an image with no file or no alt text
    • a table whose rows do not match
    • front matter that does not parse, or a code fence, comment or front matter never closed
    • a linked PDF over 20 MB, or a page over 5 MB
  • A hint marks what reads worse than it could, such as a page over 500 words of prose, a heading that asks a question, folders nested more than two deep, or a page whose cited code changed after the page did.

In the Docs tab, a page shows its count above its title, such as 3 citations needed · 1 hint, and a citation whose file is missing or ignored by git, or that names code the file no longer holds, shows its number in red, with the reason on hover; See what a doc needs fixed shows where to look.

Agents run the same check with the docs_check tool, for the whole docs folder, one folder or one page; past 200 findings it gives the count of each kind instead.

A project can tune the check for everyone on it in desk.yml: a longer page length, hints turned off by kind or all together, citation findings turned off, and unchecked folders, such as one for plans, whose pages get no findings at all. desk.yml lists each setting.

Give agents the rules

Every agent connected to Rundesk gets the essentials when it calls guide with the topic docs: where the docs folder is, how the Docs tab reads it, and that it runs docs_check and fixes every warning before calling the work done. See Guide for AI agents.

The full rules live in a skill named writing-docs, from Rundesk's skill package. When a project or your global skills have one, the docs topic tells agents to load it. If you used the writing-docs that earlier versions of Rundesk had built in, it's already in your library: the upgrade put it there for you, and once you have the skill package, its writing-docs takes over.

  • In one project: add writing-docs from the project's Skills section.
  • For everyone on the project: list it under skills: in the project's desk.yml, and each person whose library has it gets it.
skills:
  - writing-docs
  • Files & Docs: read the pages in Rundesk and see the check's findings on each.
  • Skills: add writing-docs to a project, or share it through desk.yml.
  • Guide for AI agents: what an agent calls to get the rules and run docs_check.