DSH / Atlas
2026-11-02implementedarchitecture

Subagent names live in the creator's catalog

Subagent 名称记录在创建者目录中

Models coordinate subagents through `send_message`, `interrupt_agent`, `list_agents`, and Team task owners. Those tools addressed every member by a 36-character Session id. Models copy such ids poorly: they cannot recall which id belongs to which task, they mistype ids, and every listing, receipt, notice, and identity statement spends tokens on them. Descriptions explain responsibilities but repeat and cannot address

English

Problem

Models coordinate subagents through send_message, interrupt_agent, list_agents, and Team task owners. Those tools addressed every member by a 36-character Session id. Models copy such ids poorly: they cannot recall which id belongs to which task, they mistype ids, and every listing, receipt, notice, and identity statement spends tokens on them. Descriptions explain responsibilities but repeat and cannot address a member. Models need short, readable references that survive restarts and resolve to exactly one member, without a second execution identity.

Decision

The Session id remains the only execution identity for routing, authorization, persistence, task ownership, and navigation. A name is a model-facing reference to it.

Each new child has a name that is unique among its creator's children. The name is a field of the subagent/catalog entry that the creator already appends when it creates the child, using catalog payload version 3. Local and parent-delivered external creation write it; caller-delivered external runs enter no catalog and take no name. A name is 1–32 lower-case letters, digits, or hyphens starting with a letter, and is never lead. A 36-character UUID therefore never parses as a name. Omission selects the first free agent-N. An explicit name already held by a sibling fails with DUPLICATE_AGENT_NAME, and an invalid name fails with INVALID_AGENT_NAME.

The creator reserves the name synchronously at admission, before startup awaits anything. The reservation lives in process memory beside the creator's committed catalog names and is released when the catalog entry commits or startup fails. Task assignment copies the immutable full name into optional ownerName beside ownerId in the same task event. Task reads use this saved value and fall back to ownerId, so display does not require catalog traversal.

The root is always lead. A descendant's full name is the slash-separated path of names from the root without a lead/ prefix, such as reviewer/checker. Sibling-unique segments make full names unique in the tree. A child whose catalog entry predates names, and every descendant below it, keeps its Session id as its name.

ctx.subagents.resolveName() returns the Session id for lead or a full name by reading only the catalogs along the path; any other text is returned unchanged as a Session id. Tools resolve before they call messaging, interruption, or Team assignment, and those operations authorize the resulting Session id. Resolution grants no authority. Runtime-authored text names agents by full name, while durable attribution such as senderSessionId and Team ownerId keeps Session ids. The subagent runtime owns the API contract and the upgrade guide owns caller migration.

This supersedes the rejection of "unique names as sibling-routing opt-in" and the statement that creation accepts no member name in subagent teammates, and the Session-id identity text in required runtime-context identity. Their single-identity, Team, and runtime-context retention decisions remain active.

Alternatives considered

Optional naming plugin with a root-Session binding event. A separate plugin would record a name-to-Session binding in the root Session after the child starts. That adds a second write that can fail independently after startup succeeds, so a started child can lack its binding, and binding after start can report errors for children that are already running. The presentation plugin would then own cancellation of a lifecycle it does not control, would rewrite runtime-authored messages that name agents, and would still change model-visible schemas when it is absent, because the core tools must accept and render either form. Recording the name in the creator's existing catalog fact needs no second write, no rollback protocol, and no optional service.

Flat names unique across the tree. A tree-wide flat namespace needs one registry at the root that every creation must consult and update, including creations by descendants whose root may be cold. Sibling-unique segments joined into paths are unique without a root registry, and each creator checks only its own catalog.

Recyclable names. Releasing a name when its child settles would let a later sibling take it. A model that still remembers the earlier child would then message or interrupt a different agent. A name stays taken for as long as the catalog entry exists.

Automatic suffixes on conflict. Turning a duplicate reviewer into reviewer-2 would let creation succeed, but the model would believe it holds a name that the runtime never assigned. A duplicate fails so that the model chooses a name it knows.

Consequences

Catalog payload version 3 is a same-format addition: SESSION_FORMAT_VERSION is unchanged, current readers accept versions 0 through 3, and releases that predate names reject version 3 loudly. The subagentCatalog projection state version remains 6 because old checkpoint facts keep their meaning and accept named suffix events; invalidating them would add full catalog folds to cold descendant observations without changing the recovered state. Native admission rejects a repeated sibling name in own catalog facts, so a log that could make name lookup ambiguous fails before any member is resolved. The persistence acknowledgement records the type change.

Tool schemas grow by one optional name parameter on each delegation tool, and send_message and interrupt_agent rename agent_id to agent. These schema changes invalidate cached request prefixes once after upgrading. Identity runtime context, receipts, settlement notices, agent messages, and listing rows become shorter for shallow trees, while full names lengthen with nesting depth. list_agents drops parent ids and depth because a full name encodes both.

Names cannot be renamed or recycled. Historical children have no names, and no migration assigns them. Name reservations are process-local, as is subagent residency. Tools still accept Session ids, so recorded Session ids and members below unnamed creators remain addressable.

Testing

Runtime tests cover requested and default names, duplicate and invalid names rejected before startup, reservation across concurrent startup and release after failed startup, nested paths and namesOf, resolution of names, unknown text, and Session ids without granting authority, cold restoration of a member's path from the catalogs along its creation chain, and Session-id addressing below an unnamed historical creator. Catalog tests restore version-3 names beside unnamed historical entries, and the V4 format reader admits native version-3 catalog facts. Control-tool and Team-tool tests cover name-addressed messaging, listing rows, owner names, and historical owners shown by Session id. Recorded sessions pin the tool schemas, identity runtime context, receipts, listing rows, and Team policy text.

中文

Problem

模型通过 send_message、interrupt_agent、list_agents 和 Team 任务所有者协调 subagent(子智能体)。这些工具曾以 36 字符的 Session id 寻址每个成员。模型难以准确复制这类 id:记不清哪个 id 对应哪个任务,会输错 id,而且每次列表、回执、通知和身份声明都要为其消耗 token。描述能说明职责,但可以重复,无法寻址成员。模型需要简短、可读、跨重启有效且只解析到唯一成员的引用,同时不引入第二种执行身份。

Decision

Session id 仍是路由、授权、持久化、任务归属和导航使用的唯一执行身份。名称是指向它的面向模型的引用。

每个新子级都有一个名称,在其创建者的子级之间唯一。名称是创建者在创建子级时本就会追加的 subagent/catalog 条目中的一个字段,使用第 3 版目录载荷。本地创建和父级投递的外部创建写入名称;调用方投递的外部执行不进入目录,也没有名称。名称由 1–32 个小写字母、数字或连字符组成,以字母开头,且绝不能是 lead。因此 36 字符的 UUID 永远不会被解析为名称。省略时选择第一个空闲的 agent-N。显式请求同级已持有的名称会以 DUPLICATE_AGENT_NAME 失败,无效名称以 INVALID_AGENT_NAME 失败。

创建者在准入时、启动等待任何操作之前同步预留名称。预留保存在进程内存中,与创建者已提交的目录名称并列,并在目录条目提交或启动失败时释放。任务分配在同一个任务事件中,将不可变的完整名称复制到 ownerId 旁的可选 ownerName。任务读取使用此保存值,缺失时回退到 ownerId,因此展示无需遍历目录。

根的名称始终为 lead。后代的完整名称是从根开始、以斜杠分隔的名称路径,不带 lead/ 前缀,例如 reviewer/checker。同级唯一的各段使完整名称在整棵树中唯一。目录条目早于名称机制的子级及其下所有后代继续以 Session id 作为名称。

ctx.subagents.resolveName() 只读取路径上的目录,为 lead 或完整名称返回 Session id;其他文本原样作为 Session id 返回。工具先解析名称,再调用消息、中断或 Team 分配,由这些操作对解析出的 Session id 授权。解析本身不授予权限。运行时撰写的文本以完整名称指称 agent,而 senderSessionId 和 Team ownerId 等持久归属仍保留 Session id。subagent 运行时定义 API 约定,升级指南负责调用方迁移。

本决策取代 Agent Teams 队友是子代理中对“以唯一名称选择性启用同级路由”的否决以及“创建不接收成员名称”的表述,并取代必需运行时身份中以 Session id 表述身份的文本。它们的单一身份、Team 和运行时上下文保留决策仍然有效。

Alternatives considered

带根 Session 绑定事件的可选命名插件。 独立插件会在子级启动后,在根 Session 中记录名称到 Session 的绑定。这会增加第二次写入,且可能在启动成功后单独失败,导致已启动的子级缺少绑定;启动后再绑定还可能为已在运行的子级报告错误。展示用插件因此要负责取消一个不受它控制的生命周期,要改写指称 agent 的运行时消息;而且即使插件不存在,面向模型的 schema 仍会改变,因为核心工具必须接受并渲染两种形式。把名称记录在创建者已有的目录事实中,不需要第二次写入、回滚协议或可选服务。

全树唯一的扁平名称。 全树扁平命名空间需要根上的一个注册表,每次创建都要查询并更新它,包括根可能处于冷状态时由后代发起的创建。同级唯一的各段连接成路径后无需根注册表即可唯一,每个创建者只检查自己的目录。

可回收名称。 子级结算后释放名称会让之后的同级取得该名称。仍记得先前子级的模型会因此向另一个 agent 发消息或发出中断。只要目录条目存在,名称就保持占用。

冲突时自动加后缀。 把重复的 reviewer 改为 reviewer-2 能让创建成功,但模型会以为自己持有一个运行时从未分配的名称。重复名称直接失败,模型才会选择一个自己知道的名称。

Consequences

第 3 版目录载荷是同格式增量:SESSION_FORMAT_VERSION 不变,当前读取器接受第 0 至第 3 版,早于名称机制的发布会明确拒绝第 3 版。subagentCatalog 投影状态版本保持为 6,因为旧检查点事实的含义不变,且能继续处理具名后缀事件;使其失效会在冷后代观察时增加完整目录折叠,却不改变恢复结果。原生准入会拒绝自身目录事实中重复的同级名称,因此会让名称查找产生歧义的日志在解析任何成员之前就失败。持久化确认记录记录了该类型变更。

每个委派工具的 schema 增加一个可选 name 参数,send_message 和 interrupt_agent 把 agent_id 改名为 agent。这些 schema 变更会在升级后使缓存的请求前缀失效一次。对浅层树而言,身份运行时上下文、回执、结算通知、agent 消息和列表行都变短,完整名称则随嵌套深度变长。list_agents 不再携带父级 id 和深度,因为完整名称已包含这两项信息。

名称不能修改或回收。历史子级没有名称,也没有迁移为其分配名称。名称预留与 subagent 驻留一样仅限进程内。工具仍接受 Session id,因此已记录的 Session id 和无名创建者下的成员仍可寻址。

Testing

运行时测试覆盖请求名称与默认名称、启动前拒绝重复和无效名称、并发启动期间的预留和启动失败后的释放、嵌套路径与 namesOf、在不授予权限的前提下解析名称、未知文本和 Session id、从创建链上的目录冷恢复成员路径,以及无名历史创建者之下以 Session id 寻址。目录测试在无名历史条目旁恢复第 3 版名称,V4 格式读取器接纳原生第 3 版目录事实。控制工具和 Team 工具测试覆盖按名称发消息、列表行、所有者名称,以及以 Session id 显示的历史所有者。录制会话固定工具 schema、身份运行时上下文、回执、列表行和 Team 策略文本。