code-yeongyu/lazycodex · 上手攻略

  • 仓库:code-yeongyu/lazycodex
  • 链接:https://github.com/code-yeongyu/lazycodex
  • 分类:AI Agent 框架 · Codex 工具 · 代码生成
  • 作者:Tom
  • 更新:2026-08-07

这是什么

LazyCodex 是一个将 OmO(oh-my-openagent) agent harness 打包给 Codex 使用的发行版。它的定位类似 LazyVim 之于 Neovim——把一套复杂的 agent 编排框架做成一键安装,让普通用户也能用上 Sisyphus Labs 那套高质量多 agent 协作体系。

OmO 本身是一个纪律型多 agent 编排框架,核心组件包括:

  • Hephaestus:执行 agent,负责写代码
  • Oracle:验证 agent,负责检查结果
  • Librarian:上下文管理 agent,负责维护项目记忆
  • Sisyphus:总调度 orchestrator,负责任务路由与多 agent 协调

LazyCodex 通过 Codex 的插件机制把这些组件注入到 Codex 的工作流中,使 Codex 获得:项目记忆生成、战略规划、计划执行、验证完成的能力。

解决什么问题

痛点 LazyCodex 对策
Codex 单 agent 能力有限 多 agent 分工(Hephaestus + Oracle + Librarian)
大型代码库上下文爆炸 $init-deep 生成层级式 AGENTS.md 项目记忆
长任务容易中途跑偏 $ulw-loop 自指循环,直到 Oracle 验证通过才停止
复杂项目缺乏规划 $ulw-plan 战略规划器,产出结构化 plan 文件
多人协作规范缺失 Hooks 机制在关键生命周期注入检查与规范
AI 味代码难以清理 remove-ai-slops skill 行为保留式清理

快速安装

⚠️ 核心原则:始终使用 npx 运行,不要全局安装。

一键安装(推荐)

npx lazycodex-ai install

这等同于:

npx --yes --package oh-my-openagent omo install --platform=codex

全自动安装(无 TUI)

npx lazycodex-ai install --no-tui --codex-autonomous

安装过程中 LazyCodex 会: 1. 安装 plugin cache 和 bin links 2. 创建 agent roles(explorer、librarian、plan、momus、metis、codex-ultrawork-reviewer) 3. 配置 sg binary(ast_grep MCP) 4. 在 Codex 启动时打印 bootstrap 状态,完成后重启 session

Codex 内 Marketplace 安装(备选)

1. 在 Codex 中输入 /plugins
2. 打开 Add Marketplace 标签
3. 输入:https://github.com/code-yeongyu/lazycodex
4. 从 sisyphuslabs marketplace 安装 omo

或从 CLI:

codex plugin marketplace add https://github.com/code-yeongyu/lazycodex
codex plugin add omo@sisyphuslabs

升级与诊断

# 升级插件
codex plugin marketplace upgrade sisyphuslabs

# 诊断安装健康状态
npx lazycodex-ai doctor

doctor 会检查:plugin cache、hooks、MCP servers、agents、config 状态。

卸载

npx lazycodex-ai uninstall

核心命令

LazyCodex 通过 $ 前缀在 Codex composer 中调用:

命令 作用
$init-deep 生成层级式 AGENTS.md 项目记忆,分析目录复杂度,近代码放置指导
$ulw-plan "what to build" Prometheus 战略规划器,写 plan 到 plans/<slug>.md,不碰产品代码
$ulw-loop "task" 自指循环执行器,cap 500 次(ultrawork 模式)/ 100 次(正常模式),Oracle 验证通过才停止
$start-work [plan-name] 执行 plans/ 中的 checklist,持久 Boulder 进度输出
$ulw-loop "task" --completion-promise=TEXT --strategy=reset\|continue 带承诺验证的循环策略

内置 Skills

Skill 用途
review-work 多角度实现后审查
remove-ai-slops 行为保留式 AI 味代码清理
frontend-ui-ux UI 界面打磨
programming TypeScript / Rust / Python / Go 严格规范
LSP 诊断、定义、引用、符号、重命名
AST-grep 结构化代码搜索与批量重写
rules 从 AGENTS/rules/instruction 文件读取项目规范
comment-checker 编辑操作后的反馈检查

Agent Roles

LazyCodex 安装了可选择的 agent roles 到 ~/.codex/agents/

  • explorer:探索代码库结构
  • librarian:维护项目上下文
  • plan:战略规划
  • momus:评审与反馈
  • metis:技术方案分析
  • codex-ultrawork-reviewer:ultrawork 模式质量审查

通过 Codex 的 spawn_agent tool 传 agent_type 参数选择 role。

最小可跑命令

# 1. 安装(Node.js 18+)
npx lazycodex-ai install

# 2. 重启 Codex session(安装完成后会提示)
#    首次启动在 Codex 审批 hooks

# 3. 在 Codex composer 中调用:
$init-deep              # 生成项目记忆
$ulw-plan "用户故事"    # 创建规划
$start-work [plan-name] # 执行计划

# 4. 诊断
npx lazycodex-ai doctor

硬件要求:无特殊要求,依赖 Codex 本身运行。Node.js 18+ 用于安装脚本。

典型适用场景

  1. 大型代码库维护:$init-deep 先行,为后续 agent 提供准确上下文,避免"迷失在大型项目中"
  2. 复杂多步骤任务:$ulw-loop + Oracle 验证,适合需要反复调整直到达标的任务(如重构、测试补全)
  3. 需要战略规划的开发:$ulw-plan 先产出结构化 plan,$start-work 按 checklist 执行,避免边做边改
  4. AI 味代码清理:项目上线前用 remove-ai-slops 走一遍,去除明显机器生成痕迹
  5. 多角色协作审查:librarian + metis + reviewer 三角色接力,模拟多人 code review

坑与注意

说明
必须用 npx 安装脚本设计为 npx 一次性调用,全局 npm i 可能路径异常
hooks 需每次审批 升级后 hooks 状态变为 Modified,需重新审批才能运行
--codex-autonomous 有代价 全自动模式跳过了用户确认,理解其风险再使用
spawn_agent 参数 部分 Codex build 的 spawn tool 没有 agent_type 参数,需在 message 中描述 role
OmO 是 token 大户 多 agent 并行 + 验证循环,实际 token 消耗可能比单 agent 高 3–5 倍
首次 bootstrap 慢 Librarian 生成项目记忆涉及全目录扫描,大仓库耗时可达数分钟

与同类对比

工具 类型 多 agent 验证闭环 项目记忆 规划能力
LazyCodex Codex 插件 ✅ Hephaestus + Oracle + Librarian ✅ $ulw-loop ✅ $init-deep ✅ $ulw-plan
oh-my-codex Codex 插件
Continue IDE 插件 部分
Aider CLI agent 基础
Claude Code CLI agent ❌(单 agent) 部分 基础 基础

核心差异:LazyCodex 是目前最完整的 Codex 多 agent 编排方案,真正实现了「规划 → 执行 → 验证」闭环;OmO 的 Sisyphus 架构在 GitHub 有 60K Stars,其质量已被市场验证。

一句话推荐结论

如果你用 Codex 处理复杂项目,LazyCodex 是目前最值得一键安装的插件——OmO 的多 agent 编排 + 项目记忆 + 验证闭环,让 Codex 从单 agent 工具升级为完整的 AI 开发团队。

注意:OmO 的 token 消耗较高,建议在关键路径(规划、验证)使用 ultrawork 模式,日常单 agent 能完成的任务不必强求多 agent。


原始 commit/PR/issue:https://github.com/code-yeongyu/lazycodex