Files
JARVIS/development-doc/plan/hermes-update/phase-h0-ownership-and-adr.md

88 lines
2.3 KiB
Markdown
Raw Normal View History

# H0 Ownership Matrix 与架构决策
## 1. 目标
先把 Hermes-first 的 ownership matrix、边界和成功标准写清楚防止后续开发过程中又回到“先写 adapter最后发现架构中心没变”。
## 2. 核心判断
这轮改造的目标不是:
- 给 Jarvis 再挂一个更强的 runtime adapter
而是:
- 让 Hermes 成为默认 execution core
- 让 Jarvis 退回 product shell
## 3. Ownership Matrix
### 3.1 Hermes Core
Hermes 应负责:
1. session lifecycle
2. runtime resume / recovery
3. execution loop
4. chunk streaming
5. runtime-internal tool orchestration
6. runtime health / restart metadata
### 3.2 Jarvis Product Shell
Jarvis 应负责:
1. conversation / message 持久化
2. user / auth / permission 边界
3. memory context assembly
4. retrospective / knowledge 注入
5. skill shortlist
6. task graph / parallel worthiness 分析
7. product continuity
8. SSE contract
9. observability / attachments / metrics
10. rollout / fallback / rollback policy
### 3.3 Shared Contracts
需要显式建模的共享边界:
1. runtime prepared context
2. runtime event model
3. continuity envelope
4. session health metadata
5. rollout policy metadata
## 4. 关键边界原则
1. 不把 Hermes session id 直接当成完整 continuity。
2. 不让前端直接依赖 Hermes-native event。
3. 不把 memory / skill / task graph 直接挪进 Hermes 黑盒。
4. 不让 `AgentService` 继续充当 runtime 本体。
5. 不把 runtime 选择长期暴露为普通用户负担。
## 5. 目标文件锚点
### Backend
- `backend/app/services/agent_service.py`
- `backend/app/services/agent_runtime/base.py`
- `backend/app/services/agent_runtime/hermes_runtime.py`
- `backend/app/services/agent_runtime/hermes_session_manager.py`
- `backend/app/models/conversation.py`
### Frontend
- `frontend/src/api/conversation.ts`
- `frontend/src/pages/chat/composables/useChatView.ts`
- `frontend/src/stores/conversation.ts`
## 6. 成功标准
- [ ] Hermes-first 的 ownership matrix 被写清楚
- [ ] 保留 Jarvis product shell 的范围被写清楚
- [ ] fallback / rollback 必须存在这一点被写清楚
- [ ] 后续 phase 的顺序依赖被写清楚
## 7. 本阶段结论
只有先把 ownership 定义清楚,后面 H1-H7 才不会演变成“代码改了很多,但架构中心没有变”。