Skip to content

You Are the Main Thread (Codex CLI)

With agentic coding in Codex, the opportunity cost of your attention changes. Every minute you wait on a single task is a minute you could have delegated multiple tasks in parallel—locally (CLI) or in the cloud. Codex was designed to read/modify/run code on your machine, and it can also run background, parallel cloud tasks with its own sandboxed environment. Don't block the main thread—schedule and delegate. (OpenAI Developer)


Why the math is different now

  • Local agent (CLI): Run Codex interactively, or non-interactively with codex exec to kick off one-shot work while you keep thinking. Approval modes let you hold it in Read Only for planning, then unlock execution when you're ready. (OpenAI Developer)
  • Cloud agent (Codex Cloud): Start tasks that keep running in the background, in parallel, using a fresh container per task. You can launch these from web, IDE, iOS, or even GitHub mentions—then come back to results. (OpenAI Developer)

Your attention is the bottleneck. Offload work immediately once it's spec-able, and keep your "main thread" focused on decisions.


A lightweight scheduler's playbook

  1. Frame tasks for delegation Break work into units Codex can own: "plan a refactor," "write tests for X," "investigate flaky e2e Y," "draft PR for Z." Codex CLI pairs with you locally; Codex Cloud handles longer or parallelizable items. (OpenAI)

  2. Pick the right engine

    • CLI (near-instant feedback): great for local edits, quick diagnostics, and running your exact toolchain.
    • Cloud (parallel + persistent): great for longer jobs, multi-hour refactors, or tasks you want to run while you step away. (OpenAI Developer)
  3. Gate execution with approvals Start in Read Only to make Codex plan; switch to Auto for safe local edits/runs; use Full Access sparingly. (Network/out-of-workspace actions still prompt.) (OpenAI Developer)

  4. Use non-interactive runs to avoid blocking Fire-and-forget a job while you keep thinking:

    bash
    codex exec "Fix the CI failures in the test suite"

Think like a CPU scheduler:

  • Queue tasks the moment they're spec-able.
  • Context-switch your attention to the highest-value judgment call while Codex runs plans, edits, tests, and reviews elsewhere.
  • Keep cores busy: CLI for rapid local loops; Cloud for long-running, parallelizable jobs.

When in doubt, ask: "What can Codex be doing right now while I'm thinking?" Then launch it—don't let your main thread idle.


Sources

  • Codex CLI (approvals, non-interactive exec, OS support). (OpenAI Developer)
  • Codex Cloud (background + parallel tasks; delegate from web/IDE/iOS/GitHub). (OpenAI Developer)
  • OpenAI announcement (GPT-5-Codex; adherence to AGENTS.md; approvals & compaction; code review). (OpenAI)
  • AGENTS.md repo (official format for guiding coding agents). (GitHub)