DocsOpen Moon AI
Browse the docs

Configuration

Settings files for Moon CLI and its agent, where they live on each system, the available keys, environment variables and the order in which they apply.

On this page

Moon CLI reads two families of files: its own settings (moon.json), written by the moon blur and moon guard commands, and the agent configuration (opencode.json, tui.json, and folders of skills, commands and instructions). Each exists in a personal version that applies to all your projects, and the agent configuration also exists at the project level.

LocationsLink to the Locations section

File or foldermacOS, Linux, WSLWindows
Moon CLI settings~/.config/moon/moon.json%USERPROFILE%\.config\moon\moon.json
Personal agent configuration~/.config/moon/opencode.json%USERPROFILE%\.config\moon\opencode.json
Agent interface~/.config/moon/tui.json%USERPROFILE%\.config\moon\tui.json
Personal instructions~/.config/moon/AGENTS.md%USERPROFILE%\.config\moon\AGENTS.md
Personal skills~/.claude/skills/, ~/.agents/skills/%USERPROFILE%\.claude\skills\, %USERPROFILE%\.agents\skills\
Personal commands~/.config/moon/commands/%USERPROFILE%\.config\moon\commands\

The agent configuration also accepts the names opencode.jsonc (with comments) and config.json in the same folder. If you set XDG_CONFIG_HOME, its value replaces the ~/.config folder.

In a project, the agent reads the following files, between the Git repository root and the opened folder:

File or folderRole
opencode.json, opencode.jsoncAgent configuration for this project.
tui.json, tui.jsoncAgent interface for this project.
.opencode/The project’s commands, agents, skills and plugins.
.claude/skills/, .agents/skills/The project’s skills.
AGENTS.md, CLAUDE.md, CONTEXT.mdThe project’s instructions.

Moon CLI settings (moon.json)Link to the Moon CLI settings (moon.json) section

~/.config/moon/moon.json
{
  "blur": {
    "mode": "secrets",
    "projects": { "/home/alice/code/client": "redact" },
    "allow": ["<SHA-256 fingerprint of a value>"]
  },
  "guard": { "enabled": true },
  "updates": { "auto": true }
}
KeyValuesEffectCommand that writes it
blur.modeoff, secrets, redact, strict, detectMoon Blur mode for all your projects. If absent: secrets.moon blur <mode>
blur.projectsfull folder path: modeMoon Blur mode for a specific folder.moon blur <mode> --here
blur.allowlist of SHA-256 fingerprintsValues Moon Blur no longer masks.moon blur allow <value>
guard.enabledtrue, falseWhether Moon Guard is on. If absent: off.moon guard on, moon guard off
updates.autotrue, falsefalse turns off automatic updates.none, write it yourself

A repository cannot change this file, and the agent’s tools cannot access it. An unreadable file is ignored: all settings then go back to their default values.

Agent configuration (opencode.json)Link to the Agent configuration (opencode.json) section

The same format is used for the personal file and for a project’s. Example project file:

opencode.json
{
  "model": "moonai/anthropic/claude-haiku-4.5",
  "instructions": ["guides/conventions.md"],
  "permission": {
    "bash": {
      "*": "ask",
      "npm test": "allow"
    }
  },
  "mcp": {
    "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "enabled": true }
  }
}
KeyEffect
modelDefault model, in the moonai/<id> format. See Default model.
permissionConfirmation rules for tools. See Permissions.
mcpMCP servers. See MCP servers.
instructionsInstruction files in addition to AGENTS.md: paths or patterns (guides/*.md), absolute, starting with ~/ or relative to the project.
commandCustom commands. See Custom commands.
skills.pathsSkill folders in addition to the usual locations.
compaction.thresholdAutomatic compaction threshold: a share of the context window (from 0 to 1, 0.8 by default) or a number of tokens.

A value can reuse an environment variable with {env:NAME}, or the content of a file with {file:path} (path relative to the configuration file, or starting with ~/). Use them to avoid writing a secret in clear text in a versioned file.

Moon CLI does not let any model provider other than Moon AI through: a provider or enabled_providers key that would add one is ignored, and session sharing stays off.

Order of precedenceLink to the Order of precedence section

Agent configurationLink to the Agent configuration section

Sources are merged in this order; a key defined lower down replaces the same key defined higher up.

  1. Your personal configuration (~/.config/moon/opencode.json).
  2. The session settings Moon CLI sets at every launch: the Moon AI provider and its models, the Auto model, a small model for background tasks, automatic compaction, default permissions.
  3. The project configuration, if you approved it: the opencode.json files from the repository root down to the opened folder, then the .opencode/ folders.
  4. The configuration managed by the computer’s administrator (see below).
  5. The keys locked by Moon CLI: Moon AI as the only provider, sharing off, no self-update of the agent.

instructions lists add up from one source to the next. A consequence of this order: in your personal configuration, the model, small_model, compaction.auto and compaction.prune keys and the edit, bash, webfetch and websearch rules are replaced by Moon CLI’s. To change them, use a project configuration.

Moon CLI settingsLink to the Moon CLI settings section

SettingOrder, from strongest to weakest
Moon Blur modeMOON_BLUR_MODE variable, folder setting, default setting, secrets. A workspace that requires Moon Blur replaces off with secrets.
Moon GuardMOON_GUARD variable, guard.enabled key, off.
Automatic updateturned off by MOON_DISABLE_AUTOUPDATE=1, by the CI variable, by updates.auto: false, without an interactive terminal or with MOON_API_KEY. Otherwise on.

Default modelLink to the Default model section

At launch, the agent picks its model in this order:

  1. the -m moonai/<id> (or --model) option of moon or moon run;
  2. the model key of the approved project configuration;
  3. Auto, Moon CLI’s default model.

The model chosen in the agent with /models applies to the current session; at the next launch, Moon CLI goes back to the rule above. moon models lists the available IDs, already prefixed with moonai/.

Terminal
moon models
moon -m moonai/anthropic/claude-haiku-4.5

Choosing a model and cost levels are covered in Workspaces and models.

PermissionsLink to the Permissions section

By default, the agent asks for your approval before it:

KeyAction
editCreates, edits or deletes a file.
bashRuns a command.
webfetchReads a web page.
websearchSearches the web.
<server>_*Uses a tool from an MCP server (for example context7_*).

The agent’s file tools never have access to the Moon CLI state folder (your session) or to ~/.config/moon.

Three ways to reduce prompts:

  • The session mode: edits accepted or automatic approval, with ShiftTab, /modifications or /auto. See Permission modes.
  • “Toujours autoriser” (always allow) on a request, when it offers it.
  • Rules in the project configuration, under the permission key.

A rule is allow (no prompt), ask (prompt) or deny (refused). For bash, a rule can target a command pattern, where * stands for any sequence of characters; when several patterns match, the last rule written wins.

Project opencode.json
{
  "permission": {
    "bash": {
      "*": "ask",
      "npm test": "allow",
      "git status": "allow",
      "rm *": "deny"
    },
    "webfetch": "deny",
    "context7_*": "allow"
  }
}

One exception since Moon CLI 0.5.0: git push and pull request creation written as such are asked even when an allow rule (for example "git *": "allow") covers them; a deny rule refuses them. See Commands that publish.

Moon BlurLink to the Moon Blur section

You set the mode with moon blur (saved in moon.json), for one terminal with MOON_BLUR_MODE, and during a session with /blur.

Terminal
moon blur redact          # all your projects
moon blur strict --here   # this folder only

Modes, detection and allowed values: Moon Blur in Moon CLI.

Moon GuardLink to the Moon Guard section

Moon Guard is off by default. moon guard on turns it on for the next launches (guard.enabled key), MOON_GUARD=on for a single launch. See Moon Guard.

MCP serversLink to the MCP servers section

/mcp writes servers to your personal configuration (~/.config/moon/opencode.json). You can also declare them by hand, in that file or in a project’s, under the mcp key:

KeyServer typeEffect
typealllocal (started on your machine) or remote (at an address).
enabledallfalse: the server is not started at launch.
timeoutallTimeout for a request to the server, in milliseconds (5,000 by default).
commandlocalCommand and arguments, as a list.
environmentlocalEnvironment variables passed to the server.
cwdlocalThe server’s working folder, relative to the project.
urlremoteThe server’s address.
headersremoteHTTP headers, for example a token: "Authorization": "Bearer {env:MY_TOKEN}".
oauthremoteOAuth sign-in settings (clientId, clientSecret, scope, callbackPort), or false to never attempt an OAuth sign-in.

Adding, connecting and securing servers: MCP servers in Moon CLI.

SkillsLink to the Skills section

A skill is a folder that contains a SKILL.md file: a name and a description in the header, then the instructions, and possibly scripts. The agent loads it when the task calls for it.

ScopeFolders
Personal~/.claude/skills/<name>/, ~/.agents/skills/<name>/
Project (after approval).opencode/skills/<name>/, .claude/skills/<name>/, .agents/skills/<name>/

In the agent, /skills lists the available skills; each one can also be called directly with /<name>.

Instruction filesLink to the Instruction files section

Instruction files go with every call to the model. The agent reads:

  1. a single personal instruction file: ~/.config/moon/AGENTS.md, otherwise ~/.claude/CLAUDE.md;
  2. in the approved project, the AGENTS.md files from the repository root down to the opened folder. If there are none, the CLAUDE.md files, otherwise the CONTEXT.md files;
  3. the files listed by the instructions key;
  4. during the session, the AGENTS.md of a subfolder whose files the agent reads.

Each file is cut off beyond 40 KB (the beginning is kept), and the total is limited to 100 KB. At launch, Moon CLI flags any file over 40 KB with an estimate of the tokens sent with each call. /init creates or updates the project’s AGENTS.md.

Custom commandsLink to the Custom commands section

A Markdown file in ~/.config/moon/commands/ (for you) or .opencode/commands/ (for the project) becomes an agent / command, named after the file.

.opencode/commands/test-module.md
---
description: Runs a module's tests and explains the failures
---
Run the tests of the $ARGUMENTS module, then summarize each failure and suggest a fix.

/test-module payments sends the text to the model, replacing $ARGUMENTS with payments; $1, $2 refer to the arguments one by one. The header also accepts agent (the agent that runs the command), model and subtask (true: run by a sub-agent).

Agent interface (tui.json)Link to the Agent interface (tui.json) section

~/.config/moon/tui.json
{
  "keybinds": {
    "leader": "ctrl+x",
    "session_new": "<leader>n"
  },
  "mouse": true,
  "diff_style": "auto"
}
KeyEffect
keybindsKeyboard shortcuts. leader is the prefix key (CtrlX by default); the value none turns a shortcut off.
mousefalse: the interface no longer captures the mouse.
diff_styleauto (adapts to the terminal width) or stacked (always one column).
scroll_speedScrolling speed.

You choose the theme with /themes. The list of default shortcuts is in Keyboard shortcuts.

Configuration managed by the administratorLink to the Configuration managed by the administrator section

On a company computer, the administrator can enforce an agent configuration, applied after the person’s and the project’s:

SystemFile
Linux/etc/moon/opencode.json
macOS/Library/Application Support/moon/opencode.json, or a device management profile (domain ai.realmoon.moon.managed)
WindowsC:\ProgramData\moon\opencode.json

The folder and the file must belong to the computer’s administration (root, with no write access for the group or others, on Linux and macOS; Administrators or SYSTEM on Windows); otherwise they are ignored.

Environment variablesLink to the Environment variables section

Moon CLILink to the Moon CLI section

VariableEffect
MOON_BLUR_MODEMoon Blur mode for this terminal (off, secrets, redact, strict, detect). Takes precedence over moon.json.
MOON_GUARDon or off for one launch (1, true, oui and 0, false, non are accepted).
MOON_API_KEYWorkspace API key, to run without a terminal. See In continuous integration.
MOON_TRUST_PROJECT1: loads the repository’s configuration without asking.
MOON_ALLOW_BROAD_DIR1: no warning in the home folder or at the root of a drive.
MOON_DISABLE_AUTOUPDATE1: turns off automatic updates.
CIWhen set (as in most continuous integration services): no automatic update.
NO_COLORLauncher output without colors.
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME, XDG_STATE_HOMEReplace ~/.config, ~/.local/share, ~/.cache and ~/.local/state.

InstallationLink to the Installation section

VariableEffect
MOON_INSTALL_DIRFolder of the moon command, read by the installer and by updates.
MOON_NO_MODIFY_PATH1: the installer does not change the PATH.
MOON_VERSIONVersion to install (Windows installer).

Details: Installation options.

NetworkLink to the Network section

VariableEffect
HTTPS_PROXY, HTTP_PROXY, ALL_PROXYNetwork proxy to Moon AI.
NO_PROXYAddresses reached without a proxy. Moon CLI itself adds 127.0.0.1, localhost and ::1 for the agent.
NODE_EXTRA_CA_CERTSYour company’s certificate, when a proxy intercepts HTTPS.

AgentLink to the Agent section

The agent receives your environment, except the MOON_* and OTEL_* variables. Of its own variables, only these are passed to it:

VariableEffect
OPENCODE_SERVER_PASSWORD, OPENCODE_SERVER_USERNAMECredentials for the local server started by moon serve.
OPENCODE_DISABLE_MOUSE1: the mouse is no longer captured.
OPENCODE_DISABLE_TERMINAL_TITLE1: the agent does not change the terminal title.
OPENCODE_DISABLE_AUTOCOMPACT1: no automatic compaction of the conversation.
OPENCODE_GIT_BASH_PATHWindows: path to Git’s bash.exe, for the command tool.
OPENCODE_LOG_LEVELLog level: DEBUG, INFO, WARN or ERROR.

The other variables of your environment, such as GITHUB_TOKEN, stay visible to the agent and to the commands it runs.

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.