Skip to content

AI-native SDLC with Codex

The Codex SDLC track implements the shared six-stage lifecycle with Plan mode, AGENTS.md, skills, sandbox policies, hooks, app worktrees, non-interactive execution, code review, and scheduled tasks. Use this page as the Codex adapter: it names the correct surface for each gate and links to the single canonical stage procedure.

The lifecycle remains tool-independent. Read the AI-native SDLC overview first, then use this map for Codex-specific execution details.

StageAccepted artifactCodex surfaceCanonical procedure
Planintent.mdInteractive /plan; app chat for stakeholder discovery and file contextCapture intent
Designspec.mdAGENTS.md, .agents/skills/, MCP, images, and repository inspectionWrite the spec
Buildplan.md, diff, testsApp worktrees or explicit Git worktrees; CLI sandbox and approval policiesBuild from an accepted plan
TestTest evidenceActive feedback loop; codex exec for repeatable non-interactive checksClose the feedback loop
DeployReviewed pull requestcodex review, openai/codex-action@v1, protected merge and release environmentsLayer review and approvals
MaintainIncident record and next intent.mdScheduled app tasks, hooks, CI schedules, Slack or Linear intakeClose production back into planning

Prerequisites: a Git repository, Codex authenticated, a clean working tree, and repository instructions plus verification commands in AGENTS.md.

  1. Start the interactive CLI and enter Plan mode before the agent is working:

    Terminal window
    codex
    /plan Read docs/intents/FEATURE.md and docs/specs/FEATURE.md. Inspect the
    repository and propose an ordered implementation plan with exact files,
    test-first steps, risks, and rollback. Do not edit source files.
  2. Review the plan and save the accepted version as docs/plans/FEATURE.md.

  3. For parallel work, choose Worktree in the Codex desktop app or create a worktree explicitly with Git. Codex CLI 0.146.0 has no --worktree flag.

  4. Run a bounded implementation in the chosen checkout:

    Read docs/plans/FEATURE.md and AGENTS.md. Implement only milestone 1.
    Run the named typecheck, lint, unit, integration, and visual checks.
    Diagnose implementation failures; do not weaken tests or skip gates.
    Finish with changed files, command results, and remaining risk.
  5. Review local changes:

    Terminal window
    codex review --uncommitted
  6. Keep merge and production release behind branch protection and a named human approval.

  • Put durable repository instructions in AGENTS.md; a nearer file overrides broader guidance for its subtree.
  • Put reusable workflows in .agents/skills/SKILL_NAME/SKILL.md.
  • Put deterministic lifecycle behavior in .codex/hooks.json or the active config.toml layer.
  • Use the sandbox and approval policy to constrain execution; text instructions alone do not create a security boundary.
  • Put merge and production authorization in the repository and deployment platform.

codex exec is the stable non-interactive command. New automation should request the least sandbox capability it needs:

Terminal window
codex exec \
--sandbox workspace-write \
--output-schema .github/codex/review.schema.json \
"Run the documented checks and write a structured review of the current diff."

Use --json when the consumer needs the full JSONL event stream. --full-auto remains only as a deprecated compatibility flag; prefer the explicit sandbox form above. Use danger-full-access only inside a separately isolated runner.

  • codex --help, codex exec --help, and codex review --help match every copied flag.
  • /plan is entered before an active run and produces a reviewable plan.
  • The app-created or Git-created worktree appears in git worktree list.
  • codex exec runs with the least capable sandbox and returns machine-consumable output when required.
  • Review automation can comment or fail a check, but the named human or platform rule still controls merge and production.

A guide uses codex --worktree. That flag is not present in Codex CLI 0.146.0. Use app worktrees or git worktree add.

Automation still uses --full-auto. Replace the deprecated compatibility flag with --sandbox workspace-write, then add a narrower approval and credential boundary around the job.

/plan is unavailable. It cannot switch modes while Codex is already working. Wait for or interrupt the active turn, then invoke /plan.