Skip to content
文档首页

配置参考(config.json) ​

Mogick 从全局 <config-dir>/config.json 和项目 <workspace>/.mogick/config.json 加载非敏感配置,多数用户配置以项目层优先。普通标量通常按字段覆盖;项目层非空的 llm.providers[] 整体替换全局 Provider 数组。agents 则保留全局和项目两层,按 Agent 类型与工具名解析。

MOGICK_CONFIG_FILE 只替代主配置文件加载路径,不改变 auth.json、mcp.json、Skills 或数据目录。

最小单 Provider 示例 ​

将示例地址及两处 your-model-id 替换为服务实际支持的值,并在 auth.json 中配置对应 API Key。此示例适用于 llm.providers 不存在或为空的情况;非空 provider 数组会优先于这些单 Provider 字段。

json
{
  "llm": {
    "provider": "openai-compatible",
    "base_url": "https://your-provider/v1",
    "model": "your-model-id",
    "models": [
      { "id": "your-model-id", "name": "My Model" }
    ],
    "timeout_ms": 60000,
    "max_retries": 3
  }
}

最小多 Provider 示例 ​

json
{
  "llm": {
    "providers": [
      {
        "id": "private",
        "type": "openai-compatible",
        "base_url": "https://example.com/v1",
        "models": [
          { "id": "code-model", "name": "Code Model" }
        ]
      }
    ],
    "default_model": "private/code-model"
  }
}

凭据不属于本文件,见认证与模型。

LLM 顶层字段(llm) ​

字段类型默认值说明
providersarray[]多 Provider 定义;非空时启用多 Provider 路由
default_modelstring空多 Provider 默认模型,使用 provider-id/model-id
providerstring空旧式单 Provider 类型;常用 llm-store 或 openai-compatible;providers[] 非空时忽略
base_urlstring空单 Provider API base;providers[] 非空时以 Provider 自身字段为准
modelstring空单 Provider 默认模型 ID;providers[] 非空时以 default_model 为准
modelsarray空单 Provider 静态模型列表(字段同 models[]);providers[] 非空时以各 Provider 自身 models 为准
light_modelstring回退默认模型标题、摘要等轻量任务模型
embedding_modelstring空记忆和搜索 embedding 模型;空表示不启用对应语义来源
rerank_modelstring空检索 rerank 模型
subagent_modelstring继承会话模型内置子代理默认模型
app_idstring空llm-store 应用 ID;providers[] 非空时以各 Provider 自身 app_id 为准
extra_headersobject空非敏感附加请求头;providers[] 非空时以各 Provider 自身 extra_headers 为准
timeout_msint180000普通请求和响应头超时,毫秒
connect_timeout_msint10000TCP/TLS 建连超时,毫秒
stream_idle_timeout_msint60000SSE 流无业务数据的空闲超时,毫秒
stream_overall_timeout_msint1800000SSE 请求总时长上限,毫秒
max_retriesint0失败后的最大重试次数;运行时上限为 5
client_typestringmogickX-Client-Type 请求头
client_versionstring当前二进制版本X-Client-Version 请求头

模型级 models[].thinking.enabled 是三态:true 请求开启,false 请求关闭,省略则不覆盖服务端默认值。26.9.11 的 budget_tokens 仅保留兼容,不作为思考预算发送。推理程度通过 /efforts 选择支持的值,不等同于此开关。

llm.providers[] ​

字段类型必填默认值/说明
idstring是稳定且唯一的 Provider 命名空间
typestring否llm-store 或 openai-compatible;省略时按 openai-compatible 处理
enabledbool否默认 true
base_urlstring是Provider 服务地址;llm-store 运行时追加 /api/v1
app_idstring否llm-store 的 X-APP-ID
modelsarrayOpenAI-compatible 是静态模型列表;没有启用模型时 Provider 初始化失败;llm-store 会忽略本字段并动态获取目录
extra_headersobject否非敏感附加请求头

当项目配置提供非空 llm.providers[] 时,它整体替换全局数组,不按 id 合并。

models[] ​

字段类型必填默认值/说明
idstring是发送给该 Provider 的模型本地 ID
namestring否TUI 显示名称;建议填写
descriptionstring否模型说明
input_modalsstring[]否例如 text、image
output_modalsstring[]否例如 text
context_lengthint否上下文窗口 token 数;0 表示未知
enabledbool否默认 true
thinkingobject否可选 enabled 布尔值;省略时保留服务端默认行为

Agent 工具策略(agents) ​

agents 以模式或 Agent 类型为键,例如 agent、plan。每个条目包含 tools map:

json
{
  "agents": {
    "agent": {
      "tools": {
        "shell.exec": {
          "enabled": true,
          "permission": "ask"
        }
      }
    }
  }
}
字段类型取值说明
agents.<type>.tools.<tool>.enabledbooltrue / false是否注册该语义工具;省略时继承 preset
agents.<type>.tools.<tool>.permissionstringallow / ask / deny执行权限;省略时继承 preset

agents 按层解析:项目配置中的同名 Agent、同名工具整体覆盖全局工具项;项目未声明的工具继续使用全局项,再回退到模式 preset。删除类硬门禁和 CLI 会话权限策略仍会参与最终决策。

Skills(skills) ​

字段类型默认值说明
create_rootstringmogick新建 Skill 的根目录:mogick 或 agents
create_scopestringproject新建范围:project 或 global
search_path_extrasstring[][]追加的 Skill 父目录;跨层去重追加
disabledstring[][]新会话默认禁用的 Skill ID;项目层显式列表覆盖

Memory(memory) ​

字段类型默认值说明
db_pathstring按 profile 和通道确定,见数据目录显式数据库绝对路径
enabledbooltrue同时控制检索注入和运行后抽取
retrieval.fts_top_nint50全文检索候选数
retrieval.embedding_top_nint50向量检索候选数
retrieval.directive_filter_enabledbooltrue是否启用指令矛盾过滤
retrieval.directive_filter_top_kint10过滤后保留数量
retrieval.directive_filter_min_candidatesint3启用过滤的最少候选数
retrieval.directive_filter_timeout_msint8000过滤超时,毫秒
retrieval.hybrid_weights.confidencenumber0.1混合排序的置信权重

Session(session) ​

字段类型默认值说明
heartbeat_interval_msint15000宿主会话心跳间隔
command_timeout_msint30000宿主命令超时
max_payload_bytesint1048576CRP 最大载荷,1 MiB
safe_partition_max_concurrencyint10每一步只读工具并发上限
mcp_local_max_concurrencyint3每个本地 MCP server 的并发上限
mcp_remote_max_concurrencyint20每个远程 MCP server 的并发上限
disable_stream_tools_during_stepboolfalse是否禁止在 LLM 流式阶段启动工具
checkpoint_auto_before_runbooltrue每轮用户请求前尝试创建检查点
max_concurrent_sessionsint10单个 Mogick 进程内加载的会话上限

max_concurrent_sessions 只约束单个进程,不协调共享同一数据库的多个 Mogick 实例。

注意:safe_partition_max_concurrency、mcp_local_max_concurrency、mcp_remote_max_concurrency 和 disable_stream_tools_during_step 是有效的解析字段,但当前实现不要依赖项目层 .mogick/config.json 覆盖全局值;需要设置这些运行时并发/流式边界时,优先写入全局配置或使用 MOGICK_CONFIG_FILE 指向完整配置文件。

语言、诊断与遥测 ​

字段类型默认值说明
languagestringenen 或 zh-CN
diagnose.enabledboolfalse录制 ACP/CRP diagnose 追踪
telemetry.enabledbooltrueOTel tracing 总开关;显式 false 关闭

环境诊断使用 mogick doctor --export <path>;26.9.11 的会话导出不提供协议 trace 模式。

配置合并摘要 ​

类型合并方式
普通字符串、数字多数字段项目层非零值覆盖全局;少数运行时边界字段见上方 Session 说明
显式布尔字段支持项目层显式 false 的字段按实现覆盖
llm.providers[]项目层非空数组整体替换
agents项目同名工具覆盖全局工具项;未声明项回退全局和 preset
skills.search_path_extras追加并去重
auth.providers不在 config.json;按 Provider ID 合并

完整路径和环境变量见数据目录与环境变量。

路径占位符 <config-dir>、<db-path> 指当前 profile/通道实际生效的路径,见数据目录。