对比矩阵 agents × dimensions

每个单元格是一句可追溯到章节证据的结论;点击任意结论进入对应章节的论证与源码引用。

Claude Code、Codex CLI 与 OpenCode 在五个 harness 子系统上的结论速查
子系统 Claude CodeCodex CLIOpenCode
Agent Loop
主循环
无界 async-generator loop 以 tool call 而非 stop_reason 决定续转,并可在 streaming 中投机执行工具。 tokio task 驱动的单活跃 turn loop 让工具并发执行,但按模型发出顺序写回历史。 SQLite 是真相源:每轮重载 compacted history,并以自控的 one-step loop 驱动模型调用。
Context Assembly & Compaction
上下文组装与压缩
将 system-prompt sections 与 <system-reminder> 分开组装,并按 budget、microcompact、auto-compact 的阶梯卸压。 把项目/环境作为 history diff 注入,compact 时用 summary 加近期 user messages 整体替换历史。 每轮重组 system context,且把 compaction 作为 SQLite 数据与读时过滤,而非删除旧历史。
Tool & Permission Gating
工具与权限门控
deny 工具先从模型可见列表移除,再经 hooks、严格 permission cascade 与已核查的 shell sandbox 路径执行。 approval policy 与 sandbox policy 分轨,shell/apply_patch 经集中 Orchestrator 处理批准、sandbox 与重试。 deny 工具不进模型请求;built-in 多在各自 execute 中调用 ctx.ask,而 MCP wrapper 统一兜底询问。
Memory
记忆
default-on 的 project-scoped topic memory 以 MEMORY.md 为入口,可按 relevance 预算选择 topic 注入。 default-off 的 global file-backed memory 先提取旧 rollout,再串行合并为 token-bounded handbook summary。 新 session 的规则连续性来自 instructions;SQLite 只负责特定 session 的 resume / fork,而非 first-class autonomous learned memory。
Subagent Orchestration
子代理编排
以可观测的 sidechain worker 与 background task 编排;普通 worker 从 focused prompt 开始,并可选 worktree 隔离。 MultiAgentV2 建立有界、可寻址的 persistent thread tree,支持 fresh/full/last-N fork,但默认共享 cwd 与 filesystem。 task 创建或恢复 persistent child session,spawn 前有 hard depth gate;默认 foreground 等待,background 属 feature-gated extension。