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 folder | macOS, Linux, WSL | Windows |
|---|---|---|
| Moon CLI settings | ~/ | %USERPROFILE%\.config\moon\moon.json |
| Personal agent configuration | ~/ | %USERPROFILE%\.config\moon\opencode.json |
| Agent interface | ~/ | %USERPROFILE%\.config\moon\tui.json |
| Personal instructions | ~/ | %USERPROFILE%\.config\moon\AGENTS.md |
| Personal skills | ~/, ~/ | %USERPROFILE%\.claude\skills\, %USERPROFILE%\.agents\skills\ |
| Personal 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 folder | Role |
|---|---|
opencode.json, opencode.jsonc | Agent configuration for this project. |
tui.json, tui.jsonc | Agent interface for this project. |
.opencode/ | The project’s commands, agents, skills and plugins. |
.claude/, .agents/ | The project’s skills. |
AGENTS.md, CLAUDE.md, CONTEXT.md | The project’s instructions. |
Moon CLI settings (moon.json)Link to the Moon CLI settings (moon.json) section
{
"blur": {
"mode": "secrets",
"projects": { "/home/alice/code/client": "redact" },
"allow": ["<SHA-256 fingerprint of a value>"]
},
"guard": { "enabled": true },
"updates": { "auto": true }
}| Key | Values | Effect | Command that writes it |
|---|---|---|---|
blur.mode | off, secrets, redact, strict, detect | Moon Blur mode for all your projects. If absent: secrets. | moon |
blur.projects | full folder path: mode | Moon Blur mode for a specific folder. | moon |
blur.allow | list of SHA-256 fingerprints | Values Moon Blur no longer masks. | moon |
guard.enabled | true, false | Whether Moon Guard is on. If absent: off. | moon , moon |
updates.auto | true, false | false 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:
{
"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 }
}
}| Key | Effect |
|---|---|
model | Default model, in the moonai/<id> format. See Default model. |
permission | Confirmation rules for tools. See Permissions. |
mcp | MCP servers. See MCP servers. |
instructions | Instruction files in addition to AGENTS.md: paths or patterns (guides/*.md), absolute, starting with ~/ or relative to the project. |
command | Custom commands. See Custom commands. |
skills.paths | Skill folders in addition to the usual locations. |
compaction.threshold | Automatic 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.
- Your personal configuration (
~/)..config/ moon/ opencode.json - 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.
- The project configuration, if you approved it: the
opencode.jsonfiles from the repository root down to the opened folder, then the.opencode/folders. - The configuration managed by the computer’s administrator (see below).
- 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
| Setting | Order, from strongest to weakest |
|---|---|
| Moon Blur mode | MOON_BLUR_MODE variable, folder setting, default setting, secrets. A workspace that requires Moon Blur replaces off with secrets. |
| Moon Guard | MOON_GUARD variable, guard.enabled key, off. |
| Automatic update | turned off by MOON_DISABLE_AUTOUPDATE=, by the CI variable, by updates.auto: , 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:
- the
-m(ormoonai/ <id> --model) option ofmoonormoon run; - the
modelkey of the approved project configuration; - 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/.
moon models
moon -m moonai/anthropic/claude-haiku-4.5Choosing 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:
| Key | Action |
|---|---|
edit | Creates, edits or deletes a file. |
bash | Runs a command. |
webfetch | Reads a web page. |
websearch | Searches 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 ~/.
Three ways to reduce prompts:
- The session mode: edits accepted or automatic approval, with ShiftTab,
/ormodifications /auto. See Permission modes. - “Toujours autoriser” (always allow) on a request, when it offers it.
- Rules in the project configuration, under the
permissionkey.
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.
{
"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 ) 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.
moon blur redact # all your projects
moon blur strict --here # this folder onlyModes, detection and allowed values: Moon Blur in Moon CLI.
Moon GuardLink to the Moon Guard section
Moon Guard is off by default. moon turns it on for the next launches (guard.enabled key), MOON_GUARD= for a single launch. See Moon Guard.
MCP serversLink to the MCP servers section
/mcp writes servers to your personal configuration (~/). You can also declare them by hand, in that file or in a project’s, under the mcp key:
| Key | Server type | Effect |
|---|---|---|
type | all | local (started on your machine) or remote (at an address). |
enabled | all | false: the server is not started at launch. |
timeout | all | Timeout for a request to the server, in milliseconds (5,000 by default). |
command | local | Command and arguments, as a list. |
environment | local | Environment variables passed to the server. |
cwd | local | The server’s working folder, relative to the project. |
url | remote | The server’s address. |
headers | remote | HTTP headers, for example a token: "Authorization": . |
oauth | remote | OAuth 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.
| Scope | Folders |
|---|---|
| Personal | ~/, ~/ |
| Project (after approval) | .opencode/, .claude/, .agents/ |
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:
- a single personal instruction file:
~/, otherwise.config/ moon/ AGENTS.md ~/;.claude/ CLAUDE.md - in the approved project, the
AGENTS.mdfiles from the repository root down to the opened folder. If there are none, theCLAUDE.mdfiles, otherwise theCONTEXT.mdfiles; - the files listed by the
instructionskey; - during the session, the
AGENTS.mdof 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 ~/ (for you) or .opencode/ (for the project) becomes an agent / command, named after the file.
---
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./ 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
{
"keybinds": {
"leader": "ctrl+x",
"session_new": "<leader>n"
},
"mouse": true,
"diff_style": "auto"
}| Key | Effect |
|---|---|
keybinds | Keyboard shortcuts. leader is the prefix key (CtrlX by default); the value none turns a shortcut off. |
mouse | false: the interface no longer captures the mouse. |
diff_style | auto (adapts to the terminal width) or stacked (always one column). |
scroll_speed | Scrolling 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:
| System | File |
|---|---|
| Linux | / |
| macOS | /, or a device management profile (domain ai.realmoon.moon.managed) |
| Windows | C:\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
| Variable | Effect |
|---|---|
MOON_BLUR_MODE | Moon Blur mode for this terminal (off, secrets, redact, strict, detect). Takes precedence over moon.json. |
MOON_GUARD | on or off for one launch (1, true, oui and 0, false, non are accepted). |
MOON_API_KEY | Workspace API key, to run without a terminal. See In continuous integration. |
MOON_TRUST_PROJECT | 1: loads the repository’s configuration without asking. |
MOON_ALLOW_BROAD_DIR | 1: no warning in the home folder or at the root of a drive. |
MOON_DISABLE_AUTOUPDATE | 1: turns off automatic updates. |
CI | When set (as in most continuous integration services): no automatic update. |
NO_COLOR | Launcher output without colors. |
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME, XDG_STATE_HOME | Replace ~/.config, ~/, ~/.cache and ~/. |
InstallationLink to the Installation section
| Variable | Effect |
|---|---|
MOON_INSTALL_DIR | Folder of the moon command, read by the installer and by updates. |
MOON_NO_MODIFY_PATH | 1: the installer does not change the PATH. |
MOON_VERSION | Version to install (Windows installer). |
Details: Installation options.
NetworkLink to the Network section
| Variable | Effect |
|---|---|
HTTPS_PROXY, HTTP_PROXY, ALL_PROXY | Network proxy to Moon AI. |
NO_PROXY | Addresses reached without a proxy. Moon CLI itself adds 127.0.0.1, localhost and ::1 for the agent. |
NODE_EXTRA_CA_CERTS | Your 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:
| Variable | Effect |
|---|---|
OPENCODE_SERVER_PASSWORD, OPENCODE_SERVER_USERNAME | Credentials for the local server started by moon serve. |
OPENCODE_DISABLE_MOUSE | 1: the mouse is no longer captured. |
OPENCODE_DISABLE_TERMINAL_TITLE | 1: the agent does not change the terminal title. |
OPENCODE_DISABLE_AUTOCOMPACT | 1: no automatic compaction of the conversation. |
OPENCODE_GIT_BASH_PATH | Windows: path to Git’s bash.exe, for the command tool. |
OPENCODE_LOG_LEVEL | Log 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.