架构 · 难度:进阶

配置系统

两个文件,一个特殊键,覆盖所有消费方。本页文档化整个配置系统。

一句话规则

每一个 CE 配置键的解析顺序为:.compound-engineering/config.local.yaml(用户覆盖,永不提交)→ .compound-engineering/config.yaml(共享,已提交)→ 技能默认值。首个有效值胜出。唯一的例外是 docs_root,它只从 config.yaml 读取。

双层规则

CE 配置解析顺序 — local.yaml 优先,config.yaml 共享,skill default 兜底 config.local.yaml 用户覆盖 · 永不提交 · 先读者胜出 config.yaml 共享 · 提交至仓库 · 包含 docs_root active value wins skill default last resort
每个普通 CE 配置键的解析顺序。

精确规则(所有读取 CE 键的技能通用):

  1. 先读 .compound-engineering/config.local.yaml,再读 .compound-engineering/config.yaml。缺失的文件跳过。
  2. 首个有效(非 # 注释)的值胜出。
  3. 对于标量:空值视为未设置(跳到下一个文件);非法值继续到下一个文件,再回退到技能默认值。
  4. 对于列表与映射:只要键存在(包括空列表或空映射),就整体替换该键。
  5. 本规则不适用于 docs_root(见下文)。

docs_root —— 唯一的特殊键

维度取值
读取来源.compound-engineering/config.yaml 唯一来源 —— 绝不从 config.local.yaml 读取
未设置时 →<root> = docs/
校验必须是相对仓库的目录,其真实路径(解析符号链接后)必须位于仓库内,既不能是仓库根目录,也不能位于 .git/ 之下
非法时 →直接报错并指出 docs_root 及其值;绝不回退到 docs/
使用方所有写入工件的技能:ce-brainstorm, ce-plan, ce-ideate, ce-debug, ce-explain, ce-dogfood, ce-code-review, ce-commit-push-pr, ce-compound, ce-compound-refresh, ce-optimize, ce-sweep, ce-product-pulse, ce-setup, lfg
为何 config.local.yaml 不参与

docs_root 定义的是物理机器上的位置。若某位开发者的本地覆盖泄漏到了 CI,CI runner 就会试图将工件写入本机不存在的路径。把它保留在共享文件里,是最稳妥的护栏。

全部 CE 配置键

下面是完整的键清单。“Consumer”列标明读取该键的技能;“Default”列展示当两文件中都未设置时,技能自身的默认值。

类型默认值消费方技能特殊规则
docs_rootstringdocs所有写入工件的技能仅来自 config.yaml
实现路由
work_engine_modestring(无)ce-workreferences/execution-engines.md 读取
work_engine_preferencesmap(无)ce-work格式异常 → 通过 ce-setup 修复
规划输出
brainstorm_outputstringhtmlce-brainstormhtml | md
brainstorm_modelstring(无)ce-brainstormbrainstorm 子代理使用的模型
ideate_outputstringhtmlce-ideatehtml | md
PR 描述
pr_teaching_sectionbooleantruece-commit-push-pr只有有效(非注释)的键才计入;模板里的注释行不是默认
pr_teaching_archivebooleanfalsece-commit-push-pr
auto_babysitbooleantruece-commit-push-prfalse = 跳过 PR babysit 交接
产品脉搏
pulse_product_namestring(无)ce-product-pulse未设置 = 首次运行时进行访谈
pulse_lookback_defaultstring24hce-product-pulse回溯时间窗(24h7d 等)
pulse_db_enabledbooleanfalsece-product-pulseDB 查询为可选项
反馈扫描
feedback_sourceslist(无)ce-sweep未设置 = 首次运行时进行访谈;详见 docs/guides/packs.md
sweep_intervalstring(无)ce-sweep给 cron 用的调度提示
代码评审
cross_model_review_modestring(无)ce-code-review + ce-doc-reviewoff = 跳过跨模型评审;在跨模型评审前检查
Compound Packs
packslist[]ce-code-review + ce-dogfood已声明的 Pack ID

ce-docs-rootce-config-layers 代码段

每个读取 docs_root 的 SKILL.md 都包含如下逐字段(摘自 docs/solutions/developer-experience/always-on-agents-md.md):

<!-- ce-docs-root:start -->
Resolve the CE artifact root <root> before composing any artifact path.

- **Read** `docs_root` from `<repo-root>/.compound-engineering/config.yaml` only
- **Validate**: repo-relative, real path inside repo, not repo root, not under .git/
- **Use** `<root>` as sole artifact location; create if absent
<!-- ce-docs-root:end -->

普通键对应的代码段:

<!-- ce-config-layers:start -->
Resolve ordinary CE yaml keys from the two repo files.

- Read config.local.yaml, then config.yaml (git rev-parse --show-toplevel)
- First active (non-commented) value wins
- For scalars: empty = unset; invalid → next file → skill default
- For lists/maps: present key (including empty list/map) replaces whole key
- Do NOT use for docs_root
<!-- ce-config-layers:end -->
用户本机配置的归属

提交到 config.yamldocs_rootpacksfeedback_sources(若全团队共用)以及任何 CI 可见的项。
保留在 config.local.yamlbrainstorm_modelideate_outputpr_teaching_archivepulse_product_name 以及任何用户特定的项。

模板与示例文件

skills/ce-setup/references/config-template.yaml 是模板。其逐字节一致的副本是 .compound-engineering/config.example.yaml。新增或修改配置项时,两者必须保持同步。

ce-setup 的 Phase 2 会刷新 config.example.yaml,并在缺失时询问是否创建 config.yaml