The castle command
Castle comes with a castle command for your terminal. How to get it on your PATH, check that Castle is healthy, and where your agent reads its guide.
Castle is a Mac app with a menu bar item and a command line. Most of what you do in the app’s window can be done from a terminal with the castle command, by your agent or by you. The exception is the agent switches and levels, which only you change in Castle.
Get it in your terminal
Connecting Claude Code or Codex puts castle on your terminal’s path. You can also do it on its own:
castle integrate terminal
castle integrate terminal --check says what is there, and --remove takes out exactly what Castle added.
If your terminal says castle: command not found, run that line, then open a new terminal window.
Check that Castle is healthy
castle doctor
It lists what Castle checked on your Mac, such as the macOS version, the service, free disk space and permissions, and says what to do next for anything that is wrong.
See what is connected
castle integrate
With no name it finds Claude Code and Codex, says whether each is connected, and changes nothing. To connect one:
castle integrate claude
castle integrate codex
Restart the agent app afterwards if it was open. See Connect your agent.
The guide for agents
The guide your agent reads is built into the command:
castle guide
castle guide errors
It is short, written for the agent and not for you, and it matches the Castle you have. The topics cover Ubuntu Desktop, Ubuntu Server, macOS, Windows, Android and iPhone, and these jobs: web, app, install, run, look, device and space. You never need to read it, but it is there if you are curious.
Working in a terminal
- Most commands print plain words. Add
--jsonand a command prints one result document, for scripts. -d <device>(or--device <device>) names the device a command is for.--yesconfirms something destructive. It never accepts a license for you.- Commands that wait for a device, such as
use, take--waitto say how long.
The full list is on Commands. What the numbers and names in an error mean is on Exit codes and errors.
Only you turn agents on or off
An agent can read whether agents are allowed with castle agents. Changing that is refused to everyone, your own terminal included. You do it in Castle: Settings › Agents, a device’s own Settings, or Stop All Agents in the Castle menu.