/actual:actualfrom Actual.AI Plugin
Companion for the actual CLI's architecture governance. Runs plan-check, impl-check, rule queries, check-override, login/logout, ADR commands, adr-bot, and advisor. Use when checking plans against architecture rules, finding rules for a file, explaining denials, signing in, installing/upgrading the CLI, or normalizing ADRs.
Ships in Actual.AI Plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Inline knowledge and operational workflows for the actual CLI. Read this file first; load reference files only when you need deeper detail for a specific topic.
If the actual binary is not in PATH, stop before doing anything else — all commands, pre-flight checks, and diagnostics require the CLI.
First run actual --version in your shell: a hook's PATH can differ from yours, so a CLI the hooks can't find may already be installed. When it isn't, and the user asked you to install or set up Actual, this plugin or the CLI, installing the CLI is part of what they asked for: run npm install -g @actualai/actual (or brew install actual-software/actual/actual where they use Homebrew) without asking first, then verify with actual --version. The CLI is installed for the machine, not added to the repository, so a repository's package-manager rules (bun, pnpm, yarn) don't apply to it; npm and Homebrew are the installs that update themselves. If a bun install is already there, keep it: bun blocks its postinstall, which only re-signs the macOS binary, and the CLI runs without it. Claude Code's installer may report that the plugin's options are "not yet set" or open a form of them; every option works unset, so don't ask the user to configure anything. Finish by naming /actual:adr-bootstrap as the next step for the repository. Where the plugin's hooks run, they offer that skill themselves on a later prompt, in their own words; treat that as the same offer, not a second one.
Otherwise, offer to install it rather than just printing the steps: ask so your turn actually pauses for an answer — with an interactive question tool where you have one (e.g. AskUserQuestion in Claude Code), or, in Codex, by asking in your reply and ending your turn on the question — and don't continue — not even to keep exploring or planning — until the user responds. Mentioning it and continuing anyway isn't the same as asking. If they agree, run the command yourself in your shell tool; if they decline, leave it at that and resume — installation stays optional, but only once they've actually answered.
Detect with:
command -v actual
Install options (try in this order):
| Method | Command |
|---|---|
| npm/npx (quickest) | npm install -g @actualai/actual |
| Homebrew (macOS/Linux) | brew install actual-software/actual/actual |
| GitHub Release (manual) | Download from actual-software/actual-releases on GitHub |
For one-off use without installing globally:
npx @actualai/actual <command> [flags]
After installing (or after the user declines and installs it themselves), verify: actual --version
Before using a documented subcommand or flag, verify it exists in the installed
CLI with actual --help or actual <subcommand> --help. If it is missing,
help the user update the CLI; do not run development-only flags against an older
release.
| Command | Purpose | Key Flags |
|---|---|---|
actual plan-check | Check an implementation plan against the rules in .actual/rules/ | --claude-hook, --rules-dir <dir>, --max-rounds (newer builds only; verify with actual plan-check --help). Resolve plan text in the order below; never emit permissionDecision: "allow" |
actual impl-check | Check a working-tree diff against the rules in .actual/rules/ — plan-check's implementation-stage counterpart | --claude-hook, --diff-file <path>, --rules-dir <dir>, --max-rounds (newer builds only; verify with actual impl-check --help). --claude-hook always resolves the working-tree diff (tracked changes plus untracked, non-ignored files) against the commit the turn started from when a UserPromptSubmit call recorded one, otherwise against HEAD. Direct mode also accepts --diff-file or piped stdin, and diffs the working tree against HEAD when neither is given. Never emit permissionDecision: "allow" |
actual rules ls | List the rule documents under .actual/rules/, and flag any that fail to parse | [PATH] (repository root, default the current directory), --json |
actual rules select | Select the rule documents that govern a plan, or a path with no plan | [PLAN]..., --file <path> (repeatable), --repo <path>, --limit (default 10), --min-score, --by-adr |
actual rules brief | The rules governing one file, as briefing delivers them | --file <path>, --repo <path>, --rules-dir <dir>, --limit, --rules-per-decision, --max-chars, --min-score; --claude-hook is the hooks' mode |
actual rules index | Build or refresh the scope index the checks and rules select prefilter with | [PATH], --rebuild, --clear, --json |
actual check-override | A human explicitly clears a rule that plan-check or impl-check denied for a session. From inside the session the user picks an override in the dialog a denial raises, or types /actual:override <rule-id|all> [code] [reason] (a bare /override is an unknown command in Claude Code); the plugin's mod records either through --claude-hook, which refuses any process carrying CLAUDECODE, as every agent command does. The agent never invokes it. From a terminal it refuses to run non-interactively. plan-check-override still works as a backward-compatible alias | --session <id>, --rule <doc-slug>::<rule-id> (repeatable) — required unless --claude-hook; --reason "<text>" required through v0.12.0, optional in later builds (verify with actual check-override --help); --reason-code <code> (0.14.0 or later) sets the code, one of misread, not-here, adr-wrong, adr-outdated or accepted, and a --reason without it is stored as other; --repo/--rules-dir optional, defaulting to the current directory |
actual adr discover | Sort every ADR under docs/adr/ by state: synced by Actual AI, managed by the CLI, stale, or written elsewhere and not yet governing. See ADRs Written Outside Actual | --json, --no-cloud, --root <path> |
actual adr normalize | Convert ADRs written elsewhere to Actual's format and write their .actual/rules/ files, or re-index stale ones | [FILE]... or --all, --dry-run, --extracted <json>, --answers <json>, --yes, --no-model, --legacy, --rename, --push, --json |
actual login | Sign in to Actual AI (browser OAuth) | --org <id>, --api-url <url>, --no-browser |
actual whoami | Show the signed-in Actual AI identity (no network) | (none) |
actual repo / actual repo show | Show which repository in Actual AI this checkout uses, and why (its .actual/repo.json, a remote, or its first commit) | --json |
actual repo add | Add this checkout's repository to Actual AI. Signed in, login, adr create and adr refresh already do this by themselves in a checkout with decisions, so run it only when the user asks or the CLI says to | --separate (a fork gets its own repository instead of the original's), --json |
actual repo link <id | owner/name> | Point this checkout at a repository already in Actual AI by writing .actual/repo.json, which the user commits | --json |
actual logout | Sign out of Actual AI and clear local credentials | (none) |
actual adr create "<title>" | Write a new decision. Signed out: an accepted file in docs/adr/ and its rule file in .actual/rules/. Signed in: a decision in Actual AI, sent once and never retried. new is its alias | The title or --title, --context <point> and --policy "LEVEL: statement" (each repeatable), --scope <glob>, --status accepted|draft (draft signed in only), --root, --json; signed out only, --deciders; signed in only, --file <path> in place of the title and content, --repo, --allow-duplicate |
actual adr create --all | Signed in: send every decision file under docs/adr/ that Actual AI doesn't have yet, keyed on its path. It sends the user's files to Actual AI, so ask the user first and run it only after a yes. Refused signed out (exit 2) | --repo, --allow-duplicate, --root, --json |
actual adr check [FILE]... | Check decision files with Actual AI's save rules and list likely duplicates; local, and compares with Actual AI when signed in | --no-cloud, --repo <repo>, --root, --json |
actual adr list | List the decision files in docs/adr/ signed out, or the organization's decisions signed in | --state active|draft (signed in also suggested|updated|archived), --repo <repo> (signed in only), --limit (1 to 200, default 50), --offset, --json |
actual adr show <id> | Show one decision with its policies and their ids; signed out, the file whose header names the id | --json |
actual adr update <id> | Change a decision's title, context, policies, levels or scope; signed out, an accepted file and its rule file | --title, --context, --policy "[<policy id>=]LEVEL: statement", --level <policy id>=LEVEL, --scope, --clear-scope, --json |
actual adr publish <id> | Make a draft govern: signed out, set the file's status to accepted; signed in, publish the decision | --json |
actual adr unpublish <id> | Move an active decision back to draft (needs login; refused signed out, since drafts live in Actual AI) | --json |
actual adr delete <id> | Signed out, remove the file and its rule file; signed in, archive an active decision or a draft, as Delete does in the web app | --json |
actual adr restore <id> | Restore an archived decision to the list it came from (needs login) | --json |
actual adr accept <id> | Accept a suggestion (needs login) | --json |
actual adr reject <id> | Reject a suggestion, saving the reason with it (needs login) | --reason <text> (required, up to 10,000 characters), --json |
actual adr refresh | Bring the rule files in .actual/rules/ in step with the decisions, from docs/adr/ signed out or Actual AI signed in; signed in, lists the files under docs/adr/ that create --all would send; recommends the adr-bootstrap skill when no decision governs the repository, or normalize when files under docs/adr/ aren't normalized yet, and always exits 0. This plugin's hooks run it before each of theirs | --timeout-ms <ms>, --json, --root <path> |
actual status | Check the state of the files adr-bot writes | --verbose |
actual auth | Check the runner (coding-agent) auth status | (none) |
actual config show | Display current config | (none) |
actual config set <key> <value> | Set a config value | (none) |
actual config path | Print config file path | (none) |
actual runners | List available runners | (none) |
actual models | List known models by runner | (none) |
actual cache clear | Clear local analysis and tailoring caches | (none) |
actual adr-bot | On request only: analyze repo, fetch ADRs, tailor, write CLAUDE.md, AGENTS.md or Cursor rules | --dry-run [--full], --force, --no-tailor, --project PATH, --model, --runner, --verbose, --reset-rejections, --max-budget-usd, --no-tui, --output-format, --show-errors |
actual advisor "<query>" | On request only: ask the Advisor an architecture question (needs login) | Released v0.2.0: --org <uuid>, --repo <uuid>, --api-url <url>; newer builds may add named/automatic scope |
These commands manage your Actual AI platform identity (your account/org) and are separate from actual auth — actual auth only checks the local coding-agent/runner (claude/codex/cursor) that the checks' judge and adr-bot drive. plan-check, impl-check, rules and adr check run signed out, and so does adr create, which then writes into docs/adr/; advisor needs a sign-in, and signed in the adr commands act on the organization's decisions in Actual AI. (The runner/model sections below pertain to the checks' judge and adr-bot, not to these.)
Endpoint config — production works without an override.
login reads --api-url <url>, then ACTUAL_AUTH_URL, then defaults to https://app.actual.ai.client_id/scopes default to actual-cli and openid profile offline_access adr:query adr:review (override via ACTUAL_OAUTH_CLIENT_ID / ACTUAL_OAUTH_SCOPES).actual login runs a browser OAuth flow (auth-code + PKCE + a 127.0.0.1 loopback). It needs a human at a browser, so an agent cannot complete it inside a non-interactive shell. Drive it like this:
actual whoami (no network; non-zero exit / "Not signed in" when logged out). If signed in, skip login.actual login --no-browser # prints the authorize URL instead of opening a browser
actual login --org <org-id> # multi-org accounts: pre-select an org (single-org auto-selects)
With --no-browser, give the printed URL to the user to open; the CLI waits on the loopback redirect to finish the sign-in.--org picks the org on the consent page; if the redirect times out, re-run with --org <id>.Do not attempt to script the browser/consent step — treat login as a human handoff, then resume automation once whoami succeeds.
actual whoami
Prints the cached identity — Organization, Account, Member, Scopes — with no network call. Use it as the pre-flight gate before advisor and the adr commands that reach Actual AI: exit code 2 ("Not signed in to Actual AI") means run login first.
actual logout
Best-effort server-side token revoke, then always clears local credentials. Safe and non-interactive.
For the full OAuth flow, scopes and multi-org selection, see
references/platform-advisor.md.
actual adr writes and checks ADRs in the repository and manages the organization's decisions in Actual AI. Signed out, create (alias new), list, show, update, publish and delete work on the decision files in docs/adr/, and check reads them. Signed in, the same commands, unpublish, restore, accept and reject act on the organization's decisions in Actual AI. Every command takes --json and prints its result as JSON on stdout, with errors on stderr. The commands arrived in 0.14.0 with only new and check working signed out; the rest of their signed-out pathway and create --all arrived in 0.17.0, so check actual --version first. To create, change or remove one ADR with the user, use the plugin's adr-draft skill, and to propose a repository's foundation set, its adr-bootstrap skill, which creates the user's picks through adr-draft. Both ask the user before anything is written. When actual adr refresh recommends adr-bootstrap, offer it to the user, and run it only once they agree. When it recommends normalize, the files it lists are the user's ADRs in another format: offer adr-bootstrap to convert them, and run it only once they agree. Its first two steps convert them as references/adr-discovery.md describes before it asks about drafting anything, so it doesn't draft them again. When it lists files under docs/adr/ that aren't in Actual AI yet, never send them on your own: create --all runs only after the user's yes, as below.
actual adr create "Use Postgres for storage" \
--context "Each service picked its own database." \
--policy "MUST: Services store relational data in Postgres." \
--deciders "Platform team" --json
actual adr create --file docs/adr/<file>.md --json # signed in only
actual adr create --all --json # signed in only, after the user's yes
Signed out, it writes the decision doc (docs/adr/<id>-<title>.md) under a new local id, in the layout Actual AI's sync uses, and its rule file (.actual/rules/cross-cutting-<topic>-<hash>.md), so plan-check and impl-check enforce it at once. It runs Actual AI's save check first and writes nothing when the decision would be refused (exit 1), and it never replaces a file. Every decision it writes is accepted: --status draft is refused (exit 2, naming actual login), since drafts live in Actual AI. --deciders fills the Deciders line. --file, --all, --repo and --allow-duplicate need a sign-in and are refused with the reason (exit 2). --json: adr_id, status, decision_file and rule_file.
Signed in, it saves a decision to Actual AI from flags or from a file, and writes no file into docs/adr/. If the checkout's repository isn't in Actual AI yet, it adds it first, without asking, and says so with how to undo it (on stderr; under --json stdout stays the JSON). It refuses a file that doesn't parse, or flags with no --policy, before anything is sent, and refuses a likely duplicate of the repository's decisions (exit 1) unless --allow-duplicate is passed. It then sends the decision once and never retries. Actual AI runs the save check as it saves, and a refusal exits 1 with the reasons. Flags save in one request, as the web app's New Decision does, and write no local file; for an accepted save in a repository connected to GitHub, Actual AI opens a pull request that writes its rule files, and in any repository actual adr refresh writes them. A file saves as a draft, as the web app's Import does, and create then sets the scope in the file's header and, for an accepted save, publishes it; if either step fails, the decision stays a saved draft and scope_problem or publish_problem gives the command that finishes the job. With --file it renames both files to the names the sync uses for the new id, so the next sync updates them in place. With no terminal it saves a draft unless --status accepted is passed; pass that only when the user asks. --deciders is refused signed in, so a decision saved to Actual AI has no Deciders line. On exit 3 saying the decision may have been saved, look with actual adr list before running create again. --json: adr_id, status as saved, title, repo_unique_id, and with --file, files.renamed (from, to), local_status_was when the local status changed, and scope_problem or publish_problem when a step after the save failed.
Signed in, --all sends every decision file under docs/adr/ that Actual AI doesn't have yet, one at a time and keyed on its path, and nothing under docs/adr/drafts/. Those are the user's files. Never run it on your own, from the refresh's list or for any other reason: ask the user first, naming the files and saying they go to Actual AI, and run it only after a yes. A file goes when it has an ADR header and passes actual adr check, and one whose id is already one of the repository's decisions, whose status retires it (such as superseded, deprecated, rejected or deferred), or that looks like a decision already there is skipped and listed (--allow-duplicate sends a look-alike too). Each keeps the status its header names. A draft or proposed file becomes a draft, and an accepted one is accepted at once only with a person at the terminal; from an agent's shell it's saved as a draft until it's on the default branch, and the first run after that accepts it. The run stops at the first save whose outcome is unknown (exit 3) and exits 1 when a file wasn't saved. --json: files, saved, merged (drafts accepted now that their files are on the default branch), skipped, not_saved, stopped and not_sent after a stop, and other_files (markdown with no ADR header). Signed out, --all sends nothing (exit 2): the files need no sending, because adr check checks them and adr refresh writes the rule file of each normalized one.
actual adr check --json # every file under docs/adr/ with an ADR header
actual adr check docs/adr/<file>.md # only these files
Runs the save check on each file and lists likely duplicates among the repository's files and, when signed in, the repository's decisions in Actual AI (--no-cloud skips those). It exits 1 when a file fails; a likely duplicate is reported without failing. --json: files (path, adr_id, title, ok, problems, warnings), duplicates (file, then other_file or other_decision, and the matching title and policies under overlap), skipped, and cloud (compared, scope, decisions, and a note when it didn't compare).
actual adr list --state draft --json
actual adr show <id> --json
Signed out, list lists the decision files under docs/adr/ that carry an ADR header, leaving out docs/adr/drafts/, and says how many it left out for having none. show shows the file whose header names the id, and gives each policy the rule id its rule file prints (such as R-0B6F2A1E-001), which update takes.
Signed in, list covers the checkout's repository in Actual AI (actual repo show says which), or the whole organization when there is none; --repo picks one by name, owner/name or id, and --state matches a list on the web app's decisions page. --json: decisions, total, and next_offset for the next page. show prints one decision: id, kind (group for one Actual AI grouped from several policies), title, state, status, context, policies (each with the id that update takes), scope and category. show and the commands that change a decision take the id list prints; for a grouped decision, the id of any of its policies' rows works too.
actual adr update <id> --level <policy id>=SHOULD
actual adr update <id> --policy "<policy id>=MUST: Services store relational data in Postgres." --policy "MAY: Jobs read a replica."
Changes the title, context, policies, levels or scope. Signed in, it saves the whole decision as the web app's editor does. --policy gives the whole list after the change: prefix a policy's id and = to keep it, and leave one out to remove it. --level can't be combined with --policy. --context '' clears the context. A blank --title, or a policy with no statement, is refused before anything is sent (exit 1), and an archived decision can't be changed until it's restored. Editing the list can change policy ids, so take them from this command's output or adr show before the next edit. --json: update (success, adr_id) and the saved decision, or read_back_problem when the change was saved but reading it back failed.
Signed out, it writes the file back whole and rewrites its rule file at once (--json: success, adr_id, file and rule_files). It refuses (exit 3) a file that isn't accepted, pointing at actual adr publish, and a file holding text or header fields outside the layout create writes, which it would drop. Edit such a file by hand; the next actual adr refresh brings its rule file in step.
actual adr publish <id>
actual adr reject <id> --reason "Covered by the gateway client decision"
Signed out, publish sets a file's status to accepted once it passes the save check, which writes its rule file, and delete removes the file and its rule file; git restore brings back a tracked file while the deletion is uncommitted. unpublish is refused signed out (exit 2), since drafts live in Actual AI, and so are restore, accept and reject, which act on records only Actual AI keeps.
Signed in, publish makes a draft govern and unpublish moves an active decision back to draft. delete archives an active decision or a draft, as Delete does in the web app, and restore returns an archived one to the list it came from; nothing deletes permanently. accept and reject act on a suggestion, either a new decision or a suggested change to an active one, and reject needs --reason, up to 10,000 characters. Each command reads the decision's state first and sends nothing when the state doesn't allow the change (exit 3). A grouped draft can't be published yet, and a grouped decision can't be restored yet. The next actual adr refresh brings the repository's rule files in step with the change, and for a repository connected to GitHub, Actual AI's sync pull request writes the same files. --json: success and adr_id, plus reason_saved on reject.
Exit codes for every adr command: 1 a check failed (the save check, a --policy or --level value that doesn't parse, a blank update --title or policy statement, Actual AI's refusal of the content, adr check, or create's duplicate refusal), 2 signed out, a command or flag the pathway can't take (such as create --file, create --status draft or unpublish signed out), no access to the decision, no repository in Actual AI could be chosen for the checkout, or a value refused while the command line is read (such as a blank --reason), 3 Actual AI unreachable or another API error, no decision with that id, a change the decision's state doesn't allow (such as update on a file it can't write back whole), or a create whose outcome is unknown, and 5 a local file couldn't be read or written. references/error-catalog.md gives each error's message and fix. The CLI's ADR command reference has the rest.
This plugin ships hooks that check an implementation plan, and separately the diff an
agent actually produces, against the ADR rules committed in the repository. Claude
Code registers them from hooks/hooks.json automatically on install, with no manual
setup. In Codex the CLI registers the same scripts as user-level hooks, from
hooks/codex-user-hooks.json, and Codex runs them once the user has trusted them; see "Codex hooks" below for what differs
there. Every hook but session-end.sh first runs the CLI's actual adr refresh (see
"The ADR refresh step" below). The table describes Claude Code.
| Hook | Event | What it does |
|---|---|---|
hooks/preflight.sh | SessionStart (startup, resume, clear, compact, fork) | Bootstrap preflight. It hands the agent the refresh's news, any news the other hooks kept, and the refresh's problems; past that it is silent unless the repository has rules or decision files under docs/adr/. Where docs/adr/ holds decision files and .actual/rules/ holds none, it says no check reads them and, at a pause, offers what writes their rule files: installing the CLI, upgrading one without actual adr refresh, or actual adr check for files that aren't normalized and accepted. When a session starts (startup), in any repository, it first runs actual update --auto --agent claude --budget 20 and waits for it, at most 22 seconds (UPDATE_CALL_TIMEOUT; the CLI's own budget is 20): the CLI brings itself and the plugin up to date, finishes in the background when it takes longer than its budget, and prints nothing; a CLI without the subcommand exits at once. In a repository with rules, it then reads actual --version (bounded by CLI_CALL_TIMEOUT seconds) and, when the CLI is missing, cannot run, or is older than the plugin needs (see "Requirements"), shows the user what to install or run; the first prompt is then blocked with the same message. Otherwise it tells the agent governance is active. Re-runs after compact so that survives summarization. On compact and clear it runs actual rules brief --claude-session-start, so the CLI forgets what the session was briefed and starts its budget over, and the next read briefs again; the mod starts its own budget over on the same sources |
hooks/plan-gate.sh | PreToolUse on ExitPlanMode | The plan/implementation boundary. Hands the plan to actual plan-check and blocks a non-conforming plan. From CLI 0.18.0 the CLI ranks the candidate rules before it judges (see ACTUAL_GATE_RANK), so the hook's 200-second timeout covers a rank of up to 35 seconds and the judge's 150 |
hooks/plan-approval.sh | PermissionRequest on ExitPlanMode | Unattended mode only (ACTUAL_UNATTENDED=on, or the unattended row under /plugin): answers Claude Code's plan dialog with allow and the request's tool_input echoed back as updatedInput, so an agent nobody is watching is not held there. It runs after plan-gate.sh, which has already denied a conflicting plan, and approves in any repository, rules or not. Silent, which leaves the dialog in place, whenever the switch is off or ACTUAL_HOOKS=off |
hooks/turn-start.sh | UserPromptSubmit | Marks where each turn starts: runs actual impl-check --claude-hook, which on a UserPromptSubmit envelope records HEAD for the session, so the Stop check also covers work the agent commits, or commits and pushes, during the turn. The CLI's output is discarded, since this event's stdout is added to the prompt; what the hook may add there is the refresh's news, as additionalContext. Without the record, the check diffs against HEAD. In Claude Code, in a repository without rules, the first prompt of each session with no CLI on PATH tells the agent the CLI is missing: when the user asked to install or set up Actual, the CLI is part of that install, and otherwise the agent mentions it once and offers. In a repository with rules it blocks the prompt when the CLI is missing, cannot run, is older than the plugin needs, or refuses this plugin's version (exit 78), with a message saying what to install or run. From CLI 0.19.0 the same call also starts the session's task rank: on the first prompt that says what the task is, the CLI spawns a detached child that has the configured model score the rules the prompt matches (the prompt goes to it on stdin, never to disk), and records the scores for rules brief to order by. The hook adds nothing for it: it already hands the CLI the whole envelope, and ACTUAL_PROMPT_RANK=off reaches the CLI through the environment |
hooks/impl-gate.sh | Stop | The end-of-turn checkpoint (AK-754). Hands the turn's accumulated working-tree diff (tracked changes plus untracked, non-ignored files, against the commit turn-start.sh recorded when the turn began, or HEAD when none was) to actual impl-check and forces the agent to continue on a non-conforming diff. Fires unconditionally, every turn — never gated on plan-gate.sh having run earlier in the session, so a turn that skips plan mode entirely is still governed |
hooks/report-use-allow.sh | PreToolUse on Bash | Lets the agent answer the ADR question impl-gate.sh carries (see below) without a permission prompt. Allows exactly actual rules report-use followed only by its own flags, each value plain (letters, digits and ._/:=@+,-), and only when --repo is this session's repository root, --rules-dir (when given) sits inside it, neither path has a .. component, --claude-session is this session's id and the repository has rules. Any other command, including one carrying a pipe, ;, $(...), a redirect or a quote, gets no decision, so Claude Code's usual permission flow applies. Checks for that command's prefix before scanning anything, and turns away a payload larger than REPORT_USE_MAX_PAYLOAD (in the hook), so other Bash calls pay almost nothing for it |
hooks/rules-brief.sh | PostToolUse on Read, PreToolUse on Edit|Write | Read-time briefing (AK-793) and the write-time reminder (AK-794), for versions of Claude Code that cannot load a mod. Hands the envelope to actual rules brief --claude-hook and forwards only an allowlisted additionalContext reply naming the event it was called for. Advisory: never decides on a brief, silent on any failure; on PreToolUse it names no permissionDecision, so the normal permission flow is unchanged. The one exception is an edit (PreToolUse) in a repository with rules whose CLI is missing, cannot run, is too old, or refuses this plugin's version: that edit is denied with what to fix. Where the mod loads it stands down: the mod passes classic.PostToolUse (Read) on with an actual_rules_brief_by_mod marker, and for Edit and Write sets ACTUAL_SKILL_MOD_SESSION to its session id before the hook runs, which the hook inherits and stands down on when it matches its own session_id. The mod writes no files. Edit and Write cannot carry a marker: the tool's arguments are what the permission check judges, and auto mode refuses to judge a Write with a field it does not know. Either way the brief is delivered once, by the path that also has a budget and a record, and every other hook on those events still runs. It has no budget, no session cap and none of the four limits below: it forwards none of them |
hooks/session-end.sh | SessionEnd | In a repository with rules, forwards the shutdown envelope to actual __session-ended, which records the session id, coarse end reason and last completed hook check's blocking state. Silent and fail-open on every path, including missing or older CLIs. It performs no install, version probe or network wait, and so it is the one hook that runs no refresh; the companion CLI release must ship before this hook can report end events. The CLI honors telemetry opt-out. Killed sessions still rely on the inactivity fallback |
hooks/register.js | Claude mod, $.ui.log per read and a /rules-brief pane | What briefing did, for the person watching. One line per delivered brief names the ADRs and rule counts; a spent budget or a CLI error also gets a line. A read with nothing new, or of only ungoverned files, reports nothing, so the lines that matter aren't buried; /rules-brief gives each quiet read's reason, from the reason the CLI names on stderr. /rules-brief lists the session oldest first, because a suppressed row only makes sense after the delivered row it refers to. The model reads none of it, so none of it is charged against the context budget — and nothing is reported in claude -p, the SDK, the VS Code chat panel or a cloud session |
hooks/register.js | Claude mod, tool.call on Bash, Read, Edit and Write | Briefing for both the Read tool and reads that bypass it. Measured across 212 local sessions, 80% of file reads went through cat/head/sed -n/grep, which fires no Read hook. Briefs only a Bash command Claude Code reports as isReadOnly, in the call's context beside its output. Edit and Write are briefed as a reminder for a file never read (AK-794): it lands with the tool result, after the write, and a file already briefed by its read adds nothing and reports nothing. Requires Claude Code 2.1.287+, or 2.1.285/2.1.286 with CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 |
hooks/register.js | Claude mod, session.start, tool.call (a Read, Bash, Edit or Write that is briefed or reaches an ungoverned file), turn.complete (main loop), classic.SessionStart (all but startup) and ui.render on AbovePrompt | The band above the prompt, showing the line of actual session summary --session <id> --rules-dir <dir> --json as given, such as Actual AI: 3 of 12 ADRs added to context · 2 areas with no ADR or Actual AI: no ADR covers the 3 areas you worked in. Read for the rules directory briefing uses, in the background at session start, after each read or write the mod briefs, after a read or write the CLI reports ungoverned (which can add an area, and a burst of which shares one call), after each main-loop turn, and on /clear, compaction, resume and fork. The ADR count can include the decisions of the one brief the session budget withheld, which the CLI recorded before the mod held it back. Empty with no rule files, no decision in them, no CLI or one too old to write the line, or ACTUAL_CLI_SUBPROCESS=1. Drawn in the terminal and the desktop app, and the model never reads it |
PreToolUse on ExitPlanMode fires after the plan is written and before the
user's plan-approval dialog, so a blocked plan is revised by the agent rather than
shown to the human as an approvable artifact.
This ordering is observed behavior, not a documented contract. It was verified on
Claude Code 2.1.231: a hook deny on ExitPlanMode logs ExitPlanMode tool permission denied, the agent receives the reason and revises, and no approval dialog
is shown. Re-check it when moving to a materially newer Claude Code. Enforcement does
not depend on it — a deny blocks the call whenever the hook runs — but the "the human
never sees a blocked plan" property does.
Stop fires when Claude finishes responding to a turn. Per Claude Code's own hooks
reference (https://code.claude.com/docs/en/hooks), a Stop hook forces continuation
through a top-level {"decision":"block","reason":"..."} (or exit 2 with the reason
on stderr) — a different JSON shape from PreToolUse's
hookSpecificOutput.permissionDecision, and not one this plugin assumed by analogy:
it was verified against the documented Stop contract specifically, because the two
hook events are not guaranteed to behave identically. See "Stop hook: impl-gate.sh's
JSON contract" below for why that distinction matters here in particular.
Before anything else, each hook but session-end.sh runs actual adr refresh --json --root <repository root>, the step that brings .actual/rules/ in step with the
repository's decisions: signed out from the accepted, normalized files in docs/adr/,
signed in from its decisions in Actual AI, keeping the last good copy when Actual AI
is slow. So every check and brief reads current rule files, and a repository whose
docs/adr/ holds decisions but no rule files is governed from its first hook call.
rules brief, plan-check and impl-check never refresh by themselves, so a check
run from a terminal, as a review does, judges the rule files as they are.
--timeout-ms is 500 on a tool call's hook (rules-brief.sh,
report-use-allow.sh, gate-answer.sh) and 1000 elsewhere, and a watchdog stops
the call at one or two seconds, since the flag bounds only the read from Actual AI.message (rule files written, rewritten or removed, files it
can't use and why, the create --all list signed in, the adr-bootstrap
recommendation) is said once per change. preflight.sh and turn-start.sh hand it
to the agent as context; every other hook keeps it under ~/.cache/actual-skill
for the next of those two, so it reaches the agent by the next prompt at the latest.
The agent is asked to pass it on briefly and carry on, to offer the adr-bootstrap
skill once and start it only on a yes, and to leave docs/adr/ and .actual/rules/
alone unless the user asks.actual login for a sign-in Actual AI refused or an organization the person
left, and actual repo add for a repository that isn't in Actual AI yet, one an
admin removed, or one whose name another repository in the organization has on
another host. Older CLIs say "No connected repository". A slow API or a renewal
in the background mends itself and is not passed on.message starts
"Added" and says how to undo it, so it reaches the user once as news. Never ask
the user to connect the repository. When the add fails or is refused, or CI is
set, the rule files come from docs/adr/ and the problem names the fix.actual repo add, which adds it back for the whole team, only when
they say so.rules-brief.sh, report-use-allow.sh, Codex's
gate-answer.sh) refreshes at most once every ACTUAL_ADR_REFRESH_EVERY seconds
(300 by default, 0 for every call) per checkout, counted from the last refresh any
hook started there, in a stamp under ~/.cache/actual-skill written before the CLI
runs, so a slow or unreachable Actual AI is waited on once per window. Session
start, prompts, plan exit and Stop refresh every time and restart the window.ACTUAL_ADR_REFRESH=off turns the step off on its own..codex-plugin/plugin.json names hooks/codex-hooks.json, which declares no hooks, so
Codex loads none from the plugin. Without that key Codex would fall back to Claude
Code's hooks/hooks.json, whose modules key its parser rejects, with a warning on
every session.
Instead the CLI (actual update --auto --agent codex, actual plugin update) copies
each release to ~/.actualai/actual/codex-plugin/<version>/, points current at it,
and writes hooks/codex-user-hooks.json into the user's $CODEX_HOME/hooks.json, with
${ACTUAL_CODEX_PLUGIN} replaced by the path of current. The scripts resolve their
own directory with pwd -P. A version directory is never changed in place and is
kept for a day after current moves on, so a run that started on one version
finishes on it. Every
command there runs a shared script with ACTUAL_HOOK_HOST=codex, which
hooks/lib/bootstrap.sh reads to pick the CLI flag (--codex-hook), the output
shapes and the wording; unset, everything behaves as in Claude Code.
| Hook | Event | What differs from Claude Code |
|---|---|---|
preflight.sh | SessionStart (all five sources) | The same, with --agent codex for the update. On compact and clear it runs actual rules brief --codex-session-start, which resets what the session has been briefed and starts the CLI's brief budget over, as --claude-session-start and the mod do in Claude Code |
turn-start.sh | UserPromptSubmit | impl-check --codex-hook, and the same prompt block. The refresh's news goes out as the same additionalContext shape, except on a prompt the CLI's own reply answers, when it waits for the next one. Unlike Claude Code, the CLI's reply is forwarded, and it is one of two shapes. After a check stopped the last turn, it is additionalContext handing the agent the conflicts with the user's message. For a typed actual override <rule-id|all> [code] [reason] (or /override), the override is recorded and the reply is {"continue":false,"stopReason":…}, which keeps the prompt from the agent and tells the user what was overridden. The CLI records nothing when the hook's environment carries CODEX_THREAD_ID or CODEX_SESSION_ID, which the agent's own shell commands have |
rules-brief.sh | PostToolUse on Bash, PreToolUse on Edit|Write | Codex has no Read tool. On Bash the CLI briefs the files a read-only command names (cat, head, tail, sed -n, grep, rg, nl, wc and similar, after a leading cd; no output redirection, no command substitution, at most two files). Edit|Write is the alias Codex matches apply_patch by, and the CLI briefs the files the patch adds or updates, before it applies. No mod stands this down. The hook passes --max-session-chars (ACTUAL_RULES_BRIEF_MAX_SESSION_CHARS, default 48000) and the other four limits when they are plain numbers, and the CLI enforces the cap and says once when it is spent. The CLI's reply opens with a systemMessage, such as Actual AI: briefed 2 ADRs · 7 rules · src/a.ts, because Codex shows additionalContext to the model only and has no mod to write a transcript row; Codex shows the line to the user and keeps it out of the model's context. ACTUAL_RULES_BRIEF_NOTICE=off passes --no-brief-notice, which drops it |
plan-gate.sh | Stop | Codex has no ExitPlanMode. The hook runs on every Stop and actual plan-check --codex-hook reads the turn's mode and plan from the rollout at transcript_path: outside Plan mode it prints nothing. The hook passes --codex-ask (see impl-gate.sh), so a conflicting plan ends the turn with {"continue":false,"stopReason":…} and waits for the user. Without the flag it gets {"decision":"block","reason":…} and the agent revises it in the same turn. Either way the user has seen the first draft. Silent on a CLI the plugin cannot run on, which impl-gate.sh blocks on in the same Stop |
impl-gate.sh | Stop | impl-check --codex-hook, which skips a Plan-mode turn. Its reply is already Codex's Stop shape, so it is forwarded after the check below rather than re-rendered. Codex has no mod to raise the denial dialog, so the hook passes --codex-ask: a conflict ends the turn with {"continue":false,"stopReason":…}, which lists the conflicts and the two answers (reply to revise, or type actual override …). The CLI keeps the conflicts for turn-start.sh to hand to the agent with the next message. A stop outranks a block from the other Stop hooks. Under ACTUAL_UNATTENDED=on or ACTUAL_OVERRIDE_DIALOG=off the flag is left out, and a conflict is a {"decision":"block"} that sends the agent back at once. The hook also passes --codex-picker unless ACTUAL_CODEX_PICKER=off. The CLI then reads the rollout's tool list: when request_user_input works in the turn's mode (Plan always, Default with Codex's default_mode_request_user_input feature), the conflict is instead a {"decision":"block"} telling the agent to show the user a picker. gate-answer.sh reads the answer. A picker that goes unanswered over the same diff or plan ends the turn with the text stop at the next check, without judging again. It is also the Stop hook that blocks on a CLI the plugin cannot run on (plan-gate.sh stays silent then, so a turn says it once) |
gate-answer.sh | PostToolUse on request_user_input | Codex only. With the picker (below), the gates send the agent back with the exact request_user_input call to make, and this hook hands the result to impl-check --codex-hook. The CLI accepts only answers to question ids it issued (actual_choice_<nonce>, actual_reason_<nonce>), never with CODEX_THREAD_ID or CODEX_SESSION_ID set. It replies with the agent's next step as PostToolUse additionalContext: the conflicts to fix (Revise), the "why" picker to show (Override), or, after the why answer, that the rules were overridden (source session_dialog) and the turn should end. An envelope with no gate question id spawns no CLI beyond the throttled refresh |
session-summary.sh | Stop | Codex only. actual session summary --codex-hook prints the summary line as {"systemMessage":…} when it changed since it was last shown; Codex shows it to the user and never to the model. Silent when briefing is off for both reads and writes (ACTUAL_RULES_BRIEF=off, or ACTUAL_RULES_BRIEF_READS=off with ACTUAL_RULES_BRIEF_WRITES=off) or ACTUAL_HOOKS=off |
There is no SessionEnd registration, no transcript row and no /rules-brief
pane: Codex gives a hook no way to write either (the brief's systemMessage line
stands in for the row), and its session-end event is not covered yet. Settings are environment variables only, since Codex has no
per-plugin userConfig.
Codex hook contract. Codex parses hook output strictly: a key it does not know
fails the hook run, which is why Claude Code's notice shape, with its nested
hookSpecificOutput.systemMessage, is never sent there. The CLI's --codex-hook
replies are flat, so forward_codex_reply in bootstrap.sh pins each one whole —
the exact opening bytes, the exact closing "} and a single JSON string between —
and forwards only {"decision":"block","reason":"…"} (the gates without
--codex-ask, and the ADR question), impl-gate.sh's
{"decision":"block","reason":"…","systemMessage":"…"} (the ADR question on a
round that would only have shown that notice; each of the two values must be one
JSON string, split at the one place ","systemMessage":" can occur),
{"continue":false,"stopReason":"…"} (the gates with it, and
turn-start.sh for a typed override), {"systemMessage":"…"} (the gates'
notices and the summary), or turn-start.sh's
{"hookSpecificOutput":{"hookEventName":"UserPromptSubmit","additionalContext":"…"}},
or gate-answer.sh's same shape with "PostToolUse".
Each caller names the shapes it accepts. A stop or context with an empty string
is dropped. A brief keeps Claude
Code's {"hookSpecificOutput":{"hookEventName","additionalContext"}}, which Codex
accepts, optionally preceded by a top-level "systemMessage":"…". rules-brief.sh
splits that line off at the first ","hookSpecificOutput": (a JSON string cannot
contain one unescaped), requires it to be a single JSON string with no unpaired
trailing backslash, and runs the brief's own checks on what is left; under Claude
Code a reply carrying the line is dropped. A reply with a \uXXXX escape is refused with a notice, as the Claude Code
gates refuse one; a block with an empty reason blocks with a fixed reason. Exit 2
still blocks, with stderr as the reason.
Codex runs the three Stop hooks at once. Only one gate touches the session's
governance state on a given turn, because plan-check returns before reading it
outside Plan mode and impl-check returns before reading it in Plan mode. A block
starts a continuation in the same turn, on which every Stop hook runs again.
Codex trusts each user-level entry by its command, timeout, matcher and position, so a release that changes only the scripts never asks the user to review the hooks again; one that changes an entry does (see CONTRIBUTING.md).
Worth stating plainly: this raises the cost of an unreviewed change and catches oversights before they ship, but it is not a security control, and several deliberate design choices mean it fails open rather than blocking under real-world conditions:
ACTUAL_PLAN_GATE=off still turns it off.
A hook that could get stuck or wrongly block on its own dependencies being
unavailable would make the tool itself unreliable for reasons that have nothing to
do with the plan or the diff.ACTUAL_GATE_RANK=off. This is disclosed, not
silent: a deterministically-prioritized prefix of the rules is judged and
acted on normally, and every surface (the panel, --json's partial
field, the hook's deny message, and its otherwise-silent notice) says
plainly "N of M rules checked" rather than either reporting the prefix as
complete coverage or refusing to check anything at all./actual:override in the session (actual override in Codex, or
run actual check-override from a terminal) to wave a specific rule through
outright.
An override recorded against a session clears that rule for both plan-check and
impl-check checks of that session — one override, not two independent
mechanisms. Both round-limit passes and overrides are recorded
(~/.actualai/actual/plan-check-overrides.log), which makes them inspectable,
not enforced.None of this is a defect — a hook that could hang or wrongly block a tool call under infrastructure failure would be worse than one that fails open — but treat every deny this plugin produces as a strong nudge with a paper trail, not a guarantee nothing gets past it.
Past the ADR refresh step, all hooks are silent no-ops (no output, exit 0) unless the resolved rules directory has at least one *.md file, apart from plan-approval.sh once the user turns on unattended mode and preflight.sh where docs/adr/ holds decision files. By default that directory is .actual/rules/; ACTUAL_RULES_DIR can select another. The refresh is one CLI call per hook in any repository, and in one that no decision governs, its only output is one message, said once: that no decision governs yet, and that the adr-bootstrap skill can draft a first set.
The gates also never hard-fail. If the CLI crashes, times out or fails, the hook
reports the problem and makes no blocking decision, leaving the turn to proceed
normally. A CLI that is missing, cannot run, or is too old blocks instead (see
"Requirements"). Otherwise only an explicit deny from plan-check/impl-check (JSON decision or
exit 2) can block, and only when the wrapper can read it: a verdict that carries a
\uXXXX escape anywhere, or a duplicate permissionDecision key, is refused with a
notice saying the material was not checked, because the wrapper matches bytes and
never parses JSON. A conforming plan must print no permissionDecision --
either empty stdout, or a bare systemMessage notice (a partial-coverage or
round-limit disclosure, for example) with no decision attached, are both the
contract. Never emit permissionDecision: "allow": it is a
grant, and a gate has no business approving a plan on the user's behalf. On
Claude Code 2.1.231 an allow does not actually bypass the plan-approval dialog —
Claude Code logs Hook returned 'allow' for ExitPlanMode, but ask rule/safety check requires full permission pipeline and prompts the user anyway — but that safety
check is undocumented, so the wrapper drops an allow verdict rather than rely on it.
The plugin makes two approvals. The first is plan-approval.sh's, given only once the user turns on
unattended mode. It answers Claude Code's PermissionRequest for ExitPlanMode, after
the gate has run, with allow plus updatedInput set to the request's own tool_input:
the form Claude Code's hooks guide documents for this dialog, which ignores an allow
without updatedInput. Measured on 2.1.287 and 2.1.322, it approves with no dialog and
the session returns to the permission mode it had before planning.
The second is report-use-allow.sh's, and it needs no opt-in because it covers one
command the plugin itself asks the agent to run: actual rules report-use, the answer
to the ADR question, with only its own flags and plain values. It applies only in a
repository with rules, for --repo naming this session's repository root (compared
after resolving symlinks), a --rules-dir inside that root, neither with a ..
component, and --claude-session
naming this session. Outside that it makes no decision, leaving Claude Code's prompt in place.
A file in .actual/rules/ may open with a YAML header (--- on its first line)
carrying adr_id, root, paths and the like. The plugin never parses it. It counts
*.md files exactly as before, and the CLI reads the header to decide which decisions
govern a file. Files without a header are still the original format, and a repository
can hold both.
Every CLI the plugin supports (see "Requirements") reads the header. v1 repositories are not affected. The override
syntax <doc-slug>::<rule-id> is unchanged.
<repo> is the checkout the session is actually working in. Two signals decide it,
because neither is sufficient alone. CLAUDE_PROJECT_DIR is Claude Code's project
root, but it does not follow the session into a git worktree — it keeps naming
the original checkout. The git toplevel of the working directory names the active
checkout, but when Claude Code was launched inside a subdirectory of a larger
repository it names the outer repo rather than the subproject.
When one contains the other, the deeper path wins, because it is the more specific context:
| Situation | CLAUDE_PROJECT_DIR | git toplevel of cwd | Governed |
|---|---|---|---|
| Worktree | /repo | /repo/.claude/worktrees/x | the worktree |
| Monorepo subproject | /repo/packages/api | /repo | the subproject |
| Ordinary session | /repo | /repo | either, they agree |
Otherwise the two are unrelated — a worktree created outside the project root, say — and the active checkout under the working directory wins.
Measured on Claude Code 2.1.231: entering a worktree leaves CLAUDE_PROJECT_DIR
on the original checkout and moves the working directory to
<project>/.claude/worktrees/<name>, i.e. nested inside that project root. A
plain "is cwd inside CLAUDE_PROJECT_DIR" test therefore keeps the original root and
governs the wrong branch, which is why the rule is depth rather than containment.
impl-gate.sh's JSON contractimpl-gate.sh cannot forward actual impl-check --claude-hook's stdout the way
plan-gate.sh forwards plan-check's: impl-check --claude-hook reuses
plan-check's own JSON renderer in the CLI, so its output is always
PreToolUse-shaped (hookSpecificOutput.hookEventName: "PreToolUse",
permissionDecision), regardless of which Claude Code event is actually asking.
Stop's own decision control is a top-level decision/reason pair —
{"decision":"block","reason":"..."} — with no hookSpecificOutput involved at
all. Forwarded verbatim, the CLI's verdict would carry no decision field Claude
Code recognizes for Stop, and the turn would end silently ungoverned — exactly
the failure this hook exists to prevent.
So impl-gate.sh classifies the CLI's verdict — the same byte-matching allowlist
plan-gate.sh applies (is_deny_decision, has_system_message,
has_permission_decision, and the \uXXXX-escape / duplicate-key guards; see
hooks/lib/bootstrap.sh) — and re-renders it in Stop's own shape instead of
forwarding it:
{"decision":"block","reason":"<extracted permissionDecisionReason>"}. The reason text is pulled out of the CLI's JSON with
a quote-aware byte scan (extract_json_string_field), never a JSON parse — same
dependency-hygiene constraint as everything else in bootstrap.sh — and is only
trusted once the escape/duplicate-key guards have already passed, since those are
exactly what make quote-termination unambiguous. Whitespace between the field
name, the colon, and the opening quote is skipped, so a pretty-printed verdict
still yields its reason. A recognized deny whose reason cannot be read still
blocks, with a fixed reason; it does not degrade to a notice.systemMessage becomes
{"decision":"block","reason":"...","systemMessage":"..."}, so the user still sees
the notice. This is the CLI's ADR question on a round that would otherwise have
shown only a notice. The question ("Which of these ADRs did you use this turn?")
always arrives as a deny: after the judge's reason on a block, where it asks for the
answer after the fix, or as the whole reason on a pass, which makes the agent
continue once to answer with actual rules report-use.{"systemMessage":"..."}. This is
deliberately not hookSpecificOutput.additionalContext: per Claude Code's docs,
additionalContext on Stop "keeps the conversation going through the same loop
protections as decision: block" — i.e. it also forces continuation — so it is
unsafe for a fail-open notice that must let the turn end normally.
systemMessage is Stop's only channel that does not force continuation.allow) produces no decision at all, same as
plan-gate.sh.Stop's exit-2 contract ("blocks, stderr is the reason Claude sees") is identical
to PreToolUse's, so impl-gate.sh just propagates the CLI's stderr and exit
code unchanged.This was verified against Claude Code's documented Stop hook contract
(https://code.claude.com/docs/en/hooks) specifically — not assumed from the
PreToolUse/ExitPlanMode precedent above. The two hook events are not
guaranteed to behave identically, and here, concretely, they don't: the CLI's
renderer has no notion of which event asked, so the shell wrapper is the only
place that distinction is applied.
| Variable | Effect |
|---|---|
ACTUAL_HOOKS=off (or its old name, ACTUAL_PLAN_GATE=off) | Disable all of this plugin's governance hooks (plan-gate.sh, plan-approval.sh, impl-gate.sh, report-use-allow.sh, turn-start.sh, rules-brief.sh, session-end.sh, session-summary.sh and preflight.sh), including the version blocks and the session-start update, and with them the ADR refresh step. The allHooks row under /plugin does the same; ACTUAL_HOOKS=on forces them on over the row. The mod's session-summary band is hidden too |
ACTUAL_PLAN_CHECK=off | Disable plan-gate.sh alone, and the plan check with it; impl-gate.sh and briefing keep running. Same as the planCheck row; =on forces it on over the row |
ACTUAL_IMPL_CHECK=off | Disable impl-gate.sh alone, the check of each turn's diff; plan-gate.sh and briefing keep running. Same as the implCheck row; =on forces it on over the row |
ACTUAL_RULES_BRIEF_READS=off | Disable briefing on reads alone: rules-brief.sh on PostToolUse and the mod's Read and shell-read briefs. Writes are still briefed. Same as the briefReads row; =on forces it on over the row |
ACTUAL_RULES_BRIEF_WRITES=off | Disable briefing on writes alone: rules-brief.sh on PreToolUse (Edit, Write, Codex's apply_patch) and the mod's Edit and Write briefs. Reads are still briefed. Same as the briefWrites row; =on forces it on over the row |
ACTUAL_RULES_DIR | Govern against a different rules directory (e.g. a subproject in a monorepo). The governance checks and briefing forward the resolved path to the CLI as --rules-dir; session-end.sh uses it only to check applicability. plan-check/impl-check must honor that flag rather than rediscovering rules from cwd. The ADR refresh step runs only for a directory named .actual/rules, with the folder holding it as its root, and a relative path counts from the hook's working directory |
ACTUAL_PLAN_CHECK_MAX_ROUNDS | Override plan-check --claude-hook's round limit (default 3). Independent of the variable below — the two commands' revision loops are budgeted separately, even though they share session state |
ACTUAL_TURN_START_LOG | Path of a file turn-start.sh appends the CLI's output, stderr and exit status to, for diagnosing a turn-start record that is never written. Unset by default, which keeps the hook fully silent; set, the hook is still silent on stdout and stderr |
ACTUAL_IMPL_CHECK_MAX_ROUNDS | Override impl-check --claude-hook's round limit (default 3) |
ACTUAL_GATE_RANK=off | Make plan-gate.sh and impl-gate.sh pass --no-rank, so the CLI selects the rules to judge with its first pass alone. By default a CLI that ranks in a hook scores the candidate rules with the configured runner before its judge, whenever its first pass finds more than it judges, within 35 seconds; this saves that call's time and model quota at the cost of selecting less precisely |
ACTUAL_PROMPT_RANK=off | Skip the task rank (CLI 0.19.0 or later). By default the CLI scores the rules a session's first substantive prompt matches with the configured runner, in a background process the prompt doesn't wait for, and rules brief then names the rules the task is about first when a file is governed by more decisions than a brief carries. The gates' own scores from plan-check and impl-check are kept for the brief too, whatever this says, because those ranks run anyway. Nothing reads this variable but the CLI, so no hook passes a flag for it. Saves one model call per session at the cost of ordering briefs by the file's path alone |
ACTUAL_OVERRIDE_DIALOG=off | Stop the mod asking the user how to handle a plan-check or impl-check denial: the agent reads the denial as the CLI wrote it and revises on its own. A typed /actual:override still works. In Codex, it stops the gates passing --codex-ask, so a conflict sends the agent back instead of ending the turn; a typed actual override still works. On by default; =on forces it on over the overrideDialog row, except in unattended mode, which always turns it off |
ACTUAL_CODEX_PICKER=off | Codex only: keep the gates from passing --codex-picker, so a conflict always ends the turn with the typed choices, even where the agent could show a picker |
ACTUAL_UNATTENDED=on | Unattended mode, for an agent nobody is watching: plan-approval.sh approves every plan that reaches Claude Code's plan dialog, which is a plan plan-gate.sh passed or could not check, in any repository; the mod's denial dialog is off whatever ACTUAL_OVERRIDE_DIALOG says. In Codex it leaves out --codex-ask the same way, so a conflict sends the agent back rather than waiting for someone. Off by default; =off forces it off over the unattended row. Never set it where a person reviews plans |
ACTUAL_ADR_REFRESH=off | Turn off the ADR refresh step alone: no hook runs actual adr refresh, so the checks and briefing read .actual/rules/ as it stands, as a run of the checks from a terminal does. On by default |
ACTUAL_ADR_REFRESH_EVERY=<seconds> | How far apart a tool call's hook (Read, Edit, Write, Bash) refreshes per checkout. Session start, prompts, plan exit and Stop refresh every time. Default 300; 0 refreshes on every call |
ACTUAL_RULES_BRIEF=off | Disable briefing alone — both the Read hook and the mod, and in Codex the briefing hook and the summary line — while plan-gate.sh and impl-gate.sh keep running. Briefing is the only path that fires on every read, so it is the only one whose cost is worth dropping on its own |
ACTUAL_CLI_SUBPROCESS=1 | Set by actual-cli on the nested claude -p it runs as its conformance judge. Every hook and the mod exit silently when it is set: without it the judge's own Stop hook reruns impl-check and recurses, and briefing would inject rules into the judge's prompt that it was never asked to weigh |
ACTUAL_HOOK_DEBUG=1 | Report the ADR refresh step's outcome each time rules-brief.sh runs (actual-rules-brief: refresh state=… exit=… root=…), and what briefing did, on stderr for the hook and in the transcript plus the model's context for the mod, which also adds a note when it does not brief: the resolved rules directory, the CLI's exit status and stderr, the reason a reply was dropped, and the characters injected so far against the session cap. Diagnostic only — it never changes a forwarding decision |
ACTUAL_RULES_BRIEF_MAX_SESSION_CHARS | Characters of rule context briefing may inject in one session before it stops and says so (default 48000). Measured basis: 40 governed files against a 425-rule repository injected 18,751 characters with dedup active, so the default is ~2.5x an ordinary session. 0 disables briefing where the mod loads; rules-brief.sh enforces no cap under Claude Code, and under Codex passes it to the CLI as --max-session-chars, which enforces it |
ACTUAL_RULES_BRIEF_LIMIT, _RULES_PER_DECISION, _MAX_CHARS, _MIN_SCORE | Forwarded by the mod to actual rules brief as --limit, --rules-per-decision, --max-chars, --min-score, and only when set (rules-brief.sh forwards them only under Codex, and only when each is a plain number), so the CLI keeps owning its own defaults. _MIN_SCORE especially: unset it defers to the repository's rules_min_score, and a score measures how narrowly a rule's verify glob is written rather than how relevant the rule is, so no cross-repository default is correct |
The briefing limits (ACTUAL_RULES_BRIEF_MAX_SESSION_CHARS, _LIMIT,
_RULES_PER_DECISION, _MAX_CHARS, _MIN_SCORE), ACTUAL_OVERRIDE_DIALOG
(as overrideDialog), ACTUAL_UNATTENDED (as unattended) and debug also
appear as labelled userConfig rows under /plugin; the other variables have
none. The mod reads all of the rows, and plan-approval.sh also reads
unattended, from the CLAUDE_PLUGIN_OPTION_UNATTENDED that Claude Code
exports to every hook once the row has a value. An environment variable wins over its
row: the row is the durable preference, the variable is the override for one
session. The exception is debug, which is ORed with ACTUAL_HOOK_DEBUG
rather than overridden by it.
--claude-hook plan resolutionThe wrapper does not parse the hook envelope. actual plan-check --claude-hook
must resolve plan text itself, in this order, and stop at the first hit:
tool_input.plan — non-empty string. Current Claude Code injects the plan
into the envelope before hooks run, even when the model's literal input was
empty. Older builds also put the plan here.tool_input.planFilePath — set and readable. Same injection; no transcript
I/O.prompt_id +
transcript_path → the plan_mode attachment → planFilePath. Do not scrape
the transcript when (1) or (2) already produced the plan.permissionDecision).The hook always invokes actual plan-check --claude-hook --rules-dir <dir>,
where <dir> is ACTUAL_RULES_DIR if set, otherwise <repo>/.actual/rules.
plan-check must score that directory and must not ignore the flag in favor of
cwd. --help should list --rules-dir.
Stdout must be exactly one JSON object, or empty. Logs go to stderr. A line
before the JSON makes the wrapper drop a deny; {...} that is not valid hook
JSON is forwarded and Claude Code reports a hook error.
Fixtures under hooks/tests/fixtures/ encode the three envelopes:
| Fixture | Shape |
|---|---|
pretooluse-plan-injected.json | Current: tool_input.plan and tool_input.planFilePath |
pretooluse-plan-inline.json | Legacy: plan in tool_input.plan only |
pretooluse-plan-file.json | Legacy: empty tool_input; plan only via transcript |
Briefing is delivered by hooks/rules-brief.sh on Read and Edit|Write where
no mod loads, and by the mod on Bash, Read, Edit and Write where one
does, with the hook standing down for the events the mod owns. Both call actual rules brief --claude-hook rather than the simpler
--file direct mode, because only --claude-hook consults brief memory —
direct mode is stateless and returns the full brief every time. That is what
keeps a file read with the Read tool and then cat from being briefed twice.
The CLI names why it stayed quiet on stderr, as no-brief=<token>, with
tokens ungoverned, already-briefed, outside-root, no-rules and
nothing-to-show. That is the second interface between the two repositories,
and it exists because hook-mode stdout cannot explain itself: stdout carries
the brief the model reads, so any explanation printed there would be read as
governance. stderr reaches neither the model nor the user — the shell hook
keeps it for --debug, and the mod parses it.
Without it the two silences are indistinguishable, and the mod spent several
versions asserting whichever one it had guessed: package.json, pnpm-lock.yaml governed, already briefed this session, for a lockfile nothing
governs. A mod reading a CLI too old to send a token lists the read in the
pane as no new and writes no transcript line.
Brief memory is keyed on (session_id, agent_id, rules_dir), which makes
that key an interface between the two paths rather than an implementation
detail. Any component the two compute differently splits the key, and the
symptom is always the same: one read briefs twice, silently, and in a monorepo
the second brief is against the wrong rule set.
Two instances of that have already been fixed, both invisible at runtime:
The mod did not forward --rules-dir at all. On a fixture whose root and
subproject rule sets both match one file, the hook briefed the subproject's
rule and the mod, same session, briefed the root's.
The mod derived the rules directory from $.session.root(). No single mods
API call matches resolve_repo_root: $.session.root() tracks the session's
working directory, so it is right inside a worktree and wrong one directory
below the repo root; $.session.repo().root is the main checkout, so it is
wrong in exactly the opposite cases. A mod also cannot read
CLAUDE_PROJECT_DIR, which Claude Code sets for hook processes only. The mod
now runs git rev-parse --show-toplevel and applies the same deeper-of-the-two
rule as bootstrap.sh, with the first $.session.root() it resolves, the
directory the session was launched in, standing in for the variable. Claude
Code keeps CLAUDE_PROJECT_DIR there through /cd, a worktree move and
/clear, so a moved root decides only the cache key and where git runs. The
answer is cached per session and $.session.root(), so a /cd or a worktree
move resolves it again and a shell cd does not.
The mod did not forward agent_id, the third component of the key. The Read
hook's envelope carries it inside a subagent and the mod's event carries the
same value as e.agentId, so the mod filed a subagent's reads under the
parent's slot. This one causes missed briefs rather than duplicates: the
subagent is denied a brief the parent already saw — which is precisely what
keying on agent_id exists to prevent — and the parent's record is polluted
with reads it never made.
A fourth divergence is not about the key but about the same question — which
directory a relative path belongs to. The Bash tool runs every command in one
persistent shell, so a cd in any call changes where every later call runs, and
on Claude Code 2.1.296 $.session.cwd() follows it. Session 9dc24b52 did cd <repo>/apps/actual && ls lib/oauth/ and then
read lib/oauth/verify-token.ts twice; resolved against the session cwd those
became <repo>/lib/oauth/..., which does not exist, so the existence filter
dropped them and two briefs were lost. The mod keeps no copy of the shell's
directory: it reads $.session.cwd() before the call and joins a stated cd
onto that, since by the time the call returns the cwd already includes the cd.
Where no cd states a base it tries the live cwd, the session cwd and the repo
root in that order, letting the filesystem decide.
A cd the command does state is authoritative and gets no fallback, or
cd /elsewhere && cat a.ts would brief a same-named file inside the repository.
So when changing either path, change both. Check all four repository layouts —
a worktree with and without CLAUDE_PROJECT_DIR, a monorepo subproject named
by CLAUDE_PROJECT_DIR, and a session launched in a subdirectory — and the
/cd moves hooks/register.test.ts lists, since a /cd leaves
CLAUDE_PROJECT_DIR where the session started. Check both inside and outside a
subagent.
--claude-hook diff resolutionUnlike plan text, there is no envelope field carrying the material to check — no
tool call injects a diff the way ExitPlanMode injects a plan. actual impl-check --claude-hook always resolves the diff from the working tree in the resolved
repository root: tracked changes plus untracked files that are not gitignored,
against the commit the turn started from. hooks/turn-start.sh records that commit
on UserPromptSubmit, so work the agent committed, or committed and pushed, during
the turn is still checked at Stop. When no commit was recorded, or it is no longer
an ancestor of HEAD (an amend, rebase or branch switch during the turn), the diff
is against HEAD. A file the agent has written but not git added is part of that diff.
Gitignored files stay out. The hook envelope
(hooks/tests/fixtures/stop-turn.json is the recorded shape) is forwarded unparsed
purely to key the revision-loop session off session_id, the same way
plan-check's envelope is. An empty diff (nothing changed since that commit and there
are no untracked, non-ignored files) is not an error — it is the ordinary "nothing
changed this turn" case — and degrades to a non-blocking notice, never a deny.
The hook always invokes actual impl-check --claude-hook --rules-dir <dir>, same
<dir> resolution as plan-check's.
The hooks need the actual CLI at the version MIN_CLI_VERSION names in
hooks/lib/bootstrap.sh (0.20.0, the first whose adr refresh adds a signed-in checkout with decisions to Actual AI by itself), or newer.
The installed version comes
from actual --version, cached per binary under ~/.cache/actual-skill and read
again at every SessionStart and every prompt, so an upgrade is seen on the next
turn. A --version that names no version, or is still running after
CLI_CALL_TIMEOUT seconds, blocks nothing.
In a repository with rules, when the CLI cannot govern, every hook a session reaches blocks in its own event's way, with one message:
| Event | Hook | What happens |
|---|---|---|
SessionStart | preflight.sh | The user sees the message |
UserPromptSubmit | turn-start.sh | The prompt is blocked |
PreToolUse on ExitPlanMode | plan-gate.sh | The plan is denied |
PreToolUse on Edit|Write (Codex: apply_patch) | rules-brief.sh | The edit is denied |
Stop | impl-gate.sh | The turn continues once so the agent tells the user; when the Stop already follows one a hook forced (stop_hook_active), only the user is told, so it cannot loop |
Reads, the session line and SessionEnd stay silent. The messages:
Actual can't find the actual CLI on this session's PATH. Install it with "brew install actual-software/actual/actual" or "npm install -g @actualai/actual", or add the folder that holds it to the PATH your agent starts with.PATH but actual --version fails: The actual CLI is installed but does not run. <reinstall advice>, then try again. The advice (reinstall_advice) names the command for how it was installed (cli_install_method: Homebrew, npm, bun or pnpm), or Homebrew's and npm's when that can't be told.This Actual plugin needs actual <min> or newer (you have <installed>). <upgrade advice>, then try again. The advice (upgrade_advice) names one command the same way: brew update && brew upgrade actual-software/actual/actual, npm install -g @actualai/actual@latest, bun add -g @actualai/actual@latest or pnpm add -g '@actualai/actual@>=<min>', or Homebrew's and npm's when it can't tell.cli_upgrade_in_progress: the CLI holds the flock on <config dir>/self-update.lock while npm or Homebrew runs, which may remove the binary for a moment): after one more look a second later, The actual CLI is updating right now. Try again in a minute.To work here without Actual for now, start your agent with ACTUAL_HOOKS=off. (OFF_SWITCH_ADVICE).ACTUAL_PLUGIN_VERSION, read from the host's manifest (.claude-plugin/plugin.json,
or .codex-plugin/plugin.json under Codex), and a CLI that no longer supports itself
or this plugin exits 78 with a one-line message on stderr, which the hooks show as it
is, such as Your Actual plugin 1.0.0 is too old for actual 0.19.0. Run "actual plugin update", then restart Claude Code.
Any other exit status (3 for an API error, say) keeps the gates' fail-open notice.A denied plan is not a dead end: the agent revises and calls ExitPlanMode
again, which fires the hook again. Likewise, a denied diff is not a dead end at
Stop: the agent is forced to continue, fixes it, and the next Stop re-evaluates
the new accumulated diff. Both commands track this per (session_id, rules_dir) —
not session_id alone, since one Claude Code conversation can govern more than one
repository or monorepo subproject (ACTUAL_RULES_DIR), and those commonly share
synced rule slugs from the same ADR bank. plan-check and impl-check sessions for
the same (session_id, rules_dir) share this same state — a rule an override clears
is cleared for both, and a session impl-check sees for the first time (no prior
plan-check call ever touched it) simply starts fresh, the same as any other new
session. State lives under the user's config directory, never inside the governed
repo.
A requires_decision verdict blocks exactly like a real conflict. A
plan the judge classifies as deliberately superseding a rule is not
automatically believed — that classification is model output, not a
recorded human decision — so it is denied the same way an outright
violation is, not just noted and allowed to proceed.
Cleared rules stay cleared — for the plan text that earned it. Once a rule is judged conforming against a specific plan, it is never sent to the judge again for that same plan text in this session — a later round cannot re-flag it, even if the judge would otherwise be non-deterministic about it. Edit the plan at all and the rule is judged fresh; a clearance is never a standing pass regardless of what the plan says later.
An explicit, recorded override. A human — never the agent — clears a rule.
When a gate denies, the plugin's mod (hooks/override-dialog.js, wired in
hooks/register.js) asks the user in Claude Code's own select dialog:
Fix it (first, and recommended), or Keep my changes / Keep my
plan, which records an exception for all the blocking rules (single rules
are overridden by typing the command). After an
override, a second question asks why, and the choice becomes the override's
code: the check misread the change (misread), the ADR doesn't apply here
(not-here), the ADR is wrong (adr-wrong), or it is out of date
(adr-outdated). The user types accepted under "Type something." when the block is
right and they are going ahead anyway; anything else typed there is kept as
the reason, which actual 0.14.0 or later stores with the code other and
may send to Actual with anything that looks like a secret removed, so the
user shouldn't type one there. Dismissing either question overrides
nothing. The answers go to the mod, not to the agent.
What reaches the agent says what the user chose:
/actual:override means the dialog was dismissed
or could not be shown: relay the denial, revise if you can, and tell the
user they can type the command.The user can also type /actual:override <rule-id|all> [code] [reason]
as a message at any time. The code is one of the five above, and both it and
the reason are optional; a reason that starts with no code is stored as
other. Always give the user that full
name: Claude Code registers plugin commands only under their namespaced
name, so a bare /override is rejected as an unknown command. The mod
records it from the prompt, which Claude Code stamps as typed, and adds a
context line naming what was overridden, or why nothing was. Both paths go
through actual check-override --claude-hook, which refuses any process
carrying CLAUDECODE — every agent shell command and every settings hook —
so only the mod's own spawn records. If the user asks to override a rule,
tell them to pick it in the dialog or type /actual:override themselves;
never type it or run actual check-override on their behalf, and do not
suggest an override as a way past a denial you could fix by revising. The
same override can still be
issued from an ordinary terminal with actual check-override --session <id> --rule <doc-slug>::<rule-id> --reason-code <code> --reason "<why>"
(--reason-code needs actual 0.14.0 or later, and a --reason without it is
stored as other; --reason is required through v0.12.0; it refuses to run non-interactively; plan-check-override is a backward-compatible alias;
pass --repo/--rules-dir if you are not in the repo the denial came from).
An overridden rule is excluded from judging from then on regardless of plan
or diff text — by both commands, since they share session state. An
override from the dialog or a typed command is announced when it is made;
one from a terminal is announced once, at the session's next check, and the
session summary counts every exception — an override is visible, never a
silent bypass. Each override is recorded with source
(session_dialog, session_prompt or terminal) and gate (plan,
impl, or both).
A round limit, tracked per rule. After --max-rounds (default 3, or
ACTUAL_PLAN_CHECK_MAX_ROUNDS / ACTUAL_IMPL_CHECK_MAX_ROUNDS respectively —
each command's revision loop is budgeted independently) denials of the same
rule, the gate stops blocking on that rule specifically, rather than denying
indefinitely. A rule that has exhausted its own count never exempts a different,
still-fresh conflict in the same round — the whole call stays denied until
every currently-blocking rule has individually hit its limit. This pass is
not silent either: the hook emits a loud notice, and both an override and a
round-limit pass are appended to ~/.actualai/actual/plan-check-overrides.log
(kept under its original filename for history continuity; JSONL, one line per
event) for a durable, inspectable trace.
For impl-gate.sh specifically, a round-limit pass or override clearance is a bare
notice — see "Stop hook: impl-gate.sh's JSON contract" above: it renders as a
plain systemMessage, never hookSpecificOutput.additionalContext, since the
latter would force continuation for a condition this is deliberately choosing not
to block on.
bash hooks/tests/run.sh
Runs the full decision matrix (no-op, missing binary, old CLI, pass, deny, crash)
against recorded hook payloads and a fake CLI, for plan-gate.sh, plan-approval.sh
and impl-gate.sh, under Claude Code and, from hooks/tests/codex.sh, under Codex with
the envelopes captured from Codex CLI 0.167.0. No network and no real actual
install required.
Use this to determine which runner a user needs:
Has claude binary installed?
YES -> claude-cli (default runner, no API key needed)
NO -> Do they want Anthropic models?
YES -> anthropic-api (needs ANTHROPIC_API_KEY)
NO -> Do they want OpenAI models?
YES -> codex-cli or openai-api (needs OPENAI_API_KEY)
NO -> cursor-cli (needs agent binary, optional CURSOR_API_KEY)
| Runner | Binary | Auth | Default Model |
|---|---|---|---|
| claude-cli | claude | claude auth login | claude-sonnet-4-6 |
| anthropic-api | (none) | ANTHROPIC_API_KEY | claude-sonnet-4-6 |
| openai-api | (none) | OPENAI_API_KEY | gpt-5.2 |
| codex-cli | codex | OPENAI_API_KEY or codex login (ChatGPT OAuth) | gpt-5.2 |
| cursor-cli | agent | Optional CURSOR_API_KEY | (cursor default) |
The CLI auto-selects a runner from the model name:
| Model Pattern | Inferred Runner |
|---|---|
sonnet, opus, haiku (short aliases) | claude-cli |
claude-* (full names) | anthropic-api |
gpt-*, o1*, o3*, o4*, chatgpt-* | codex-cli |
codex-*, gpt-*-codex* | codex-cli |
| Unrecognized | Error with suggestions |
For deep runner details (install steps, compatibility, special behaviors), see
references/runner-guide.md.
The checks read only .actual/rules/, so an ADR a person or an agent writes into docs/adr/ governs nothing until it has a rule file there. When the user asks to import, adopt, normalize or index existing ADRs, or asks why one isn't enforced, run actual adr discover --json and follow references/adr-discovery.md. In short:
actual adr normalize --all --dry-run --json. Get the user's go-ahead before writing without --dry-run: it rewrites docs in place.--extracted, with --no-model) instead of letting the CLI start a model, keep the JSON files outside the repository, and flag your extracted policies for the user to review. adr-bootstrap's step 1 is the one exception: on the user's yes it lets the CLI's model write those policies, and its step 2 extracts only the docs no model read.needs-input) and pass the answers with --answers. Never answer for them, and use --yes only when they ask for an unattended run: it writes undecided decisions as drafts.Never normalize a synced or synced-edited decision, since Actual AI's sync owns it. Convert legacy (adr-bot) ADRs only on request. Ask before --push, which saves the decisions to the user's Actual AI organization. All of this works without an Actual AI account.
Run actual adr-bot only when the user asks for it, or for ADR guidance written into CLAUDE.md, AGENTS.md or Cursor rules, and actual advisor only when the user asks for the Advisor. Neither is part of governance. Their full reference is at docs.actual.ai: https://docs.actual.ai/guides/context-files-with-adr-bot and https://docs.actual.ai/guides/ask-the-advisor, with each command's flags at https://docs.actual.ai/cli/adr-bot and https://docs.actual.ai/cli/advisor. The adr-bot workflow follows in Non-Interactive Environments, Sync Quick Reference and Operational Workflow: Running Sync, with its files in Output Formats.
Endpoint config — advisor reads --api-url <url>, then ACTUAL_API_URL, then defaults to https://api-service.api.prod.actual.ai.
actual advisor "<question>" asks an architecture question. It is agent-friendly (no TTY required): it starts an async job, polls to completion, and prints a plain-text summary followed by the related ADRs. Progress ("advisor thinking…") goes to stderr; the answer goes to stdout.
actual advisor "How should I handle database access in a new service?"
# point at a local/staging endpoint — one export steers it; --api-url overrides
ACTUAL_API_URL=https://your-advisor-endpoint actual advisor "…"
# released v0.2.0: scope by connected-repository UUID
actual advisor "…" --repo <repo-uuid>
# newer builds only; verify these flags with `actual advisor --help`
actual advisor "…" --repo actual-software/actual-cli
actual advisor --show-scope
actual advisor --repo none
actual advisor --repo auto
Requires a valid signed-in session — NotLoggedIn (exit 2) means run login first. The advisor transparently refreshes an expired token before the call. Output is human-readable text today (no --json flag yet).
Scope behavior is version-dependent:
--repo
uses organization scope.owner/name, remember a per-working-tree
scope, auto-detect from origin, and expose --show-scope, --repo none,
and --repo auto.Always inspect actual advisor --help before using the newer scope workflow.
For the full OAuth flow, scopes, multi-org selection, the advisor poll model, and org/repo scoping, see
references/platform-advisor.md.
This skill runs inside coding agents (Claude Code, Codex, Cursor) where the Bash tool does not provide a TTY. The CLI's TUI prompts and confirmation dialogs will fail with TerminalIOError unless disabled.
Always pass --force --no-tui on every actual adr-bot invocation:
--no-tui disables TUI rendering that requires a terminal--force skips interactive confirmation prompts that cannot receive inputUse the agent's built-in question/confirmation tools (e.g., AskUserQuestion) for user confirmation instead of relying on CLI prompts.
The most common sync patterns:
# Preview what sync would do (safe, no file changes)
actual adr-bot --dry-run --force --no-tui
# Preview with full content
actual adr-bot --dry-run --full --force --no-tui
# Run sync
actual adr-bot --force --no-tui
# Sync specific subdirectories only (monorepo)
actual adr-bot --force --no-tui --project services/api --project services/web
# Use a specific runner/model
actual adr-bot --force --no-tui --runner anthropic-api --model claude-sonnet-4-6
# Skip AI tailoring (use raw ADRs)
actual adr-bot --force --no-tui --no-tailor
# Re-offer previously rejected ADRs
actual adr-bot --force --no-tui --reset-rejections
# Set spending cap
actual adr-bot --force --no-tui --max-budget-usd 5.00
For the complete 13-step sync internals, see
references/sync-workflow.md.
Follow this pattern whenever running sync. Do NOT skip pre-flight.
command -v actual # Must succeed before anything else
If missing, follow the install steps in CLI Not Installed above. Do NOT proceed until actual --version succeeds.
actual runners # Verify runner is available
actual auth # Verify authentication (for claude-cli)
actual config show # Review current configuration
If any check shows a problem, diagnose and fix before proceeding.
actual adr-bot --dry-run --force --no-tui [--full] [user's flags]
Show the user what would change. Let them review.
Ask user if they want to proceed using the agent's built-in tools (e.g., AskUserQuestion). Do NOT rely on CLI prompts — they will fail in non-interactive shells. If no, stop.
actual adr-bot --force --no-tui [user's flags]
Match the error against the troubleshooting table below. For full error details, load references/error-catalog.md.
Apply the fix, then return to step 1 to verify.
For comprehensive environment checks, run the bundled diagnostic script:
Run the bundled scripts/diagnose.sh by its absolute path under the active
actual skill directory. Do not assume a Claude-specific install location.
For example, when the current directory is the skill directory:
bash scripts/diagnose.sh
This checks all binaries, auth status, environment variables, config, and output files in one pass. It is read-only and never modifies anything.
Use inline commands instead when checking a single thing (e.g., just actual auth).
| Error | Exit Code | Likely Cause | Quick Fix |
|---|---|---|---|
| ClaudeNotFound | 2 | claude binary not in PATH | Install Claude Code CLI |
| ClaudeNotAuthenticated | 2 | Not logged in | Run claude auth login |
| CodexNotFound | 2 | codex binary not in PATH | Install Codex CLI |
| CodexNotAuthenticated | 2 | No auth for codex | Set OPENAI_API_KEY or run codex login |
| CursorNotFound | 2 | agent binary not in PATH | Install Cursor CLI |
| ApiKeyMissing | 2 | Required env var not set | Set ANTHROPIC_API_KEY or OPENAI_API_KEY |
| NotLoggedIn | 2 | Not signed in to the Actual AI platform | Run actual login |
| CodexCliModelRequiresApiKey | 2 | ChatGPT OAuth with explicit model | Set OPENAI_API_KEY (OAuth only supports default model) |
| AdrAccessDenied | 2 | Actual AI refused an adr request (HTTP 403) | Run actual login again, or get a role that can change decisions |
| AdrRepoRequired | 2 | No repository in Actual AI could be chosen for the checkout | actual repo show says why; actual repo link <id | owner/name> or --repo owner/name picks one |
| AdrPathway | 2 | An adr command or flag the signed-out or signed-in pathway can't take | Leave it out, or sign in with actual login |
| CreditBalanceTooLow | 3 | Insufficient API credits | Add credits to account |
| ApiError | 3 | API request failed | Check API URL, network, credentials |
| ApiResponseError | 3 | Unexpected API response | Check API status, retry |
| AdrCreateUnconfirmed | 3 | A create got no answer, so it may have saved | Look with actual adr list before running create again |
| AdrNotFound | 3 | No decision or decision file has that id | Take the id from actual adr list |
| AdrNotAllowed | 3 | The decision's state doesn't allow the change | Do what the message names first, once the user agrees |
| AdrNotSaved | 3 | Actual AI couldn't be reached, so nothing was saved | Check the network and actual whoami, then retry |
| RunnerFailed | 1 | Runner process errored | Check runner output, logs |
| RunnerOutputParse | 1 | Could not parse runner output | Check model compatibility |
| RunnerTimeout | 1 | Runner exceeded time limit | Increase invocation_timeout_secs |
| ConfigError | 1 | Invalid config file | Check YAML syntax, run actual config show |
| AnalysisEmpty | 1 | No analysis results | Check project path, repo content |
| TailoringValidationError | 1 | Tailored output invalid | Retry, or use --no-tailor |
| TerminalIOError | 1 | CLI needs a TTY (non-interactive shell) | Add --force --no-tui flags |
| AdrInvalid | 1 | A decision failed the save check, or a value didn't parse | Fix each reason the message lists |
| AdrCheckFailed | 1 | adr check found failing files, or create --all didn't save one | Fix the files the report names |
| AdrDuplicate | 1 | create found a look-alike decision and sent nothing | Update that decision, or --allow-duplicate if the user wants both |
| IoError | 5 | File I/O failure | Check permissions, disk space |
| UserCancelled | 4 | User cancelled operation | (intentional) |
For full error details with hints and diagnosis steps, see
references/error-catalog.md.
| Code | Category | Errors |
|---|---|---|
| 1 | General / runtime | RunnerFailed, RunnerOutputParse, ConfigError, RunnerTimeout, AnalysisEmpty, TailoringValidationError, InternalError, TerminalIOError, AdrInvalid, AdrCheckFailed, AdrDuplicate |
| 2 | Auth / setup | ClaudeNotFound, ClaudeNotAuthenticated, CodexNotFound, CodexNotAuthenticated, CursorNotFound, ApiKeyMissing, CodexCliModelRequiresApiKey, NotLoggedIn, AdrAccessDenied, AdrRepoRequired, AdrPathway |
| 3 | Billing / API | CreditBalanceTooLow, ApiError, ApiResponseError, AdrCreateUnconfirmed, AdrNotFound, AdrNotAllowed, AdrNotSaved |
| 4 | User cancelled | UserCancelled |
| 5 | I/O | IoError |
Config file: ~/.actualai/actual/config.yaml (override with ACTUAL_CONFIG or ACTUAL_CONFIG_DIR env vars).
Most-used config keys:
| Key | Default | Purpose |
|---|---|---|
runner | claude-cli | Which runner to use |
model | claude-sonnet-4-6 | Model for Anthropic runners |
output_format | claude-md | Output format: claude-md, agents-md, cursor-rules |
batch_size | 15 | ADRs per batch (min 1) |
concurrency | 10 | Parallel requests (min 1) |
invocation_timeout_secs | 600 | Runner timeout in seconds (min 1) |
max_budget_usd | (none) | Spending cap (positive, finite) |
For all 18 config keys with validation rules, see
references/config-reference.md.
| Format | File | Header |
|---|---|---|
| claude-md (default) | CLAUDE.md | # Project Guidelines |
| agents-md | AGENTS.md | # Project Guidelines |
| cursor-rules | .cursor/rules/actual-policies.mdc | YAML frontmatter (alwaysApply: true) |
Managed sections use markers: <!-- managed:actual-start --> / <!-- managed:actual-end -->.
Merge behavior:
For full format details and merge internals, see
references/output-formats.md.
Load these only when you need deeper detail on a specific topic:
| File | When to Load |
|---|---|
references/sync-workflow.md | Debugging sync failures, understanding sync internals |
references/runner-guide.md | Setting up a runner, model compatibility, runner-specific behavior |
references/error-catalog.md | Troubleshooting a specific error with full diagnosis steps |
references/config-reference.md | Looking up config keys, validation rules, dotpath syntax |
references/output-formats.md | Output format questions, managed section behavior, merge logic |
references/platform-advisor.md | Login/OAuth flow, scopes, multi-org selection, advisor poll model, org/repo scoping |
references/adr-discovery.md | Discovering ADRs in docs/adr/ that Actual didn't write, normalizing and re-indexing them, the states adr discover reports |
For anything not covered by this skill or its reference files, fetch the documentation at docs.actual.ai, where each page also serves its markdown at its address with .md added:
check-override, rules, sign-in and troubleshootingactual adr, and managing them in Actual AIreferences/adr-discovery.md (opens in a new tab)references/config-reference.md (opens in a new tab)references/error-catalog.md (opens in a new tab)references/output-formats.md (opens in a new tab)references/platform-advisor.md (opens in a new tab)references/runner-guide.md (opens in a new tab)references/sync-workflow.md (opens in a new tab)scripts/diagnose.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
architecture-governance, adr, plan-check, impl-check, cli-tool
3 skills in this plugin
/adr-bootstrapSet up a repository's Architecture Decision Records (ADRs) with the actual CLI in three steps. Converts the ADRs it already has, in docs/adr/ or another ADR tool's folder, that the CLI reads on its own, after one question; goes through the rest with the user; then asks whether to draft ADRs for what they don't cover, surveying the code and, once the user agrees, this checkout's Claude Code or Codex sessions. The adr-draft skill creates each draft the user picks: signed out an accepted file in docs/adr/, signed in a decision in Actual AI. The last N commits or this session narrow the survey. Use when asked to bootstrap, seed or set up a repository's ADRs, to convert its existing ADRs, to find the decisions in a repository, its recent commits or this session, or when the actual CLI's refresh recommends adr-bootstrap or normalize. When that recommendation alone prompted it, offer this skill and run it only once the user agrees. Don't use it for a single ADR (adr-draft does that) or to review code./adr-draftCreate, update or delete one Architecture Decision Record (ADR) with the actual CLI, from an intent the user states or an observation the user or the agent makes about the code. Drafts the ADR or the change, shows it, and runs actual adr create, update or delete only once the user agrees. Signed out, an ADR is an accepted decision doc in docs/adr/ with the rule file in .actual/rules/ that plan-check and impl-check read; after actual login, it's a decision in Actual AI, accepted or a draft as the user picks. Use when asked to draft, write, capture or record an ADR or an architecture decision, to change or remove one, or when a decision settled in the session warrants one. To find several decisions across a repository, its recent commits or this session, use adr-bootstrap, which creates the ones the user picks through this skill. Don't use it to list, publish, archive, accept or reject decisions (the actual skill covers those commands), or to review code.npx claudepluginhub actual-software/actual-plugin --plugin actualOther plugins' skills for the same job