The moon binary brings together the launcher (sign-in, workspace, Moon Blur, updates) and the agent. Commands the launcher does not handle are passed on to the agent. moon --help prints the summary in the terminal.
OverviewLink to the Overview section
| Command | Purpose |
|---|---|
moon | Start the agent in the current folder or in the given folder. |
moon , moon | Run a task without the interface. |
moon (moon ) | Make a session on this computer controllable from the Moon AI Code page. See Remote control. |
moon login | Sign in to Moon AI. |
moon logout | Sign out and revoke the session. |
moon whoami | Sign-in and workspace status. |
moon (moon ) | List your workspaces and choose the one Moon CLI uses. |
moon | List and revoke your Moon CLI sessions. |
moon (moon ) | List the Moon AI connectors Moon sees in Moon CLI’s workspace. See Moon AI connectors in Moon CLI. |
moon blur | Set up Moon Blur. |
moon guard | Turn Moon Guard on or off. |
moon doctor | Diagnose the installation, the network and the account. |
moon update (moon upgrade) | Update Moon CLI. |
moon | Go back to the previous version. |
moon | Uninstall Moon CLI. |
moon (moon ) | Show the licenses. |
moon (-v) | Show the version. |
moon --help (-h, moon help) | Show the launcher help. |
moon (moon ) | Show a command’s help, without doing anything else. |
Settings and environment variables: Configuration.
moonLink to the moon section
Starts the agent in the current folder, or in the folder passed as the first argument. Without a session, sign-in starts first; an expired or revoked session triggers a new sign-in.
| Option | Effect |
|---|---|
--auto | Starts in Autonomous mode: approve everything without asking, deletions and actions outside the project included. Since Moon CLI 0.6.1, publishing or deploying is still asked (git push, PR, npm publish, vercel, scp to a server…), as are the connector actions Moon AI asks about in every mode (in 0.6.0, publishing went through without asking; from 0.5.0 to 0.5.6, git push and pull request creation were still asked). No effect when your organization does not allow Autonomous mode (Moon CLI 0.5.4): see Permission modes and When your organization does not allow Autonomous mode. |
-m, --model | The session’s model. moonai/auto means Auto. |
-c, --continue | Resumes the last session. |
-s, --session | Resumes the given session. |
--fork | With -c or -s: resumes in a copy of the session. |
--prompt | Sends this message as soon as it opens. |
--agent | Starting agent (build or plan). |
--print-logs | Writes the agent’s log to the terminal (standard error). |
--log-level | Log level: DEBUG, INFO, WARN or ERROR. |
moon
moon ../other-project
moon -c
moon -m moonai/anthropic/claude-haiku-4.5 --prompt "explain the architecture of the src folder"moon runLink to the moon run section
Runs a task without opening the interface, prints the answer, then exits. moon does the same thing: a first argument that is not an option, a command or an existing file or folder is treated as a task.
| Option | Effect |
|---|---|
--dir | Works in this folder. The trust question and the Moon Blur mode apply to it. |
-m, --model | Model to use. |
--agent | Agent to use (build or plan). |
--auto | Accepts permission requests, deletions and actions outside the project included. Since Moon CLI 0.6.1, a publication or a deployment is refused, with or without this option, and moon run says why: nobody can answer its request (in 0.6.0, --auto accepted it; from 0.5.0 to 0.5.6, it was still refused). Without this option, every action that needs your permission is refused, as it is with the option when your organization does not allow Autonomous mode (Moon CLI 0.5.4). |
-f, --file | Attaches one or more files to the message. |
-c, --continue | Continues the last session. |
-s, --session | Continues the given session. |
--fork | With -c or -s: continues in a copy of the session. |
--command | Runs an agent / command; the message is used as its arguments. |
--title | The session title. |
--format | Writes the raw events as JSON, one per line. |
--thinking | Shows the model’s thinking. |
--attach | Uses an agent already started by moon serve (with -p, --password and -u, --username). |
moon run "explain what the src/api folder does"
moon run --auto "fix the failing test"
git diff | moon run "summarize these changes"
moon run --command review main- Without
--auto, a file change, a command or a web access is refused, with the message “permission demandée : … ; refus automatique” (permission requested: …; automatically denied). - Whatever you send on standard input (
|) is added to the message. - The exit code is 1 on error.
Continuous integration: Task without the interface.
moon loginLink to the moon login section
Links Moon CLI to your Moon AI account.
| Option | Effect |
|---|---|
| (none) | Sign-in through the browser, then the agent starts in the current folder. With a code in an SSH session or on Linux without a graphical display. |
--device | Sign-in with a code, for a machine without a browser. |
--browser | Forces sign-in through the browser. |
--token | Saves a pasted Moon CLI token; with no value, you are asked for the token. |
--no-launch | Does not start the agent after sign-in through the browser. |
--no-open | Does not open a browser: prints the sign-in address, to open where your Moon AI account is signed in (5 minutes). |
--json | For an app: no browser opened, JSON lines (the address to open, then the result), never the token. |
moon login
moon login --deviceSee Sign-in.
moon logoutLink to the moon logout section
Revokes the session with Moon AI, then erases the token from your machine. The command takes no arguments (“Usage : moon logout”).
moon logoutmoon whoamiLink to the moon whoami section
Shows the account, the masked token and its expiry, the session’s workspace with its plan, Moon CLI access and the number of days before you must sign in again. Exit code 1 if you are not signed in or if Moon AI refuses the session. With --json, the same status as JSON for an app, without the token.
moon whoamimoon workspaceLink to the moon workspace section
Lists your workspaces with their plan: ✦ marks those that include Moon CLI, and “utilisé par Moon CLI” (used by Moon CLI) the session’s workspace. moon changes the session’s workspace, designated by its number in the list, its name or its ID (the start is enough if it matches only one workspace). The workspace open on the web does not change.
moon workspace
moon workspace use 2
moon workspace use Studiomoon sessionsLink to the moon sessions section
Lists your Moon CLI sessions (ID, device, sign-in date) and marks the current terminal’s session (“celle-ci”, this one). moon closes one; the start of the ID is enough if it matches only one session.
moon sessions
moon sessions revoke 3f9a1cmoon connecteursLink to the moon connecteurs section
Lists the connectors connected in Moon AI that Moon sees in Moon CLI’s workspace (Gmail, Outlook, Notion, GitHub, Slack, calendars, mailbox, your MCP servers and those of your organization), and the ones that are paused. Nothing to set up: they come into the agent on their own, and their tokens stay with Moon AI. Moon CLI 0.6.0 or later.
| Option | Effect |
|---|---|
--json | The same list as JSON, for a program. |
moon connecteurs
moon connecteurs --jsonIn the interface: /connecteurs. See Moon AI connectors in Moon CLI.
moon blurLink to the moon blur section
Sets up Moon Blur, the masking done on your machine.
| Form | Effect |
|---|---|
moon blur | The active mode, where it comes from, and the list of modes. |
moon | Default mode: off, secrets, redact, strict or detect. |
moon | Mode for the current folder only (--project is accepted). |
moon | Removes the default mode; with --here, the folder’s mode. |
moon | Stop masking this value. Only its fingerprint is saved. |
moon | Number of allowed values. |
moon | Empties the list of allowed values. |
moon | Lists what would be masked in a file (first 50 items), without sending anything. |
moon blur redact --here
moon blur audit config/dev.envThe older form moon is still accepted. See Moon Blur.
moon guardLink to the moon guard section
Turns Moon Guard on (on) or off (off) for the next launches of moon. Without an argument, shows the status and where it comes from.
moon guard on
moon guardSee Moon Guard.
moon doctorLink to the moon doctor section
Checks the installation, the network, the session, the workspace, the settings, the current folder and whether an update is available, and says what to fix. --json gives the same diagnosis as JSON, without your token. Exit code 1 if a problem remains to be fixed.
moon doctor
moon doctor --json > diagnostic.jsonSee Troubleshooting.
moon updateLink to the moon update section
Looks for the latest published version and installs it. It is used the next time moon starts.
| Option | Effect |
|---|---|
--to | Installs this version, including an older one. |
--channel | Update channel; latest by default. |
--force | Reinstalls even if the version is up to date. |
moon update
moon update --to 0.2.2See Updates.
moon rollbackLink to the moon rollback section
Reactivates the version installed before the active one. It is used at the next launch. Moon CLI first asks “Revenir à la version précédente de Moon CLI ? [o/N]” (go back to the previous version of Moon CLI?): type o (oui, yes) to confirm; --yes (or -y) confirms in advance, for a script.
moon rollback
moon rollback --yesmoon uninstallLink to the moon uninstall section
Revokes the session and erases the token, then removes Moon CLI: the binary, the installed versions and the addition to the PATH. Your settings and the agent’s session history are kept.
| Option | Effect |
|---|---|
--purge | Also erases your settings, your personal agent configuration, the session history and the caches. |
--yes (-y) | No confirmation. Required without an interactive terminal. |
moon uninstall
moon uninstall --purge --yesSee Uninstall.
moon licensesLink to the moon licenses section
Shows the license notices of Moon CLI, of the agent (based on OpenCode, MIT license) and of the included components.
moon licenses | lessmoon --versionLink to the moon --version section
Prints Moon , then the version of OpenCode the agent is based on.
moon --versionCommands passed to the agentLink to the Commands passed to the agent section
These commands first go through sign-in and the workspace check, like moon, and are then run by the agent. moon shows their options.
| Command | Purpose |
|---|---|
moon serve | Starts the agent’s local server, without the interface (--port, --hostname). |
moon | Opens the interface on a server started by moon serve. |
moon acp | Starts the agent for a code editor that supports ACP (Agent Client Protocol). |
moon models | Lists the IDs of the models you can use (moonai/<id>). |
moon , moon | Creates a custom agent, lists the available agents. |
moon | Lists the MCP servers and their status. |
moon mcp add | Adds an MCP server: --url <url> for a remote server (--header ), or, for a local server, the command that starts it after a double hyphen, as in the example below (--env ). Without a name, adding is guided. |
moon , moon | Connects an MCP server through OAuth, or erases its credentials. |
moon | Diagnoses an MCP server’s OAuth connection. |
moon , moon | Lists the agent’s sessions (-n, --format ), deletes one. |
moon | Exports a session as JSON (--sanitize masks sensitive data in the transcript). |
moon | Imports a session from a JSON file. |
moon stats | Statistics on your sessions: tokens, tools, models (--days, --models, --tools, --project). |
moon | Fetches a GitHub pull request’s branch, then starts the agent. |
moon , moon | Shows the agent’s final configuration, or its folders. |
moon models
moon mcp add context7 --url https://mcp.context7.com/mcp
moon mcp add my-server -- npx -y mcp-package-name
moon session list -n 5moon servealways starts with a password: if you do not set one withOPENCODE_SERVER_PASSWORD, Moon CLI generates a random one and prints it with the user name (“moon”, unless you setOPENCODE_SERVER_USERNAME).moon serve,moon acpandmoon prnever load the repository’s configuration.
Refused commands:
| Command | Response |
|---|---|
moon | Refused: Moon CLI only goes through Moon AI. |
moon web, moon account, moon github | Refused: not available in Moon CLI. |
Interface commandsLink to the Interface commands section
In the agent, type / to see the commands, and filter the list by typing the rest of the name. CtrlP opens the palette, which also contains actions without a / command. Names in parentheses are aliases.
Moon AILink to the Moon AI section
| Command | Effect |
|---|---|
/workspace (/ws) | Changes the session’s workspace, without leaving the agent. The web is not changed. |
/usage (/quota, /limites) | Shows your usage: 5-hour session, week and month. |
/blur | Changes the Moon Blur mode for the session. |
/rc | Makes the current conversation controllable from the Moon AI Code page, after telling you what the page will see; /rc stop, or /rc a second time, stops it. See From an open conversation. |
/connecteurs (/connectors) | Shows the Moon AI connectors the agent sees (Moon CLI 0.6.0). See Moon AI connectors in Moon CLI. |
/mcp | Adds, connects, disconnects or deletes MCP servers. |
/style (/styles) | Chooses the session’s response style: “Par défaut” (default), “Explicatif” (explanatory) or “Apprentissage” (learning). The style shows under the input when it is not the default one (Moon CLI 0.5.0). See Response styles. |
Model, agent and permissionsLink to the Model, agent and permissions section
| Command | Effect |
|---|---|
/models (/mo) | Chooses the model, with its cost level. |
/variants | Chooses a variant of the model, when it offers some. |
/agents | Chooses the agent: build (full access) or plan (analysis without changes). |
/mcps | Turns configured MCP servers on or off. |
/ (/modifs) | Turns the Accept edits (“Accepter les modifications”) mode on or off. |
/auto (/bypass) | Turns automatic approval on or off; asks for confirmation the first time. git push and pull request creation are still asked (Moon CLI 0.5.0): see Commands that publish. |
SessionLink to the Session section
| Command | Effect |
|---|---|
/new (/clear) | Starts a new session. |
/sessions (/resume, /continue) | Resumes an earlier session. |
/rename | Renames the session. |
/compact (/summarize) | Summarizes the conversation to free up context. |
/undo | Undoes your last message and the file changes that followed it; the message comes back into the input. |
/redo | Redoes what /undo undid. |
/timeline | Jumps to a message in the session. |
/fork | Duplicates the session from a message. |
/copy | Copies the session transcript to the clipboard. |
/export | Saves the transcript as Markdown in the current folder, after you choose the name and the content (thinking, tool details), then opens it in your editor. |
/move | Moves the session to another project folder. |
/fond (/, /background) | Lists the commands Moon left running in the background, the session’s first, with their status and their last line. Enter on a running command stops it, with everything it started (Moon CLI 0.5.1). Not offered in an interface opened by moon attach. See Background commands. |
Input and displayLink to the Input and display section
| Command | Effect |
|---|---|
/editor | Writes the message in your text editor (VISUAL or EDITOR variable). |
/skills | Lists the available skills and inserts the one you choose. |
/diff | Opens the Git changes viewer. |
/thinking (/) | Expands or collapses the model’s thinking. |
/timestamps (/) | Shows or hides message times. |
/themes | Changes the interface theme. |
ProjectLink to the Project section
| Command | Effect |
|---|---|
/init | Creates or updates the project’s AGENTS.md file. Text typed after the command says what it should cover. |
/revue (/review) | Code review of the current changes, findings by file and by severity: without an argument, uncommitted changes (or, failing that, the files changed during the session); otherwise a commit, a branch, a PR (number or URL, with the gh tool installed) or paths. Moon CLI 0.5.0: see Code review. |
/ (/) | Security review of the current changes, vulnerabilities by file and by severity; same arguments as /revue (Moon CLI 0.5.0). |
/pr | Prepares and creates the pull request for the current branch with GitHub CLI (gh): commits the work, then git push and gh pr create, both always asked. Text typed after the command sets the target branch, the title, or “brouillon” (draft) (Moon CLI 0.5.0). See Create a PR with /pr. |
SystemLink to the System section
| Command | Effect |
|---|---|
/status | Status of the MCP servers, language servers, formatters and loaded plugins. |
/debug | Version, system, terminal, session and model, to copy into a support request. |
/help | Help: commands and shortcuts. |
/exit (/quit, /q) | Quits the agent. |
Commands added by your filesLink to the Commands added by your files section
The list also contains:
- your custom commands;
- your skills, called by name (
/<name>); - the prompts offered by your MCP servers.
Keyboard shortcutsLink to the Keyboard shortcuts section
| Key | Effect |
|---|---|
| Enter | Send the message. |
| ShiftEnter or CtrlJ | New line in the input. |
| Esc twice | Interrupt the current response. |
| ShiftTab | Switch to the next permission mode. |
| Tab | Switch to the next agent (build, plan). |
| CtrlP | Command palette. |
| CtrlT | Next model variant. |
| F2 | Next recent model. |
| CtrlC | Clear the input; quit if it is empty. |
| ! at the start of the input | Shell mode: the line runs as a command in the project. |
| @ | Cite a file, an agent or an MCP resource. |
CtrlX is the prefix: press these keys, release them, then type a letter.
| Then | Effect |
|---|---|
| N | New session. |
| L | List of sessions. |
| M | List of models. |
| A | List of agents. |
| C | Compact the session. |
| E | Write in the external editor. |
| U, R | Undo or redo the last message. |
| Y | Copy the message. |
| X | Export the session. |
| G | Session timeline. |
| S | Status. |
| T | Themes. |
| B | Show or hide the side panel. |
You can change the shortcuts in tui.json: see Agent interface.