> ## 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.

# Rule briefs

> Brief your agent on the rules that govern each file as it reads or writes it, and tune how much context briefing uses.

A rule brief is the short list of rules that govern one file. The plugin delivers one as your agent reads a governed file, so the rules reach the agent before its first edit, and you can print the same brief yourself with `actual rules brief`. Briefing is advisory and never blocks anything; the [plan and change checks](https://docs.actual.ai/concepts/plan-and-change-checks.md) are what block.

## Briefing in Claude Code

* **A file the agent reads.** After the agent reads a governed file, the rules that govern it arrive before its next step, which is ahead of its first edit.
* **A file the agent writes without reading it first**, usually a new one. The brief arrives with the result of the write, after it ran, as a reminder that can prompt a revision.
* **A file already briefed.** Editing or reading it again adds nothing. Where the mod loads, a `/clear` or a compaction that empties the agent's context lets decisions be briefed again on the next read.

Most reads go through the shell rather than the Read tool: measured across 212 sessions, four in five file reads used `cat`, `head`, `sed -n` or `grep`. The plugin's mod briefs those reads too, and where it loads it takes over the Read tool as well, so every read goes through one path with one budget. The mod needs Claude Code 2.1.287 or later; on 2.1.285 and 2.1.286, set `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1` to load it. Without the mod, reads through the Read tool are still briefed, with no session cap and no transcript lines.

Where the mod loads, it caps briefing at 48,000 characters a session by default, and tells your agent once when the cap is reached. It also reports each read of a governed file as one transcript line:

```text theme={null}
actual-cli: ▌ BRIEFED    2 ADRs · 8 of 35 rules    tokens.ts
actual-cli: ▌ NO CHANGE  briefed earlier  tokens.ts
```

A governed file that briefs nothing says why: nothing new for it, the budget spent, or the CLI couldn't answer. Reads of files nothing governs report nothing. Type `/rules-brief` to list the session's briefing records in order, quiet reads included, with the reason beside each (the last 40 of up to 200). These lines are for you: the model never reads them, and they don't count against the cap. They need a terminal or the desktop app; `claude -p`, the SDK, the VS Code chat panel and cloud sessions show no lines, though briefing still runs there.

## Briefing in Codex

Codex has no Read tool, so the plugin briefs the files a read-only shell command names (`cat`, `head`, `sed -n`, `grep`, `rg` and the like) after the command runs, and the files a patch adds or updates before the patch applies. The CLI keeps the same 48,000-character session cap. Codex shows a hook's context to the model only, so each brief is announced to you as one line, such as `Actual AI: briefed 2 ADRs · 7 rules · src/auth/tokens.ts`, which the agent never sees. A read that briefs nothing new shows nothing, and there's no `/rules-brief`. `ACTUAL_RULES_BRIEF_NOTICE=off` drops the line and keeps the briefing. See [Codex](https://docs.actual.ai/guides/codex.md).

## Brief contents and limits

Run `actual rules brief` with a file to see the brief your agent gets for it:

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

A brief carries the best-ranked decisions for the file and the rules from each, within these limits:

| Flag | Default | What it limits |
| - | - | - |
| `--limit <LIMIT>` | 2 | Decisions per brief |
| `--rules-per-decision <RULES_PER_DECISION>` | 8 | Rules carried per decision |
| `--max-chars <MAX_CHARS>` | 4000 | Characters in the whole brief. Rules are dropped whole, lowest-ranked first, and the brief says how many decisions it left out |
| `--min-score <SCORE>` | none | The score a rule document must reach to be briefed at all |
| `--max-session-chars <CHARS>` | none | Characters of briefs one session receives, in the hook modes. Actual CLI 0.15.0 or later |

`--min-score` falls back to the repository's own floor, then the user-wide `rules_min_score` config key. A rule's score reflects how narrowly its paths are written, so the useful floor differs from one repository to the next. Set one repository's floor with:

```bash theme={null}
actual config set --repo rules_min_score <score>
```

`rules brief` reads rule files with a YAML header from Actual CLI 0.9.0 on, as well as the original format.

## Tune briefing

Each limit has a row under `/plugin` in Claude Code and an environment variable. A variable wins over its row. In Codex, which has no per-plugin settings, the variables are the only way to set them.

| Setting under `/plugin` | Variable | Effect |
| - | - | - |
| Rule brief: per-session character budget | `ACTUAL_RULES_BRIEF_MAX_SESSION_CHARS` | The session cap. Default 48,000; 0 turns briefing off |
| Rule brief: maximum characters per brief | `ACTUAL_RULES_BRIEF_MAX_CHARS` | Passed as `--max-chars` |
| Rule brief: decisions per brief | `ACTUAL_RULES_BRIEF_LIMIT` | Passed as `--limit` |
| Rule brief: rules per decision | `ACTUAL_RULES_BRIEF_RULES_PER_DECISION` | Passed as `--rules-per-decision` |
| Rule brief: minimum rule score | `ACTUAL_RULES_BRIEF_MIN_SCORE` | Passed as `--min-score`. Raise it if briefing feels noisy |
| Rule brief: log the budget each call | `ACTUAL_HOOK_DEBUG` | Writes a dim transcript line with the characters briefed so far and the session's context use. The variable also adds a note for each read that wasn't briefed |

Two switches turn briefing off. `ACTUAL_RULES_BRIEF=off` stops briefing alone and leaves the checks running. `ACTUAL_PLAN_GATE=off` turns off everything the plugin does. [Settings](https://docs.actual.ai/plugin/settings.md) lists every setting and switch.

## A brief that doesn't appear

The briefing hook fails silently by design: no rule files, no CLI, an old CLI or an ungoverned file all leave the agent unbriefed with no message. To see why, set `ACTUAL_HOOK_DEBUG=1` and run `claude --debug`. The hook then reports the rules directory, the CLI's exit status, why a reply was dropped, and how much context briefing has used. [Troubleshooting](https://docs.actual.ai/resources/troubleshooting.md) covers the other causes.


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