Skip to content
←INDEX / Prompt library
TUTORIAL/OpenAI Codex/AdvancedPRO

Advanced Codex CLI Playbook: Layered AGENTS.md + config.toml + Research-to-Ship Workflow

Upgrades OpenAI Codex CLI from 'vibe coding' into a controllable engineering agent: layered AGENTS.md, approval and sandbox settings in .codex/config.toml, and Starlark command gating, paired with a five-stage Research → Plan → Execute → Review → Ship workflow.

SakuyaPromptCraft editor · Updated 2026-06-08
TutorialOpenAI CodexAdvanced
01PROMPT
Codex CLI 不只是能跑指令的聊天框。把上下文分層、把審批與沙箱設好、把每個任務跑成「先研究再計畫再執行再審查再上線」——讓代理可控、可重現、敢放手。MIT 授權。

[ Log in to see the full prompt ]
LOGIN TO UNLOCK

Sign up free to see the full prompt, copy it, save it, and join the discussion. Free content unlocks on login; Pro content is a separate subscription.

02CONTEXT / Why it works

**What it is / what problem it solves** Telling OpenAI Codex CLI to just 'build this feature' often produces runaway results: it edits files carelessly, runs dangerous commands, or produces code that doesn't match team conventions. This playbook upgrades Codex CLI from improvised 'vibe coding' into a controllable, reproducible engineering-agent process — built on three things: writing project context into a layered AGENTS.md, managing approvals and sandboxing via .codex/config.toml, and running every task through one fixed workflow (Research → Plan → Execute → Review → Ship). **Why this source is worth using** shanraisshan/codex-cli-best-practice (MIT licensed) is one of the few repos that systematically organizes real-world Codex CLI practice: it compiles 50+ community tips and compares six mainstream agent workflows side by side (Superpowers, Spec Kit, gstack, Get Shit Done, oh-my-codex, Compound Engineering), distilling their common skeleton down to Research→Plan→Execute→Review→Ship. It also covers Codex's advanced mechanisms: subagents (purpose-built specialized agents rather than one generic role), skills (reusable, progressively-disclosed instruction packages), MCP server integration for external tools, hooks (shell scripts for logging / security scanning / validation), and memories (learning across sessions). This content has been rewritten and reorganized, not copied verbatim. **How to use it (key points)** 1. **Layered AGENTS.md**: keep a lean one at the root (in practice, roughly under 150 lines, hard-capped at 32 KiB) that clearly states setup / build / test commands — anyone should be able to read it and immediately run the tests. Don't put personal preferences into the team version; use an `AGENTS.override.md` instead. Keep the codebase clean (unfinished framework migrations mislead the model). 2. **.codex/config.toml**: set `approval_policy` (on-request by default / never / always), `sandbox_mode` (workspace-write + on-request is recommended), use profiles to switch between security levels (e.g. conservative / trusted), and optionally specify the model. 3. **Starlark command gating**: use `prefix_rule()` to classify command prefixes into allow / prompt / forbidden, and test rules with `codex execpolicy check`. 4. **Run the workflow**: for every task, follow Research (agentic search: glob + grep beats RAG for finding code) → Plan (use /plan to break down steps) → Execute → Review (have a second Codex or Claude Code review it like a senior engineer) → Ship. **When to use it** When you want Codex CLI to handle larger tasks autonomously while still being controllable and producing trustworthy output. Especially suited to team collaboration and situations where you want 'how to run this project' codified once and for all. 📎 Source: shanraisshan/codex-cli-best-practice (by shanraisshan, MIT licensed) — this piece is a rewritten and reorganized version; see the link above for the full tip list and workflow comparisons.

RELATED
PRO01
TUTORIALSuno v5.5FEATURED
r/SunoAI (anonymous studio engineer)2026-06-12

Suno Engineer's Mindset: 4 Steps to a Song That Doesn't Sound Like AI

5.0(1)

A studio engineer's breakdown of Suno's fatal weaknesses (fried vocals, high-frequency artifacts), plus a 4-step DAW workflow and a Suno Studio cleanup prompt.

Advanced
Read

Free02
TUTORIALClaude 4.5 SonnetFEATURED
r/ClaudeAI2026-05-14

5 Claude Weekly Workflows That Stuck After 6 Months

Proposal generator / meeting processor / content repurposer / Friday review / shutdown reset — out of 40 I tried, only these 5 survived, each saving 30+ minutes per run.

Intermediate
Read

PRO03
TUTORIALClaude 4.5 SonnetFEATURED
r/PromptEngineering2026-05-14

7 Cross-Model A/B-Tested Prompt Techniques (Not Vibes)

Written after six months of A/B testing 200+ prompts on Claude, GPT-4, and Gemini with human raters. Covers persona + constraint stacking, anti-examples, role-reversal QA, cognitive scaffolds, emotional priming, uncertainty CoT, and steelman-first.

Advanced
Read

Free04
TUTORIALChatGPTFEATURED
r/ChatGPTPromptGenius2026-05-14

5 trust-checking one-liner prompts (no role-play)

After a year of role-play system prompts and 14-step frameworks, here's the takeaway: the thing that actually moved the needle on quality was 5 one-line prompts. No roles, no markdown, no "you are an expert."

Beginner
Read

COMMENTS · 討論區0 則
登入 後可留言。還沒帳號?註冊
目前沒有留言。第一個說說你的經驗。