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

# How it works

> How the Actual CLI and the plugin turn your team's architecture decisions into checks on a coding agent's plans and changes.

Your team writes its architecture decisions down, and each decision comes with a rule file the checks read. While your coding agent works, the plugin briefs it on the rules for each file it reads, checks its plan before you approve it, and checks its changes at the end of every turn. A conflict goes back to the agent with the rule and the reason, unless you override that rule.

## The parts

| Part | What it is |
| - | - |
| Decisions | Your architecture decision records (ADRs), as files under `docs/adr/` or in [Actual AI](https://app.actual.ai). Each has policies such as "MUST: Services store relational data in Postgres." |
| Rule files | One file per decision under `.actual/rules/`, listing its rules and the paths they govern. The checks read these, never the decision documents. See [Decisions and rule files](https://docs.actual.ai/concepts/decisions-and-rule-files.md) |
| The Actual CLI | The `actual` command. It picks the rules that apply to a plan, a diff or a file, and asks a model to judge the plan or diff against them. See [Install the CLI](https://docs.actual.ai/install-cli.md) |
| The plugin | Hooks for Claude Code and Codex that run the CLI at the right moments, plus the `actual` skill, which runs and troubleshoots the CLI for your agent. See [Install the plugin](https://docs.actual.ai/install-plugin.md) |
| The runner | The model backend that judges: the Claude Code CLI by default, or the Anthropic API, the OpenAI API, the Codex CLI or the Cursor CLI. `actual runners` lists them |

The checks, `actual rules` and the rule briefs need no Actual AI account. [Sign in](https://docs.actual.ai/sign-in.md) when you want to manage your organization's decisions from the terminal or ask the Advisor.

## A turn in Claude Code

```mermaid theme={null}
flowchart TD
    A["Agent reads a file"] --> B["Brief: the rules that govern that file"]
    B --> C["Agent leaves plan mode with a plan"]
    C --> D{"Plan check"}
    D -->|conflict| E["You choose: revise or override"]
    E -->|revise| C
    E -->|override| F["Approval dialog"]
    D -->|passes| F
    F --> G["Agent changes files"]
    G --> H{"Change check at the end of the turn"}
    H -->|conflict| I["You choose: revise or override"]
    I -->|revise| G
    I -->|override| J["Turn ends"]
    H -->|passes| J
```

* **As the agent reads a file**, the plugin runs `actual rules brief` and puts the rules that govern that file in front of the agent before its first edit. A file the agent writes without reading first, usually a new one, is briefed when it writes it. Briefing is advisory and never blocks. [Rule briefs](https://docs.actual.ai/guides/rule-briefs.md) covers it.
* **When the agent leaves plan mode**, the plugin runs `actual plan-check` on the plan before you see Claude Code's approval dialog. A plan that conflicts with a rule goes back to the agent with the reason.
* **At the end of every turn**, the plugin runs `actual impl-check` on the turn's changes, committed ones included. A conflict sends the agent back to fix it, and the turn continues until the check passes.
* **When a check denies**, Claude Code asks whether the agent should revise or whether you override the rules it denied, and why. With the dialog turned off, or for an unattended agent, the agent revises on its own. You can also type `/actual-cli:override <rule-id|all> [code] [reason]` at any time. Only you can override; the agent can't record one from its shell. [Overrides](https://docs.actual.ai/guides/overrides.md) covers the choices.

In Codex the same checks run with a few differences, the main one being that a plan is checked when the Plan-mode turn ends, so you see its first draft. [Codex](https://docs.actual.ai/guides/codex.md) lists them.

## Outside the agent

The CLI doesn't run until you call it in a terminal or CI. There, you run the same checks yourself:

```bash theme={null}
actual plan-check --plan-file plan.md   # check a plan
actual impl-check                       # check the working tree against HEAD, untracked files included
git diff HEAD | actual impl-check       # check a diff from stdin
```

[Plan and change checks](https://docs.actual.ai/concepts/plan-and-change-checks.md) explains how a check picks rules and what its outcomes mean, and [Unattended agents and CI](https://docs.actual.ai/guides/unattended-agents-and-ci.md) covers running them in a pipeline.

## Staying out of the way

* In a repository with no rule files under `.actual/rules/`, the plugin does nothing.
* If the CLI is missing, outdated or crashes, you get a message, not a block. The checks fail open.
* A rule that stays unresolved stops blocking after three denied rounds in a session.
* An override clears a rule at both checks for the rest of the session.


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