Skip to content

The CLI

The terminal has two commands. brain is for brAIn’s own faculties, ha is for Home Assistant operations.

Terminal window
brain doctor # free health check; run it first when anything misbehaves
brain memory add "We call the office lamp the beacon"
brain findings done 2 "replaced the battery myself"
brain undo # list what Claude edited, then revert one
ha log errors -f # follow Home Assistant's errors
ha reload automations

You rarely need to type these. In the Terminal, typing brain or ha opens a palette of every subcommand, and Claude runs the right one when you ask “reload automations” or “what did you learn last week?”.

A subcommand typed into the wrong command tells you where it lives:

$ ha undo
'undo' is a brAIn faculty, not a Home Assistant operation.
Run: brain undo

The CLI covers files and workflow. The live home belongs to the MCP tools and admin changes to Power Tools (how the layers fit).

brain commands

Command What it does Claude runs
brain memory <action> The home memory. Actions below none (consolidate uses one)
brain findings <action> The findings work list. Actions below fix, and apply when a step needs working out
brain learn [topic] Run a study session, on a topic or on whatever has gone stalest one session
brain ask "<question>" One question about your home, answered as text one
brain undo [n] List the files Claude edited and revert one. --all-today reverts today’s none
brain own [-r] <path…> Make a file Claude cannot write writable again. -r does a whole folder none
brain check Run the house checks now. list prints the catalog and when each last ran; --json the raw result none
brain why [ask] What brAIn is curious about (why somebody does something by hand) and what it has worked out. ask asks the next question now ask: one
brain weekly [send] The week’s numbers and the last report sent. send writes and sends this week’s now, and moves the next one a week out send: yes
brain doctor Checks the whole stack (MCP, sign-in, listeners, worker pool, memory, panel, daemons, disk) and prints PASS/FAIL with a fix hint per part. --json for one object none
brain doctor --deep One real round trip through every face about five
brain doctor --rehearse Plant test defects, score the checks and the analyst, clean up. Asks first; --yes skips the question one
brain doctor --sweep Remove anything named brain_test_* a rehearsal left behind none
brain eval outcomes How the Resident’s judgement held up: what it decided and what you did next, per producer and entity. --nightly runs the nightly grading pass now none
brain eval first_look Replay captured first looks against today’s prompt and report agreement with what you did. Changes nothing. Caps: --days (14), --max-tokens (60000), --max-batches (20) capped
brain report Write one redacted text file to /share/brain/reports/ for a bug report. --no-names hashes entity ids none
brain devloop [status|run [stream]|look "<what to fix>"] The development loop: its state, run one stream now, or file What do you want to fix? look: one
brain tune "<asked>" "<answered>" Record something you settled about how the assistant should be. Listed in ⚙ › Personality, where you can remove it none
brain login [--status|--share] Sign in to Claude and share the login with the other BRUH apps. Same command as ha login none
brain help The full list none

brain memory actions

Action What it does
add "<fact>" Teach it something
list Print the memory document
edit Open it in $EDITOR
forget "<text>" Queue a line for removal
inbox Facts waiting to be filed
consolidate File the inbox now
hypotheses (alias guesses) Guesses waiting for your yes or no
confirm "<text>" / reject "<text>" [why] Answer a guess. A reason after a reject teaches
log [n] What it learned recently (default 10). --show <n> prints one entry in full
history [n] Every kept version of the document
undo / undo <n> Go back one version, or revert change n from the log
clear --confirm Reset the document. A .bak is kept
export [file] / import <file> Everything learned as one portable file, and back in. --replace-memory overwrites the document

brain findings actions

The number is the one brain findings prints. Each ending goes through the panel, so it writes the same memory line and undo as the button.

Action What it does
list (default) Open findings and guesses waiting
fix <id> Ask what fixing it would change. Changes nothing
apply <id> Make the planned change. The only action that changes the house
cancel <id> Do not apply. The plan stays on the card
undo <id> Put back the files a fix changed. Service calls are listed, not reversed
done <id> ["note"] You fixed it yourself
wrong <id> ["note"] Not a problem here. Never raised again
ack <id> Acknowledge an automated fix
snooze <id> [hour|tomorrow|week|month|now] Hide it for a while

The three doctors

What it answers What it spends
brain doctor Is everything connected? nothing
brain doctor --deep Does each face work end to end, right now? about five Claude turns
brain doctor --rehearse Do the checks and the analyst find a defect planted in this house? one analyst run

The two that spend never run on a timer. Both are also in the panel: Run all tests in ⚙ → Diagnostics, and Rehearse the house checks in ⚙ → Developer. Details: Deep Check & Rehearsal.

ha commands

Command What it does
ha log [core|supervisor|host|addon <name>|errors|all] Tail Home Assistant logs. -f follows, -n N sets the line count
ha reload <target> Reload config: automations, scripts, scenes, groups, input_booleans, input_numbers, input_selects, input_texts, input_datetimes, timers, counters, core, all. check validates without reloading. Singular forms work too
ha check [path] Validate YAML syntax for a file or folder (default /config). --ha asks Home Assistant to check the config; --all does both. Alias: ha yaml
ha context Regenerate /config/CLAUDE.md, the context file Claude reads each session
ha entity <action> get <id>, set <id> <state>, list [domain], search <pattern>
ha service call <domain>.<service> Call any service. --data '{…}' passes data, --response returns the service’s response data. ha service list [domain] lists services
ha addon <action> <slug> list, info, restart, stop, start, logs, options
ha notify "msg" A persistent notification, or a phone push with --target <name>|all. --title sets the title
ha share <action> Copy files through /share for other add-ons: push <src> <dest>, pull <src> <dest>, ls [path]. Credential-shaped files are refused unless --force
ha login [--status] Same command as brain login. --status reports every credential store
ha help The full list

If another ha command is already on PATH inside the container, brAIn installs its own as hass and says so in the startup log.

One more command is on PATH:

Command What it does
persist-install apk|pip <pkgs> Install packages that survive add-on restarts. Also list and remove

Undo

Terminal window
brain undo # list what Claude edited, newest first
brain undo 3 # put edit #3 back, byte for byte
brain undo --all-today # revert everything Claude changed today
brain undo
Claude's recent edits to /config:
1 Nov 27 14:22 modified /config/automations.yaml
2 Nov 27 14:19 modified /config/scripts.yaml
3 Nov 27 09:41 created /config/packages/energy.yaml
Revert one with: brain undo <n>

Before a file under /config is written, the previous version is snapshotted. Reverting restores the file exactly as it was. Undoing an edit that created a file removes the file.

Covered Edits made with Claude’s file tools, notebook edits included. Writes the panel makes with no Claude run: an accepted proposal appended to automations.yaml, four scenes appended to scenes.yaml, one automation changed by a condition proposal, and a one-off’s Remove.
Not covered Files outside /config. secrets.yaml, which is never snapshotted. Changes a shell command made (a redirect, a script).
Kept for edit_journal_days (default 14).

Service calls a plan made are put back with Restore on its card (Permissions & Safety). A failed snapshot never blocks an edit.

This is not a backup. Home Assistant’s own backups version your whole configuration; the edit journal covers only the files brAIn touched. See Reference.

Files Claude cannot write: brain own

Terminal window
brain own /config/scenes.yaml /config/scripts.yaml
brain own -r /config/packages # a whole folder

Claude Code runs as a non-root user. Home Assistant saves automations.yaml, scripts.yaml and scenes.yaml as root, and other add-ons do the same with their config, which can leave those files read-only for Claude.

brAIn hands them back by itself:

  • at startup;
  • right before Claude edits a file it cannot write, or runs a shell command that names one;
  • about once a minute for the top-level YAML the editors rewrite and each add-on’s folder under /addon_configs.

brain own does the same on demand, for what those hooks cannot see, such as a command writing to a path held in a variable. It raises no approval card and needs no sudo. Claude is told never to ask you for sudo or chown.

Works under /config, and /addon_configs, /share, /media and /addons while the add-on’s access option for each is on
Never touches Anything outside those folders, .storage, .cloud, brAIn’s own credentials, secrets.yaml, the recorder database, or a file with other hard links
Symbolic links Answered for the file the link points at, which must pass the same checks

If it says the panel is not answering, the add-on is not running; brain doctor checks that. More in Permissions & Safety.

Slash commands in the terminal

In the Terminal tab, / lists Claude Code’s own commands, including anything you put in /config/.claude/commands. Two worth knowing:

  • /learn [topic] starts a study session you can watch and correct as it runs.
  • /memory shows what brAIn knows right now.