ADR 0023: CollaborationScene multi-endpoint agent collaboration
Status
Accepted, revised by ADR 0027 and ADR 0028.
Context
Zhin needs a first-class experience where multiple real bots in the same IM group can collaborate visibly. Earlier designs stored pipeline state on the collaboration unit and used group chat as the orchestration plane. That coupled IM projection, task state, and five-agent workflow too tightly.
Decision
CollaborationScene (formerly CollaborationCell) is not the orchestration state machine. It is the collaboration plane over one or more IM scenes:
| Concept | Owner | Responsibility |
|---|---|---|
| Transport Actor | Endpoint | Platform identity used for outbound messages |
| Cognitive Profile | ai.agents / .agent.md | Model, prompt, tools, and policy |
| Runtime | ZhinAgent per endpoint | Executes local turns and local tasks |
| Collaboration Scene | CollaborationScene | Logical unit, member directory, endpoint/profile mapping, group projection context |
| IM Scene | IMSceneRef | Platform group/channel/private identity (ADR 0028) |
| Run State | OrchestrationKernel | Runs, tasks, assignments, events, state transitions |
Run-to-scene linkage:
run.source = {
kind: 'im_scene',
scene: { platform, endpointId, sceneId, kind },
collaborationSceneId, // optional CollaborationScene.id
}Invariants
- Identity follows outbound: when a peer endpoint should speak, the scene executor sends an actual IM mention instead of making the planner impersonate that peer.
- Cognition follows profile: agent configuration does not imply transport identity.
- Coordination follows the kernel: runs, tasks, assignments, handback, progress, and result recovery are kernel events.
- Platform remains a projection bus: group messages are a visible projection of assignments and results, not the source of truth for task state.
Scene Mention Executor
Group collaboration uses scene_mention (group_mention is a read-time alias only).
- Assignment emits a group/channel mention containing
#taskId. - Handback first matches an explicit
#taskId. - If no
#taskIdexists and the(collaborationSceneId, endpoint)pair has exactly one active assignment, the reply is attributed to that task. - Private scenes cannot use
scene_mention.
Persistence
Tables (new installs, ADR 0028):
collaboration_scenes— id, adapter, scene_id (IM), goal, optional legacy pipeline fieldscollaboration_scene_members— collaboration_scene_id, endpoint_id, rolescollaboration_scene_aliases— logical_scene_id ↔ adapter/scene_idcollaboration_scene_member_channels— cross-adapter identity edges
Host REST: /api/collaboration/scenes* (members, pipeline, artifacts sub-resources).
User commands
/collab init, bind, status, etc. remain the in-chat management surface. Master endpoint gate unchanged.
Consequences
- Console collaboration REST manages scenes and members; run snapshots and event streams come from the kernel.
- Existing group-chat collaboration remains visible to users; implementation evolves independently of the core run state machine.
- Five-agent collaboration is a workflow strategy over kernel tasks, not a scene-level state machine.