> ## Documentation Index
> Fetch the complete documentation index at: https://docs.actual.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Find existing decisions

> See which decisions govern a repository, a path or a plan, in the rule files and in Actual AI.

The rule files under `.actual/rules/` are the decisions that govern a repository today: they're what `plan-check` and `impl-check` read. `actual rules` lists them and picks the ones that govern a path or a plan, with no sign-in. Signed in, `actual adr list` and `actual adr show` read your organization's decisions in Actual AI, drafts and suggestions included.

## The rule files in a repository

`actual rules ls` lists every rule document under `.actual/rules/`, with a count of its rules by level and any parse warnings or errors:

```bash theme={null}
actual rules ls               # the repository you're in
actual rules ls path/to/repo  # another repository root
actual rules ls --json        # the same report as JSON
```

A rule file can open with a YAML header that names its decision's id, status and the paths it governs. A decision whose status is `draft`, `deferred`, `rejected` or similar doesn't govern. With `--json`, a document with a header also reports its `adr_id`, `status` and `root`. Reading headers needs Actual CLI 0.9.0 or later.

## Decisions that govern a path

Give `actual rules select` a file or a directory with `--file`, and it returns the rule documents whose paths cover it:

```bash theme={null}
actual rules select --file src/api/
actual rules select --file src/api/users.ts --file src/db/ --explain
```

A path-only query scores each document on the paths its rules name, and uses no model and no network. A rule set whose rules name no paths therefore returns nothing for every file, which says nothing about whether those rules govern it. To see what your agent would be briefed for a file, run `actual rules brief --file <path>` instead (see [Rule briefs](https://docs.actual.ai/guides/rule-briefs.md)): when no path covers the file, it retries with the path's words as the query.

## Decisions that govern a plan

Give `actual rules select` a plan, with or without the paths it touches, to see the decisions a plan check would weigh:

```bash theme={null}
actual rules select "Add a caching layer in front of the user repository."
actual rules select "Add a caching layer in front of the user repository." --file src/users/ --json
```

Selection runs in two stages. The first is a deterministic prefilter over a scope index of the rule files: it ranks every document by its paths, its scope sentence and its title, with no model and no network. The second asks your configured runner which of the candidates govern the change, and runs only when the prefilter returns more candidates than `--limit` allows and the query has plan text to judge. The runner can only keep, drop or promote candidates; it never adds one. When it can't run or fails, the prefilter's answer stands, and the `Stage 2` line of the report says why.

| Flag | What it does |
| - | - |
| `--file <PATH>` | Adds a file or directory the change touches. Repeatable |
| `--limit <LIMIT>` | Most documents to return. Default 10 |
| `--by-adr` | Groups the result by decision and counts `--limit` in decisions |
| `--min-score <SCORE>` | Drops documents below this score. Defaults to the repository's `rules_min_score`, then the user-wide one, else no floor |
| `--no-rank` | Uses the prefilter alone: offline and exactly reproducible |
| `--runner <RUNNER>`, `--model <MODEL>` | Picks the runner and model for the second stage |
| `--explain` | Shows the signal behind every hit |
| `--json` | Prints the selection as JSON |

The second stage has a 90-second deadline, and a measured plan took between 6 and 218 seconds. Pass `--no-rank` when you can't wait. [Plan and change checks](https://docs.actual.ai/concepts/plan-and-change-checks.md) explains how the checks use the same selection.

## The scope index

The selection commands keep a scope index of the rule files in your user config directory, never in the repository. It's keyed by the exact bytes of every rule file, so any edit, addition, removal or rename rebuilds it on the next query. `actual rules index` builds or refreshes it yourself and prints a summary:

```bash theme={null}
actual rules index            # build, or reuse a valid cached index
actual rules index --rebuild  # rebuild even when the cached index is still valid
actual rules index --clear    # remove every cached index, then rebuild this one
```

## Decisions in Actual AI

Sign in with `actual login` (see [Sign in](https://docs.actual.ai/sign-in.md)) to read the decisions your organization keeps in Actual AI, including drafts and suggestions that don't govern yet.

```bash theme={null}
actual adr list                             # the connected repository's decisions
actual adr list --repo owner/name --state draft
actual adr show <id>                        # one decision, with its policies, their ids and its scope
```

`adr list` uses the connected repository your checkout's `origin` remote names, or the one `--repo` names by its name, `owner/name` or id, and lists the whole organization when neither names one. `--state` takes `active`, `draft`, `suggested`, `updated` or `archived`, the same lists as the web app's decisions page. `--limit` (1 to 200, default 50) and `--offset` page through a long list, and `--json` prints the result as JSON.

The same decisions are in the web app at [app.actual.ai](https://app.actual.ai). An accepted decision reaches the repository's rule files through the pull request Actual AI's sync opens.

## Duplicates of a new decision

Check for one that already says it. `actual adr check` lists likely duplicates among your decision files and, signed in, your decisions in Actual AI, and `actual adr create` refuses a look-alike unless you pass `--allow-duplicate`. [Write and draft decisions](https://docs.actual.ai/guides/write-and-draft-decisions.md) covers both.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.