中文 | English
为 OpenCode 增加上下文、边界、证据、验证与修复闭环的可靠性增强层。
OpenCode++ 不是 OpenCode 官方项目,也不替代 OpenCode。OpenCode 负责聊天、读代码、改代码、跑命令;OpenCode++ 负责上下文增强、编辑边界、命令证据、策略门禁、影响分析和修复/完成决策报告。
OpenCode 负责聊天、读代码、改代码、跑命令。
OpenCode++ 负责上下文、边界、证据、门禁、影响分析和修复/完成决策报告。当前 opencode-plusplus 还没有发布到 npm,所以不能直接执行 npm i -g opencode-plusplus。现在请从源码安装 OpenCode++,并把 opencode-plusplus 命令链接到全局:
npm i -g opencode-ai
git clone https://github.com/whut09/opencode-plusplus.git
cd opencode-plusplus
npm install
npm run build
npm link然后进入你要使用 OpenCode++ 的目标代码仓库:
cd your-repo
opencode-plusplus发布到 npm 之后,安装命令会简化为:
npm i -g opencode-plusplus opencode-ai然后像使用 OpenCode 一样聊天:
帮我修复登录超时 bug
给这个模块补单测
重构这个函数并保持行为不变OpenCode++ 会在外层安静运行:
- 初始化并增量刷新仓库上下文
- 检查编辑边界
- 阻断危险命令和幻觉命令
- 在执行前阻断 protected / secret path
- 记录 sidecar 事件、命令结果和验证证据
- OpenCode 空闲且有 dirty diff 时执行增量验证
- 复用 contracts / hallucination / regression / impact / tests / policy Guard 栈
- 输出影响范围、回归风险和最新验证报告
默认不打断聊天,只有发现 blocker 时才提醒。
opencode-plusplus # 进入 OpenCode 聊天模式,并自动启用 OpenCode++ sidecar
opencode-plusplus report # 查看最近一次检查结果
opencode-plusplus status # 查看 sidecar 是否 active
opencode-plusplus doctor # 诊断 OpenCode / auth / git / context / plugin
opencode-plusplus --pure # 纯 OpenCode,不启用 OpenCode++opencode-plusplus 会执行 preflight,确保 .agent-context,写入 .opencode/plugins/opencode-plusplus.ts,准备 OpenCode commands/agent 文件,先打印简短状态,再进入当前仓库的 OpenCode TUI。sidecar plugin 会监听 tool.execute.before、tool.execute.after、file.edited 和 session.idle:执行危险命令、幻觉 package script / Makefile target、触碰 protected / secret path 时会前置阻断;工具执行结束后会记录 command、exit code、stdout/stderr hash、working tree hash 和 touched files;OpenCode 空闲且有 dirty diff 时会自动运行增量验证,写入 .agent-context/sidecar/latest.json 和 .agent-context/sidecar/latest.md。
首页主路径只推荐 opencode-plusplus。批处理 Harness Mode、CI-like executor、手动 verify / policy / impact、MCP 和 retrieval 等内核能力保留给高级用户:
| 项目 | 主要职责 | 与 OpenCode++ 的关系 |
|---|---|---|
| Codex / Claude Code / Cursor | 读代码、改代码、跑命令 | 作为 executor,OpenCode++ 提供外层验证和约束 |
| OpenCode / MiMoCode | 开源 coding agent runtime / assistant | 重点 executor 接入方向,OpenCode++ 补充 harness gate |
| CodeGraph | 代码图谱 / symbol / call graph / MCP | 可作为可选深度代码理解 backend |
| OpenHarness / Oh My OpenAgent | 通用 agent harness / workflow | 同属 harness 方向,OpenCode++ 更聚焦 coding agent 可靠闭环 |
- OpenCode 不知道该读哪些文件,靠猜入口和模块。
- OpenCode 修改范围失控,误改 generated、lockfile、CI、migration 或无关模块。
- OpenCode 生成不存在的 API、命令、配置、环境变量或项目约定。
- OpenCode 声称测试通过,但没有可信的 exit code / timestamp / working tree hash 证据。
- OpenCode 改完影响范围不可见,review 风险难判断。
- OpenCode 重复引入历史 bug,repair loop 不知道何时停止。
| 能力 | 当前状态 | 说明 |
|---|---|---|
opencode-plusplus OpenCode TUI launcher |
MVP | 可 preflight、打印短状态、启动 OpenCode TUI,并支持 --pure |
| OpenCode transparent sidecar plugin | MVP | 注入 .opencode/plugins/opencode-plusplus.ts,监听 session / file / tool 事件 |
| sidecar command guard | MVP+ | 支持危险命令、未知 package script / Makefile target、protected / secret path |
| sidecar post-tool evidence | Foundation | 通过 tool.execute.after 记录 exit code、时间、输出 hash、working-tree hash |
| sidecar verify / shared guard stack | Foundation | 复用 contracts、hallucination、regression、impact、tests、policy,仍需更多实仓验证 |
opencode-plusplus report/status/doctor |
Foundation | 可读取 sidecar 报告、检查 active 状态、诊断 OpenCode / auth / git / context |
batch OpenCode executor / opencode-plusplus oc |
Foundation | 适合 benchmark、CI-like run、非交互任务和可重复 demo |
bounded harness-led orchestrator / orchestrate |
Foundation | 支持多轮 artifacts、checkpoint、executor command、decision report |
build / AGENTS.md / .agent-context |
Stable | 仓库上下文编译与生成产物稳定 |
| task plan / pack / run | Stable | 任务级上下文、边界、prompt、trace 文件稳定 |
| TypeScript Compiler API analyzer | Stable | TypeScript / JavaScript 分析主路径稳定 |
| Python AST / optional Tree-sitter analyzer | Foundation | Python 分析可用,Tree-sitter 为可选增强 |
| Hallucination Guard | MVP | 覆盖缺失文件、命令、依赖、配置、symbol 的确定性检查 |
| Regression Guard / memory candidates | MVP / Foundation | 有结构化 regression memory 和候选写入流程 |
| MCP stdio server + core tools | Foundation | MCP 基础工具可用,端到端客户端集成仍需逐项验证 |
| MCP Agent Native Runtime tools | Experimental | start/step/evaluate/repair/finalize 仍属实验能力 |
| MiMoCode / Codex / Claude native normalizers | Planned | 计划补齐更多真实 agent transcript / JSONL normalizer |
| RAG export / retriever provider interface | Foundation | 已有导出和 provider 接口 |
| direct LightRAG server sync | Planned | 计划中 |
完整成熟度说明见 文档首页。
- 5 分钟跑通
- 项目定位
- 总体架构
- Guard 模块
- Agent-led vs Harness-led
- Loop Engineering 源码链路
- CLI 命令参考
- 输出结构说明
- Executor Adapter 状态
- Benchmark 指南
- Roadmap
OpenCode++ 的设计受到 OpenAI Codex、OpenCode、MiMo-Code、CodeGraph、Oh My OpenAgent、OpenHarness 和 OpenClaw 等项目启发。