## Summary Raven's host acts as the user's agent manager: it delegates production work, including small edits, to the agent whose ownership or description fits the task -- or, on a turn bound to a Worker Table, to the worker whose brief covers it -- keeps track of the task and its instance, routes follow-ups back to that instance, and gathers the results for the user. Its own tools support briefing, checking and coordination. - Add the resident `multi-agent-coding` skill for choosing coding agents, keeping one instance per task, passing results by file, isolating concurrent edits in worktrees, and handing over work when an agent exhausts its quota. - Keep the new host role authoritative in both the DAG skill's resident description and its full guide. A single task uses `spawn`, or a one-node graph when only the DAG dispatch path is available. - Rename the generic sub-agent to `Raven-General`, with `Raven` and `raven` retained as compatibility aliases. Instance records, handle locks, live activity, cancellation, preferences and RPC lookups use the same canonical identity. Historical spawn and DAG readers normalize names before liveness checks and serialization, so tasks and transcripts join the current instance roster. Concurrent alias calls preserve both turns instead of overwriting one conversation snapshot. The instance registry reads former-name rows under the current name and, on its next write, saves every loaded row under it; transcripts, direct chats and stored graphs stay as written. - Resolve built-in configuration aliases before merging fields: `Raven-General` wins over `Raven`, then `raven`, regardless of file order. Discard older rows wholesale with a warning, preventing stale model, permission or transport settings from leaking into the selected row. - Resume the most recently written message state and instance log across former names. Saved messages take precedence over an empty chat directory; equal timestamps prefer the current name and then the most recent former name. Existing files stay in place. Legacy spawn records, completed DAG manifests and unfinished graphs remain readable through the current name. - Emit the agent roster once at the end of `spawn`'s description. The registry places `run_subagent_dag` and then `spawn` last, including after late MCP or session tools. The graph tool renders the roster itself when `spawn` is unavailable. With a Worker Table bound, dispatch guidance selects worker labels from the live enum; the roster explains underlying capabilities. The tool descriptions and resident DAG guide follow the same rule. - On a turn bound to a Worker Table, such as a Persona session, `spawn` and the DAG nodes offer worker labels alone, and a generated Persona never includes the generic agent. The host role on such a turn routes production work to the worker whose brief covers it, by label, and puts work no worker covers to the user, who can add a worker or give the conversation another Harness, instead of doing it itself or naming an agent outside the enum. Ordinary turns render byte for byte as before. A Harness that `load_playbook` binds mid-turn takes effect after the identity was assembled, so that call's result carries the same routing as this system's trusted note, after the untrusted fence. The coding skill picks worker labels on such a turn, for its first pick and for a quota takeover. ## Type - [ ] Fix - [x] Feature - [ ] Docs - [ ] CI / tooling - [ ] Refactor - [ ] Other ## Verification Measured at this head on Linux/Python 3.12.13. - `UV_NO_SYNC=1 uv run --no-sync pytest -q -n 12`: **33,767 passed, 178 skipped, 2 xfailed; 9 failed and 1 error.** Eight of the failures are bound to this box and fail the same way on current main, measured the same day: five provider tests that read the box's proxy environment, a Node.js path case, a LibreOffice conversion, and a fixture that root can read anyway. The ninth, with its teardown error, is the `remote_runs` race tracked in #990; that test passed 5 of 5 runs alone, and its file 58 of 58. - 13 new regression tests for Worker Table routing: 12 fail against the previous head's source and all pass now; the thirteenth checks that a Harness loaded mid-turn leaves the next turn's role plain, and passes on both by design. The end-to-end case drives a real Persona-bound turn: both enums offer `research-a` alone, dispatching `Raven-General` is refused, and the role must name neither that agent nor the roster fallback. - Nine single-construct mutants, each applied to an isolated copy of the tree, each fail at least one new test: the role ignoring the table, the default path not reading the turn's table, the uncovered-work rule removed, the generic fallback kept in the worker routing, the coding skill reverted, and the mid-turn note never added, added on every call, added without a dispatch path, or phrased apart from the role. - The host identity on ordinary turns is byte-identical to the previous head in all 16 rendered shapes: a launched sub-agent process or not, with or without ownership lines, and every combination of the two dispatch tools. - Instance registry probe, run with this head and with main on one synthetic file: reads leave the file byte-identical; one unrelated `upsert_spawn` saves every former-name row as `Raven-General`, keeping the more recently updated of two colliding spellings and the later one in the file on a tie; main then finds none of those rows under `Raven` or `raven`. - `uv run --no-sync python scripts/coverage_gate.py --coverage-json <coverage.json> diff --base-ref origin/main --threshold 90`, over a coverage run of 225 test files (8,952 passed): **99.40%**, 167/168 executable changed lines covered. - `UV_NO_SYNC=1 make lint-types lint-imports check-large-files check-source-language COMMIT_RANGE=origin/main...HEAD`: passed; all 10 import contracts kept. - `UV_NO_SYNC=1 make check-commits`: both commit-message validators passed; each also refused a dangling control commit with a malformed subject. - `ruff check` and `ruff format --check` over the branch's Python files passed. `node ui-tui/scripts/gen-i18n.mjs --check` passed after the rebase onto #1015, which also changed the i18n catalogue. - `uv run --no-sync pre-commit run --from-ref origin/main --to-ref HEAD`: every hook passed except the whole-TUI Prettier hook, which reports only `newInstancePicker.tsx` and `subagentsHub.tsx`; both are byte-identical to current main. - Live-model replay and native Windows/macOS testing were not repeated for these fixes. - [x] Relevant tests pass locally - [x] Relevant lint / type checks pass locally - [x] User-facing docs or screenshots are updated when needed ## Risk - The host delegates work it previously performed itself, including small scripts. Task-to-instance routing remains prompt-based; a task can still stay with the host after it has already answered a follow-up itself. - In a conversation bound to a Persona or another Harness with workers, work no worker's brief covers now waits for the user to add a worker or change the conversation's Harness, rather than being carried out by the host. - Old agent spellings remain accepted. The instance registry's first write after the upgrade, of any row for any session, saves every former-name row in `subagent_instances.json` as `Raven-General`, and keeps only the more recently updated row where two spellings of one instance collide. Builds from before the rename cannot look those rows up, so reverting the squash commit alone does not restore their instance bindings: that needs the registry file as it stood before that first write. Renaming rows back by hand cannot recover a colliding row the write dropped. Transcripts, direct chats and stored graphs are not rewritten. - When multiple generic-agent configuration spellings coexist, only the newest row contributes overrides. Fields supplied exclusively by an older row are intentionally discarded. - Moving the dispatch tools changes the tool-array cache prefix once after upgrade. - A plugin participant that removes `spawn` through `select_tools` can still leave the graph tool pointing at an absent roster, because that selection occurs after the registry's offer check. No bundled participant does this. - [x] Security impact considered - [x] Backward compatibility considered - [x] Rollback path is clear for risky changes ## Related Issues N/A
experimental:数字员工的 Worker RSI
这个目录实验一件事:让 Curator 通过多轮交互,把一个 Raven 数字员工的 Harness 改造到能满足交互方提出的核心要求,像培养一个新员工那样。
- 按资料定制:交互方交出的资料(流程、规范、模板)被 Curator 落到 Harness 的四个策略面上,员工从第一轮起就按这些规矩工作。
- 按反馈改进:员工工作后,交互方说出哪里不对,Curator 修订 Harness,下一轮再检验。
通用机制(Curator、Analyst、Iteration)不认识任何具体场景;simulation/ 用一个模拟旅行社把这套机制跑起来,并留下一个展示案例。
整个目录对 Raven 源码零侵入:raven/ 没有为它改动,也不引用它。Curator 生成的东西落在 Raven 本来就开放的扩展点上(home 文件、配置、钩子、插件贡献、ACP 子代理),由真实的 Raven AgentLoop 执行;连接方式和依赖的少量内部成员见 design.md 第 5 节。
目录
experimental/
├── README.md
├── requirements.py # 行为要求 Requirement:Analyst、模拟评审与 playbook 节点要求共用
├── docs/
│ ├── design.md # Curator 怎样生成与管理 harness-of-harnesses
│ └── rsi-iteration.md # Harness 怎样在多轮反馈中迭代改进
│
├── curator/ # 【通用】读取、生成、校验、安装 Harness
│ ├── workflow.py # 入口 improve / propose
│ ├── composition/ # 两层组合:根候选 → 各子候选 → 整体校验与一次生效
│ ├── generation/ # 分阶段生成
│ │ ├── stages/ # understand → select → design → implement → repair
│ │ ├── prompts/ # 各阶段提示词
│ │ └── context/ # 生成材料的组装与只读查询
│ ├── harness/ # 产物模型、target 声明、四个公共策略协议与参考材料
│ └── raven_adapter/ # 与 Raven 运行时的连接层
│ ├── targets/ # 四个策略面在 Raven 上的扩展点声明
│ ├── bind.py, strategy.py # 把生成的策略与组件绑定到原生扩展点
│ ├── worker.py # 被培养的 worker:装载、执行、安装
│ ├── deployment.py, hosting/ # 子 Harness 的部署与 ACP 托管
│ ├── inspection/ # 从实际运行时读出当前 Harness
│ ├── observe.py # 机制每次决定写成观测记录
│ ├── exploration.py # 生成期间 Curator 的只读探索空间
│ ├── planning/, action/, capability/, memory/ # 各策略面的运行时绑定
│ ├── baselines/ # 专家与朴素 Raven 基线的准备
│ └── reference/ # 给 Curator 读的宿主参考材料
│
├── analyst/ # 【通用】把评价者的话整理成 Curator 的行为要求
│ ├── run.py # 一次有界的模型交换,产出 Feedback
│ ├── feedback.py # Feedback:决定 + 行为要求
│ ├── materials.py # 材料组装与 read_records 查询
│ ├── activity.py # 机制活动:装上的机制本轮实际做了什么
│ ├── role.py # Analyst 基类,场景可继承
│ └── prompts/
│
├── iteration/ # 【通用】多轮闭环
│ ├── run.py # 入职 curation → 每轮:试炼 → 评价 → 分析 → 修订
│ ├── protocols.py # Trial / Evaluator 协议与 Signal
│ ├── conversation.py # 对话型 Trial
│ ├── dataset.py # 数据集型 Trial 兼 Evaluator
│ ├── exchange.py # 各模型角色共用的有界结构化提交
│ ├── human.py, __main__.py # 真人 CLI:真人既对话又评价
│ └── records.py # 按轮读取一次运行的记录
│
└── simulation/ # 【实例】旅行社场景
├── __main__.py, suite.py # 单次运行与批量挖掘入口
├── scenarios/travel_agency/ # 场景数据:岗位说明、资料、评审标准、客人画像
├── employee.py # 数字员工:每张题卡一个隔离副本
├── traveller.py, cards.py # 模拟客人与每轮重新抽取数值的题卡
├── agency.py, prompts/ # 模拟老板:演练后评审,决定交出哪些资料
├── channel.py, files.py, render.py, reference.py # 客人实际看到的内容、交付物读取与页图、价目计算器
├── record.py # 把一次运行导出成培养记录 transcript
├── value.py, attribution.py, isolation.py # 价值判定、机制归因、越界检查
├── caching.py # 网关模型的提示词缓存断点
└── cases/s0925c/ # 展示案例
通用机制与场景的关系
依赖方向固定:simulation/ 引用通用层,通用层不引用 simulation/。
| 通用接口 | 旅行社场景的实现 |
|---|---|
iteration.run.run(worker, provider, trials, analyst, opening=…) |
simulation/__main__.py 组装参数,默认最多 4 轮 |
Trial.run(worker) -> Sessions |
通用的 iteration.conversation.Conversation 配模拟客人 Traveller;employee.Fresh 让每次演练从干净的子代理 home 开始,Together 让每张题卡在员工的隔离副本上并行演练 |
analyst.role.Analyst.review(…) |
agency.Agency:老板说出评审意见;默认把原话交给通用 Analyst 整理成要求 |
curator.raven_adapter.worker.Worker |
employee.hire 雇来的员工,带上 Curator 不能读的评测侧文件(withheld);employee.Replica 是每张题卡的隔离副本 |
curator.workflow.improve(worker, provider, feedback=…) |
不改,直接调用 |
入职资料 opening |
老板的入职对话与交出的资料 |
运行
# 旅行社模拟:一次运行(需要自备带 key 的配置文件)
uv run python -m experimental.simulation --config <config.json> --home <基线 home> \
--state-dir <新的空目录> --scenario travel_agency --chain documents --rounds 4
# 真人 CLI:真人既是对话方也是评价者
uv run python -m experimental.iteration --help
# 测试
uv run pytest tests/test_harness_curator_*.py tests/test_analyst_*.py tests/test_iteration_*.py tests/test_simulation_*.py
展示案例
simulation/cases/s0925c/ 是一次自动运行的培养记录:老板只交资料、扮客人演练、说意见,Curator 在入职时凭资料生成了流程与关口,之后按意见逐轮补齐,第 3 轮全部红线通过。目录里有案例说明、系统自动导出的 transcript,以及第 1 轮和第 3 轮的方案 PPT。