shanraisshan
codex-cli-best-practice
Python

from vibe coding to agentic engineering - practice makes codex perfect

Last updated Jul 7, 2026
916
Stars
56
Forks
0
Issues
+916
Stars/day
Attention Score
65
Language breakdown
No language data available.
โ–ธ Files click to expand
README

codex-cli-best-practice

from vibe coding to agentic engineering - practice makes codex perfect

updated with Codex CLI-white?style=flat&labelColor=555) GitHub Stars

Best Practice Implemented Orchestration Workflow Codex Community Click on these badges below to see the actual sources
= Agents ยท = Commands ยท = Skills

Codex CLI mascot jumping

๐Ÿง  CONCEPTS

| Feature | Location | Description | |---------|----------|-------------| | Commands | interactive session / slash popup | Built-in slash commands for session control โ€” examples include /plan, /fast, /fork, /review, /status, /mcp, /agent, /apps, /model, and /permissions | | Subagents | .codex/agents/<name>.toml | Best Practice Implemented Custom agents registered under [agents.<name>] with dedicated TOML role configs, parallel subagent orchestration, and CSV batch processing ยท Global settings live under [agents] (maxthreads, maxdepth, jobmaxruntime_seconds) ยท Built-in: default, worker, explorer | | Skills | .agents/skills/<name>/SKILL.md | Best Practice Implemented Reference Reusable instruction packages with required name + description metadata and progressive disclosure via scripts/, references/, assets/, and optional agents/openai.yaml ยท Invoke explicitly via /skills or $skill-name, or implicitly by description match ยท Built-in examples: $plan, $skill-creator, $skill-installer ยท Distributed via Plugins | | Plugins | .codex-plugin/plugin.json | Distributable bundles combining skills + app integrations + MCP servers โ€” local/personal marketplace system ยท Built-in: $plugin-creator ยท Browse via /plugins or Codex App | | Marketplace new | $CODEXHOME โ†’ [marketplaces.*] | Best Practice Plugin catalog system (v0.121.0+) โ€” codex plugin marketplace add\|upgrade\|remove accepts GitHub shorthand, git URLs, and local directories ยท Manifest at .agents/plugins/marketplace.json ยท Browse installed marketplaces via /plugins tabs | | Memories new | $CODEXHOME/memories/ | Best Practice Cross-session memory pipeline (v0.119.0+) โ€” enable via [features] memories = true and configure under [memories] ยท TUI control via /memories (use ยท generate ยท reset) ยท Per-thread toggle persists in state DB ยท Scope is per-user, not per-project | | Workflows | .codex/agents/weather-agent.toml | Orchestration Workflow End-to-end usage patterns โ€” explain codebase, fix bugs, write tests, prototype from screenshot, iterate UI, delegate to cloud, code review, update docs | | MCP Servers | config.toml โ†’ [mcpservers.*] | Best Practice Implemented Model Context Protocol for external tools โ€” STDIO + Streamable HTTP servers ยท OAuth support (codex mcp login) ยท Also acts as MCP server via codex mcp-server (exposes codex() + codex-reply() tools) ยท MCP Apps (v0.119.0+): resource reads, elicitations, file-parameter uploads ยท Parallel calls (v0.121.0+): supportsparalleltool_calls = true per server ยท CLI management: codex mcp add\|get\|list\|login\|logout\|remove | | Config | .codex/config.toml | Best Practice Implemented TOML-based layered config system ยท Profiles ยท Sandbox ยท Approval Policy ยท Advanced ([features], [otel], [shellenvironmentpolicy], [tui], model providers, granular approvals) ยท Trust system for project configs ยท developerinstructions ยท modelinstructionsfile for custom system prompts | | Rules | .codex/rules/ | Starlark-based command execution policies via prefixrule() โ€” allow, prompt, forbidden decisions with exact-prefix matching ยท Test via codex execpolicy check ยท Rules work alongside granular approval_policy controls and user-managed approvals | | AGENTS.md | AGENTS.md | Best Practice Project-level context for Codex CLI โ€” hierarchical discovery from cwd to repo root, capped at 32 KiB (projectdocmaxbytes) ยท AGENTS.override.md for personal overrides | | Hooks beta | .codex/hooks.json | Best Practice Implemented User-defined shell scripts that inject into the agentic loop โ€” logging, security scanning, validation, and custom automation ยท Requires codex_hooks = true feature flag | | Speed | config.toml โ†’ servicetier | Fast Mode (1.5x speed, 2x credits) on gpt-5.4 โ€” toggle with /fast on\|off\|status ยท GPT-5.3-Codex-Spark for near-instant iteration (Pro subscribers) | | Code Review | /review | Review branches, uncommitted changes, or specific commits โ€” configurable reviewmodel in config.toml ยท Custom review instructions | | Sessions new | $CODEXHOME/sessions/ ยท /archive | Session lifecycle management โ€” resume or fork prior threads ยท archive via /archive (TUI) or codex archive / codex unarchive (CLI); archived threads are protected from resume/fork until restored (v0.137.0+) ยท search local conversation history with case-insensitive content matches + result previews (v0.135.0+) | | AI Terms | | Best Practice Agentic Engineering ยท Context Engineering ยท Vibe Coding | | Best Practices | | Official best practices ยท Prompt Engineering ยท Codex Guides |

section divider

Orchestration Workflow

See orchestration-workflow for implementation details of Agent โ†’ Skill pattern. The agent fetches temperature from Open-Meteo and invokes the SVG creator skill.

Orchestration Workflow: Agent โ†’ Skill โ†’ Output

How to Use

codex
> Fetch the current weather for Dubai in Celsius and create the SVG weather card output using the repo.
Note: This workflow is not 100% in sync with the Claude Code Best Practice orchestration workflow. Codex CLI does not yet support custom commands (.codex/commands/), so the full Command โ†’ Agent โ†’ Skill pattern is not possible. There is an experimental tool/requestUserInput in the Codex App Server docs and an internal requestuser_input capability gated behind an under-development feature flag in codex-cli 0.115.0, but neither is publicly available yet.

section divider

โš™๏ธ DEVELOPMENT WORKFLOWS

All major workflows converge on the same architectural pattern: Research โ†’ Plan โ†’ Execute โ†’ Review โ†’ Ship

| Name | โ˜… | Workflow | | | |------|---|----------|---|---| | Superpowers | 218k | brainstorming โ†’ writing-plans โ†’ subagent-driven-development โ†’ test-driven-development โ†’ requesting-code-review โ†’ finishing-a-development-branch | 5 | 14 | | Spec Kit | 108k | /speckit.constitution โ†’ /speckit.specify โ†’ /speckit.plan โ†’ /speckit.tasks โ†’ /speckit.implement | 0 | 0 | | gstack | 107k | /office-hours โ†’ /plan-ceo-review โ†’ /plan-eng-review โ†’ /plan-design-review โ†’ implement โ†’ /review โ†’ /qa โ†’ /ship โ†’ /land-and-deploy | 0 | 41 | | Get Shit Done | 64k | /gsd-new-project โ†’ /gsd-discuss-phase โ†’ /gsd-plan-phase โ†’ /gsd-execute-phase โ†’ /gsd-verify-work โ†’ /gsd-ship โ†’ /gsd-complete-milestone | 33 | 0 | | oh-my-codex | 30k | $deep-interview โ†’ $ralplan โ†’ $ralph | 19 | 36 | | Compound Engineering | 20k | /ce-ideate โ†’ /ce-brainstorm โ†’ /ce-plan โ†’ /ce-work โ†’ /ce-code-review โ†’ /ce-compound โ†’ repeat | 49 | 42 |

Note: yellow tags are sub-loops โ€” steps that repeat inside a parent step (e.g. per task, per story, or until a verify condition passes).

Others

section divider

๐Ÿ’ก TIPS AND TRICKS (50)

Prompting ยท Planning ยท AGENTS.md ยท Agents ยท Skills ยท Hooks ยท Memories ยท Workflows ยท Advanced ยท Git / PR ยท Debugging ยท Utilities ยท Daily

Community

โ–  Prompting (3)

| Tip | |-----| | challenge Codex โ€” "prove to me this works" and have Codex diff between main and your branch | | after a mediocre fix โ€” "knowing everything you know now, scrap this and implement the elegant solution" | | Codex fixes most bugs by itself โ€” paste the bug, say "fix", don't micromanage how |

โ–  Planning (4)

| Tip | |-----| | use /plan when you want an explicit plan โ€” Codex may also plan automatically for multi-step tasks | | always make a phase-wise gated plan, with each phase having multiple tests (unit, automation, integration) | | spin up a second Codex (or use cross-model) to review your plan as a staff engineer | | write detailed specs and reduce ambiguity before handing work off โ€” the more specific you are, the better the output |

โ–  AGENTS.md (5)

| Tip | |-----| | keep AGENTS.md concise โ€” 150 lines is a useful heuristic, but the actual limit is byte-based (32 KiB) | | use AGENTS.override.md for personal preferences without affecting the team | | any developer should be able to launch Codex, say "run the tests" and it works on the first try โ€” if it doesn't, your AGENTS.md is missing essential setup/build/test commands | | keep codebases clean and finish migrations โ€” partially migrated frameworks confuse models that might pick the wrong pattern | | use config.toml for harness-enforced behavior (approval policy, sandbox, model) โ€” don't put behavioral rules in AGENTS.md when config.toml settings are deterministic |

Agents (3)

| Tip | |-----| | have feature specific sub-agents with skills instead of general qa, backend engineer | | use multi-agent to throw more compute at a problem โ€” offload tasks to keep your main context clean and focused | | use test time compute โ€” separate context windows make results better; one agent can cause bugs and another can find them |

Skills (7)

| Tip | |-----| | use skills with clear name and description frontmatter for auto-discovery | | skills are folders, not files โ€” use references/, scripts/, examples/ subdirectories for progressive disclosure | | build a Gotchas section in every skill โ€” highest-signal content, add Codex's failure points over time | | skill description field is a trigger, not a summary โ€” write it for the model ("when should I fire?") | | don't state the obvious in skills โ€” focus on what pushes Codex out of its default behavior | | don't railroad Codex in skills โ€” give goals and constraints, not prescriptive step-by-step instructions | | use the built-in skill creator to scaffold new skills, and document one invocation style consistently across the repo |

โ–  Hooks (3)

| Tip | |-----| | use hooks for logging, security scanning, and validation โ€” requires codexhooks = true feature flag | | use hooks for auto-formatting code โ€” Codex generates well-formatted code, the hook handles the last 10% to avoid CI failures | | branch SessionStart on source (startup \| resume \| clear) โ€” skip heavy context on clear so /clear stays snappy (v0.120.0+) |

โ–  Memories (2)

| Tip | |-----| | enable memories once and forget about it โ€” consolidation runs between sessions, not mid-turn | | set nomemoriesifmcporwebsearch = true for threads that touch secrets or untrusted content โ€” reset via /memories โ†’ Reset if exposure happens |

โ–  Workflows (4)

| Tip | |-----| | vanilla Codex is better than any workflows with smaller tasks | | use profiles to switch between project-defined safety levels โ€” in this repo, conservative and trusted are examples | | start with on-request approval policy โ€” only escalate to never when confident | | use /fork in-session (or codex fork) to explore alternatives without losing your current thread, and /resume (or codex resume) to pick up where you left off |

โ–  Workflows Advanced (5)

| Tip | |-----| | use multi-agent to spawn sub-agents for parallel fan-out work (GA โ€” enabled by default) | | use codex exec for headless/CI pipelines | | combine sandbox modes with approval policies โ€” workspace-write + on-request is a good default | | git worktrees for parallel development | | use ASCII diagrams a lot to understand your architecture |

โ–  Git / PR (3)

| Tip | Source | |-----|--------| | keep PRs small and focused โ€” one feature per PR, easier to review and revert | | | always squash merge PRs โ€” clean linear history, one commit per feature, easy git revert and git bisect | | | commit often โ€” as soon as a task is completed, commit | Shayan |

โ–  Debugging (5)

| Tip | Source | |-----|--------| | always ask Codex to run the terminal (you want to see logs of) as a background task for better debugging | | | use MCP (Chrome DevTools, Playwright) to let Codex see browser console logs on its own | | | make it a habit to take screenshots and share with Codex whenever you are stuck with any issue | Shayan | | use a different model for QA โ€” e.g. Claude Code for plan and implementation review | | | agentic search (glob + grep) beats RAG โ€” code drifts out of sync and permissions are complex | |

โ–  Utilities (4)

| Tip | Source | |-----|--------| | iTerm/Ghostty/tmux terminals instead of IDE (VS Code/Cursor) | | | Wispr Flow for voice prompting (10x productivity) | | | codex-cli-hooks for Codex feedback | Shayan | | explore config.toml features like profiles, sandbox modes, and MCP for a personalized experience | |

โ–  Daily (2)

| Tip | Source | |-----|--------| | update Codex CLI daily | Shayan | | start your day by reading the changelog | Shayan |

Codex

| Article / Tweet | Source | |-----------------|--------| | How Codex is built โ€” 90% self-built in Rust (Tibo, Pragmatic Engineer) \| 17 Feb 2026 | Tibo | | Skills in Codex โ€” standardizing .agents/skills across agents (Embiricos) \| Feb 2026 | Embiricos | | Unrolling the Codex agent loop โ€” how Codex works internally (Bolin) \| Jan 2026 | Tweet | | AMA with Codex team โ€” CLI, sandbox, agents (Embiricos, Fouad, Tibo + team) \| May 2025 | Reddit | | Codex CLI โ€” open-source local coding agent, first look (Fouad + Romain) \| Apr 2025 | Tweet |

section divider

๐ŸŽฌ VIDEOS / PODCASTS

| Video / Podcast | Source | Link | |-----------------|--------|------| | The power user's guide to Codex โ€” parallelizing workflows, planning, context engineering (Embiricos) \| 2026 \| How I AI | Embiricos | Podcast | | Scaffolding is coping not scaling, and other lessons from Codex (Tibo) \| 2026 \| Dev Interrupted | Tibo | Podcast | | How Codex team uses their coding agent (Tibo + Andrew) \| 18 Feb 2026 \| Every | Tibo | Podcast | | Dogfood โ€” Codex team uses Codex to build Codex (Tibo) \| 24 Feb 2026 \| Stack Overflow | Tibo | Podcast | | Why humans are AI's biggest bottleneck โ€” Codex product vision (Embiricos) \| Feb 2026 \| Lenny's Podcast | Embiricos | Podcast | | OpenAI and Codex (Tibo + Ed Bayes) \| 29 Jan 2026 \| Software Engineering Daily | Tibo | Podcast |

section divider

๐Ÿ”” SUBSCRIBE

| Source | Name | Badge | |--------|------|-------| | Reddit | r/ChatGPT, r/OpenAI, r/Codex | Codex | | X | OpenAI, OpenAI Devs, Tibo, Embiricos, Jason, Romain, Dominik, Fouad, Bolin | Codex | | X | Jesse Kriss (Superpowers), Garry Tan (gstack), Kieran Klaassen (Compound Eng), Lex Christopherson (GSD), Yeachan Heo (oh-my-codex), Andrej Karpathy | Community | | YouTube | OpenAI | Codex | | YouTube | Lenny's Podcast, The Pragmatic Engineer | Community |

section divider

Billion-Dollar Questions

section divider

Other Repos

Codex CLI Hooks codex-cli-hooks ยท Claude Code claude-code-best-practice ยท Claude Code Hooks claude-code-hooks


Codex for Open Source

section divider

Sponsor My Work

If you like my work, buy me a doodh patti ๐Ÿต on

Polar Polar

ยฉ 2026 GitRepoTrend ยท shanraisshan/codex-cli-best-practice ยท Updated daily from GitHub