[feat] omp:完整配置顾问(advisor)——开关与 advisor.* 设置、多顾问 WATCHDOG.yml、WATCHDOG.md、用户级与项目级
Describe the feature or problem you’d like to solve
magpie 的 omp 行现在只能设置顾问的模型和思考强度,也就是 ~/.omp/agent/config.yml 里的 modelRoles.advisor(internal/agent/omp.go 的 role("advisor", …),#1397)。omp 的顾问还有很多其他设置,用户级和项目级都有,magpie 一项都还没有。
下面这些都是从已安装的 omp 18.15.0 里读出来的,对照的是 magpie origin/main(441a2b6b)。
1. 全局顾问设置(config.yml 里的 advisor.*)
| 键 | 取值 | omp 默认值 | 作用 |
|---|---|---|---|
advisor.enabled |
bool | false |
总开关 |
advisor.reviewMode |
turn / agent-end |
turn |
每轮审,或者只在完成时审(没有 WATCHDOG.yml 时才生效) |
advisor.reviewInterval |
1, 2, 3, 5, 10 … | 1 |
每 N 次审一次(没有 WATCHDOG.yml 时才生效) |
advisor.syncBacklog |
off / 1 / 3 / 5 / strict |
off |
顾问积压时是否让主 agent 等它 |
advisor.maxNotesPerUpdate |
1–32 | 4 |
每次审查最多给几条非 blocker 建议 |
advisor.continueSeverity |
nit / concern / blocker |
concern |
agent 已经结束后,什么级别的建议能把它叫回来继续 |
advisor.immuneTurns |
0–5 | 3 |
顾问打断一次后,接下来几轮里 concern 不再打断 |
advisor.evictStaleResults |
bool | true |
清掉旧审查留下的 read/grep/glob 输出 |
2. 子代理的顾问开关:task.agentAdvisor。这是一个记录,按子代理分别设 on / off,旧的 advisor.subagents 会被迁移到这里。
3. 顾问的备用链:retry.fallbackChains.advisor。magpie 会改写里面的模型引用(ompRefKeys),但界面上没有地方能编辑。
4. 多顾问列表 WATCHDOG.yml(也认 WATCHDOG.yaml)
instructions: 所有顾问共用的提示 # 可选
maxNotesPerUpdate: 4 # 可选,所有顾问共用
advisors:
- name: quick # 必填
model: magpie/opendesign/deepseek-v4.1-flash:max
reviewInterval: 2
instructions: 只盯明显的执行错误……
- name: final
model: magpie/anthropic/claude-opus-5-5:medium
reviewMode: agent-end
instructions: 宣布完成时做终审……
每个条目可以写的字段:model、tools、reviewMode、reviewInterval、syncBacklog、instructions、enabled、maxNotesPerUpdate、scope(main / subagent / all)、includeReasoning。
5. 关注点提示 WATCHDOG.md:每个文件的内容会以「Especially pay attention to」的形式加进顾问的提示词。
这些设置都分用户级和项目级:
| 用户级 | 项目级 | |
|---|---|---|
advisor.*、task.agentAdvisor、retry.fallbackChains |
~/.omp/agent/config.yml |
<项目>/.omp/config.yml(叠加在用户级之上) |
WATCHDOG.yml / WATCHDOG.md |
~/.omp/agent/ |
从当前目录一直往上到仓库根目录,每一层的 .omp/ 和目录本身 |
magpie 只读写用户级的 config.yml,项目级的文件和所有 WATCHDOG.* 都不管。
由此带来的问题:
- 只选模型,顾问不会运行。
advisor.enabled默认是false,magpie 不写也不显示它,所以只在 magpie 里选了「顾问」,顾问根本不会跑。 - 有了
WATCHDOG.yml,magpie 的「顾问」选项可能不起作用。 只要advisors列表不为空,omp 就只跑列表里的顾问,modelRoles.advisor只给没写model的条目当默认值。全局的advisor.reviewMode和advisor.reviewInterval也不再生效:条目不写的话默认是turn和1,不会沿用全局设置。magpie 界面上对这些都没有提示。 - 项目级设置会悄悄覆盖用户级。 项目里的
.omp/config.yml和WATCHDOG.yml会改变实际生效的顾问,但在 magpie 里看不到。
Proposed solution
在 omp 行里加一个完整的「顾问」区域:
-
开关:直接对应
advisor.enabled。只选了模型但开关没开的时候,要提示「顾问未启用」。 -
全局设置:上面表格里的 8 个
advisor.*设置。下拉选项可以直接用 omp 自带的 label 和 description,它们都在 omp 的 settings 定义里,ui.group是"Advisor"。 -
多顾问:可以增删顾问,每个能设置:
- 模型和思考强度
- 审查时机:每步 / 每 N 步 / 完成时
instructions、scope、enabled、syncBacklog、maxNotesPerUpdate、includeReasoning- 共用的
instructions
magpie 把这些写到
~/.omp/agent/WATCHDOG.yml。 -
关注点:编辑
~/.omp/agent/WATCHDOG.md。 -
子代理:按子代理开关顾问(
task.agentAdvisor)。 -
备用链:编辑
retry.fallbackChains.advisor。 -
项目级:magpie 已经从 omp 的会话里知道用户在哪些项目里用过 omp(
internal/sessions/omp.go),可以列出这些项目,或者让用户手动选一个项目文件夹,然后:- 显示和编辑该项目的
.omp/config.yml里的advisor.*,以及该项目的WATCHDOG.yml和WATCHDOG.md - 显示合并之后实际生效的顾问,并标明每一项来自哪个文件
- 显示和编辑该项目的
-
其他:
- 「改动了…」的列表和「断开并还原」要包含 magpie 写过的所有新文件和新键。
- 检测到
WATCHDOG.yml时,在「顾问」那一行标出「已由 WATCHDOG.yml 接管」。
Additional context
omp 18.15.0 的行为细节(来源:advisor/config.ts、session-advisors.ts,以及 settings 定义):
- 合并顺序:先读用户级,再读项目级;项目级从外层目录到内层目录依次读。
advisors按name合并,同名的以后读到的为准,不同名的叠加。共用的instructions会拼接起来,共用的maxNotesPerUpdate以最后一个为准。 scope:main只在主会话运行,subagent只在子代理里运行。enabled: false:顾问会显示为暂停状态。model匹配不到:omp 会给出提示「Advisor "x": no model matched」,这个顾问不运行。tools:只认 omp 已知的工具名,不认识的会被丢掉并记录日志。syncBacklog:条目不写的话沿用全局的advisor.syncBacklog。WATCHDOG.md:用户级和项目级找到的所有文件都会生效,不会互相覆盖。
PRs here are limited to collaborators, so the implementation is on a branch of my fork:
https://github.com/MystryMocha/magpie/tree/omp-advisor-config (3 commits on b088fd0f)
sessions: omp's projects, the folders its sessions ran inagent: omp's advisor settings, roster, notes, subagents and fallback chain, a user's and a project's (#5019)gui: omp's row edits its advisor, in the reader's language (#5019)
What it does. omp's row on the Agents page gets an Advisor sheet. It edits these at the user's level (the profile folder's config.yml / WATCHDOG.yml / WATCHDOG.md) or a project's (<project>/.omp/…):
- omp's eight
advisor.*settings - the
WATCHDOG.ymlroster: one line per advisor, which opens out in place, with each pick written at once WATCHDOG.mdtask.agentAdvisorper subagentretry.fallbackChains.advisor
An advisor's thinking levels are the ones models.yml gives its model. Disconnect puts back only what magpie wrote while connected and the user hasn't changed since. The disconnect preview lists the project files too. Every word is translated. Details are in the omp's advisor row of docs/subsystems/agent-wiring.md.
Tested on Windows 11 with omp 18.15.0:
- Go:
- the 10
TestOmpAdvisor*tests and thesessionsomp tests pass - all of
internal/agent's WSL tests pass: 74 onmain, 75 here
- the 10
- Browser:
omp-advisor.test.cjspasses 8/8: Chromium and WebKit × en/zh × 800px/390pxi18n-keysandold-webkitpass- of the 958 tests in the
agent-*/modal*/ prefs files, 953 pass. The 5 that fail (agent-disconnect-preview,modal-morph) fail the same way on unchangedmain
- Breaking the in-place redraw or the
Levelswiring by hand turns their tests red - Clicked through in the desktop app with a real config
- The full
go test ./...on Windows has failures such asappdir,TestWorkBuddyRestartOnMacandTestCCListingKeepsItsNames. Each one fails the same way on unchangedmain.
Harm check: nothing under .github, no Dockerfile or site/ changes, no go.mod / go.sum / package.json changes, no new network addresses.
Rebased omp-advisor-config onto main at 94d4866b: it's now the same 3 commits on that instead of b088fd0f. The conflicts were small, and both sides were kept in each. One change beyond the rebase: a comment cut from app.js so the core scripts stay inside their budget, with no raise (noted in core_budget_test.go).
Run on Windows: the omp GUI tests pass in Chromium and WebKit (32 of 32). internal/agent, internal/gui and internal/sessions show no reds that clean main doesn't show on the same box, apart from TestLaneLimitRoutes, which was red once in a full run and passed on rerun. Not run: the whole GUI suite and a full go test ./....