DSH / Atlas
2026-10-13implementedarchitecture

Team identity in required runtime context

必需 runtime context 中的 Team 身份

A teammate identity embedded in its initial task depends on ordinary history retention. Compaction can remove it, and an ordinary fork from that teammate can retain the old role even though the fork is an independent Lead. Identity must reflect current membership while keeping shared system instructions uniform.

English

Problem

A teammate identity embedded in its initial task depends on ordinary history retention. Compaction can remove it, and an ordinary fork from that teammate can retain the old role even though the fork is an independent Lead. Identity must reflect current membership while keeping shared system instructions uniform.

Decision

tool-agent-team contributes team:identity through the Agent-scoped systemPrompt.context() registry with required: true. Its provider reads the existing Team membership and renders the member's role, name, and addressing instructions. Optional-context suppression cannot remove it. Fixed collaboration policy stays in the system prompt; roster and task state remain tool queries. Initial tasks contain only their supplied content.

The loop owns logging, retained-snapshot comparison, and re-admission after compaction. A changed role appends the current full runtime-context snapshot after inherited history; unchanged retained context adds no message. No Team-specific retention state, event type, or log migration is introduced. Existing recorded reminders remain historical messages.

This supersedes only the initial-task identity decision in Agent Teams; its roster, mailbox, and task decisions remain active.

Alternatives considered

Keep identity in the initial task. Preserves a uniform system prompt but cannot restore removed identity or correct a fork's inherited role without another mechanism.

Put identity in the system prompt. Makes system text differ across members and can rewrite the inherited request prefix on routes without in-history system updates.

Add custom reminder retention and reinjection. Duplicates the loop's existing runtime-context projection and recovery responsibilities.

Consequences

Members pay for identity within the full runtime-context snapshot. Other context changes repeat it, while stable retained context adds no new message. Forks preserve inherited history and append current identity; actual provider cache hits remain best-effort. Existing Team authorization remains in tool execution.

Verification covers fresh and fork teammates, an independent fork from a teammate, optional-context suppression, compaction restoration, cold resume, and registration disposal. The recorded team-targets scenario pins Lead context; the keyless headless Team workflow pins teammate context through the shipped profile.

中文

Problem

嵌入初始任务的 teammate 身份依赖普通历史保留。压缩可能移除它;从 teammate 创建的普通 fork 即使已成为独立 Lead,也可能保留旧角色。身份必须反映当前 membership,同时保持共享系统指令一致。

Decision

tool-agent-team 通过 Agent 作用域的 systemPrompt.context() 注册 team:identity,并设置 required: true。提供方读取现有 Team membership,渲染成员角色、名字与寻址说明。关闭可选 context 不能移除它。固定协作策略保留在 system prompt;roster 和 task 状态仍通过工具查询。初始任务只包含传入的正文。

Loop 负责日志记录、保留快照比较和压缩后的重新接纳。角色变化会在继承历史之后追加当前完整 runtime-context 快照;保留的 context 未变化时不追加消息。不引入 Team 专属的保留状态、事件类型或日志迁移。已有身份提醒仍作为历史消息保留。

本决策仅取代 Agent Teams 中的初始任务身份决策;其 roster、mailbox 和 task 决策仍然有效。

Alternatives considered

身份留在初始任务中。 保持 system prompt 一致,但恢复被移除的身份或纠正 fork 继承的角色需要额外机制。

身份放进 system prompt。 成员之间的 system 文本会不同;不支持历史内 system 更新的路由可能重写继承的请求前缀。

添加自定义提醒保留与重新注入。 重复了 loop 已有的 runtime-context 投影和恢复职责。

Consequences

成员承担完整 runtime-context 快照中的身份 token 成本。其他 context 变化会重复身份,保留的 context 稳定时则不追加消息。Fork 保留继承历史并追加当前身份;提供方实际缓存命中仍为尽力而为。现有 Team 授权仍在工具执行时落实。

验证覆盖 fresh 和 fork teammate、从 teammate 创建的独立 fork、关闭可选 context、压缩后恢复、冷恢复和注册释放。录制的 team-targets 场景固定 Lead context;无密钥 headless Team 工作流通过内置 profile 固定 teammate context。