Codex 增强版:对标 Claude Code 新增 Agent Teams、Hooks、anthropic api Agent 、WebUI

0 阅读2分钟

Codex 增强版:对标 Claude Code 新增 Agent Teams、Hooks、anthropic api Agent 、WebUI

基于原版 Codex,加了五个核心功能:

功能一句话说明
Agent Teams多 Agent 组队协作,任务分发 + 持久化消息
Hooks18 种生命周期事件拦截,对齐 Claude Code
Anthropic API(Agent)原生 anthropic-sdk-rs,直接用 Claude 模型
Web UIcodex serve 启动浏览器交互,Axum + React + SSE
Remote Control手机/其他设备远程控制本地 CLI 会话(就是在 TUI 里面启动 serve)

后面会重点优化 Agent 编排工作流。先看现在能干什么。


安装

一键安装(macOS / Linux / WSL):

  curl -fsSL https://raw.githubusercontent.com/stellarlinkco/codex/main/scripts/install.sh | bash

Windows PowerShell:

  irm https://raw.githubusercontent.com/stellarlinkco/codex/main/scripts/install.ps1 | iex

脚本自动检测 OS 和架构,二进制装到 ~/.local/bin。验证:

  codex --version
# 输出类似:codex 1.2.1

codex-cli-splash.png

系统要求:macOS 12+ / Ubuntu 22.04+(glibc >= 2.35)/ Windows 11 WSL2,4GB RAM 起步。


功能一:Web UI

codex serve 启动 webUI 默认随机端口+安全 Token ,搭配内网穿透可以远程 VibeCoding。

  codex serve
# 指定端口:codex serve --port 8080
# 不自动打开浏览器:codex serve --no-open

SCR-20260227-g0a.png 基于 GitHub - tiann/hapi: App for Claude Code / Codex / Gemini / OpenCode, vibe coding anytime, anywhere 二次开发的,感谢 hapi。


功能二:Agent Teams

对标 Claude Code 的 Sub-Agents。多个 Agent 组队,各司其职。

Screenshot 2026-02-27 at 11.24.16.png

Screenshot 2026-02-27 at 11.24.59.png

  {
  "team_id": "my-feature-team",
  "members": [
    { "name": "planner", "task": "制定实现计划", "agent_type": "architect" },
    { "name": "implementer", "task": "实现功能", "agent_type": "develop", "worktree": true },
    { "name": "reviewer", "task": "审查代码", "agent_type": "code-review" }
  ]
}

worktree: true 给 Agent 独立的 Git Worktree,避免互相踩文件。任务有锁、消息有持久化 Inbox(JSONL),进程崩了数据也不丢。

任务流很简单:team_task_listteam_task_claim_next → 干活 → team_task_complete。成员之间用 team_message 点对点聊,team_broadcast 群发。


功能三:Hooks

18 种生命周期事件,跟 Claude Code 的 Hooks 基本对齐。

  [[hooks.pre_tool_use]]
command = ["python3""/Users/me/.codex/hooks/check_tool.py"]
timeout = 5

[hooks.pre_tool_use.matcher]
tool_name_regex = "^(shell|exec)$"

三种 Handler:

  • Command:跑 Shell 命令,stdin 进 JSON,stdout 出 JSON
  • Prompt:让模型判断,返回 {"ok": true/false}
  • Agent:起一个验证 Agent,能调工具做复杂检查

退出码 0 放行,2 阻断。Hook 输出可以注入上下文、改写工具输入、做权限决策。

Skill 级别也能定义 Hooks,在 SKILL.md 的 YAML frontmatter 里写,作用域限定在 Skill 激活期间。


功能四:多模型支持(Anthropic API)

config.toml 里定义 Provider,支持 openai 和 anthropic:

  [model_providers.anthropic]
name = "Anthropic"
base_url = "https://api.anthropic.com"
env_key = "ANTHROPIC_API_KEY"
wire_api = "anthropic"

model_provider = "anthropic"
model = "claude-sonnet-4-5"
  export ANTHROPIC_API_KEY="sk-ant-api03-..."

还能按 Agent 角色分配不同 Provider——Architect 用 Claude 推理,Developer 用 GPT 写代码,各取所需。


功能五:Remote Control

电脑上跑着 CLI,手机浏览器远程操控。目前是 MVP 阶段,轮询机制。

  # TUI 里输入 /remote-control,handoff 到 serve
/remote-control

Screenshot 2026-02-27 at 11.34.59.png

会话 handoff 到 codex serve,浏览器接管。心跳 30 秒,断线自动重连(退避 1s → 2s → 4s → 8s → 30s 封顶)。


项目仓库:github.com/stellarlink…

如果觉得好用可以给个 star 感谢