agent-fleet/openspec/changes/agent-fleet-platform/specs/matrix-chatops/spec.md
Zer4tul aabd52ed52 init: OpenSpec project scaffolding with proposal, design, specs, tasks
- 7 capabilities: agent-registry, task-router, receipt-protocol,
  forgejo-integration, matrix-chatops, agent-adapter, orchestrator-core
- Tech stack: Rust + axum + zigbuild (single binary)
- Forgejo as task source of truth
- Matrix as real-time ChatOps layer
- Adapter pattern for multi-agent type support
2026-05-11 14:37:43 +08:00

45 lines
2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## ADDED Requirements
### Requirement: Matrix room as coordination channel
Orchestrator SHALL 使用 Matrix 房间作为实时协同通道Agent 状态变更、任务分配、完成通知、人类审批等事件 SHALL 推送到 Matrix。
#### Scenario: Task assigned notification
- **WHEN** 任务 #42 被分配给 Agent `worker-03`
- **THEN** Matrix 协同房间 SHALL 收到通知:`📋 #42 → worker-03 [code:typescript]`
#### Scenario: Agent offline alert
- **WHEN** Agent `worker-03` 连续 3 次心跳失败
- **THEN** Matrix 房间 SHALL 收到告警:`⚠️ worker-03 offline — 2 running tasks affected`
### Requirement: Slash commands for orchestration
人类 SHALL 能通过 Matrix slash command 触发编排操作。
#### Scenario: /fleet status
- **WHEN** 人类发送 `/fleet status`
- **THEN** Bot SHALL 回复所有 Agent 当前状态表格Agent ID、类型、状态、当前任务数、能力
#### Scenario: /assign command
- **WHEN** 人类发送 `/assign worker-03 #42`
- **THEN** 任务 #42 SHALL 被手动分配给 worker-03
#### Scenario: /retry command
- **WHEN** 人类发送 `/retry #42`
- **THEN** 失败的任务 #42 SHALL 被重新入队
### Requirement: Matrix notifications for receipts
每个 receipt 回写 SHALL 触发 Matrix 通知包含任务状态、摘要、artifact 链接。
#### Scenario: Task completed notification
- **WHEN** 任务 #42 的 receipt 验证通过,状态为 `completed`
- **THEN** Matrix 房间 SHALL 收到通知:`✅ #42 completed by worker-03 — PR #15 — "修复登录验证 bug"`
#### Scenario: Task failed notification
- **WHEN** 任务 #42 失败
- **THEN** Matrix 房间 SHALL 收到通知:`❌ #42 failed — worker-03 — "构建超时"`
### Requirement: Per-agent Matrix thread
每个 Agent SHALL 有独立的 Matrix thread或 topic用于该 Agent 的执行日志、状态更新、调试输出。
#### Scenario: Agent execution log
- **WHEN** Agent worker-03 开始执行任务 #42
- **THEN** worker-03 的 thread SHALL 收到执行开始消息,后续日志更新也在此 thread