Once you are signed in, you use Moon CLI from your project folder. You describe the task; the agent reads the code, proposes changes and runs commands, with your approval.
Start the agent in a projectLink to the Start the agent in a project section
cd my-project
moonYou can also point it at another folder: moon .
At startup, the terminal shows a summary: your workspace and its plan, the selected model, the Moon Blur mode and your usage (5-hour session, week, month). The usage bar turns amber from 75% and red from 90%. The agent interface then opens.
The agent works in this folder, inside the Git repository that contains it. It never loads configuration or instructions located above the repository root.
At the end of the session, Moon CLI tells you how many values Moon Blur masked.
Home folder and drive rootLink to the Home folder and drive root section
Started in your home folder or at the root of a drive, the agent would scan every file and startup could take several minutes. Moon CLI warns you and asks “Continuer quand même ? [o/N]” (continue anyway?). Move to a project folder instead.
To stop seeing this warning (in a script, for example), set MOON_ALLOW_BROAD_DIR=.
A repository’s configurationLink to the A repository’s configuration section
A repository can contain agent configuration: it can launch plugins, add MCP servers or skills, or allow commands without confirmation. A booby-trapped cloned repository could use it to take control. Moon CLI only loads it with your approval.
Files involved, in every folder between the opened folder and the repository root:
opencode.json,opencode.jsonc,tui.json,tui.jsonc;- the
.opencode/,.claude/andskills/ .agents/folders.skills/
If any of them exists, Moon CLI lists them and asks “Faire confiance à cette configuration ? [o/N]” (trust this configuration?).
| Answer | Effect |
|---|---|
o (oui, yes) | The configuration is loaded. Your approval is remembered for this repository as long as these files do not change. |
N (no, the default) | Nothing from the repository is loaded for this session: no configuration, plugins or skills, and no AGENTS.md or CLAUDE.md. |
- The question comes back if the content of these files changes.
- Beyond 5,000 files or 200 MB, the configuration cannot be fully checked: the question comes back at every launch.
- Without an interactive terminal, the repository’s configuration is ignored, unless
MOON_TRUST_PROJECT=is set.1 - A repository with none of these files does not trigger the question: its instruction files are read normally.
- To forget all your approvals, delete the
trusted-projects.jsonfile from the state folder (see File locations).
Instruction filesLink to the Instruction files section
The agent reads your project’s AGENTS.md files (or CLAUDE.md, then CONTEXT.md, if there is none) and your personal instruction file (~/, or ~/ if there is none). They go with every call to the model, so they count against your usage limit. Above 40 KB, Moon CLI shows a warning at startup with an estimate of the tokens sent with each call: keep these files short.
/init creates or updates the project’s AGENTS.md. Reading order and limits: Instruction files.
The interfaceLink to the The interface section
- Header: your workspace and the gauge of your usage limit.
- Status bar: folder, Git branch, Moon Blur mode and how full the context is.
- Input panel: your message and the active permission mode.
- Actions: each action of the agent is summed up on one line.
- Permissions and questions: choices are numbered; answer with the 1, 2, 3 keys.
- Moon, the Moon AI mascot, follows the session: it thinks, acts, waits for your approval, cheers at the end of a turn or looks worried about an error.
/themes changes the colors of the whole interface.
Writing to the agentLink to the Writing to the agent section
| Input | Effect |
|---|---|
| Text, then Enter | Sends the request. ShiftEnter starts a new line. |
@ | Cites a project file, an agent or a resource from an MCP server. |
/ | Opens the list of commands. See Interface commands. |
! at the start of the input | Switches to shell mode: the line runs as a command in the project. |
| Esc twice | Interrupts the current response. |
The build and plan agentsLink to the The build and plan agents section
Two main agents are available. Tab or /agents switches between them.
| Agent | Use |
|---|---|
build | The default agent, with every tool: it reads, edits and runs commands. |
plan | Analyzes and proposes without changing your files. Useful to explore a repository before you allow changes. |
To explore the code, the agent can hand part of the work to a sub-agent, which uses an economical model.
Permission modesLink to the Permission modes section
By default, the agent asks for your approval before it changes a file, runs a command, reads a web page or searches the web, and before it uses an MCP server’s tool. Some requests also offer to always allow (for a website, for example).
Three modes change this behavior:
| Mode | File changes | Commands, web and MCP tools | Indicator |
|---|---|---|---|
| Ask (“Demander”) | Asked | Asked | none |
| Accept edits (“Accepter les modifications”) | Not asked | Asked | “⏵⏵ Accepter les modifications” |
| Autonomous (“Autonome”) | Not asked | Not asked | “⏵⏵ Autonome” |
- ShiftTab goes from Ask to Accept edits, then to Autonomous if you have already accepted it in this session, then back to Ask.
/turns Accept edits on or off.modifications /autoturns Autonomous mode on or off. The first time in a session, Moon CLI asks “Passer en mode Autonome ?” (switch to Autonomous mode?) and shows the warning below.moon --autostarts directly in Autonomous mode, with no confirmation.
Requests already on screen when you change mode still wait for your answer.
In the terminal, every session starts in Ask mode, unless you use moon --auto. In Code, on the web with moon rc as in Moon Desktop, “Keep the chosen mode” makes the next sessions of a folder start in the last mode you chose (Moon CLI 0.5.4): see Keep the chosen mode.
In Ask and Accept edits modes, git push and pull request creation written as such (Moon CLI 0.5.0), and the deletions Moon CLI recognizes (Moon CLI 0.6.0), are always asked: see Commands that publish and Deletions. So are the writes of your Moon AI connectors: see Moon AI connectors in Moon CLI.
To allow certain commands permanently in a project, use permission rules: see Permissions.
When your organization does not allow Autonomous modeLink to the When your organization does not allow Autonomous mode section
A managed organization can prevent its members from using Autonomous mode. With Moon CLI 0.5.4 or later, in a workspace of that organization:
- ShiftTab and
/autono longer offer it; Accept edits is still allowed. moon --autostarts in normal mode and says so: “Votre organisation ne permet pas le mode Autonome : Moon CLI démarre en mode normal.” (your organization does not allow Autonomous mode: Moon CLI starts in normal mode).moon rundenies permission requests as it does without--auto, and says so.- In Code, “Autonomous” is no longer offered, and an Autonomous mode kept for a folder is not applied.
- As long as Moon CLI could not read the rule, it does not grant this mode: “La règle de votre organisation sur le mode Autonome n’a pas pu être lue : Moon CLI démarre en mode normal.” (your organization’s rule on Autonomous mode could not be read: Moon CLI starts in normal mode).
The rule does not apply to Moon CLI started with an API key (MOON_API_KEY). See Moon CLI Autonomous mode.
Commands that publishLink to the Commands that publish section
Since Moon CLI 0.5.0, a command that can publish your code outside your computer is asked every time in Ask and Accept edits modes, and since Moon CLI 0.6.1 in Autonomous mode too (as it was up to 0.5.6; in 0.6.0, it went through without asking):
git push, in its written forms (git,-C folder push sudo, an alias defined on the same line…);git push - creating a pull request:
gh pr createand its equivalents for other forges; - anything that changes where and how a push will go:
gitorremote add set-url, a push URL or a git alias set withgit config; - since Moon CLI 0.6.1, a deployment or an upload to a server (
vercel,netlify,deploy firebase,deploy wrangler,deploy scp,rsyncorrcloneto another machine,curlsending data to an address that is not on your computer,kubectl,apply terraform…), publishing a package (apply npm publish,cargo…) and whateverpublish ghorglabwrites to GitHub or GitLab (gh,issue create gh pr merge,gh,release create gh apiwrites…).
Reading from the network is not publishing: curl or wget reads, a download, npm install, git fetch and git pull, gh api reads, scp that copies a file back to your machine. In Autonomous mode, Moon runs them without asking.
An allow rule in the configuration, or an earlier “Toujours autoriser” (always allow), changes nothing here; a deny rule refuses the command. When in doubt, Moon asks: a command that looks like a push is asked.
- The request is titled “Commande shell qui publie” (shell command that publishes). It shows the command, says where the push goes (the remote repository’s address, without credentials) and which commits are sent, and only offers “Autoriser une fois” (allow once) and “Refuser” (deny).
- Since Moon CLI 0.6.1, these commands are asked in Autonomous mode too (
moon --autoincluded); in 0.6.0, they went through without asking. moon run, with nobody there to answer, refuses these commands and explains why, with or without--auto.- On the Code page, the same request appears as a card: see Publish: git push and PR.
DeletionsLink to the Deletions section
Since Moon CLI 0.6.0, a deletion that Moon CLI recognizes is always asked in Ask and Accept edits modes: rm, del or Remove-Item, a file emptied or overwritten, git clean, git , git checkout on files, a patch that removes a file, and Moon’s delete tool. A “Toujours autoriser” (always allow) rule changes nothing here.
- The request, in red, lists the files that will go and says what will happen: “Les fichiers vont à la corbeille.” (the files go to the trash) for Moon’s delete tool, “Cette commande peut supprimer ou écraser pour de bon : rien ne passe par la corbeille.” (this command can delete or overwrite for good: nothing goes through the trash) for a command. It only offers “Autoriser une fois” (allow once) and “Refuser” (deny).
- Moon prefers its delete tool, which moves files to the system trash (Windows, macOS, Linux) instead of erasing them. The
.gitfolder is off limits to it, except in Autonomous mode. - In Autonomous mode, deletions go through without asking, even outside the project; Moon CLI notes them in the terminal.
moon runwithout--autorefuses them and suggestsmoonto accept them automatically.run --auto - In Code, the same request appears as a card, and deletions stay listed in the rail, with “Restore”: see Deletions.
Moon’s questionsLink to the Moon’s questions section
When a decision is yours to make, Moon can ask you a question while it works, with answers to pick from or an answer to type. Answering authorizes nothing: every action is still asked. In Code, the question appears as a card: see Moon’s questions.
Background commandsLink to the Background commands section
Since Moon CLI 0.5.1, when Moon starts a command that runs indefinitely, such as a development server (npm run dev) or a test watcher, it leaves it in the background and takes back control after a few seconds, with its first lines. Before, it was cut off after two minutes, or started outside any tracking (with & or Start-Process, for example).
- The request is titled “Commande shell, en arrière-plan” (shell command, in the background). It explains, in French, that the command keeps running after this step, with everything it starts, until it ends, is stopped, or Moon CLI closes; that anything it opens, such as a browser, may close with it; and that
/fondshows or stops it. It follows the same rules as any command: the permission mode, Moon Guard and commands that publish. /fondlists the background commands, the session’s first, with their status (“en cours depuis 3 min”, running for 3 min; “terminée (code 1)”, finished (code 1); “arrêtée par vous”, stopped by you…) and their last line. Enter on a running command stops it, along with everything it started: “Commande arrêtée, avec tout ce qu’elle avait lancé.” (command stopped, along with everything it had started).- When they stop: when they end, when you stop them, or when you quit Moon CLI. Interrupting Moon (Esc twice) does not stop them, except in the first seconds after launch. With
moon, they stop whenrun --auto moon runfinishes. - Moon can also read their output or stop them itself, for example to restart a server with other options.
- Limits: 8 background commands at a time per session, 16 for a single Moon CLI.
- On the Code page and in Moon Desktop, the “In progress” panel shows them with their last lines and stops them in one click: see Background commands.
Agent commandsLink to the Agent commands section
Type / in the agent to show the commands, or CtrlP for the palette. The most used:
| Command | Purpose |
|---|---|
/models | Choose the model, with its cost level. |
/workspace | Change the session’s workspace. |
/usage | See your usage: 5-hour session, week, month. |
/blur | Change the Moon Blur mode for the session. |
/mcp | Add and connect MCP servers. |
/compact | Summarize the conversation to free up context. |
/undo | Undo the last message and its file changes. |
/revue | Get the current changes reviewed: findings by file and by severity (Moon CLI 0.5.0). |
/new | Start a new session. |
Full list with aliases: Interface commands.
Task without the interface (moon run)Link to the Task without the interface (moon run) section
For a one-off task, without opening the interface:
moon run "explain what the src/api folder does"
moon run --auto "add a test for the parse_date function"moon "…" does the same thing: a first argument that is not an option, a command or an existing folder is treated as a task. Moon CLI prints the answer, then exits.
Nobody is there to answer permission requests: without --auto, every file change, command or web access is denied, and the terminal shows “permission demandée : … ; refus automatique” (permission requested: …; automatically denied). Reading and searching the code still work. With --auto, every request is accepted: since Moon CLI 0.6.0, that includes deletions and commands that publish (git push, pull request creation); from 0.5.0 to 0.5.6, the latter were still refused. A Moon AI connector write that Moon AI asks about in every mode (a payment, a bulk send) is refused, since nobody is there to approve it.
| Option | Purpose |
|---|---|
--auto | Approve everything without asking, including deletions, actions outside the project and publishing (dangerous). |
--dir | Work in another folder. The trust question and the Moon Blur mode apply to that folder. |
-m, --model | Choose the model, for example moonai/auto. |
-c, --continue | Continue the last session. |
Whatever you send on standard input is added to the request: git . All options: moon run.
In continuous integrationLink to the In continuous integration section
Without an interactive terminal, Moon CLI does not start a browser sign-in. Use a workspace API key (moai_org_…) in the MOON_API_KEY variable: nothing is written to disk, and the workspace and plan are those of the key.
export MOON_API_KEY="moai_org_..."
export MOON_TRUST_PROJECT=1 # only if the repository's configuration is safe
export MOON_GUARD=on # blocks destructive commands
moon run --auto "run the tests and summarize the failures"--autolets the agent run commands: keep it for a disposable environment.- The key is removed from the environment of the agent and of the commands it runs.
- Automatic updates do not run in continuous integration.
- To create a workspace key, see Workspace keys.