Verified against current OpenAI docs on April 18, 2026

CODEX
COING
101

This is a polished operating guide for using Codex in the desktop app and in VS Code, written for beginners through senior AI developers. It covers practical setup, prompt blueprints, hidden productivity wins, advanced command usage, automations, how Codex behaves as a tool-calling coding agent, and a set of high-signal external repos and cookbooks for real-world examples.

App + VS Code + CLI Cloud + GitHub + MCP Automations + Skills Prompt Blueprints Maintenance + Safety
00
Positioning
Overview & Positioning

Codex is not just a chat interface. In practice it behaves like a coding agent with repo context, a planning loop, tool access, diff generation, validation, and review steps. For senior AI developers, the useful mental model is: Codex = model + execution harness + tools + state + review workflow.

SURFACE

Codex App

Best full workflow shell: threads, worktrees, Git diff pane, commit/PR flow, automations, local terminal, and in-app project switching.

EDITOR

VS Code Extension

Best day-to-day development surface when you want file selections, command palette actions, recent editor context, and quick cloud handoff.

TERMINAL

CLI

Best keyboard-first interface with deep command control, profiles, MCP management, resume/fork flows, and automation-friendly execution modes.

SYSTEM

Cloud + GitHub + Automations

Best for parallel tasks, PR reviews, recurring jobs, and workflows that should continue beyond one local session.

Best Mental Model

Use the app when you want the strongest workflow shell. Use VS Code when you want the tightest coding loop. Use the CLI when you want total command-line control. Use Cloud and GitHub when you want Codex working in parallel with you rather than under your cursor.

01
Getting Started
Installation
CLI Install

Install, launch, and upgrade Codex CLI

These commands match the current official CLI docs.

npm i -g @openai/codex codex npm i -g @openai/codex@latest
OpenAI Docs MCP

Add the official OpenAI developer docs as an MCP server

Useful for current model, API, and Codex guidance inside your editor or CLI.

codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp codex mcp list
VS Code Setup

Install the extension from the marketplace and sign in

The current IDE docs say the extension works with Visual Studio Code and VS Code forks like Cursor and Windsurf. In VS Code it opens in the right sidebar by default after install, and it prompts you to sign in with ChatGPT or an API key.

Windows Note

The IDE docs currently say Windows support is experimental. For the best Windows experience in the extension and CLI, use a WSL2 workspace.

Windows App

Install the Codex app from the Microsoft Store or with winget

winget install Codex -s msstore

The Windows app can run natively with PowerShell and Windows sandboxing, or through WSL2.

Fast Start Path

Open one repo, start one thread, ask for a plan first, let Codex inspect before editing, run validation, then review the diff before you accept changes.

02
Workflow Surfaces
Which Surface To Use
Codex App - Best all-around product workflow

Use the app when you want project switching, thread management, worktrees, built-in Git review, local terminal visibility, and automations from one place.

Strength
Best overall workflow shell
Use for
feature work, review, isolated worktrees, automations
Power move
local vs worktree vs cloud per thread
Watch out
do not over-permission a repo before you trust the flow
VS Code Extension - Best coding loop

Use it when you want to highlight code, add file context directly, stay in your editor, and still switch between local and cloud execution.

Strength
tight editor-context iteration
Use for
daily coding, targeted fixes, review of selected files
Power move
add only selected text or file to thread context
Watch out
long-lived chats get noisy fast if scope drifts
CLI - Best keyboard-first control

Use the CLI when you want slash commands, exact profiles, MCP control, inline images, automation-friendly exec mode, and session forking or resuming.

Strength
precise control + scriptability
Use for
terminal-heavy repos, ops, batch-style prompting, MCP setup
Power move
resume, fork, compact, debug-config, statusline
Watch out
be explicit about directories and approvals
Codex Cloud - Best for parallel or background work

Use cloud when you want a task to keep running remotely, or when you want to compare alternate attempts without tying up your local environment.

codex cloud list codex cloud status codex cloud diff codex cloud apply
GitHub - Best for PR review and task delegation from comments

The current GitHub integration docs support PR review comments like @codex review and other task prompts such as CI triage and cloud task handoff.

@codex review @codex review for security regressions @codex fix the CI failures
03
Operational Control
Commands That Matter

App Slash Commands

  • /feedbacksubmit feedback and optionally attach logs
  • /mcpopen MCP status and connected servers
  • /plan-modetoggle plan mode for complex tasks
  • /reviewreview uncommitted changes or compare to a base branch
  • /statusshow thread id, context usage, and rate limits

VS Code Slash Commands

  • /auto-contexttoggle auto-inclusion of recent files and IDE context
  • /cloudswitch to cloud mode
  • /cloud-environmentpick the cloud environment
  • /localswitch back to local mode
  • /reviewstart review mode
  • /statusinspect thread and context state

VS Code Command Palette

  • chatgpt.addToThreadadd selected text range to current thread
  • chatgpt.addFileToThreadadd the current file to thread context
  • chatgpt.newChatcreate a new thread
  • chatgpt.implementTodoask Codex to address the selected TODO
  • chatgpt.newCodexPanelopen a new Codex panel
  • chatgpt.openSidebaropen the Codex sidebar panel

CLI Power Commands

  • /modelswitch active model
  • /permissionschange approval behavior mid-session
  • /statusinspect model, policy, roots, and token usage
  • /reviewreview local diff
  • /compactsummarize older context to stay lean
  • /forkbranch a session while preserving transcript
  • /resumecontinue earlier sessions
  • /planswitch directly into planning mode
  • /copycopy the latest response
  • /debug-configinspect config precedence and policy sources
  • /statuslinecustomize footer status fields
  • /titlecustomize terminal title fields
  • /psinspect background terminals
  • /stopstop background terminals
Useful "Easter Eggs"

These are not undocumented hacks. They are simply easy-to-miss power features: Cmd+K opens the Codex app command palette, Ctrl+L clears the integrated terminal, /statusline customizes footer telemetry, /title customizes your terminal title, and on native Windows CLI /sandbox-add-read-dir C:\path grants sandbox read access to an extra absolute directory.

CommandWhereWhy it matters
codex reviewCLIRun a code review non-interactively when you want a review pipeline or a shell-based second pass.
codex resume --lastCLIJump back into the most recent session fast.
codex fork --lastCLICreate a new attempt from the latest session without destroying the original line of reasoning.
codex completion powershellCLIGenerate PowerShell shell completions for faster local command use.
codex features listCLIInspect current feature flags and stages.
codex login statusCLICheck auth status when a surface behaves unexpectedly.
04
Prompting
Prompt Blueprints
Senior AI Developer Rule

The Codex prompting guidance and GPT-5-Codex cookbook both reinforce a useful principle: less is often more. Codex already knows how to code, inspect, plan, and validate. The main prompt job is to specify the task boundary, constraints, validation, and what good looks like.

Blueprint 01

Debug a bug

Debug this bug in <repo>. Symptom: <what fails> Expected: <expected behavior> Actual: <actual behavior> Relevant files: <paths> Validation: <test or repro command> Inspect first, explain the root cause, patch minimally, then verify.
Blueprint 02

Review a diff or PR

Review these changes for: - real bugs - regressions - risky assumptions - security or data-loss issues - missing tests Prioritize correctness over style. Findings first, ordered by severity.
Blueprint 03

Understand a codebase

Read <repo> and produce a concise onboarding brief: - what the system does - main modules and entry points - how to run / test / lint it - where <feature> lives - the first 5 files a new engineer should read
Blueprint 04

Build a new application

I want to build a new <app type> in <stack>. Audience: <users> Must-have features: <list> Non-goals: <list> Constraints: <hosting, auth, budget, team, compliance> First propose a realistic v1, then scaffold the smallest working version.
Blueprint 05

UI / UX iteration

Use this screenshot or design reference to improve <screen>. Goals: <visual goals> Constraints: - responsive desktop + mobile - preserve accessibility - stay aligned with the existing design system - change only the relevant files Inspect first, then implement.
05
Bootstrap
AGENTS.md, SKILL.md, PLANS.md, and Build/Test Blueprints

This is the missing operating layer most teams need. If you want Codex to behave consistently, you need repo guidance, reusable workflows, and a planning convention for larger work. The official best-practices docs emphasize AGENTS.md, the skills docs emphasize SKILL.md, and the cookbook shows how PLANS.md can drive long-running implementation work.

What AGENTS.md Should Contain

  • repo layoutimportant directories and entry points
  • run commandsdev server, scripts, env expectations
  • build / test / lintexact commands Codex should run
  • review expectationsPR standards and done criteria
  • constraintsdo-not rules and safety boundaries

What a Skill Should Do

  • trigger narrowlybe explicit about when it should and should not trigger
  • stay reusableencode repeatable workflows, not one-off context
  • use progressive disclosurekeep the metadata short; load detail only when needed
  • include scripts only when neededuse code if it improves reliability
Plan Workflow

Use AGENTS.md + PLANS.md for larger multi-step work

The Codex cookbook’s PLANS.md pattern is explicitly designed for multi-hour problem solving. It recommends teaching Codex, through AGENTS.md, when to use a planning document, then keeping the plan as a living design-and-implementation artifact.

# Example AGENTS.md convention # ExecPlans When writing complex features or significant refactors, use an ExecPlan (as described in .agent/PLANS.md) from design to implementation.
Why This Matters

The cookbook shows this pattern supporting very long Codex runs. The win is not just planning quality. It is restartability: the plan becomes a self-contained artifact that both humans and agents can resume from.

Bootstrap Command

Start with /init for repo guidance

The best-practices docs explicitly call out /init as the quick-start command to scaffold a starter AGENTS.md in the current directory.

/init
AGENTS.md Starter

Minimal high-signal AGENTS.md blueprint

# Repository Guide for Codex ## Repo Layout - app: main application code - tests: automated tests - scripts: helper scripts ## Run Commands - dev: - build: - test: - lint: ## Rules - inspect before editing - change only relevant files - run the most relevant validation after changes - review diffs before stopping ## Done Means - requested behavior implemented - relevant tests updated or explained - build / lint / type checks addressed as needed - summary of changes and verification provided
SKILL.md Starter

Minimal skill blueprint

--- name: skill-name description: Explain exactly when this skill should and should not trigger. --- # Overview Use this skill when the task is <repeatable workflow>. ## Workflow 1. Inspect the current state 2. Gather the minimum required context 3. Perform the workflow 4. Validate the output 5. Summarize what changed and any risks
Build / Test / Review Blueprint

Prompt Codex to run a disciplined implementation loop

The best-practices docs explicitly call out writing or updating tests, running the right test suites, checking lint/format/type checks, confirming behavior, and reviewing the diff.

Implement <feature or fix>. Before editing: - inspect the current implementation - propose a short plan After editing: - update or add tests if appropriate - run <build command> - run <test command> - run <lint / typecheck command> if relevant - review the diff for regressions before stopping Summarize: - what changed - how it was verified - what remains unverified
06
Senior Level
Advanced Workflows
Workflow 01

Prompt -> AGENTS.md -> Skill -> Plugin -> Automation

Promote stable knowledge upward. Do not keep paying token tax for reusable instructions.

# Fast start for repo guidance /init # Then refine AGENTS.md with: # - repo layout # - run / test / lint commands # - PR expectations # - constraints and done criteria
Workflow 02

Use cloud for comparison runs

A strong expert pattern is to keep local work moving while one or more remote tasks explore alternate implementations.

codex cloud list codex cloud status codex cloud diff codex cloud apply
Workflow 03

Use PLANS.md for multi-hour tasks

The Codex cookbook includes an explicit pattern for long-running work using PLANS.md. Use this for migrations, deep refactors, or broader system changes where you want implementation to follow a reviewed design document.

Workflow 04

Review-first engineering

Codex is at its best when the loop includes tests and review, not just generation. For senior teams, this means treating it as part of your software delivery process rather than a one-shot assistant.

Implement <feature>. After coding: - add or update tests if needed - run the most relevant checks - summarize the behavior change - review the diff for regressions before stopping
Workflow 05

Use screenshots and multimodal input intentionally

The official use cases and frontend guidance consistently show that UI work gets better when you attach screenshots, visual references, or design inputs instead of describing layouts in prose.

07
Recurring Work
Automations

The current app docs define automations as recurring background Codex tasks. Results go to the app inbox / Triage when there is something to report, or the task can auto-archive when there is nothing notable.

Standalone / Project Automations

  • Fresh run each timebest when every scheduled run should be independent
  • Multiple projectscan run across one or more projects
  • Triage outputfindings show up as separate automation runs
  • Worktree optionideal for isolation in Git repositories

Thread Automations

  • Heartbeat stylewake up the same thread on a schedule
  • Same contextbest when continuity matters
  • Minute / daily / weeklysupports active follow-up loops and check-ins
  • Good forpolling GitHub, Slack, long-running checks, ongoing triage
How They Work

Automation execution model

The current app docs say automations run in the background, use your default sandbox settings, can use the same plugins and skills available to Codex, and in Git repos can run either in your local project or in a dedicated background worktree.

Why Skills Matter

Skills define the method; automations define the schedule

The docs explicitly recommend using skills to keep automations maintainable and shareable. You can trigger a skill from an automation with $skill-name.

Test First

Manual thread first, schedule second

The docs explicitly recommend testing the prompt manually in a normal thread before scheduling it. This is the right pattern: prove that the task is reliable manually, then automate it.

Security Model

Automations run unattended

That makes sandbox and approval choices more important. Read-only blocks many useful operations. Full access raises risk. Workspace write plus targeted rules is usually the right middle ground.

Promotion Message For Senior Teams

Automations are how Codex stops being just an interactive agent and starts behaving like programmable engineering labor. The stable pattern is: human-designed prompt + durable repo guidance + optional skill + scheduled execution + inbox review.

08
Creative + Business Work
Images, PowerPoint, and Integration Options

How To Draw / Generate Images

For product work inside Codex, the main pattern is multimodal: attach screenshots or visual references for UI tasks. For actual image output, OpenAI’s image generation docs recommend the image generation tool in the Responses API or the Image API with GPT Image models.

  • attach screenshotsbest for UI fixes and redesigns
  • image_generation toolbest for creating or editing raster images in API workflows
  • gpt-image-1.5OpenAI’s current top image generation model in the docs
Use this screenshot to redesign <screen>. Keep the layout responsive and accessible. If an image asset is needed, generate a new image that matches the product style and explain where it should be used.

How To Build PowerPoint / Slide Decks

The official Codex use cases explicitly include generating slide decks. In the local plugin cache on this machine, the SharePoint plugin exposes a sharepoint-powerpoint skill specifically for creating, editing, restyling, and reviewing PowerPoint .pptx files while preserving deck style.

  • generate slide decksofficial Codex use case
  • sharepoint-powerpointstyle-preserving PowerPoint workflow from SharePoint
  • rendered visual QArecommended when slide fidelity matters
Open the SharePoint PowerPoint workflow and update the deck: - preserve the existing design language - add a new summary slide - keep formatting and theme consistent - render and visually QA the changed slides before upload
Microsoft 365 / Office 365

Available plugin-backed options in this Codex install

The local plugin marketplace cache on this machine includes teams, outlook-email, outlook-calendar, and sharepoint. That gives you practical Microsoft workflow coverage for chat summarization, inbox triage, calendar context, SharePoint documents, spreadsheets, and PowerPoint decks.

Examples: - Summarize the last 24 hours of Teams channel discussion and draft a follow-up. - Triage my Outlook inbox and draft replies for the urgent threads. - Summarize this SharePoint site and identify owners, status, and next actions. - Update the PowerPoint deck in SharePoint and preserve the theme.
Teams + Planner

Teams can also drive Planner task workflows

The local Teams plugin skills include channel summarization, notification triage, reply drafting, and Planner task management. That makes it a good surface for turning meeting or channel follow-ups into trackable work.

Summarize the launch channel in Teams for this week, extract the action items, and turn confirmed follow-ups into Planner tasks in the launch board.
Jira + Confluence

Use Atlassian Rovo for Jira and Confluence

The local plugin metadata identifies atlassian-rovo as “Manage Jira and Confluence fast.” Its bundled skills include converting specs to backlogs and triaging issues, which is exactly the kind of high-value PM + engineering bridge workflow many teams need.

Create Jira tasks from this Confluence spec in project <KEY>. Break the spec into an Epic plus implementation tickets, present the planned breakdown first, then create the backlog.
GitHub

Use the GitHub plugin for PRs, issues, CI, and publish flows

The local GitHub plugin metadata describes it as a hybrid GitHub connector and CLI workflow for repositories, pull requests, issues, CI, and publishing changes. Its local skills include addressing review comments and fixing CI.

Inspect the open PR, triage the failing checks, summarize the root cause, and prepare a focused fix plan before making any changes.
Slack, Linear, and Other Product Tools

Use plugins when the workflow lives outside the repo

The official Codex docs already expose Slack and Linear as integrations, and the local plugin marketplace cache here also includes slack, linear, notion, figma, and many others. The correct pattern is to install the plugin, start a new thread, then describe the outcome you want.

Examples: - Summarize unread Slack threads from today and extract engineering action items. - Pull the latest launch notes from Google Drive. - Review the latest Linear issues tagged payment and propose a triage summary. - Turn a Figma selection into responsive production-ready UI code.
09
Architecture
How Codex Works Under The Hood

Think "tool-calling agent"

For senior AI developers, the right model is close to function calling or tool orchestration rather than plain chat. Codex receives a task, maintains thread state, decides when to inspect code, when to use shell or review tools, when to read docs through MCP, and when to return a diff or review output.

Typical execution path

  • Prompttask, constraints, validation target
  • PlanCodex decides a work strategy
  • Toolsshell, Git, MCP, web/docs, images, skills
  • Patch / diffimplement or review output
  • Validationtests, lint, direct repro
  • Reviewfinal inspection before acceptance
Component 01

AGENTS.md supplies durable repository behavior

The best-practices docs explicitly position AGENTS.md as the default place for repo-specific agent rules such as how to build, test, lint, review, and define done.

Component 02

Skills supply reusable workflows with progressive disclosure

The skills docs explain that Codex loads skill metadata first and only loads the full SKILL.md when it decides the skill is relevant. That is a context-efficiency pattern, not just a packaging detail.

Component 03

MCP connects Codex to external tools and live systems

MCP is the tool / connector layer. Use it when the needed context is outside the repo or changes frequently.

Component 04

Cloud, GitHub, and automations extend the same agent pattern

Cloud offloads runs, GitHub triggers tasks from comments or PRs, and automations schedule the work. These are not separate products conceptually; they are alternate execution surfaces for the same tool-using Codex workflow.

10
Maintenance
Cache, History, Auth, and Cleanup
Important

The commands below are operational maintenance commands. Some are official CLI commands. The cleanup examples are manual filesystem operations based on the local Codex home layout on this machine. Use them intentionally and back up first if you care about preserving local history.

Official Maintenance Commands

  • codex login statuscheck whether auth is valid
  • codex logoutremove stored credentials
  • codex loginsign in again
  • codex features listinspect effective feature flags
  • codex completion powershellgenerate shell completions
  • codex resume --lastre-open your latest session
  • codex fork --lastcreate an alternate branch of the last session

Manual Local Housekeeping

  • %USERPROFILE%\.codex\cachecache files
  • %USERPROFILE%\.codex\sessionssession history by year
  • %USERPROFILE%\.codex\archived_sessionsarchived session logs
  • %USERPROFILE%\.codex\logs_2.sqlitelocal logs database
  • %USERPROFILE%\.codex\auth.jsonstored authentication metadata
Inspect First

Inspect local Codex state

Get-ChildItem -Force "$env:USERPROFILE\.codex"
Clear Cache

Remove cached files only

Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\cache\*"

This is the lowest-risk cleanup step if Codex metadata feels stale.

Inspect Session History

Review sessions before deleting anything

Get-ChildItem -Recurse "$env:USERPROFILE\.codex\sessions" | Sort-Object LastWriteTime -Descending | Select-Object -First 20 FullName,LastWriteTime
Clear Archived Sessions

Delete archived history only

Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\archived_sessions\*"

This is safer than deleting active session history under sessions.

Auth Reset

Reset authentication cleanly

codex logout codex login codex login status
History Reality Check

Current product docs do not expose a first-class “clear all history” command. In practice, the right controls are: start a new thread, use /compact, use /fork for alternate branches, use /resume for continuity, and only do manual cleanup when you intentionally want to remove local stored state.

11
External References
Prompt Repos, Cookbooks, and Example Links

If this document is meant to help promote Codex internally or externally to senior AI developers, include living examples. The links below are the highest-signal ones I found for prompt examples, durable patterns, and real generated outputs.

12
Quality
Best Practices That Actually Matter

Do This

  • One thread per taskkeeps context coherent and token-efficient
  • Plan before broad workprevents premature edits and scope drift
  • Move durable rules to AGENTS.mdstop repeating yourself manually
  • Use skills for recurring workflowskeep context lean through progressive disclosure
  • Attach screenshots for UIbetter than long visual prose
  • Use review modefind regressions before you accept code
  • Use worktreesavoid overlapping file edits across live tasks
  • Automate only proven workflowsmanual first, scheduled second

Avoid This

  • One giant thread per repobloats context and quality decays over time
  • OverpromptingCodex often gets worse when the harness is too verbose
  • Full access by defaultespecially before you trust the repo workflow
  • Prompting instead of toolinguse MCP when the data is external and dynamic
  • Recurring job without a skillharder to maintain, share, and debug
  • Skipping verificationgeneration without tests or review is not an engineering workflow
Strong Closing Message

Codex is most impressive when you stop using it as a conversational novelty and start using it as a disciplined engineering system: scoped threads, durable repo guidance, reusable workflows, explicit validation, review loops, and the right execution surface for the job.