配置文件

MiMo Code 以 JSON / JSONC 配置文件管理提供商、模型、服务器、工具、权限等运行时参数。多层配置合并加载,managed 层优先级最高。

加载位置、合并规则与场景对照见 配置覆盖

顶层字段

字段 类型 说明
$schema string JSON Schema URL,启用编辑器补全与校验
model string 默认主模型,格式 provider_id/model_id
small_model string 轻量任务(如标题生成)使用的模型
provider object 提供商连接与运行选项
disabled_providers array 禁用的提供商 ID 列表
enabled_providers array 启用的提供商白名单
agent object 自定义代理定义
default_agent string 默认代理
command object 自定义命令模板
permission object | string 工具操作的权限规则
tool object 工具调用风格
mcp object MCP 服务器
plugin array 插件 spec 列表(npm 包名或本地路径)
skills object 技能加载源
lsp object LSP 集成
formatter object 代码格式化程序
instructions array 指令文件路径或 glob
share string "manual" / "auto" / "disabled"
autoupdate boolean | "notify" 自动更新行为
compaction object 上下文压缩策略
checkpoint object Checkpoint 阈值与配额
snapshot boolean 启用快照(默认 true
watcher object 文件监视器忽略模式
server object mimo serve / mimo web 服务器设置
enterprise object 企业相关配置(url
username string 自定义用户名
logLevel string 日志级别
experimental object 实验性功能,不稳定

完整示例

1{
2  "$schema": "https://mimo.xiaomi.com//config.json",
3  "model": "mimo/mimo-v2.5-pro",
4  "small_model": "mimo/mimo-v2.5-pro",
5  "default_agent": "build",
6  "share": "manual",
7  "autoupdate": true,
8
9  "provider": {
10    "anthropic": {
11      "options": { "timeout": 600000, "setCacheKey": true }
12    }
13  },
14
15  "server": {
16    "port": 4096,
17    "hostname": "0.0.0.0",
18    "mdns": true
19  },
20
21  "permission": {
22    "*": "ask",
23    "bash": "allow",
24    "edit": "deny"
25  },
26
27  "compaction": { "auto": true, "prune": true, "tail_turns": 2 },
28  "watcher": { "ignore": ["node_modules/**", "dist/**"] },
29
30  "mcp": {},
31  "plugin": ["mimocode-helicone-session"],
32  "instructions": ["CONTRIBUTING.md"],
33
34  "disabled_providers": ["openai", "gemini"]
35}

TUI 相关项(tui / theme / keybinds)写在 ~/.config/mimocode/tui.json,不在此文件中。

字段说明

model / small_model

设置默认模型。格式 provider_id/model_idsmall_model 未设置时回退到主模型或提供商内更便宜的模型。详见模型与提供商

provider

每个提供商可单独配置 options

字段 类型 默认值 说明
apiKey string API 密钥
baseURL string 自定义端点 URL
enterpriseUrl string 企业版端点(如 GitHub Enterprise Copilot)
timeout number | false 300000 请求超时(毫秒),false 禁用
chunkTimeout number | false 流式响应 chunk 间超时(毫秒),false 禁用
setCacheKey boolean false 始终为该提供商设置缓存键

options 支持透传额外字段到底层 SDK。提供商专属字段(如 Bedrock 的 region / profile / endpoint)见提供商特定选项

server

mimo serve / mimo web 的服务器设置:

字段 类型 默认值 说明
port number 监听端口
hostname string 监听主机名;启用 mdns 且未设置时为 0.0.0.0
mdns boolean 启用 mDNS 服务发现
mdnsDomain string opencode.local mDNS 自定义域名
cors array<string> 允许的 CORS 来源

详见服务器

permission

控制工具操作直接执行、提示审批或被阻止。可统一设置或针对单个工具:

1{ "permission": { "*": "ask", "bash": "allow", "edit": "deny" } }

完整规则见权限

compaction

上下文自动压缩策略:

字段 类型 默认值 说明
auto boolean true 上下文已满时自动压缩
prune boolean true 删除旧工具输出以节省 Token
tail_turns number 2 压缩时保留的最近对话轮数
preserve_recent_tokens number 压缩时强制保留的最近 Token 数
reserved number Token 缓冲,避免压缩过程溢出

watcher

1{ "watcher": { "ignore": ["node_modules/**", "dist/**"] } }

agent / default_agent

agent 定义专用代理:

1{
2  "agent": {
3    "code-reviewer": {
4      "description": "Reviews code for best practices",
5      "model": "mimo/mimo-v2.5-pro",
6      "prompt": "You are a code reviewer.",
7      "tools": { "write": false, "edit": false }
8    }
9  },
10  "default_agent": "build"
11}

default_agent 必须是主代理。无效值回退到 "build" 并发出警告,对所有界面(TUI / mimo run / 桌面 / GitHub Action)生效。也可用 Markdown 文件定义代理,详见代理

command

重复任务的命令模板。详见自定义命令

1{
2  "command": {
3    "test": {
4      "template": "Run the full test suite with coverage report.",
5      "description": "Run tests with coverage",
6      "agent": "build"
7    }
8  }
9}

share

行为
"manual" 通过 /share 手动分享(默认)
"auto" 自动分享新会话
"disabled" 完全禁用

autoupdate

行为
true 启动时自动下载新版本
false 禁用自动更新
"notify" 不自动更新,仅在新版本可用时通知

未设置时启用自动更新。通过包管理器(如 Homebrew)安装时此选项不生效。

formatter

1{
2  "formatter": {
3    "prettier": { "disabled": true },
4    "custom-prettier": {
5      "command": ["npx", "prettier", "--write", "$FILE"],
6      "environment": { "NODE_ENV": "development" },
7      "extensions": [".js", ".ts", ".jsx", ".tsx"]
8    }
9  }
10}

详见格式化程序

plugin

接受 npm 包名或本地路径:

1{ "plugin": ["mimocode-helicone-session", "./plugins/local.ts"] }

详见插件

skills

1{ "skills": { "paths": ["./skills/"], "urls": ["https://example.com/bundle.json"] } }

详见 Skills

tool

控制工具调用风格:

字段 类型 说明
invocation_style string 全局调用风格(如 "json" / "xml"
invocation_style_by_tool object 按工具名覆盖

tool 与已废弃的 tools 是不同字段。tools 已合并到 permission

instructions

注入额外指令文件,接受路径与 glob:

1{ "instructions": ["CONTRIBUTING.md", ".cursor/rules/*.md"] }

详见规则

disabled_providers / enabled_providers

1{
2  "disabled_providers": ["openai", "gemini"],
3  "enabled_providers": ["anthropic", "openai"]
4}
  • 被禁用的提供商即便设置了环境变量或通过 /connect 配置密钥也不会加载,模型不出现在选择列表中。
  • 设置 enabled_providers 后仅启用列表中的提供商,其他全部忽略。
  • disabled_providers 优先于 enabled_providers

其他字段

  • mcp — MCP 服务器,详见 MCP
  • lsp — LSP 集成,详见 LSP
  • enterprise{ "url": "https://enterprise.example.com" }
  • checkpoint — checkpoint 阈值与配额(thresholds / reserved / push_caps),以 schema 为准
  • experimental — 实验性功能,可能在不另行通知的情况下变更或移除

变量替换

配置值中可引用环境变量与文件内容:

1{
2  "model": "{env:MIMOCODE_MODEL}",
3  "provider": {
4    "anthropic": {
5      "options": {
6        "apiKey": "{env:ANTHROPIC_API_KEY}",
7        "baseURL": "{file:~/.secrets/anthropic-endpoint}"
8      }
9    }
10  }
11}
  • {env:VAR} — 未设置时替换为空字符串
  • {file:path} — 相对配置文件目录,或 / / ~ 开头的绝对路径

NOTE: JSONC 中位于 // 单行注释内的占位符不会被替换。

Schema

配置文件遵循 code.xiaomimimo.com/config.json。在文件顶部添加 "$schema" 即可启用编辑器补全与校验:

1{ "$schema": "https://mimo.xiaomi.com//config.json" }