# Generate docs from the code

Generation turns your code into a first set of docs. It happens in two steps, so you decide what gets written: the agent proposes an outline, you edit it, then it drafts the pages.

It needs a [Docs tier](https://docs.rimfe.com/reference/plans-and-limits#docs-tiers), on any plan, and a code repository linked to the site. See [Link code repositories](https://docs.rimfe.com/platform/changes-from-pull-requests#link-code-repositories). When several are linked, generation reads the first one.

## Generate

<video src="https://public.cdn.rimfe.com/assets/videos/clip-generate-outline-1e266b5b.mp4" poster="https://public.cdn.rimfe.com/assets/videos/clip-generate-outline-f07898e3.webp" controls />

<Steps>
<Step>

### Choose Generate

Open the site's **Automations** tab and choose **Generate**. Under **Audience**, choose **Public** for people who use your product, **Internal** for people who work on it, or **Both**.

To add pages to one part of a site that already has folders, choose **One section** instead. Pick the **Section** and how many **New pages** to plan, up to your Docs tier's limit. Pages already in the section stay as they are.

<img src="/images/platform/automations.webp" alt="Automations tab with Ask the agent, Verify, Translate, Generate and recent tasks" width={900} height={563} />

</Step>
<Step>

### Check the cost and start

The dialog shows what the task is expected to cost. Choose **Propose an outline**.

<img src="/images/app/generate-dialog.webp" alt="Generate dialog with whole site or one section, the audience, more options and the cost" width={464} height={1100} />

</Step>
<Step>

### Edit the outline

When the task is done, find it under **Recent tasks** and choose **Edit outline**. Pages are listed under their sidebar groups: **Get started**, **Guides**, any groups for your product's own areas, **Concepts** and **Reference**. Each page has a title, a path, a kind and an audience. Rename pages, move them up or down within their group, choose **Add a page** in a group or remove pages, then choose **Draft these pages**.

<img src="/images/platform/outline.webp" alt="Proposed pages grouped as Home, Get started and Guides, each with title, path, kind and audience" width={900} height={563} />

</Step>
<Step>

### Review the drafts

Choose **Review drafts** on the task. Each page arrives as a draft, with a diff against what is live. The home page is built from the outline: a short introduction and a set of cards for each group, linking every drafted page. If you already edited the home page, it is kept and listed as left out. The sidebar follows the same groups. Nothing is public until you [publish](https://docs.rimfe.com/platform/publishing-and-builds).

<img src="/images/platform/review.webp" alt="Review changes with the published page next to the draft" width={900} height={563} />

<img src="/images/platform/review-source.webp" alt="Review changes in source view with the added lines" width={900} height={563} />

</Step>
</Steps>

## What it uses

The agent reads the facts Rimfe already extracts from your code for reviews, such as exported functions, routes, commands, config keys and environment variables, plus your README, manifests and OpenAPI specs. For the **Public** and **Both** audiences, the outline also lists reference pages for the API, the CLI, environment variables and configuration when your code has them. They are built straight from the code. Build and test scripts from `package.json` are left out of public pages. The outline holds up to 80 pages.

Every drafted page is checked against your code and read once more by an editor model, which can send it back for one more draft. A page that fails the checks is left out, with the reason on the task.

Public pages are written for people who use the product and do not name internal files, symbols, feature flags or tickets. On a public site, pages for the **Internal** audience are visible to workspace members only, not to readers. On a private site they are visible to every reader who can open the site, so limit them to a group in the page settings or leave them out.

## Cost

Generation runs on your [Docs tier](https://docs.rimfe.com/reference/plans-and-limits#docs-tiers), on Rimfe's models. It never uses your AI key or included reviews. Each page it drafts counts as one AI page, except reference pages built from your API spec. Your tier also sets how many pages one generation drafts: 25 on Docs Lite, 50 on Docs Plus and 100 on Docs Pro. When the cycle's AI pages are used, generation pauses until the next cycle. Without a tier, the task shows **Runs on Docs** with an **Add Docs** link.
