DocsOpen Moon AI
Browse the docs

Command reference

Every subcommand of the moon binary with its options and an example, the agent interface commands you type with /, and the keyboard shortcuts.

On this page

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

CommandPurpose
moon [folder]Start the agent in the current folder or in the given folder.
moon run "<task>", moon "<task>"Run a task without the interface.
moon rc [folder] (moon remote-control)Make a session on this computer controllable from the Moon AI Code page. See Remote control.
moon loginSign in to Moon AI.
moon logoutSign out and revoke the session.
moon whoamiSign-in and workspace status.
moon workspace (moon workspaces)List your workspaces and choose the one Moon CLI uses.
moon sessionsList and revoke your Moon CLI sessions.
moon connecteurs (moon connectors)List the Moon AI connectors Moon sees in Moon CLI’s workspace. See Moon AI connectors in Moon CLI.
moon blurSet up Moon Blur.
moon guardTurn Moon Guard on or off.
moon doctorDiagnose the installation, the network and the account.
moon update (moon upgrade)Update Moon CLI.
moon rollbackGo back to the previous version.
moon uninstallUninstall Moon CLI.
moon licenses (moon licences)Show the licenses.
moon --version (-v)Show the version.
moon --help (-h, moon help)Show the launcher help.
moon <command> --help (moon help <command>)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.

OptionEffect
--autoStarts 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 moonai/<id>The session’s model. moonai/auto means Auto.
-c, --continueResumes the last session.
-s, --session <id>Resumes the given session.
--forkWith -c or -s: resumes in a copy of the session.
--prompt "<message>"Sends this message as soon as it opens.
--agent <name>Starting agent (build or plan).
--print-logsWrites the agent’s log to the terminal (standard error).
--log-level <level>Log level: DEBUG, INFO, WARN or ERROR.
Terminal
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 "<task>" 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.

OptionEffect
--dir <folder>Works in this folder. The trust question and the Moon Blur mode apply to it.
-m, --model moonai/<id>Model to use.
--agent <name>Agent to use (build or plan).
--autoAccepts 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 <file>Attaches one or more files to the message.
-c, --continueContinues the last session.
-s, --session <id>Continues the given session.
--forkWith -c or -s: continues in a copy of the session.
--command <name>Runs an agent / command; the message is used as its arguments.
--title "<title>"The session title.
--format jsonWrites the raw events as JSON, one per line.
--thinkingShows the model’s thinking.
--attach <url>Uses an agent already started by moon serve (with -p, --password and -u, --username).
Terminal
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.

OptionEffect
(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.
--deviceSign-in with a code, for a machine without a browser.
--browserForces sign-in through the browser.
--token <token>Saves a pasted Moon CLI token; with no value, you are asked for the token.
--no-launchDoes not start the agent after sign-in through the browser.
--no-openDoes not open a browser: prints the sign-in address, to open where your Moon AI account is signed in (5 minutes).
--jsonFor an app: no browser opened, JSON lines (the address to open, then the result), never the token.
Terminal
moon login
moon login --device

See 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”).

Terminal
moon logout

moon 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.

Terminal
moon whoami

moon 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 workspace use 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.

Terminal
moon workspace
moon workspace use 2
moon workspace use Studio

See Workspaces and models.

moon 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 sessions revoke <id> closes one; the start of the ID is enough if it matches only one session.

Terminal
moon sessions
moon sessions revoke 3f9a1c

moon 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.

OptionEffect
--jsonThe same list as JSON, for a program.
Terminal
moon connecteurs
moon connecteurs --json

In 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.

FormEffect
moon blurThe active mode, where it comes from, and the list of modes.
moon blur <mode>Default mode: off, secrets, redact, strict or detect.
moon blur <mode> --hereMode for the current folder only (--project is accepted).
moon blur resetRemoves the default mode; with --here, the folder’s mode.
moon blur allow <value>Stop masking this value. Only its fingerprint is saved.
moon blur allowNumber of allowed values.
moon blur allow --clearEmpties the list of allowed values.
moon blur audit <file>Lists what would be masked in a file (first 50 items), without sending anything.
Terminal
moon blur redact --here
moon blur audit config/dev.env

The older form moon blur mode <mode> 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.

Terminal
moon guard on
moon guard

See 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.

Terminal
moon doctor
moon doctor --json > diagnostic.json

See 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.

OptionEffect
--to <version>Installs this version, including an older one.
--channel <channel>Update channel; latest by default.
--forceReinstalls even if the version is up to date.
Terminal
moon update
moon update --to 0.2.2

See 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.

Terminal
moon rollback
moon rollback --yes

moon 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.

OptionEffect
--purgeAlso erases your settings, your personal agent configuration, the session history and the caches.
--yes (-y)No confirmation. Required without an interactive terminal.
Terminal
moon uninstall
moon uninstall --purge --yes

See 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.

Terminal
moon licenses | less

moon --versionLink to the moon --version section

Prints Moon CLI 0.6.1, then the version of OpenCode the agent is based on.

Terminal
moon --version

Commands 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 <command> --help shows their options.

CommandPurpose
moon serveStarts the agent’s local server, without the interface (--port, --hostname).
moon attach <url>Opens the interface on a server started by moon serve.
moon acpStarts the agent for a code editor that supports ACP (Agent Client Protocol).
moon modelsLists the IDs of the models you can use (moonai/<id>).
moon agent create, moon agent listCreates a custom agent, lists the available agents.
moon mcp listLists the MCP servers and their status.
moon mcp addAdds an MCP server: --url <url> for a remote server (--header KEY=VALUE), or, for a local server, the command that starts it after a double hyphen, as in the example below (--env KEY=VALUE). Without a name, adding is guided.
moon mcp auth [name], moon mcp logout [name]Connects an MCP server through OAuth, or erases its credentials.
moon mcp debug <name>Diagnoses an MCP server’s OAuth connection.
moon session list, moon session delete <id>Lists the agent’s sessions (-n, --format json), deletes one.
moon export [id]Exports a session as JSON (--sanitize masks sensitive data in the transcript).
moon import <file>Imports a session from a JSON file.
moon statsStatistics on your sessions: tokens, tools, models (--days, --models, --tools, --project).
moon pr <number>Fetches a GitHub pull request’s branch, then starts the agent.
moon debug config, moon debug pathsShows the agent’s final configuration, or its folders.
Terminal
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 5
  • moon serve always starts with a password: if you do not set one with OPENCODE_SERVER_PASSWORD, Moon CLI generates a random one and prints it with the user name (“moon”, unless you set OPENCODE_SERVER_USERNAME).
  • moon serve, moon acp and moon pr never load the repository’s configuration.

Refused commands:

CommandResponse
moon providers loginRefused: Moon CLI only goes through Moon AI.
moon web, moon account, moon githubRefused: 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

CommandEffect
/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.
/blurChanges the Moon Blur mode for the session.
/rcMakes 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.
/mcpAdds, 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

CommandEffect
/models (/mo)Chooses the model, with its cost level.
/variantsChooses a variant of the model, when it offers some.
/agentsChooses the agent: build (full access) or plan (analysis without changes).
/mcpsTurns configured MCP servers on or off.
/modifications (/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

CommandEffect
/new (/clear)Starts a new session.
/sessions (/resume, /continue)Resumes an earlier session.
/renameRenames the session.
/compact (/summarize)Summarizes the conversation to free up context.
/undoUndoes your last message and the file changes that followed it; the message comes back into the input.
/redoRedoes what /undo undid.
/timelineJumps to a message in the session.
/forkDuplicates the session from a message.
/copyCopies the session transcript to the clipboard.
/exportSaves 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.
/moveMoves the session to another project folder.
/fond (/arriere-plan, /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

CommandEffect
/editorWrites the message in your text editor (VISUAL or EDITOR variable).
/skillsLists the available skills and inserts the one you choose.
/diffOpens the Git changes viewer.
/thinking (/toggle-thinking)Expands or collapses the model’s thinking.
/timestamps (/toggle-timestamps)Shows or hides message times.
/themesChanges the interface theme.

ProjectLink to the Project section

CommandEffect
/initCreates 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.
/revue-securite (/security-review)Security review of the current changes, vulnerabilities by file and by severity; same arguments as /revue (Moon CLI 0.5.0).
/prPrepares 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

CommandEffect
/statusStatus of the MCP servers, language servers, formatters and loaded plugins.
/debugVersion, system, terminal, session and model, to copy into a support request.
/helpHelp: 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

KeyEffect
EnterSend the message.
ShiftEnter or CtrlJNew line in the input.
Esc twiceInterrupt the current response.
ShiftTabSwitch to the next permission mode.
TabSwitch to the next agent (build, plan).
CtrlPCommand palette.
CtrlTNext model variant.
F2Next recent model.
CtrlCClear the input; quit if it is empty.
! at the start of the inputShell 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.

ThenEffect
NNew session.
LList of sessions.
MList of models.
AList of agents.
CCompact the session.
EWrite in the external editor.
U, RUndo or redo the last message.
YCopy the message.
XExport the session.
GSession timeline.
SStatus.
TThemes.
BShow or hide the side panel.

You can change the shortcuts in tui.json: see Agent interface.

Moon AI

Moon AI in action

0:00

Explore

Screenshots of chat.realmoon.ai taken on October 29, 2026, with fictional data.

Moon AI

Your preferences

Visits counted without cookies.

Our server counts visits without cookies or trackers. Your theme and your answer about ad measurement are remembered on this device.

Ad measurement

With your consent, our ad networks’ trackers (Google) measure our ads, from the visit to the sign-up and then to the first subscription and its amount, and may show you our ads. Your answer is valid for 13 months; you can change it here at any time.

No answer saved on this device.

After you decline, no tag is loaded anymore and the site deletes the cookies they had set on realmoon.ai. Those on the ad networks’ own domains are managed with them or in your browser.

The Moon AI app has its own privacy settings.