# Understand code your agents wrote

Have your agents write docs where every sentence links to the code behind it, so you can see how your project works and check any claim.

Agents write code faster than you can read it. After a few weeks, it's hard to say how your project works or why it was built that way. Asking an agent doesn't settle it, because an agent sounds just as sure when it's guessing.

Rundesk helps with docs that show their sources. Each page says what a feature is for and how it works, and every sentence links to the code that does what it says. If you doubt a sentence, open its link and read the code. If a sentence cites no code, Rundesk marks it `[citation needed]`, so a guess stands out.

Here is how to set it up for a project your agents already work in.

## 1. Add the writing-docs skill to the project

The docs rules come in `writing-docs`, a skill in your Rundesk library like any other. To give it to everyone who works on the project, add it to the project's [`desk.yml`](/docs/desk-yml.md):

```yaml
skills:
  - writing-docs
```

Agents connected to Rundesk also get the essentials by calling `guide` with the topic `docs`. [Writing docs](/docs/writing-docs.md#give-agents-the-rules) has the details.

## 2. Ask an agent to document one area of the project

Pick the area you understand least, or the one agents have changed most. Open an agent in the project and paste this, with the area filled in:

```text
Document how <area> works, as pages in docs/, following the writing-docs rules. Read the code for
every claim. Each page states what the feature is for in its intent, then what the code does, and
every sentence cites the function that does it. Write nothing you cannot cite. Run docs_check on
the folder when you finish and fix every warning.
```

To watch it write, hover the project's header, choose **Files & Docs** (**Files & Pages** if the project also has a pages folder), pick the **Docs** tab, and open the page. It updates as the agent saves.

## 3. Read a page and check the claims you doubt

Each sentence ends with a numbered link, such as `[3]`. Click it to jump to its footnote under **References**. Click the footnote's link to open that code in Rundesk, and see whether it does what the sentence says.

Problems show above the page's title, such as `3 citations needed · 1 hint`. Click that to list them, and click a line to jump to it. A sentence with no source ends in a red `[citation needed]`, and a citation whose file isn't there shows its number in red.

Rundesk can tell when a sentence has no source. It can't tell whether a source really backs the sentence. That part is up to you: before you act on a claim, open its code.

## 4. Update the docs with each change

Docs help only while they match the code. Ask your agents to update the docs whenever they change the code:

```text
Before you change <area>, read its pages in docs/. When your change alters what a page says,
update the page in the same change, citing the code, and run docs_check before you finish.
```

Rundesk hints that a page may be out of date when code it links to changed after the page did, committed or not. Ask an agent to read the page against the code and fix it.

## Related pages

- [Files & Docs](/docs/docs-view.md): reading pages in Rundesk, and the problems it finds on each.
- [Writing docs](/docs/writing-docs.md): the page format, and why every sentence links to its code.
- [Guide for AI agents](/docs/for-agents.md): the `guide` and `docs_check` tools agents use.
