Codex Bridge
Delegate coding tasks from OpenClaw to the local codex CLI and manage them asynchronously.
This skill provides a file-based bridge so OpenClaw can:
- - dispatch tasks
- poll status and recent output
- relay clarifying questions
- send answers
- collect final results
When to Use
- - Build scripts (Python, Bash, etc.)
- Implement or refactor code in an existing project
- Run larger multi-file coding tasks in the background
- Delegate coding work while keeping OpenClaw responsive
- Handle tasks that may require clarifying questions mid-run
When NOT to Use
- - Quick factual questions or explanations
- Small code snippets that OpenClaw can write directly
- Non-coding tasks
- Tasks that should not invoke a local coding agent/CLI
Dispatch a Task
CODEBLOCK0
Prompt Writing
Include:
- - what to build/fix
- file paths if known
- expected behavior/output
- language/framework preferences
- constraints (tests, style, no new deps, etc.)
Example:
CODEBLOCK1
Check Status
CODEBLOCK2
Common status commands:
CODEBLOCK3
Answer Clarifying Questions
When status is waiting_for_answer, read the pending question and send a response:
CODEBLOCK4
The bridge resumes the same Codex session after the answer is written.
Workflow
- 1. Dispatch task with a clear prompt.
- Report the task ID.
- Poll status/output periodically.
- If status becomes
waiting_for_answer, read --question, relay to user, then write answer with --answer. - When status is
complete, read --result and summarize outcomes. - If status is
error, inspect --log and --output.
Notes and Limits
- - Uses the local
codex CLI (codex exec and codex exec resume). - Clarifying questions are implemented via a lightweight text marker protocol in the prompt wrapper.
- Bridge state is stored in
~/.codex-bridge/tasks/<task-id>/. - Commands run via Codex in the specified
--workdir. - For unattended runs, the bridge times out after 10 minutes waiting for an answer and resumes with a default/sensible fallback.
Codex Bridge
将OpenClaw的编码任务委托给本地codex CLI,并以异步方式管理这些任务。
该技能提供基于文件的桥接,使OpenClaw能够:
- - 分发任务
- 轮询状态和最近的输出
- 转发澄清问题
- 发送答案
- 收集最终结果
使用场景
- - 构建脚本(Python、Bash等)
- 在现有项目中实现或重构代码
- 在后台运行较大的多文件编码任务
- 委托编码工作,同时保持OpenClaw的响应性
- 处理运行过程中可能需要澄清问题的任务
不适用场景
- - 快速的事实性问题或解释
- OpenClaw可以直接编写的小代码片段
- 非编码任务
- 不应调用本地编码代理/CLI的任务
分发任务
bash
~/.openclaw/skills/codex-bridge/codex-bridge-dispatch.sh \
--task-id <描述性名称> \
--workdir <项目目录> \
--prompt <详细的编码任务>
提示编写
包含:
- - 要构建/修复的内容
- 已知的文件路径
- 预期的行为/输出
- 语言/框架偏好
- 约束条件(测试、风格、不新增依赖等)
示例:
bash
~/.openclaw/skills/codex-bridge/codex-bridge-dispatch.sh \
--task-id scripts-csv-parser \
--workdir ~/projects/data-tools \
--prompt 创建 parseorders.py。读取订单CSV,保留已发货行,按customerid分组,并写入包含customerid、ordercount、total_amount列的汇总CSV。使用pandas。添加基本的CLI参数和错误处理。
检查状态
bash
~/.openclaw/skills/codex-bridge/codex-bridge-status.sh --task-id
常用状态命令:
bash
~/.openclaw/skills/codex-bridge/codex-bridge-status.sh --list
~/.openclaw/skills/codex-bridge/codex-bridge-status.sh --task-id --output
~/.openclaw/skills/codex-bridge/codex-bridge-status.sh --task-id --question
~/.openclaw/skills/codex-bridge/codex-bridge-status.sh --task-id --result
~/.openclaw/skills/codex-bridge/codex-bridge-status.sh --task-id --log
回答澄清问题
当状态为waitingforanswer时,读取待处理的问题并发送回复:
bash
~/.openclaw/skills/codex-bridge/codex-bridge-status.sh --task-id --question
~/.openclaw/skills/codex-bridge/codex-bridge-answer.sh --task-id --answer <回答文本>
写入答案后,桥接将恢复相同的Codex会话。
工作流程
- 1. 使用清晰的提示分发任务。
- 报告任务ID。
- 定期轮询状态/输出。
- 如果状态变为waitingforanswer,读取--question,转发给用户,然后使用--answer写入答案。
- 当状态为complete时,读取--result并总结结果。
- 如果状态为error,检查--log和--output。
注意事项和限制
- - 使用本地codex CLI(codex exec和codex exec resume)。
- 澄清问题通过提示包装器中的轻量级文本标记协议实现。
- 桥接状态存储在~/.codex-bridge/tasks//中。
- 命令通过Codex在指定的--workdir中运行。
- 对于无人值守运行,桥接在等待答案10分钟后超时,并使用默认/合理的回退方案继续执行。