# Task 与 Agent Space 收敛

> Canonical path: `specs/task/agent-space-convergence.md`
> Status: draft-target-spec-2026-05-02
> 相关规范：
> - [`specs/task/board.md`](board.md)：task detail、task discussion、checkpoint、artifact、review、subtask 的 canonical task primitives
> - [`specs/task/embedded-view.md`](embedded-view.md)：source thread task references、quiet-thread behavior、active task target、agent-authored routing
> - [`specs/task/collaborator-policy.md`](collaborator-policy.md)：Task / thread / channel collaborator lists、effective collaborator union、private-agent context eligibility / discussion audit
> - [`specs/message/delivery-ledger-optimization.md`](../message/delivery-ledger-optimization.md)：Task-native collaborator / discussion 收敛后的 delivery ledger 写入放大优化目标
> - [`specs/agent-space/shared-spaces-and-agent-spaces.md`](../agent-space/shared-spaces-and-agent-spaces.md)：当前未上线 Agent Space / Space implementation reference
> - [`specs/collaboration/collaboration.md`](../collaboration/collaboration.md)：channel / thread / mention / task handoff 协作语义

> Inline embedded task cards are retired. Current task-shaped execution uses task detail, task discussion, task references, source refs / owner_quote messages, explicit task announcements, and active-target controls; source thread scopes must not receive new inline task cards.
>
> 范围：定义当前 Agent Space 用户能力如何收敛到 Task + Scope Execution，使 Task 承担 task-shaped agent 执行协作的用户可见入口、上下文、状态、讨论、产物和对外发布责任；Scope Execution 承担 owner-scoped private-agent execution context 的最终态内部模型。本文是 target spec；在实现完成前，`../agent-space/shared-spaces-and-agent-spaces.md` 仍描述当前 Agent Space v1 的实现事实。
>
> Pre-ship stance：Agent Space 尚未作为正式产品 / schema baseline 上线。旧过渡实现曾包含 browser-facing Agent Space API、Agent Space panel/flow、以及 prompt / tool 中让 agent 推理隐藏 execution target 的词汇；这些都不指最终态内部 Scope Execution 模型。合并 / 发布前可以改写 Agent Space foundation migration、API facade、realtime event 和 delivery ledger，让 shipped 形态直接落到 Task + Scope Execution 模型。当前未发布分支不保留旧 Agent Space runtime target alias；agent / daemon 看到并复用 parent target，owner-private execution context 只通过 authenticated runtime session / current delivery hidden context 传递。

## 1. 产品判断

Agent Space 解决的是一个真实问题：agent 需要一个比普通 thread 更结构化、更低噪声、更适合执行过程沉淀的协作空间。

但 `Agent Space` 本身不是现实世界里用户自然理解的工作对象。用户真正发起、跟踪、验收的是 task：

- “让 agent 跟进这个问题”
- “把这个任务拆给几个 agent”
- “这里有什么进展、产物、阻塞、review 证据”
- “哪部分需要我决策”

因此产品方向是 **Task-first, not task-only**：

> 不把 Agent Space 作为用户显式交互概念暴露；把 task-shaped 工作收敛到 Task，让 Task 成为持续执行、计划、验收和产物沉淀的用户可见对象。

Task 不能替代所有 private-agent execution context。普通 channel/thread 中也存在非任务型协作：owner 把某个人、某个 thread 或某个 channel 分享给自己的 private agents；collaborator 明确唤醒这些 private agents；agent 需要在 owner 授权边界内读取上下文。这类能力的最终态内部模型是 **Scope Execution**：一个按 `(owner, source scope)` 或 `(owner, explicit task)` 定位的 private-agent execution context。它不是 legacy；legacy 只指旧的 Agent Space 用户表面、API/target 名称和兼容 wiring。

如果底层仍需要 generic `space` 作为 message/runtime storage substrate，它应隐藏在 Task 或 Scope Execution 之后，不作为用户必须理解、选择或管理的对象。由于 Agent Space 尚未上线，`agent_space` 不应被默认为必须发布的长期兼容层；只有在明确降低内部 runtime / storage 复杂度时，才可以作为私有实现细节保留。

这里的“隐藏”指隐藏旧产品概念与用户交互对象，不是删除 Agent Space 已经承载的问题域能力，也不是简单移除 UI 按钮后让用户失去入口。收敛必须是 **surface replacement**：显式工作看到和操作的是 Task；非任务型授权看到和操作的是 Agent sharing / Share with agents；底层可以在迁移期调用当前 Agent Space substrate，但最终 shipped contract 应以 Task + Scope Execution 为入口和事实来源。

## 2. 目标

1. Task 成为 task-shaped agent 执行协作的主对象。
2. 用户通过 task detail / task discussion / task references / checkpoint / artifact / review 来理解和驱动 agent 工作。
3. 非任务型 channel/thread private-agent 协作由最终态内部 Scope Execution 承接，用户通过 Agent sharing / Share with agents 管理授权。
4. Agent Space 当前能力不丢失，而是映射到 task-owned primitives 和 scope-execution-owned primitives。
5. 普通 thread 保持清爽，只承载 human-facing 决策、阻塞、公告和上下文入口。
6. Agent Space 不再作为主 UI / 主 API / 主心智模型暴露给用户。
7. runtime 仍能获得足够结构化上下文：active task target、parent target + hidden owner-private context、task discussion、task artifacts、source thread refs、subtask rollup。

## 3. 非目标

本文不要求在同一 spec 中规定所有内部表名、store 包名或迁移文件名。

本文不做：

1. 重新设计 generic `scopes` 底座；
2. 把当前未上线 Agent Space v1 固化为生产兼容 baseline；
3. 把 task 变成 channel/thread 的替代品；
4. 把所有 agent runtime log 暴露给用户；
5. 把 private agent 的所有内部思考、tool stdout/stderr、hidden reasoning 存入 task；
6. 让用户管理一个名为 “Agent Space” 的对象。

## 4. 核心原则

### 4.1 用户可见对象是 Task 与 Agent sharing

用户应看到：

- task
- subtask
- task discussion
- checkpoint
- artifact
- review
- source thread / task reference
- Agent sharing / Share with agents

用户不应被要求理解：

- agent space identity
- scope execution identity
- parent space / child space 派生链
- agent space transcript vs parent transcript
- agent space publish pipeline

用户应学习 Task 语言和 sharing 语言：

- `Task`：一件持续执行的工作，有状态、负责人 / agent、子任务、review 和产物；
- `Source refs / owner_quote`：用户把来源消息分享 / 转发给可见 conversation surface 时，系统生成具体 `owner_quote` 消息，并保留来源、作者、分享者、快照和 jump-back；
- `Task discussion`：围绕这个 task 与 agent / human 讨论的地方；常规进展、问题和协作消息默认沉淀在 Task，而不是刷普通 thread；
- `Task announcement`：把重要结果发回 source thread / channel 的显式动作，例如 milestone、blocker、review request、artifact、completion summary；
- `Task policy`：通知、唤醒和输出策略；用户调的是这个 task 如何通知、agent 产出如何回到 thread/channel，不是调 Agent Space；
- `Task collaborators`：谁可以参与这个 explicit task 的 agent 协作；
- `Agent sharing` / `Share with agents`：owner 把某个人、这个 thread 或这个 channel 授权给自己的 private agents 作为上下文来源；这些授权绑定到 owner-scoped Scope Execution，explicit Task 运行时沿 source chain 取 effective union；collaborator grant 影响对应 scope/task 的 context eligibility 和 explicit wake 授权，但不是普通 channel/thread membership，也不是 delivery fanout list。

一句话：用户在 Task 里完成任务型协作，在 Agent sharing 里管理非任务型 private-agent 授权；Scope Execution 是最终态内部模型；Agent Space 只是当前分支里的技术底座 / implementation reference，不是要发布给用户学习的概念。

### 4.2 Agent Space 能力必须完整迁移到 Task + Scope Execution

收敛不是“删掉 Agent Space 功能”，也不是让 Task 强行替代所有 execution context。Task 必须承接 task-shaped 工作的核心能力；Scope Execution 必须承接 owner-scoped private-agent context 的核心能力：

- private / scoped agent collaboration；
- share-in context；
- publish-out / legacy auto-publish behavior；
- runtime current conversation / wake scope；
- transcript / history；
- notification / unread；
- owner-gated ingress / egress；
- parent surface projection；
- agent status aggregation。

### 4.3 Task 与 Scope Execution 分别是事实来源

目标状态下：

- explicit task 拥有 task detail、task discussion、checkpoint、artifact、review、summary 和 task-owned execution metadata；
- scope execution 拥有 owner+source-scope 的 private-agent collaboration boundary、participant/grant facts、wake/context scope 和必要 runtime state；
- shared channel/thread 拥有普通 transcript、source refs / owner_quote attribution 和 source-scope visibility；
- source thread 拥有原始 transcript、task references 和显式 task announcements；
- internal space 可以承载 delivery、message storage 或 runtime wake；
- 但 internal space 不是用户可见事实来源。

### 4.4 不是隐藏 UI，而是替换用户入口

收敛不能通过“把 Agent Space 按钮、面板、文案藏起来”来完成。如果某项能力当前只有 Agent Space surface 能提供，隐藏该 surface 前必须先提供 task-native 等价入口。

产品要求：

- 用户不需要看到、选择、打开、分享到、发布自一个名为 Agent Space 的对象；
- 用户仍然必须能完成 Agent Space v1 已提供的协作能力；
- 每个用户可见动作都应以 Task、ordinary Share/Forward 或 Agent sharing 语言表达，例如 task discussion、checkpoint、artifact、review、announcement、agent output policy、Share/Forward as `owner_quote`、Share with agents；
- 旧 Agent Space surface 可以在迁移期作为内部 compatibility/debug surface 存在，但不能是默认产品路径、主入口、公开文档路径或 agent-facing 默认术语；
- 不能出现“UI 不显示 Agent Space，但用户必须知道 agent space id / agent-space target / hidden route 才能完成工作”的状态。

换句话说，目标不是把 Agent Space 能力拿掉，而是让 Task 和 Agent sharing 承担用户交互责任，让 Scope Execution 承担内部 execution boundary 责任。

### 4.5 默认自动，必要时 human 显式控制

大多数情况下，daemon / server 应自动建立对应 execution context：

- task 创建；
- task discussion wake；
- claim / assign；
- subtask 分配；
- current focus task；
- task-native tool call。

human 只在需要时显式选择 / 覆盖 / 清除 active task target，例如多 task thread、agent 选错目标、临时切换 subtask。

## 5. 能力映射

| Agent Space v1 能力 | Task 收敛后的用户可见能力 | 说明 |
|---|---|---|
| Agent Space transcript | task discussion + task activity | 用户在 task 内看执行讨论与事件；不展示 “Agent Space transcript” 概念 |
| private agent collaboration | task-scoped execution + Agent sharing | explicit task 上的执行归 Task；channel/thread 非任务型协作归 Scope Execution；普通 thread 只看高信号投影 |
| invite human into Agent Space | Task collaborators / Agent sharing | explicit task 维护 task-local collaborator grants；channel/thread 维护 owner-scoped Scope Execution grants；V1 只支持 owner 显式加入的 People/direct member collaborators，用 `task_scope_participant_metadata(owner_scope_execution_id, member_id, ...)` 表达；whole thread/channel range sharing 不进入 shipped schema；运行时按 source chain effective union 解析 context eligibility；collaborator 普通消息可作为 context 但不默认 delivery，direct mention / explicit wake 才写 sparse targeted event |
| share-in parent messages | Share/Forward 生成具体 `owner_quote` 消息 / source refs / discussion quote | 用户把 thread 消息 materialize 成普通 timeline 里的 owner-quoted 消息，而不是 share 到 Agent Space 或写入 task-owned source row |
| publish-out to parent | explicit thread announcement / task milestone message | 从 task 向 source thread 发公告必须是显式 human-facing action |
| auto-publish | Task announcements + Notifications & output policy | 用户理解为“agent replies can appear in the source thread/channel”，默认谨慎，重要结果优先通过 announcement 明确发回 thread |
| wake current space | active task target / parent target + hidden owner-private context | task-shaped wake 指向 task target；非任务型 private-agent wake 向 agent 暴露 parent channel/thread target，owner-private context 只通过 authenticated runtime session / current delivery 隐式携带 |
| Agent Space panel | task detail / task references | source thread 通过显式 task reference 或 announcement 跳转 task，不渲染 inline task projection |
| Agent Space notifications | task-native notifications / unread / watchers | 通知归属 task，不额外暴露 agent space inbox |
| owner-gated ingress | owner_quote 授权入口 + scope context eligibility | 非 owner / 非 participant 的消息要进入 owner private-agent 可读上下文，必须通过明确 Share/Forward `owner_quote`、collaborator grant 或明确 task routing 授权 |
| parent observer browse | source thread participants follow task references into authorized task detail | 可见性由 task board + source thread 权限共同决定 |
| private agent auto-publish settings | Notifications & output | 用户配置“这个 task 如何通知、agent replies 是否可以出现在 source thread/channel”，而不是配置 Agent Space |
| Agent Space user-facing routes / panel wiring | task-owned routes / Agent sharing routes / owner-private context facade | Web 不恢复旧 Agent Space browser route / panel；用户和公开 API 不以 Agent Space 为入口 |

迁移验收必须按这张表做 capability parity。只有当某一行的 Task / Agent sharing 用户入口以及 Scope Execution 内部事实来源可用时，才可以移除或隐藏对应的 Agent Space 用户入口。

## 6. Task 需要补齐的能力

### 6.1 Task execution context

Explicit Task 需要拥有一个结构化 execution context，用来承接 task-shaped 工作里的“当前执行空间”能力。非任务型 channel/thread execution context 由 Scope Execution 承接，见 [`collaborator-policy.md`](collaborator-policy.md)。

概念字段：

- `taskId`
- `channelRef`
- `sourceThreadRef`
- `activeAgentRefs`
- `plannerAgentRef`
- `workerAgentRefs`
- `contextMessageRefs`
- `workspaceRefs`
- `relevantURLs`
- `latestSummary`
- `currentFocus`
- `nextStep`
- `blockedReason`
- `routingPolicy`

这些字段应作为 task detail / task activity / task metadata 的一部分呈现，而不是另建一个用户可见 Agent Space。

### 6.2 Task discussion as agent transcript

Agent 的常规执行讨论应写入 task discussion。

规则：

- agent progress / coordination / conclusion 写入 `add_discussion_entry`；
- agent 不为 routine progress 发送普通 thread message；
- task discussion 支持 mention agent / human；
- task discussion 可以触发 task-native delivery / wake；
- task discussion entry 可以引用 source thread message、artifact、checkpoint、review。
- task discussion / collaborator ingress 不应延续 Agent Space 的默认 per-message/per-recipient delivery materialization；普通 discussion unread 使用 task/scope cursor 推导，只有 direct mention、explicit wake、reaction delivery 等明确 targeted intent 才写稀疏 durable fact。

### 6.3 Checkpoint and artifact as work products

Agent Space 中过去容易形成“聊天式进度”的内容，必须拆成 task-native primitives：

- checkpoint：阶段性进展、关键发现、完成轮次；
- artifact：PR、branch、文件、日志包、截图、review evidence、链接、报告；
- activity：状态变化、claim、assign、review request、block/unblock。

这能避免 task discussion 退化成 raw runtime log。

### 6.4 Share-in becomes owner_quote concrete messages

用户把 parent thread/channel 的消息交给 agent 时，用户动作应表达为：

> Share / Forward as owner_quote / Attach artifact

而不是：

> Share to Agent Space

写入结果：

- 在目标 channel / DM / thread timeline 中创建具体 `owner_quote` 消息；
- `owner_quote` 消息保存 source refs / frozen quote snapshot / source author / sharing actor attribution；
- ordinary message delivery、wake、diagnostics 和 jump-back 使用该 concrete message；
- task detail 不维护独立 task-owned source 列表；
- 不创建隐藏 task-owned source row 或普通 thread mirror。

### 6.5 Publish-out becomes task announcement

Agent 对外可见输出应通过 task-owned action 发生：

- request human decision；
- report blocker；
- announce milestone；
- request review；
- completion summary；
- publish artifact / deliverable.

这些动作可以 materialize 成 source thread message，但必须带明确 intent，并和 task discussion / activity 建立 cross reference。

默认不做 “每条 agent output 自动 publish 到 thread”。

### 6.6 Runtime wake becomes active task or scope target

Agent runtime 被任务型工作唤醒时，应优先获得 active task target：

- channel；
- task number；
- role；
- source / thread；
- parent/root task；
- relevant context refs；
- routing rule。

Agent runtime 被非任务型 channel/thread private-agent 协作唤醒时，应获得 parent channel/thread target；owner-private scope metadata 由 authenticated runtime session / current delivery hidden context 携带。runtime 不应需要知道“当前是在 Agent Space 里”，也不应看到或提交 hidden execution id。

### 6.7 No-task execution fallback

Agent Space 不应作为“没有 task 时的用户可见备用执行空间”。

当用户在 channel / thread 中要求 agent 跟进一个需要持续执行、沉淀进展、产物或 review 的事项时，系统应优先创建或关联 task，再把后续执行收敛到 task-native surface。

如果事项足够简单，不需要 task：

- agent 可以直接在 source thread / channel / DM 回复；
- 不创建 task 也不暴露 Agent Space；
- 不要求用户打开某个 private execution panel 才能继续。

因此默认用户路径只有两类：

1. 简单对话：普通 channel / thread / DM；
2. 持续执行：Task + task detail / task discussion / task references。

Agent Space 只在内部承载 runtime isolation、delivery、message storage 或兼容数据流。

这不表示没有 task 时就没有 execution context。非任务型 private-agent 协作仍可以有 Scope Execution，但它是内部授权与 runtime 边界，不是一个需要用户打开、命名或管理的 task-board task。

## 7. 多 agent / planner / subtask 模型

### 7.1 Planner

Planner agent 应创建或使用一个 root task 作为计划入口：

- root task 承载整体 goal、plan、progress summary、review status；
- planner 在 root task 下创建 subtasks；
- planner 的整体协调写入 root task discussion / checkpoint；
- root task detail 展示 subtask rollup。

### 7.2 Worker

Worker agent 的 active task target 通常是一个 subtask：

- routine progress 写入 subtask discussion；
- checkpoint/artifact 写入 subtask；
- parent/root task 展示 rollup；
- 只有需要 human 决策或跨 thread audience 时才发 source thread message。

### 7.3 多 agent 同时工作

Task 必须支持多个 agent 在同一 root task 下并行工作：

- root task 展示 active agents；
- subtask 展示 assignee / status / latest progress；
- task discussion 支持按 entry author / subtask / checkpoint 聚合；
- notification 应尽量按 task-native unread 去重。

## 8. UI 收敛

### 8.1 Source thread

Source thread 保持轻量，只显示普通消息、task references、thread current-focus affordance 和显式 task announcements。持续执行状态、active agents、checkpoint、artifact、blocker、review、subtask rollup 和 task discussion 预览属于 task detail / task discussion，而不是自动插入 thread 的 inline card。

不显示 “Open Agent Space” 作为主要动作。

如果当前实现需要保留旧 Agent Space panel，默认入口也必须迁移为 Task 动作。不能把一个无文案的快捷图标、隐藏菜单项或 secondary drawer 当作 Agent Space 概念的替代暴露方式；用户点击后看到的仍应是 task execution surface。

### 8.2 Task detail

Task detail 是完整执行中心：

- discussion；
- source refs / owner_quote attribution；
- checkpoints；
- artifacts；
- activity；
- review；
- subtasks；
- active task target / agent routing 状态。

如果当前实现仍有 Agent Space panel，后续应收敛为 task detail 内的 task execution surface，或作为内部调试入口隐藏。

task detail 必须承接原 Agent Space panel 的有效能力，包括：

- 查看 agent execution discussion/history；
- 写入 task discussion；
- 查看 source refs / owner_quote jump-back；
- 将 milestone、blocker、review request 或 artifact announcement 发回 source thread；
- 配置 task-level agent wake / notification / output routing policy；
- 查看 active agents、planner/worker 分工和 subtask rollup。

### 8.3 Explicit human routing

Human 能显式选择：

- thread current focus task；
- agent/session active task target；
- one-shot route。

UI 可以使用 task chip / selector / detail action menu 表达，但文案应围绕 Task：

- `Set as thread focus`
- `Assign as active target for @agent`
- `Share / Forward as owner_quote`
- `Ask agent in this task`
- `Announce milestone to thread`

不使用：

- `Open Agent Space`
- `Share to Agent Space`
- `Publish from Agent Space`

## 9. API / MCP 收敛

目标 public / human-facing API 应以 Task 和 Agent sharing 命名：

- share / forward source as owner_quote；
- write task discussion；
- add checkpoint；
- add artifact；
- set active task target；
- clear active task target；
- announce task milestone；
- request task review。
- manage agent sharing for this thread / channel / task。

旧 Agent Space browser API 不再属于当前 shipped route surface；相关能力应表达为：

- Task / owner-private context facade；
- hidden server/runtime owner-private context；
- parent channel/thread/task target，而不是 Agent Space product surface。

这意味着：

- Web 用户操作应调用 task / sharing 命名 API，或调用一层 Task / owner-private context facade；
- agent tools / prompt 不应要求或鼓励 agent 构造旧 Agent Space target alias 或 hidden execution id；
- 公开产品文档、UI copy、可见 route label、action label 不应出现 Agent Space 作为用户任务对象；
- browser client 不应调用旧 Agent Space route surface；测试 helper 也不得把它重新变成 public API。

MCP guidance：

- active task target 存在时，agent 默认使用 task tools；
- non-task owner-private context 存在时，agent 使用 parent target；hidden execution context 只由 runtime/session metadata 传递，不学习 Agent Space；
- `send_message` 需要 routing intent；
- 不要求 agent 选择 agent space；
- 不把 Agent Space 作为 agent-facing product instruction 的默认术语。

## 10. 数据模型方向

Pre-ship implementation bridge：

- 当前未上线分支可以暂时仍用 `scopes.type = agent_space` 承载 runtime transcript / delivery，用 task API 封装读写；
- 这只是 pre-ship internal 迁移桥，不是可以直接 ship 的产品 / API / schema contract；
- 在 merge / release 前，应优先把 task discussion、owner_quote source refs、announcement、notification/output policy、collaborator 和 delivery ledger 的事实来源迁到 task-native / ordinary message APIs；
- 如果最终仍保留某个 `agent_space` implementation detail，它必须是私有 substrate，不暴露为 browser-facing product API、user route、public docs、agent-facing prompt target 或 durable delivery fanout requirement。

目标方向：

- task 是用户可见 aggregate root；
- task-native tables / activity / discussion / artifacts 是事实来源；
- scope execution 是 owner-scoped private-agent runtime/context boundary；
- agent-space-like storage 只有在明确降低实现复杂度时才可作为 private delivery/runtime substrate 保留；
- 能从 task id 或 `(owner, source scope)` 直接找到执行上下文和 runtime wake scope；
- 不需要用户或 agent prompt 依赖 agent space id。

## 11. 权限与可见性

收敛后，权限应按 task + source surface 解释：

- 读取 task execution context：必须能读 task 所属 channel-bound task board；
- 读取 source-thread task reference / announcement：必须能读 source thread；
- Share/Forward parent message as `owner_quote`：actor 必须能读 source message，且能写目标 channel / DM / thread；
- agent 写入 task discussion/checkpoint/artifact：agent 必须是 active target 允许的 participant / assignee；
- 对外 announcement：必须满足 source thread write 权限。

Private agent 的 owner-gated ingress 语义应翻译为：

> 不是所有 parent messages 都自动进入 owner private-agent context；非 owner / 非当前 task participant 的内容必须通过 explicit Share/Forward `owner_quote`、collaborator grant 或明确 task routing 才能被纳入可读执行上下文。

## 12. 能力差距与迁移门槛

本节记录 task-native convergence 的能力门槛。这里列出的 code paths 是实现定位线索，不是永久架构承诺；如果文件移动，能力门槛仍然有效。

核心结论：

> 收敛不能通过直接隐藏 Agent Space surface 完成。Task 与 Scope Execution 必须先补齐等价能力和 facade，再把默认入口迁过去。因为 Agent Space 尚未上线，这不是生产兼容限制：完成 Task + Scope Execution 替代后，可以直接改写未上线 API、schema 和 realtime surface。

2026-05-03 follow-up review（当前实现状态）：

- 已覆盖：Task API 已提供 execution history、announcement、notification policy、output policy、active target facade；daemon/runtime 已能注入 active task target 并对 `send_message` 做 routing-intent soft guard；task detail / discussion 已提供 task-first 路由、thread / dual-send 路由、thread focus set/clear、subtask rollup 与 agent-session selector；source thread 不再写 inline task card；ShareFlow 只生成 ordinary channel / DM / thread 目标，并以 concrete `owner_quote` 消息保留 source attribution。
- 2026-05-03 Phase A 更新：source sharing 默认 materialize 为具体 `owner_quote` 消息，保存 source refs / frozen quote attribution；不再保留旧 add-context 夹心写入口。
- 2026-05-03 Phase B 更新：inline embedded task card surface 已退休；task detail / discussion 直接读取 viewer-scoped task state。旧 embedded-task card 数据只作为 compatibility input 被读面过滤，不再作为 renderer、fallback 或 extension point。
- 2026-05-03 Phase C 更新：task discussion composer 已补 attachment parity；附件会上传到当前 thread 可见的 attachment substrate，task discussion route 以 markdown attachment refs 持久化，并把 attachment IDs claim 到对应 task discussion entry，下载权限按 task/discussion 可读性校验；thread / dual-send route 继续使用普通 message attachment IDs，dual-send 的同一 attachment 也会同时关联 task discussion entry。dual-claim 附件下载采用 OR 授权：task discussion 可读或普通 message space 可读任一路径成立即可。2026-06-01 strict-boundary 更新：task discussion 是 message-backed send；edit/delete 不作为 task discussion 产品能力保留；reaction 必须走普通 message reaction surface，不能再保留 task-native reaction mutation primitive。
- 2026-05-03 UX 收口更新：默认用户路径已经 task-first。ShareFlow 默认不再列出 Agent Space compatibility panel / `agent_space` target；普通 channel / thread composer 和 message action 不再默认暴露 Agent Space compatibility panel 入口；因为 Agent Space 尚未上线，不保留用户可见 Agent Space compatibility opt-in。剩余 Agent Space storage / migration references 只能作为 pre-ship internal substrate、迁移参考或测试辅助，不成为 public flow。
- 仍未完全收口：旧 Agent Space transcript / publish / auto-publish / hidden-target 心智仍可能存在于部分 schema、store helper 或 historical spec 中；它们不能被新用户文档、默认入口、agent prompt、browser-facing public API 或 runtime contract 当作主路径。非任务型 private-agent context 必须通过 Scope Execution 语义保留，而不是被误标为 legacy 后删除；task discussion 相关 UI 不得恢复 task 专属 edit/delete/reaction API，reaction 只能复用 message reaction 语义。
- 因此本节后续差距列表应按“迁移门槛 / pre-ship internal substrate”理解：当前实现已完成默认 UX 收口、主路径迁移和 parity foundation，但底层 Agent Space 技术概念不应因此获得 shipped compatibility status；能在 Task / Scope Execution 层收口的部分应在 merge / release 前直接收口。

### 12.1 浏览器 API 仍把 Agent Space 作为公开对象

旧过渡实现曾注册 browser-facing Agent Space 路由并由 router 挂载。该 route surface 已不属于当前 shipped browser API；对应能力必须由 Task / owner-private context facade 承担。旧 route surface 曾覆盖：

- list / get / linkage；
- message history / write；
- share-in；
- publish-out；
- wake-state；
- notifications；
- agent auto-publish。

这些能力不能消失；但它们不能再以 Agent Space browser API 作为用户可见 Task 操作的公开入口。

迁移门槛：

- Task 必须提供 task-named facade，覆盖 execution discussion/history、announcement/publish-out、notification、wake/output policy；ordinary Share/Forward 必须以 `owner_quote` concrete message 覆盖 source materialization；Scope Execution facade 必须覆盖非任务型 channel/thread private-agent context、collaborators 和 explicit wake；
- Web 默认用户动作必须调用 task / sharing facade，或至少通过 task-owned client API 间接封装 Agent Space 兼容层；
- 不恢复 browser-facing Agent Space API；任何临时测试 helper 也不得成为公开产品文档或新 UI 的默认接口；
- 新 task / owner-private surface 不得要求用户或 agent 提供 Agent Space id 或 hidden execution id。

### 12.2 Web UI / compatibility surface

迁移前 Web 曾有用户可见入口和文案，包括：

- channel / thread composer 附近的 `Open Agent Space` 触发器；
- `AgentSpacePanel` 作为主要执行面板；
- message row 的 open / share to Agent Space actions；
- locale 中的 `agent_space.*` 用户文案；
- ShareFlow target kind `agent_space`。

这些入口承载过真实能力，不能简单移除。迁移时必须由 task surface 接住：

| 当前用户动作 | 当前承载能力 | Task-native replacement gate |
|---|---|---|
| Open Agent Space | 查看执行 transcript、写入 agent-facing discussion、查看 private agents | task detail 可查看 task execution discussion、active agents、subtask rollup、source refs |
| Invite human to Agent Space | 邀请 human 参与执行协作上下文 | `Share with agents` / task collaborators；thread/channel 授权绑定到 owner-scoped Scope Execution，explicit task 授权语义绑定到 task Scope Execution，owner-only task identity 由 task row 承担；运行时取 source-chain effective union，并在 Task discussion / context 中记录 source scope / relation audit |
| Share to Agent Space | owner 授权 parent message 进入执行上下文 | Share/Forward materializes a concrete `owner_quote` message with source refs and frozen quote attribution |
| Publish Agent Space message | 把执行输出发回 parent channel/thread | `Announce milestone / blocker / review request / artifact to thread`，带 task/activity cross reference |
| Agent Space notification panel | wake、auto-publish、self notification | task-level Notifications & output；用户理解为 task 如何通知、agent replies 是否可以出现在 source thread/channel |
| Agent Space switcher | 多 owner / 多 parent private execution surface 浏览 | task / subtask selector、active agents、watcher/read state；非 task 调试入口不能成为默认产品路径 |

迁移门槛：

- 用户点击默认入口后看到的是 task execution surface，而不是改名后的 Agent Space panel；
- UI copy、aria label、test id、visible route label 应迁移到 Task 语言；
- ShareFlow 不生成 legacy `task_context` 或 `agent_space` compatibility targets；source materialization 只通过 ordinary targets 上的 concrete `owner_quote` 消息承接；
- 旧 Agent Space panel 若保留，只能作为 compatibility / debug surface，且不应是新用户操作的主入口。

当前状态：

- 普通 task 的默认入口已迁到 task detail / task discussion / owner_quote source refs / task announcement / task references；
- ShareFlow 默认只显示 channel、DM、thread 等 ordinary forward targets；legacy `task_context` 和 Agent Space compatibility panel targets 不进入普通 share/forward/select 默认路径；
- 普通 channel / thread composer 与 message row 不再展示 Agent Space compatibility panel entry；不存在用户可见 explicit compatibility URL；任何旧 compatibility query/header 不得打开普通 browser-facing Agent Space surface；
- 旧 panel/API/realtime 相关代码若暂时保留，只能作为 pre-ship internal / migration substrate，不再作为新增能力、新用户操作或默认回归旅程。

### 12.3 Task API parity gate

当前 task routes 已承接 Agent Space v1 的关键 task-shaped 用户能力：execution history、announcement、notification / output policy、active task target set / clear、source linkage、collaborator discussion authorization audit；source materialization 由 ordinary Share/Forward 生成的 `owner_quote` concrete message 承担。旧 Agent Space browser API 已从默认 route surface 移除，不得作为 compatibility substrate 重新进入用户操作路径；非任务型 channel/thread private-agent 授权必须通过 Scope Execution / Agent sharing facade 表达。

必须持续由 task-owned facade 覆盖的 capabilities：

- share context：把 source thread/channel messages materialize 为具体 `owner_quote` 消息，带 frozen quote/source refs/授权归因；不得回退到旧 add-context 夹心模型；
- execution history facade：从 task 读取 execution discussion / activity / checkpoint / artifact 的统一历史，不暴露或封装旧 Agent Space transcript；
- announcement / milestone API：把 blocker、human decision request、review request、artifact delivery、completion summary 明确发布回 source thread；
- notification / unread API：task-native unread、watcher、task read/watch state、agent execution notification；
- Notifications & output：表达 task 如何通知、哪些 agent 会被 wake、哪些 milestone / blocker / artifact 会明确公告到 source thread/channel；
- active task target API：set / clear thread focus、agent/session active target、one-shot route；
- source linkage：从 `owner_quote` concrete message 跳回 parent source message，并从 source refs 找到引用关系。

这些接口的具体 route shape 可以由实现决定；但不能恢复旧 Agent Space browser API 或用改名透传替代 task 权限、task audit、task activity 和 task-visible cross reference。

### 12.4 Runtime / MCP parent target contract

当前 agent-facing runtime contract 已收敛为 parent target + hidden owner-private context：

- `agentteam` MCP `message_history_read` 只描述 channel / thread / DM / current message target；agent-visible target 必须是 parent collaboration surface；
- AgentTeam 对 owner-scoped private-agent execution delivery 输出 parent target，并把 scope context 绑定到 authenticated runtime session / current delivery metadata；
- README 不指导 agent 构造或复用 hidden execution id；
- internal agent message API 按 parent target 解析，authorization 由 authenticated agent + hidden session/current-delivery context 决定；
- realtime delivery 使用 parent channel/thread/task event surface，不再发送 Agent Space message update event。

这些规则是当前未发布分支的 runtime 契约。旧 Agent Space target alias、隐藏 execution id 字符串、publish transcript target 都不进入 agent-facing parser、tool schema、prompt 或用户文档。

迁移门槛：

- task tools 返回结构化 `activeTaskTarget`，daemon / runtime 使用该结构化状态，而不是解析自然语言提示；
- active task target 是 durable / server-backed 或 daemon-session-backed state，有 set / clear / override 来源和过期策略；
- agent prompt 只在 active task target 存在时默认使用 task discussion / checkpoint / artifact；
- non-task Scope Execution context 只作为 hidden current execution context 传递，不把隐藏 id 教给 agent 当作可推理对象；
- `send_message` 不因 active task target 缺省而阻断发送；
- 旧 Agent Space target alias 和隐藏 execution id 不出现在 parser、默认 tool description、prompt 主路径或用户文档。

### 12.5 Realtime / event surface 仍以 Agent Space 命名

旧过渡实现包含 Agent Space message update websocket event，Web 曾直接消费它刷新 Agent Space messages。该 browser-visible event 已从当前 route/runtime surface 移除；Task UI 不应直接绑定到 Agent Space event 作为产品语义。

迁移门槛：

- 提供 task-facing realtime facade，例如 task discussion/activity/checkpoint/artifact/notification updated；
- task detail / task discussion 订阅 task updates，而不是直接订阅 Agent Space message update；
- 如果未来内部 substrate 需要 bridge event，转换必须发生在 task / owner-private facade 层，不恢复 browser-visible Agent Space event；
- browser-visible event names、debug labels、diagnostics 若面向普通用户展示，应使用 Task / parent target / owner-private context 语言。仅技术诊断可以暴露 internal substrate terminology。

### 12.6 用户文档与 E2E 仍验证 Agent Space 操作路径

迁移前 website docs 仍教用户使用 Private Agents / Agent Spaces，E2E 也断言 Open Agent Space、agent-space-panel、Share to Agent Space、Agent Space browser API 等路径。当前默认用户文档和 E2E 应覆盖 Task / owner-private context replacement，而不是旧 Agent Space 操作路径。

迁移门槛：

- `docs/public/` 中面向用户的协作文档必须改成 Task / Share/Forward owner_quote / task announcement / output policy 语言；
- E2E 需要新增 Task-surface parity 覆盖：task execution discussion、owner_quote source attribution、announcement、notification/output policy、task detail update；
- 旧 Agent Space E2E 不再作为用户可见 compatibility opt-in 覆盖；如需保留底层回归，应放在 internal/testkit 或实现层测试，不能通过 browser compatibility path；
- 新测试不应把 `Agent Space` 字样作为主用户旅程断言。

当前状态：

- `docs/public/` 面向用户的协作文档已经使用 Task / Share/Forward owner_quote / task announcement / output policy 语言；
- `web/e2e/tasks.spec.ts` 覆盖 task surface parity 主路径；
- 用户可见 Agent Space compatibility E2E 覆盖已移除；默认 E2E 只覆盖 Task-first journeys。Agent Space substrate 若仍需测试，应使用 internal/testkit / store-level tests，并断言它不进入默认 UX、public API 或 agent runtime target。

### 12.7 迁移优先级

实现推进时应按能力风险排序：

1. Task API parity：execution discussion/history、announcement、notification/output policy、active target；Share/Forward owner_quote source attribution。
2. Runtime routing：active task target durable state、tool return hints、prompt injection、`send_message` guard。
3. Task detail / task discussion surface：接住 Agent Space panel 的用户能力。
4. ShareFlow / publish / notification UI 改名并改语义：从 Agent Space action 迁移到 task action。
5. Website docs 与 E2E 迁移。
6. 最后才隐藏或降级旧 Agent Space UI/API 主入口。

任何旧入口移除前，都必须能回答：用户今天通过这个 Agent Space 入口完成的具体工作，新的 Task 入口在哪里完成、权限如何判断、记录沉淀在哪里、如何回到 source thread、如何被测试覆盖。

### 12.8 当前剩余 follow-up

当前实现已覆盖默认 UX 收口、task-first ShareFlow、quiet source-thread behavior、task references / announcements、owner_quote source-ref model、active task target、task API parity facade、announcement、notification/output policy、attachment parity、planner/subtask task detail/discussion flow 与 legacy compatibility regression 的 foundation。2026-05-03 试用发现的 context ingress / source attribution 缺口记录在 §12.9，当前状态以 §12.10 的 T1-T4 为准：reply-thread source binding、ShareFlow ordinary target routing、owner_quote source attribution、structured share/forward attribution 已完成。

后续不应再把 Agent Space 当作用户概念扩展；如需继续收敛，按以下 follow-up 做：

1. 保持 task discussion message-backed：不恢复 edit/delete 产品入口；reaction 使用普通 message reaction primitive、权限、cache 与 audit，不新增 task-native mutation surface。
2. 保持 realtime / browser client 通过 task-facing 或 parent-message event facade 更新，不依赖 Agent Space message update event 作为产品语义。
3. 旧 Agent Space browser API 和 visible runtime target 已从当前 route/runtime surface 移除；后续不得以 compatibility 名义恢复为默认入口。
4. 如后续决定彻底删除剩余旧 Agent Space storage substrate，只能删除旧表名 / target / route / event 兼容面；不能删除 Scope Execution 语义。删除前必须确认对应 Task / Scope Execution 入口、权限、audit、source jump-back 与 E2E parity 都已覆盖。

### 12.9 历史缺口：context ingress 与 source attribution

本节保留 2026-05-03 试用反馈的根因和验收方案。它是历史问题记录；当前完成状态见 §12.10。

#### 12.9.1 ShareFlow task-context targets retired

ShareFlow 不再提供 task_context 目标。普通 channel / DM / thread forwarding 直接 materialize 为 owner_quote 消息，避免 source thread 再次出现 task-projection 心智和自动任务候选噪音。

当前要求：

- `web/src/agentteam/workspace/conversation/state/shareFlowTargets.ts` 只产出 channel / DM / thread 目标；
- Share/Forward 提交后写具体 `owner_quote` 消息，由普通 message timeline、source refs、delivery/wake 链路承接；
- 不从 task detail 或 ShareFlow 重新暴露 task_context target。

验收方案：

- ShareFlow 只允许生成普通 channel / DM / thread 目标，不再生成 legacy `task_context` candidate 或 target；
- source message 分享到普通目标后，必须生成具体 `owner_quote` 消息，并保留 source refs / jump-back / ordinary message delivery 语义；
- task detail 不再提供旧来源导入或来源管理入口，也不读取或展示 task-owned source 列表；
- 服务端不再暴露旧 task-context browser route 或 task-service add-context 写入口；
- private-agent context 如需引用非协作者或历史材料，只能通过 owner explicit Share/Forward 生成的 `owner_quote` 消息进入 ordinary timeline。

当前状态：Done by §12.10 T2 的最终收敛口径。`ThreadMessages` / selection toolbar 的 Share/Forward 入口只面向 ordinary targets；提交后 materialize 为 `owner_quote` concrete message。旧 `task_context` target、task detail context-add UI、task-context browser route、task-service context-add 写入口与 task-owned source storage/read model 均不得恢复为默认入口。

#### 12.9.2 Agent Space 安全语义必须在 Scope Execution 中保留

2026-05-06 clarification：Task-first 不等于 Task-only。旧 `(owner, channel)` / `(owner, thread)` Agent Space 的 owner-scoped execution container 能力必须由最终态 Scope Execution 承接；explicit task 则语义绑定自己的 task Scope Execution，owner-only task identity 由 task row 承担。公开用户心智是 Task / Agent sharing / Share with agents，不是 Agent Space，也不是要求每个 channel/thread private-agent context 都变成 task-board task。新的安全语义分成两层：

- **context eligibility**：owner、active People collaborator 在授权生效后的 source-scope messages，可以被对应 owner 的 channel/thread Scope Execution 或 explicit task agents 用作上下文；
- **delivery / wake**：只有 direct mention、explicit wake、Task assignee /
  explicit Watch attention 等明确 targeted intent 才递交 / 唤醒 private
  agents，并写 sparse targeted event；
- 普通 collaborator message 只是 context-eligible，不默认触发 private agent 回复；
- non-collaborator source messages 默认不进入 owner private-agent context，也不能直接唤醒 owner private agents，除非 owner explicit Share/Forward owner_quote / approve / add collaborator。

Task + Scope Execution 收敛后的等价规则：

- channel/thread scope 必须有可懒创建的 owner-scoped Scope Execution，作为 private-agent execution container；它们必须有稳定 execution identity，供 participants、context、artifact/diagnostics 和 delivery target 引用；
- explicit task 必须语义上绑定 task Scope Execution；owner-only execution identity 由 task row 自身承担，不要求每个 task 创建空 execution row；task-local People grants、collaborator metadata 或内部 scope-execution target 需要时才物化 `(owner, task)` execution row；task detail 读取 task-owned facts，并通过 Scope Execution 解析 private-agent context boundary；
- channel/thread 可以在产品需要时投影成 task-facing detail/facade，但这只是 projection，不是要求每个非任务型 context 默认占 task board 编号；
- 懒创建边界必须保持轻量：普通消息写入、普通 membership/read-history/read-cursor、普通 preview 不创建 Scope Execution；只有 explicit collaborator/share/wake/direct mention/open detail 等动作才创建最小 projection，且不默认创建订阅/read-state/discussion/artifact rows；
- “邀请 human 参与 execution collaboration” 收敛为 channel/thread/task collaborator grants，而不是继续通过 Agent Space UI 暴露；该 policy 由 [`collaborator-policy.md`](collaborator-policy.md) 单独定义；
- collaborator grant 不是普通 channel/thread membership，也不是 delivery fanout list；它只让命中的 future source messages 进入 owner scope/task 的 context-eligible stream，并允许 collaborator 明确 wake owner private agents；
- explicit Share/Forward owner_quote 是 non-collaborator 或历史材料进入可读执行上下文的路径；share 不会自动把 source author 变成 collaborator；
- shipped storage 应保持 `scope_memberships` 的纯普通 member participant/read-state 语义：People/direct member collaborator grants 使用 `task_scope_participant_metadata(owner_scope_execution_id, member_id, ...)`；whole thread/channel range sharing 不塞进 `scope_memberships`，也不维护 shipped boundary table；不再发布 `collaborator_grants` / `owner_private_collaborators` 作为平行事实来源；
- owner+scope execution projection 不持有单独 collaborator edge；V1 没有 range-sharing hint field，不做 descendant cascade，也不把 range sharing 暴露成前端/API contextEligibility 事实源；
- People collaborator grants 存在 task collaborator metadata，只存 owner 授权的 People，不存 source messages，也不是普通 channel/thread participants；owner-only 是缺省 fast-path，未授权 scope 不创建 execution row，读取也不得为了 owner-only 结果创建空 row；
- channel <= thread <= task effective collaborators 由运行时沿 source chain union 得到，没有 copy-on-create，没有 inherited row materialization，没有 v1 task-level deny / inherited override；
- 普通 message write 不查询 collaborator grants、不复制消息、不写 per-collaborator delivery；普通 thread/task 首屏也不得默认为所有可见历史消息调用 message-level private-agent context resolver；private agent context resolver 只在读取 owner 的 task execution context / explicit wake / direct mention / message action / realtime delta 时按有限 source chain 做 bounded indexed lookup；context load 需要明确的 source-scope + author/global-seq 有界索引，不能靠 workspace/global seq 或 author-only 大扫描，也不能枚举 descendant thread scopes；
- owner-only 是默认态，collaborator 是稀疏例外；普通 message write 不查 `scope_memberships`；private-agent context load 只解析已有有限 source-chain execution rows；message-level resolver 必须保持常数查询组 + 请求消息数 N 的返回行，不得出现 per-message DB query；
- UI 应同时解释“agents can use this as context”和“this will wake agent”，避免把 collaborator grant 误解成普通 transcript visibility 或自动回复；消息级 context eligibility / share-needed 状态应由 server/API 按 viewer/scope/intent 返回，前端不应把 delivery snapshot 当成 context 可见性，也不应在首屏默认预取完整历史窗口。`privateAgentContextState` 不是普通消息的全局字段：发送反馈走 contribution capability；owner / 有权限操作者在菜单、Share/Forward、wake 等动作中懒加载 action state；普通旁观者不显示、不查询。composer / send confirmation 可以读取轻量 contribution capability，向非授权 viewer 明确提示普通消息不会进入该 owner 的 private-agent context；该能力查询按 bounded channel <= thread <= task effective source chain 解析授权，不得扫描消息。
- private-agent wake access 不是普通 channel/thread read state。打开 channel/thread、composer 初始化或普通旁观者阅读路径不得预取所有 private-agent owners 的 wake eligibility。private-agent mention candidates 只在 `@prefix` intent 下按当前 source scope、prefix/token 和 hard limit 懒加载；own private agents 使用 owner fast-path，不查 People；other owners' private agents 只在 viewer 是当前 source chain 的 active People collaborator 时作为候选返回。发送消息 / explicit wake 是最终授权事实：只对实际 mention tokens / selected wake targets 做 exact candidate lookup，批量检查 non-owner candidate owners 的 People grants，并只为授权且实际 targeted 的 private agents 写 sparse targeted events。read-only candidate/access path 不得调用会 cleanup expired participants 或产生写入的 helper；旧 broad `private-agent-wake-access` route / client / port / service 如果不再有生产调用，应删除而不是保留为可误用入口。

#### 12.9.3 分享他人消息到 thread 时 source attribution 丢失

原始试用中，用户把另一个 human 的消息分享到话题后，目标 thread 里看起来像 owner 自己重新发了一条消息；agent 很容易误判 source author。

原始原因：

- 普通 forward path 使用 `buildShareFlowBatchWrites`；
- `shape = separate` 曾只复制 `message.content`，不保留 source author、created_at、message id 或 structured source refs；
- `shape != separate` 时虽然会写 `messageType = owner_quote`，但消息 top-level author 仍是分享者；如果 UI 没有足够明显地渲染 “shared by X from Y”，human 和 agent 都可能把引用内容误读为分享者自己的原始发言；
- Agent Space 的 owner-gated share path 使用 owner-authored quote message + source refs，但普通 thread forward path 没有同等强制的 attribution 保护；
- 原始消息是否对目标范围内 agents 不可见，当前只依赖 delivery diagnostics / preview 信号；在普通分享流程中不够明显，且某些 used-in-context 状态会隐藏 inline summary。

验收方案：

- 任何把他人消息分享进 agent-visible surface 的动作，都必须使用 structured `owner_quote` / context card，而不是纯文本复制；
- `separate` 也应产生多条 structured `owner_quote` rows，或者在 agent-visible targets 中降级为明确 ordinary forward；
- 普通 thread share 应明确区分 “forward as ordinary message” 与 “share as owner_quote with source refs”；当目标 thread 有 agents 或 active task target 时，默认使用后者；
- UI 应显示 “shared by @owner from @sourceAuthor” 并提供 source jump-back；
- source 消息行应更明确提示“目标 agents 尚不可见，需 Share/Forward 为 owner_quote 后才会进入执行上下文”，并复用 delivery diagnostics 作为解释入口，而不是只在诊断弹层里暴露。

当前状态：ShareFlow emits structured `owner_quote` rows instead of plain copied text; owner_quote messages expose source refs / frozen quote attribution through ordinary message surfaces. The old add-context DTO/UI/API path is removed.

#### 12.9.4 建议修复顺序

1. 修复 reply-thread agent task creation 的 source binding，确保 human-visible origin thread 会记录 task source binding，且不会插入 inline task card。
2. 移除 ShareFlow legacy `task_context` target discovery；普通消息 source materialization 必须通过 ordinary targets 上的 `owner_quote` concrete message 发起。
3. 修复 share/forward attribution，禁止 agent-visible context 以纯文本复制他人消息。
4. 按 [`collaborator-policy.md`](collaborator-policy.md) 实现 task/thread/channel collaborators，承接旧 Agent Space invite human 能力；不要继续把 Agent Space 作为用户可见入口。

### 12.10 收敛状态与验收清单

本节是 task-native convergence 的长期验收清单，不记录单个 PR、分支或一次性推进顺序。每条描述当前必须持续成立的行为；如果实现回退，应同步更新本 spec、相关 domain spec 和回归覆盖。

| ID | 目标 | 主要 spec 位置 | 状态 |
|---|---|---|---|
| T1 | 修复 reply thread 中 agent 创建 task 时 source binding 丢失：保留 human-visible origin thread，`create_tasks` 使用 source thread/source refs；source conversation 保持 quiet，只通过 task reference、explicit announcement 或 active task target 连接后续协作 | `embedded-view.md` Source binding / Active task target behavior；本文 §12.9.4 | Done: daemon `create_tasks` 从 active target / AgentTeamMeta source / current parent target 推断 source thread；owner-private hidden context 保留 human-visible origin，让 private agent 能在授权 parent thread 语境下创建带 source refs 的 task，且不写 source-thread inline card |
| T2 | 收敛 ShareFlow target：普通消息分享只 materialize 到 channel / DM / thread，并以 `owner_quote` 保留来源归因；不提供 task_context target | 本文 §12.9.1；`embedded-view.md` §7.7；`collaborator-policy.md` §5.2 | Current: ShareFlow 默认目标是 ordinary conversation surfaces；task_context target / old add-context 入口不进入默认路径 |
| T3 | 修复 owner_quote attribution：shared/forwarded material 必须以具体 owner_quote 消息保留 shared-by、source author、source refs/frozen quote；agent 读取时不能误判为 owner 原创 | 本文 §12.9.3；`collaborator-policy.md` §4、§5.2 | Current: ShareFlow emits structured `owner_quote` rows with source refs; add-context DTO/detail path is removed |
| T4 | 修复普通 share/forward 到 agent-visible thread 的 attribution：禁止纯文本复制他人消息进入 agent-visible context；`separate` 也要 structured quote/source refs 或降级为明确普通 forward | 本文 §12.9.3；`../agent-space/shared-spaces-and-agent-spaces.md` §9 | Done: ShareFlow separate 模式改为多条 `owner_quote` structured rows，保留 source refs；普通 note 仍作为分享者说明 |
| T5 | Pre-ship delivery ledger rewrite：因为 Agent Space / `scope_fanout_outbox` 尚未上线，不把 `scope_fanout_outbox` 作为 shipped schema；普通 dense/broad delivery 用 scope cursor 推导，`@all` / `@online` 都是 broad policy 且不写 per-recipient targeted rows；direct mention / explicit wake / task dispatch / reaction 用 sparse targeted event，owner_quote source materialization 写 ordinary message/source-ref audit；同时移除隐藏 materialization paths，包括 Agent Space auto-flow copy、creation backfill、routine auto-publish mirror、source-ref-as-dedupe、attachment copy、eager inherited participant/subscription rows、human/reaction side delivery ledgers | `../message/delivery-ledger-optimization.md` §2.1、§5、§9；`../storage/storage.md` Delivery Ledger Write Amplification | Done: `scope_fanout_outbox` 已从 bootstrap / 00093 / runtime dependency / migration SQL 移除；`scope_fanout_outbox` 承接 sparse facts including reaction signals；ordinary dense receive 通过 cursor / scope composition；`@online` 已与 `@all` 一样收敛为 best-effort broad wake，不写或迁移 `channel_broadcast_online` targeted rows；auto-flow、creation backfill、default auto-publish、attachment copy default、source dedupe 命名等 hidden materialization path 已收口并有回归；`00094_task_native_convergence.sql` 保留为 order-preserving no-op，已跑旧 00093 的 pre-ship internal DB 默认重建 |
| T6 | 实现 collaborator participant/grant 模型：channel/thread/task Scope Execution 独立 owner-scoped local People grants、add/remove/leave、owner 授权、lazy effective union、source scope / participant relation audit；collaborator 普通消息 context-eligible 但不默认 delivery；默认 owner path 与普通消息写路径不查表、不创建空 rows、不做 per-message collaborator query；承接旧 Agent Space scope execution container 能力但不暴露 Agent Space | `collaborator-policy.md` §3-§9 | Done for current convergence slice: backend People 事实源收敛到 internal collaborator metadata 的 `task_scope_participant_metadata(owner_scope_execution_id, member_id, removed_at IS NULL)`；whole-scope range sharing 不交付，backend/API/frontend 不发布 `{boundaries}` contract 或 boundary table。 |
| T7 | 接入 Task discussion / collaborator context eligibility：owner、active People collaborator 的普通 source-scope 消息可进入对应 owner channel/thread/explicit task 的 context-eligible stream；collaborator direct mention / explicit wake 才写 sparse targeted delivery；non-collaborator 消息必须 explicit Share/Forward owner_quote；remove/leave 后停止未来 collaborator 行为，历史 audit 保留；不得写 per-message/per-collaborator delivery rows | `collaborator-policy.md` §4-§9；`../message/delivery-ledger-optimization.md` §5 | Done for current convergence slice: backend `privateAgentContextState` route/DTO 提供 server-side contextEligibility；task discussion authorization audit 记录 owner/people relation；direct mention 写 sparse targeted event；普通 collaborator comment 本身不因 collaborator membership 自动 wake，也不写 per-message/per-collaborator delivery rows。Canonical Task assignee / Watch attention 是 Task-domain event recipient policy，不是 collaborator grant 的隐式扩张；frontend 消费 server DTO，不猜 resolver、不复用 delivery snapshot。Cost convergence 要求见 T9：该 route 不得作为 thread/task 首屏历史窗口默认预取路径。 |
| T8 | 补回归覆盖与文档：source binding/source refs、owner_quote source attribution、task references/announcements、active target、collaborator add/remove/leave/expire、安全拒绝、delivery ledger pre-ship gate、owner-private context replacement | `embedded-view.md` Acceptance criteria；本文 §15；`collaborator-policy.md` §8；`../message/delivery-ledger-optimization.md` §10 | Done for focused convergence gate: storage no-ledger gate、hidden materialization / receive / sparse event / diagnostics / quiet source-thread behavior / active-target / collaborator / default hidden Agent Space UX coverage 已补齐或更新；collaborator coverage 包含单表 grant、无 fast-path 字段/notification 专表、owner-only bounded lookup / 普通写路径不查 collaborator、普通消息 no collaborator fanout |
| T9 | 收敛 private-agent context state 成本：owner authorization metadata 只存 owner 授权 People；owner-only channel/thread scope 不创建 execution row / 空 collaborator metadata row；explicit task owner-only identity 由 task row 承担，不因 task 存在默认创建空 `(owner, task)` execution row；thread/task 首屏不为所有可见历史消息预取 `privateAgentContextState`；`privateAgentContextState` 是 viewer+intent scoped 操作状态，不是普通消息全局字段；composer 使用 contribution capability 给非授权 viewer 明确提示；message-level resolver 只在菜单、Share/Forward、wake、批量选择、realtime delta 等明确意图下小批量运行，且 DB 层无 per-message query | `collaborator-policy.md` §2、§7.2、§8.1、§8.5、§9、§12 | Done for this cost-convergence slice: thread message first paint no longer prefetches visible-window `privateAgentContextState`; composer uses contribution capability without message IDs; backend resolver batch-loads message/readability/owner-private-agent facts and has query-count regression coverage against per-message DB amplification. |
| T10 | 收敛 private-agent wake/access candidate 成本：channel/thread 首屏和 composer 初始化不预取所有 private-agent owners 的 wake access；`@prefix` 候选按当前 source scope + prefix/token + hard limit 懒加载；own private agents owner fast-path；other owners' private agents 只在 viewer 是当前 source chain active People collaborator 时返回；发送路径对实际 mention tokens 做最终授权并批量查 non-owner candidate grants；read-only candidate path 不做 expired participant cleanup 写入；删除无生产调用的 broad wake-access endpoint/client/port/service | `collaborator-policy.md` §5.1、§7.3、§8.5、§9、§12 | Done for this cost-convergence slice: channel/thread first paint and composer initialization no longer prefetch broad `private-agent-wake-access`; composer mention candidates use intent-scoped prefix queries with hard limits; owner-owned private agents use the owner fast-path; non-owner candidates require active People collaborator grants on the bounded source chain; send-path exact private-agent wake rechecks bounded direct mention tokens and batch-loads non-owner grants before writing sparse targeted events; the broad wake-access production surface is removed. |

## 13. 迁移策略

### Phase A：Spec 和术语收敛

- 新增本 spec；
- product spec index 指向本 spec；
- source-thread task reference spec 只引用本 spec，不内嵌 Agent Space 收敛计划；
- prompt / UI copy 开始减少 Agent Space 术语；
- 把当前用户可见 Agent Space routes / panels / docs / tests 标记为 old Agent Space surface，不再作为新能力扩展入口；
- 明确 Scope Execution 是最终态内部模型，不是 legacy；legacy 只指旧暴露面和兼容 wire/API 命名。

### Phase B：Task / Scope Execution API 包裹 Agent Space 能力

- 增加 owner_quote source refs / frozen source snapshots（当前 owner_quote source-ref model 已落普通 message/source refs；后续如需更完整 quote rendering，可在该 source model 上扩展展示层，不回退到 metadata / discussion note 作为事实来源）；
- 增加 active task target server/daemon state；
- 增加 ordinary Share/Forward owner_quote source attribution；
- 增加 task-level milestone announcement API；
- 增加 task-level notification / output routing policy API；
- 增加 task execution history facade；
- 增加 Scope Execution / Agent sharing facade，覆盖 channel/thread private-agent context、collaborator grants、explicit wake 和 diagnostics；
- MCP task tools 返回结构化 active task target。

### Phase C：UI 入口迁移

- Agent Space panel 的主入口迁移到 task detail / task references / explicit announcements（当前实现已完成默认入口迁移；旧 panel 没有用户可见 opt-in）；
- ShareFlow 文案改为 Share/Forward as owner_quote，并且默认 targets 不再包含 Agent Space compatibility panel 或 task_context；
- publish-out 文案改为 task announcement / milestone；
- private agent output policy 改为 task-level Notifications & output。
- 每个旧 Agent Space 用户入口移除前，必须确认 task-native 等价入口已经可用；不能只隐藏旧入口导致能力断层。
- website docs 与 E2E 从 Agent Space 用户旅程迁移到 Task 用户旅程。

### Phase D：内部实现收敛

- 因 Agent Space / `scope_fanout_outbox` 尚未上线，不走“上线后逐步退役”路线；ship 前直接改写未上线 Agent Space foundation migration、bootstrap snapshot、browser API facade、realtime event facade 和 delivery truth；
- `scope_fanout_outbox` 不进入 shipped schema；durable facts 拆到 scope cursors、sparse targeted events、policy epochs 和 task-native audit；
- collaborator storage 不发布 task-centric 多表模型，也不同时发布 `scope_memberships` + `collaborator_grants` / `owner_private_collaborators` 多套重叠边界模型；ship 前 People/direct member collaborator grants 收敛到 `task_scope_participant_metadata(owner_scope_execution_id, member_id, ...)`，`scope_memberships` 只保留普通 member participant/read-state 语义；whole thread/channel range sharing 不作为 V1 授权对象，不维护 boundary table，不展开成员、不参与普通 message write；thread/channel collaborator grant 是 private-agent context eligibility boundary，不是普通 message delivery fanout baseline；
- 保留 owner-scoped private-agent Scope Execution 作为最终态内部模型；实现可以继续使用或重命名当前 `agent_space` substrate，但 exposed target / route / panel / prompt 不能继续以 Agent Space 作为产品模型；
- 如果最终保留 `agent_space` implementation detail，明确它只是 Scope Execution 的存储/runtime substrate，不再是 public product object、browser-facing flow、agent prompt target、diagnostic user concept 或 delivery fanout baseline；
- realtime / diagnostics / browser client 增加 task-facing facade；
- 移除或隐藏用户可见 Agent Space API / UI，但只在 Task 已经完整承接对应能力之后进行。

## 14. 被拒绝方案

### 14.1 保留 Agent Space 作为并列用户对象

这会让用户在 thread、task、agent space 三个协作面之间选择，心智成本过高，并且会削弱 task 作为执行事实来源的地位。

### 14.2 删除 Agent Space 能力，只留下 task discussion

这会丢失 Agent Space 已经解决的 private ingress、publish-out、runtime scope、notification、share-in 等能力。正确方向是能力迁移，不是能力删除。

### 14.2A Task-only：不保留 Scope Execution

这会把普通 channel/thread 中的 owner-scoped private-agent context 强行塞进 task board，或者让非任务型授权、collaborator wake、context eligibility 没有事实来源。Task 只能承接 task-shaped execution；Scope Execution 必须保留为内部 runtime/context boundary。

### 14.3 把所有 Agent Space transcript 镜像进 thread

这会重新制造噪音和重复事实来源。Thread 应展示轻量 task references 和少量 human-facing announcement，而不是执行日志。

### 14.4 只隐藏 Agent Space UI，不补 Task 能力

这会让产品表面上不暴露 Agent Space，但实际丢失 share-in、publish-out、notification、wake、history、output policy 等能力，或者迫使高级用户通过隐藏 route / id / API 绕路使用 Agent Space。

这不满足本 spec。正确方式是用 Task / Agent sharing surface 替换 Agent Space surface，并用 Scope Execution 保留内部 execution boundary，而不是只把旧 surface 移出视觉层级。

## 15. 验收标准

收敛方向完成时，应满足：

1. 用户完成 agent 协作时不需要理解或打开 Agent Space；
2. task detail / task discussion / task references 覆盖 task-shaped Agent Space v1 主要执行能力，Scope Execution 覆盖非任务型 channel/thread private-agent context；
3. share-in 能力以 “Share/Forward as owner_quote” 呈现；
4. publish-out 能力以 task announcement / milestone / review request 呈现；
5. private agent 的输入边界被 Task + Scope Execution 化：owner 普通消息和 active People collaborator 的授权后 source-scope 消息可以作为对应 owner scope/task 的 context；non-collaborator 普通 thread/channel 消息必须 explicit Share/Forward owner_quote；
6. runtime wake 能以 active task target 或 parent target + hidden owner-private context 表达；
7. 多 agent / planner / subtask 协作流程在 task 下完整表达；
8. 普通 thread 不被 agent routine progress 淹没；
9. Agent Space API/UI 不再作为 primary user-facing surface；
10. 兼容期内的 agent_space internal implementation 不泄漏为产品心智模型；
11. 移除或隐藏任何 Agent Space 用户入口前，Task 已提供同等用户可见能力；
12. 用户不需要通过 Agent Space 名称、agent space id、隐藏面板或公开 Agent Space route 完成日常 agent 协作。
13. Task API / UI / realtime / docs / E2E 均覆盖 Agent Space v1 的 share-in、publish-out、history、notification、wake/output policy 能力；
14. 旧 Agent Space browser API、Agent Space message update event、visible hidden-target strings 等路径不得作为默认用户或 agent-facing contract；runtime target 使用 parent target，owner-private context 只通过 hidden authenticated session / delivery binding 传递。
15. Shipped schema 不依赖 `scope_fanout_outbox`；默认 dense/broad delivery、`@all` / `@online`、Task discussion 和 collaborator ingress 不产生 per-message/per-recipient delivery rows。
16. 普通 channel/thread/task discussion 消息不会通过 Agent Space auto-flow、creation backfill、routine auto-publish、source/publication refs、attachment copy、participant/subscription inheritance、collaborator grant 或 descendant task 产生隐藏 message-copy / parent-mirror / delivery materialization；context eligibility 通过 source refs、author、effective global seq range 和 participant/grant resolver 读取组合，显式 owner_quote source refs、dual-send、Task announcement、artifact 或 sparse targeted event 仍写各自 audit/fact。
17. Thread/channel collaborator grant 会扩大对应 owner scope/task 的 context eligibility，但不会扩大普通 transcript visibility，也不会自动 delivery / wake；UI 必须区分“agents can use this as context”和“this will wake agent”。在 agent/context 操作面，或状态已按意图懒加载存在时，消息行 / composer 不复用 delivery snapshot 表达 context eligibility；owner / 有权限操作者对 non-collaborator 消息执行 Share/Forward / wake 等动作时，才懒加载并展示对应 affordance。普通 thread 首屏和旁观者阅读路径不默认查询这些消息级状态，也不默认查询所有 owner 的 private-agent wake access。
18. Private-agent mention candidates 是 intent-scoped：own private agents 可直接候选；collaborator-visible private agents 只在 `@prefix` lazy resolver 中按 hard limit 返回；发送路径重新授权实际 mention tokens 并只写 authorized sparse targeted events。
19. Scope Execution / owner-scoped private-agent execution context 在 specs、diagnostics 和代码边界中被明确为最终态内部模型，不被命名为 legacy；legacy 只用于旧 Agent Space browser API、panel/flow、publish transcript 和 agent-facing hidden-target vocabulary 的历史描述，不用于当前 runtime target。
