DocsOpen Moon AI
Browse the docs

Moon Guard

The guard that blocks destructive commands and keeps your secrets from leaving your machine. Off by default since version 0.2.2, it turns on with one command.

On this page

Moon Guard is an optional guard that inspects the agent’s actions before they run. It blocks destructive commands, reading your Moon AI session, and sending real secrets outside your machine.

Turn Moon Guard on or offLink to the Turn Moon Guard on or off section

Terminal
moon guard on
moon guard off
moon guard       # show the status and where it comes from

The setting applies to the next launches of moon. For a single launch, use the MOON_GUARD variable, which takes precedence over the setting:

bash, zsh
MOON_GUARD=on moon
PowerShell
$env:MOON_GUARD = "on"
moon

moon doctor also shows whether Moon Guard is on.

What is blockedLink to the What is blocked section

When Moon Guard is on, these commands are refused. The agent receives a message such as “[Moon Guard] Commande bloquée : fork bomb. Exécutez-la vous-même hors de l’agent si vous êtes sûr.” (command blocked: fork bomb; run it yourself outside the agent if you are sure).

CategoryExamples
Recursive deletion of a critical targetrm -rf /, a system folder, ~, $HOME, *, .
Recursive deletion of an opaque targetrm -rf $(…), a path that climbs out of the project (../../)
Mass deletionfind … -delete, find … -exec rm
Writing directly to a diskredirection to /dev/sd* or /dev/nvme*, dd of=/dev/…, mkfs
Running downloaded codecurl or wget output piped to a shell or to python, perl, ruby, node; eval $(curl …)
Shutting down the machineshutdown, reboot, halt, poweroff, systemctl reboot
Fork bomba shell function that keeps relaunching itself

Moon Guard also blocks:

  • reading your Moon session and settings: the Moon CLI state folder, ~/.config/moon and the system keychain, including through recursive scans (grep -r, find, tar…), wildcards, symbolic links or Windows short names;
  • sending a real secret restored by Moon Blur: through a network command, a DNS query, a git push or another remote Git operation, an interpreter with inline code (python -c, node -e, powershell -Command…), a web page or web search, or an MCP tool.

What is flaggedLink to the What is flagged section

These commands are risky but common. Moon Guard shows a warning and asks you to confirm or refuse; in automatic approval mode, they go through without confirmation:

  • rm -rf on an ordinary target;
  • git push --force and git push --force-with-lease;
  • git reset --hard;
  • chmod 777 on a system path;
  • history -c (clears the shell history).

External content markedLink to the External content marked section

When Moon Guard is on, the content of a web page the agent reads is presented to it framed as untrusted external content: data to analyze, never instructions to follow. This reduces the risk that a booby-trapped page pushes the agent to act against you.

If Moon Guard does not loadLink to the If Moon Guard does not load section

When Moon Guard is on, Moon CLI sends nothing to the model until the guard is loaded. If it fails to load, the agent shows: “La protection de Moon CLI (Moon Guard) ne s’est pas chargée : par sécurité, rien n’a été envoyé. Relancez « moon » ; si cela persiste, lancez « moon doctor ».” (Moon CLI’s protection, Moon Guard, did not load: to be safe, nothing was sent; run moon again, and if the problem persists, run moon doctor).

LimitsLink to the Limits section

  • Moon Guard reads the text of commands. An obfuscated command (variables, encodings) can get past it: it is not a sandbox.
  • It adds to your confirmations; it does not replace them. Keep normal mode on a project you do not know.
  • A blocked command is still possible: run it yourself, outside the agent, if you are sure.

See alsoLink to the See also section

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.