codex-cli
它能做什么
这项技能向 AI 展示如何以非交互模式运行 Codex,作为编码、分析或审查的助手。适合希望让另一个模型执行或检查任务的开发人员。
适用场景
- ✓你想把编写代码或重构任务交给 Codex,并取回结果的时候。
- ✓你想让第二个模型审查你的修改并指出问题的时候。
- ✓你想运行一项漫长、重复的编码工作,同时自己继续规划工作的时候。
技能链接
https://github.com/kortix-ai/suna/blob/dev/.agents/skills/codex-cli/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把这个重构任务交给 Codex,并告诉我它改了什么,以便我检查。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会编写清晰的任务说明,在选定的文件夹中以某个沙盒设置运行 codex exec,把最终消息保存到文件,然后自行检查被修改的文件和测试。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
The golden rule: Codex's self-report is a claim, not the truth. Always capture its output, then independently verify the artifacts yourself (read the files, re-run the tests) before treating the task as done.
Verified available on this machine: codex-cli 0.137.0, logged in via ChatGPT
(no API key needed). Confirm with codex login status.
</overview>
codex exec \
--cd <workdir> \
--sandbox <read-only|workspace-write|danger-full-access> \
-o /tmp/codex_<rand>.txt \
"your metaprompt here" 2>>/tmp/codex_<rand>.log
- Prompt as the final arg, OR pipe via stdin:
echo "$PROMPT" | codex exec -(good for long/generated prompts). If both are given, stdin is appended. -o, --output-last-message <file>— writes ONLY Codex's final message to a file. This is your clean capture; read it back, don't scrape the TUI stream.2>>/tmp/...log— Codex streams progress/reasoning to stderr; the final message goes to stdout. Redirect stderr to a log so it doesn't bloat your context. Generate the suffix withopenssl rand -hex 4.--cd <dir>— Codex's working root. Scope it to the relevant subdir (e.g.apps/api), not the whole monorepo, so it stays focused.--skip-git-repo-check— only needed when running outside a git repo.</the-core-command>
read-only(default) — Codex can read/grep/run read-only commands but cannot edit files or hit the network. Use for review, analysis, planning, "find the bug", second opinions.workspace-write— can edit files in--cd(and--add-dirpaths) and run commands, but no network by default. Use for real implementation/refactors.danger-full-access— no sandbox at all. Avoid; only for throwaway/ephemeral dirs you fully control.
Approvals: in exec mode Codex does not prompt for approvals. For a fully
autonomous run with no gating at all, add
--dangerously-bypass-approvals-and-sandbox. This is powerful — only use it when
the user has explicitly authorized autonomous edits AND the --cd is scoped, or
when running in an already-sandboxed/throwaway dir. When unsure, ask the user
which sandbox tier before running with write access.
</sandbox-tiers>
codex exec resume --last "now also update the tests" # most recent session
codex exec resume <session-id> "..." # a specific one
The session id is printed at the start of each exec run. Use resume for
multi-turn delegation (draft → refine → fix) instead of re-sending all context.
</session-resume>
常见问题
Codex 能完全访问我的电脑吗?
不能。它在每次运行时设定的沙盒级别内工作,例如只读或仅限工作区写入。
我需要 OpenAI API 密钥吗?
技能说明登录 ChatGPT 即可,并可以用 codex login status 命令检查。
我应该相信 Codex 的报告吗?
不应直接相信。技能说明它的自我报告只是一种说法,因此 AI 应自行核对文件并重新运行测试。
详情
作者的原始描述
Drive OpenAI's Codex CLI (`codex exec`) as a non-interactive coding sub-agent from inside Claude Code. Load WHENEVER you want to delegate a coding/analysis/refactor task to Codex, get a second opinion / adversarial review from another model, fan out parallel agents across files or worktrees, or run a long mechanical job while you stay the planner. Covers the exact `codex exec` flags, sandbox tiers, output capture, JSON/schema modes, session resume, parallel fan-out, and the mandatory "delegate → capture → independently verify, never trust the self-report" supervision loop.
repo: kortix-ai/suna
热度
- GitHub 星标
- 20k
- 排名
- #10371
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
claude-code
20k帮你的智能体把编写代码、审查或规划任务交给 Anthropic 的 Claude Code CLI,并保存结果以便检查。
commit-dis
20k帮你的智能体把本次对话中的修改保存为当前 Git 分支上的一次提交,不推送,也不创建新分支。
composio
20k帮你的智能体使用 Composio 连接 Gmail、Slack、GitHub 和 Notion 等应用,服务于你自己的智能体或你开发的产品。
e2e
20k教你的智能体编写端到端测试,用通俗的目标描述和精确的检查来操作网页或移动应用。