Skip to content

The CLI

The terminal ships two commands, split by what they act on:

  • brain — brAIn’s own faculties: memory, learning, undo, diagnostics.
  • ha — Home Assistant operations: logs, reloads, entities, services, add-ons.

The split exists so that “which log?” is never a question anyone has to ask. brain help and ha help list everything; typing a subcommand into the wrong dispatcher tells you which one it belongs to rather than failing quietly.

These cover the file-and-workflow side that live APIs don’t; the live home belongs to the MCP tools, and admin changes to Power Tools — see how the layers fit.

brain — its own faculties

CommandWhat it does
brain memory <action>The home memory: add, list, forget, edit, inbox, hypotheses, confirm, reject, log, undo, consolidate, clear
brain learn [topic]Run a study session. With a topic, on that topic; without one, on whatever has gone stalest
brain ask "<question>"One-shot question about your home — the same engine as the panel’s Ask card
brain undo [n]List the files Claude edited, in plain English, and revert one
brain doctorRun this first when anything misbehaves — drives the whole stack end-to-end (MCP, auth, listeners, worker pool, memory) and prints PASS/FAIL with a fix hint per part
brain helpThe full list
Terminal window
brain memory add "We call the office lamp the beacon"
brain memory hypotheses # pending guesses awaiting a yes/no
brain memory confirm "the garage fridge runs 24/7"
brain learn energy
brain undo --all-today # revert everything Claude changed today

ha — Home Assistant operations

CommandWhat it does
ha log [core|supervisor|host|addon <name>|errors|all]Tail HA logs. -f to follow, -n N for line count
ha reload <target>Reload HA config: automations, scripts, scenes, groups, core, all
ha check [path]Validate YAML before reloading
ha contextRegenerate /config/CLAUDE.md, the context file Claude reads each session
ha entity <action> <id>Get/set entity states: get, set, list, search
ha service call <domain>.<service>Call any HA service from the shell
ha addon <action> <slug>Manage add-ons: list, info, restart, stop, start, logs, options
ha notify "msg"Send a persistent or mobile push notification
ha share <action>Cross-add-on file sync via /share: push, pull, ls
ha loginAuthenticate the shared Claude credential from the shell
ha helpThe full list

If ha is already taken

If some other ha command is ever present on PATH inside the container, brAIn installs its own as hass instead rather than shadowing it. The startup log says so when this happens.

Also on PATH

CommandWhat it does
persist-install apk|pip <pkgs>Install packages that survive add-on restarts (list, remove too)

Undo

Before Claude writes to any file under /config, the previous version is snapshotted. Only /config is journalled, and secrets.yaml is never snapshotted. Snapshots are kept for edit_journal_days (default 14).

Terminal window
brain undo # list what Claude edited, newest first, in plain English
brain undo 3 # put edit #3 back, byte for byte
brain undo --all-today # revert everything Claude changed today
brain undo
1 14:22 automations.yaml modified (added brightness to the hallway action)
2 14:19 scripts.yaml modified
3 09:41 packages/energy.yaml created

The hook that takes the snapshot can never block an edit: if it fails for any reason it exits quietly and Claude carries on. A journal that stops you working is worse than no journal.

This is not a backup system. brAIn doesn’t version your configuration — Home Assistant’s own backups do that job, whole-system and restorable. The edit journal only covers files brAIn itself touched. See Reference.

In the terminal, they’re a palette

You don’t have to remember any of this. In the Terminal tab, typing brain or ha opens a palette of every subcommand your install actually has — read from what the dispatchers print, so it can’t go stale — and / lists Claude Code’s own commands, including anything you’ve dropped in /config/.claude/commands.

Two of those are worth knowing: /learn [topic] starts a study session you can watch and correct mid-flight, and /memory shows what it knows right now.

Everything is brAIn-usable

The generated context lists both dispatchers, so “reload automations”, “check the logs for zigbee errors”, or “what did you learn last week?” resolve to the right command without you naming it.