三方对比
总体架构
| 维度 | Pi | OpenCode | Hermes |
|---|---|---|---|
| 主语言 | TypeScript | TypeScript/Bun | Python + TS UI |
| 核心定位 | agent harness | coding agent platform | personal AI runtime |
| 核心对象 | AgentSession / Agent | SessionV2 / SessionRunner | AIAgent |
| Agent loop | 清晰集中 | durable runner | 单体 loop + 大量生产防护 |
| Session | JSONL/tree | SQLite/event-sourced | SQLite/FTS5/messages/compression lineage |
| 工具 | coding tools | coding+web+todo+skills | 通用工具生态 |
| 扩展 | extension API | plugin/agent/skill/MCP | plugin/hooks/skills/MCP/toolsets |
| UI | 轻量 TUI | OpenTUI/Solid | prompt_toolkit CLI + Ink TUI + Electron Desktop |
| Gateway | 弱/无 | server/API 为核心 | messaging gateway 为核心 |
| Cron | 无 | 非核心 | 核心功能 |
| Memory/Skills | 有技能/资源 | skills/agents | memory + skills 是核心闭环 |
调用链对比
Pi
pi CLI → AgentSessionRuntime → AgentSession → AgentLoop → pi-ai → tools → JSONL session特点:短、清晰、适合学习 agent loop
OpenCode
opencode CLI/TUI → local server / SDK / API → SessionV2.prompt()
→ durable session_input → SessionExecution.wake() → SessionRunner
→ LLM.request / LLMClient.stream → ToolRegistry.settle → EventV2 / projector / TUI特点:durable、server-first、event-driven、产品级 coding agent
Hermes
CLI / Gateway / Cron / ACP / TUI / Desktop → AIAgent
→ build_turn_context() → conversation_loop.run_conversation()
→ ProviderTransport / OpenAI SDK → tool_executor → model_tools
→ tools.registry → SessionDB / memory / skills / plugins / platform delivery特点:同一核心被多个 surface 复用
核心设计差异
Hermes 的窄腰
AIAgent + tools + system prompt
OpenCode 的窄腰
SessionV2 + EventV2 + LLM route runtime
Pi 的窄腰
AgentLoop + Tool interface
学习价值
| 想学... | 优先看 |
|---|---|
| agent loop 最小实现 | Pi |
| 产品级 coding agent | OpenCode |
| 多平台 agent runtime | Hermes |
| LLM provider 抽象 | OpenCode (route-based) > Hermes (adapters) > Pi (simple) |
| 持久化 session | OpenCode (event-sourced) > Hermes (SQLite) > Pi (JSONL) |
| 工具生态 | Hermes (最广) > OpenCode > Pi |
| 扩展/插件 | OpenCode ≈ Hermes > Pi |