# The code graph

Rimfe keeps a map of your code and your docs. The map links a change deep in a helper to the feature it belongs to. It is built from your default branch and updated as you merge.

A pull request reviewed while the map is still catching up on a merge uses the last complete map. Rimfe reads the code merged since from the pull request's base, so new names are not reported as missing.

## What the map holds

The graph connects the things your code does:

- **Calls**: which function uses which.
- **Renders**: which screen shows which component.
- **Routes**: which URL runs which code.
- **Jobs and events**: what runs in the background, and what triggers it.
- **Keys**: the names that code and docs share, such as environment variables, config keys and flags.

Your docs are in the map too. A statement in a page, such as "the `timeout` option defaults to 30 seconds", is a **claim**, and it is linked to the code it describes.

## Which pages a change affects

For a changed function, Rimfe walks outward through the map to the things people can see or call: a route, a screen, a command, a public export. Today this walk runs beside the review and is recorded for measurement; it does not add pages to the ones checked. The walk stops at shared helpers that nearly everything uses, so a change to a logger would not point at every page. You can name those helpers with [`graph.hubs`](https://docs.rimfe.com/configuration/rimfe-json#graph-keys).

```mermaid title="From a changed helper to the pages about it"
flowchart LR
  Helper[Changed helper] --> Caller[Functions that call it]
  Caller --> Surface[Route, screen, command or public export]
  Surface --> Claims[Claims in docs pages]
```

You do not need to set anything up for this. When a library has an unusual layout, [`entryPoints`](https://docs.rimfe.com/configuration/rimfe-json#graph-keys) tells Rimfe where its public surface starts.

## Who may see what

Every page has an [audience](https://docs.rimfe.com/configuration/rimfe-json#audiences): public users, your team, API readers, changelog readers, help center readers or coding agents (agent context files). A suggested fix is written for the audience of the page it edits.

Each audience has a list of things it must never read. Before a patch is offered, Rimfe checks it against that list:

| Audience | A patch must not name |
| --- | --- |
| Public and help center | Code names, internal file paths, feature flag keys, unreleased features or ticket ids. |
| API reference | Internal file paths, feature flag keys or unreleased features. |
| Changelog | Feature flag keys or internal file paths. |
| Internal and agent context files | Nothing is blocked. |

```mermaid title="The audience check on a suggested fix"
flowchart LR
  Fix[Suggested fix] --> Check{Safe for the page's readers?}
  Check -->|Yes| Offer[Offered in the comment]
  Check -->|No| Hold[Held back, the finding stays]
```

In short, a public patch never names internal code. A patch that fails the check is held back, and the finding stays so you can write the fix yourself. Set an audience for a folder in `.rimfe.json` when the default is wrong.

## Stale claims and broken references in audits

An [audit](https://docs.rimfe.com/how-it-works/audits) also uses the map, with no code change involved:

- A **broken reference** is a name or link in a page that the code or the docs no longer have.
- A **stale claim** is a statement whose linked code is gone. The page may still be true, so Rimfe asks you to look.

Both show as findings in the audit, like any other. See [Findings and checks](https://docs.rimfe.com/how-it-works/findings-and-checks).

## Related

- [`.rimfe.json` reference](https://docs.rimfe.com/configuration/rimfe-json)
- [Privacy and data](https://docs.rimfe.com/how-it-works/privacy-and-data)
