Dayward AI
Week 1 · D2About 4 hours

Codex, Level Up: Cloud Tasks, Code Review, MCP Integration, Custom Instructions, IDE Integration

Grow Codex from a single terminal session into a full working style: running cloud tasks in parallel, reviewing PRs, wiring in external tools, and reaching for it inside the IDE.

Today's goals 0/3

Sign in to tick these off and save your progress.

Today's Goals

  1. Send a task to run in parallel in a Codex cloud environment, come back to review the diff, and decide whether to open a PR
  2. Have Codex review code with /review and @codex review on GitHub, and explain the split between reviewing and generating
  3. Wire in an MCP server with codex mcp add, and capture a reusable workflow with skills

Yesterday you worked through one job with Codex in the terminal, watching the whole time. Today's questions are: what happens when there is more work than that? What happens when you cannot watch it all? What happens when it cannot do something? The answers are cloud parallelism, code review, MCP, and skills. Once you have read this and finished the work, scroll back to the top and tick off the three goals.

Plain-Language Walkthrough

Cloud tasks: send the work out and only look at the diff when it returns

Continue the story of yesterday's contractor. For the first few days they sat next to you and you watched every change. Once you trust how they work, the natural next step is to send the job out, let them do it back at their own firm, and have the result sent over for you to review. And since it is going out anyway, sending three jobs at once is no problem — none of them occupy your desk. That is the whole idea behind Codex cloud tasks: the task runs in an isolated container on OpenAI's side, unrelated to your local machine, you can send several at once, and each one comes back as a diff to review.

There are several entry points: chatgpt.com/codex in a browser; codex cloud in the terminal to browse or start a cloud task; a "send to the cloud" action in the IDE extension; and ChatGPT on your phone. The same machinery sits behind all of them: a cloud environment bound to your GitHub repository, where every task clones your repository into a fresh container, runs the setup script you configured, and then starts working.

The biggest difference from the local CLI is not where it runs but that the approval model changes. Locally you nod in real time; in the cloud nobody is beside it, so its boundaries are drawn entirely in advance by the environment configuration: whether it can reach the public internet, which dependencies get installed, which environment variables exist. That means everything you decided yesterday "when the approval pops up" has to be thought through ahead of time and written into the environment configuration. Back to the workflow: when a task finishes you get a summary plus a diff, and you can do one of three things — accept it and open a PR in one click, ask a follow-up so it keeps working, or discard it outright. codex apply drops the diff from a cloud task straight onto your local working tree, which suits the combination of proposing in the cloud and testing locally.

Configuring the cloud environment: dependencies, variables, and whether to grant internet access

Environment configuration is the watershed for cloud tasks, because the container is not the machine you spent yesterday setting up. There are only four categories of setting:

  1. Base image and dependencies: pick the runtime version (Node, Python, and so on) and write install commands in the setup script, such as pnpm install. The setup script runs before every task and a failure kills the task, so it has to be as reproducible as a CI script.
  2. Environment variables and secrets: put in the variables the tests need. Do not put in production secrets — what runs in the container is a program that executes commands autonomously, and whatever you give it, it can use.
  3. Public internet access: off by default. On, and it can npm install a new dependency or look up documentation; off, and it can use only what the setup phase installed. The middle path is to allow the network during setup for dependency installation and cut it off during the task.
  4. AGENTS.md: still in effect. It gets cloned into the container with the repository, so the handbook you wrote yesterday applies in the cloud too — precisely the benefit of putting the rules in the repository rather than in your head.

Configure it once and every later task shares it, so it is worth half an hour to get it into the state where any task you send has its setup pass. In the lab you will actually configure one.

Code review: /review locally and @codex review on GitHub

The work has come back — who reviews it? You will of course look, but you can also have another reviewer go first. Codex's code review has two entry points matching two rhythms.

Locally, inside a session: type /review in the CLI and it offers three options — review the currently uncommitted changes, review the whole branch diff against a base branch, or supply a custom review instruction ("only look for missing error handling"). The results appear as line-by-line comments and do not touch your working tree; it only reports problems. The unattended version is codex review, non-interactive and suited to a pre-push script.

Remotely, on a PR: with Codex's GitHub integration installed on the repository, writing @codex review in a PR comment has it read the whole PR context and the existing comments and post its review back as inline comments. A team can configure it to review every PR automatically.

A natural question: if the same vendor's model both writes and reviews the code, is the review worth anything? Yes, but understand its boundary. A review gives the model different input — it sees the diff rather than the requirement, and it stands in the position of finding problems rather than completing a task, and that role switch alone catches plenty of oversights from generation time (missed edge cases, callers left un-updated). What it cannot catch is a misunderstanding of the requirement itself, because reviewer and generator share the same reading of the requirement. So the most valuable review combination is generate with one vendor and review with another, and on D5 we build that workflow properly.

MCP integration: one command to give Codex another pair of hands

The contractor is very capable, but some things are beyond them: querying your company's internal ticketing system, reading your in-house knowledge base, operating some internal service. You need to grant them accounts and tools. MCP (the Model Context Protocol) is the general protocol for wiring external tools into a coding agent — an MCP server exposes a set of tools, and any MCP-capable client can call them. D23 of the 30-day course has the protocol details; here we only cover using it in Codex.

Wiring up a server is one command:

BashBash
codex mcp add <server-name> --env KEY=VALUE -- <command that starts the server>

After -- comes the command that starts this stdio-type server, and --env passes the environment variables it needs. Behind the command, a block of configuration is written into ~/.codex/config.toml:

tomltoml
[mcp_servers.<server-name>]
command = "npx"
args = ["-y", "some-mcp-server"]
env = { SOME_TOKEN = "read from an environment variable; never hard-code it" }

Editing that block by hand is equivalent to running the command. codex mcp list shows the servers wired up; for a remote server requiring OAuth, codex mcp login <server-name> completes the authorization. Once connected, Codex treats those tools as its own capabilities in a session — you only say, in plain language, "file this bug in the ticketing system," and it finds the right tool itself.

One reverse usage is worth knowing: codex mcp-server turns Codex itself into an MCP server. That is, another agent — including the one you write with the Agents SDK on D4 — can call "have Codex change the code" as a tool. That is the entry point for embedding a coding agent inside a larger system.

Custom instructions and skills: rules go in AGENTS.md, workflows go in a skill

You now have two ways to teach Codex: AGENTS.md for rules and MCP for tools. One is missing — a reusable workflow. Take the pre-release checklist: bump the version, update the changelog, run the full test suite, tag. That is neither a rule nor a tool but a sequence of steps with some judgment in it, and you do not want to describe it from scratch in the prompt every time. That is the problem skills solve.

A skill is a directory containing a SKILL.md whose frontmatter carries at minimum name and description, with the body describing how the workflow goes; alongside it you can put scripts/ (scripts the workflow runs) and references/ (documents it consults). Where you put it decides its scope: .agents/skills/ inside a repository applies to that project only, while ~/.agents/skills/ in your home directory applies to all your projects.

There are two ways to invoke one: explicitly, by typing $skill-name in the input box, or not at all — Codex decides from the description whether the current task matches a skill and uses it automatically if so. So the description should say when to use me, not what I am.

The division of labor among the three fits in one sentence: AGENTS.md governs the rules of working, MCP governs the external systems it can reach, and a skill governs a workflow you walk through repeatedly. Rules are read every session; tools are called on demand; workflows are matched per task. When you cannot tell which is which, ask: is this content something to obey every time (a rule), something that fetches data from outside (a tool), or a multi-step procedure (a workflow)?

If you have taken the companion course on using Claude effectively, you will notice Claude Code has an almost isomorphic trio: CLAUDE.md, MCP, and .claude/skills/. The two vendors' designs converge tightly at this layer, and that convergence is itself a signal — this division of labor is the general pattern for coding agents, so learning it once serves you on both sides.

IDE integration: hand it the code you selected

The last entry point is the editor. Codex's IDE extension supports VS Code and its derivatives (Cursor, Windsurf), the JetBrains family, and Xcode. Once installed you get a Codex panel in the sidebar, and selecting a stretch of code in the editor makes it the context of the conversation — no more copy-pasting, no more describing which lines of which file you meant.

The workflow inside the IDE matches the CLI: the same AGENTS.md, the same approvals and sandbox, the same /review. Two things are extra. First, diffs are accepted or rejected block by block right in the editor, which is far more comfortable than reading git diff in a terminal. Second, you can send the current task to the cloud in one click, keep working locally, and come back when it finishes. The extension also creates git checkpoints before and after a change, making a wholesale rollback easy.

When to use the IDE and when the CLI? A rough rule: local changes that need you to look at surrounding code often go to the IDE; large tasks spanning many files, unattended runs, and anything script-driven go to the CLI. They share the login, the configuration, and the session history, so switching costs nothing.

Source Reading

Hands-On Lab

🧪 D2 lab: an execution checklist for one round of parallel cloud tasks

Code location: labs/codex-mastery/day-02-cloud-task-checklist

Acceptance criteria:

  1. A cloud environment is configured for a GitHub repository, and the setup script passes for any task you send.
  2. The add-validation and add-unit-tests tasks were sent out at the same time and both finished, with start and end times recorded on the checklist.
  3. Every diff got an accept, follow-up, or discard decision per the checklist, with the reason written down.
  4. You ran /review once over the diff you accepted, and the checklist records one review comment you disagreed with along with why.

Today is a documentation-style lab whose deliverable is a one-page reusable cloud task checklist. starter/ is the checklist template with blanks and solution/ a worked version filled in for this course's TODO API. Readers without a GitHub repository can push the TODO API from D1 to a new private repository.

  1. Create an environment for the repository at chatgpt.com/codex: pick the Node runtime, put pnpm install in the setup script, leave the public internet off, and send a read-only task listing every route in the project to verify setup passes.
  2. Send out "add input validation to POST /todos" and "add unit tests for the existing routes" as two simultaneous tasks, note the start time of each, and write on the checklist whether you expect them to touch the same files.
  3. When both return, read the summary and diff of each and make the three-way decision from the checklist (accept / follow up / discard), writing one line of reasoning per decision.
  4. Apply the accepted one locally with codex apply, run the tests, then run /review and mark each review comment as agreed or disagreed.
  5. Write three things you would do the same way next time and three you would change, into the retrospective section at the end of the checklist.

Interview Questions

Today's 3 questions are in the question bank below, weighted toward the approval boundary of a cloud coding agent, the split between code review and code generation, and the difference between MCP and skills. Expand each one and read the analysis before the key points — practicing the derivation beats memorizing bullets.

Checklist and Tomorrow

  • Send a task to run in parallel in a Codex cloud environment, come back to review the diff, and decide whether to open a PR
  • Have Codex review code with /review and @codex review on GitHub, and explain the split between reviewing and generating
  • Wire in an MCP server with codex mcp add, and capture a reusable workflow with skills
  • State the division of labor among AGENTS.md, MCP, and a skill in one sentence
  • All 4 acceptance criteria of the lab pass
  • Answer at least 2 of the 3 interview questions without looking at the key points

Tomorrow (D3) we drill down a layer: how a finished product like Codex uses the Responses API underneath to organize the model, the tools, and multi-turn state. Using the product before reading the API is a deliberate order — you have already watched the loop of the model requesting a tool, receiving the result, and continuing, right there in Codex, so when the function_call and function_call_output fields show up tomorrow you will know which step each corresponds to instead of reading an abstract interface document.

Interview questions

  • A cloud coding agent can run many tasks in parallel with nobody around to approve steps. Where should its approval boundary sit?云端 coding agent 能同时跑很多任务,但没有人在旁边点头。它的审批边界应该画在哪里?
    Common in ChinaCommon overseasIntermediate#coding-agent#cloud#approvals

    How to reason about it · think before answering

    1. This checks whether you noticed the approval model changed: local means step-by-step approval, cloud means authorize upfront and review afterwards.
    2. Split the boundary across three moments: before the task (environment config decides network, variables, dependencies), during (container isolation), after (a human reviews the diff before any PR).
    3. Conclude that the cloud boundary is two gates, environment config plus pre-PR human review, with nobody in between; hence no production secrets, network off by default, merge rights stay human.
    4. Add the engineering angle: draw boundaries between parallel tasks too; tasks that touch the same files should not run concurrently.
    5. Expect the follow-up: can it auto-merge? Only in low-risk repos for fully green PRs, with rollback in place, and treat enabling auto-merge as a change that itself needs approval.

    分析过程 · 先想清楚再作答

    1. 这题考的是你有没有意识到「审批模型变了」:本地是逐步审批,云端只能事先授权、事后审阅。答成「跟本地一样弹窗」说明没用过。
    2. 拆法是把边界分成三个时间点:任务开始前(环境配置决定能联网什么、有哪些变量、装什么依赖)、任务执行中(容器隔离,改动只在容器里)、任务结束后(人审 diff 再决定开不开 PR)。
    3. 结论是:云端的审批边界就是「环境配置 + PR 前人工审阅」这两道门,中间不再有人;所以生产密钥不能进环境、公网默认关、合并权限保留在人手里。
    4. 补一条工程视角:并行任务之间的边界也要画——互相会改同一批文件的任务不要同时派,否则合并成本吃掉并行收益。
    5. 可预期的追问:能不能让它自动合并?可以在低风险仓库对通过全部测试的 PR 这么做,但要保留回滚手段,并且把「自动合并」本身当成一个需要审批的配置变更。

    Key points

    • No step-wise approval in the cloud; the boundary becomes upfront environment config plus post-hoc human review
    • Keep production secrets out, network off by default, merge rights with humans
    • Draw boundaries between parallel tasks: never run file-overlapping tasks concurrently
    • Auto-merge only for low-risk repos with fully green PRs, with rollback ready

    答题要点

    • 云端没有逐步审批,边界变成事前的环境配置与事后的人工审阅两道门
    • 环境里不放生产密钥、公网默认关、合并权限保留给人
    • 并行任务之间也要画边界:会改同一批文件的任务不同时派
    • 自动合并只适用于低风险仓库且全绿的 PR,并保留回滚
  • If the same model both writes and reviews code, is the review still meaningful? How do you make it more independent?让同一个模型既写代码又审代码,审查还有意义吗?怎么让审查更独立?
    Common in ChinaCommon overseasIntermediate#code-review#coding-agent#workflow

    How to reason about it · think before answering

    1. The crux is 'still meaningful'; a flat yes or no fails. Explain what it catches and what it misses.
    2. What it catches: the input changes (diff instead of requirements) and the stance changes (find faults instead of finish the job), which surfaces missed edge cases, unsynced callers and style violations.
    3. What it misses: reviewer and author share one understanding of the requirement, so a misread requirement passes; they share blind spots too.
    4. Conclude with three independence levers: review with a different vendor's model, feed the reviewer different information (original requirement plus acceptance criteria, not just the diff), and run deterministic checks first.
    5. Expect the follow-up: auto-apply review comments? No; review is input, not verdict, and both false positives and misses exist.

    分析过程 · 先想清楚再作答

    1. 题眼在「还有意义吗」——直接答「没意义」或「有意义」都不及格,要说清它能抓什么、抓不到什么。
    2. 先说能抓的:审查时输入变了(看 diff 而不是需求)、立场变了(找问题而不是完成任务),这种角色切换能抓出漏掉的边界情况、没同步的调用方、明显的风格违规。
    3. 再说抓不到的:审查者和生成者共享同一份对需求的理解,需求理解错了两边一起错;也共享同样的盲区与偏好。
    4. 结论给三条提高独立性的手段:换一家模型审、给审查者不同的信息(需求原文加验收标准而不是只给 diff)、用确定性工具(测试、lint、类型检查)做第一道审查。
    5. 可预期的追问:审查意见要不要自动应用?不要,审查是输入不是判决,误报与漏报都存在,最终判断留给人。

    Key points

    • Yes: the switch of input and stance catches edge cases, unsynced callers and style issues
    • It misses requirement misreads because author and reviewer share one understanding
    • Increase independence: a different vendor's model, richer reviewer context, deterministic checks first
    • Treat comments as input, never auto-apply

    答题要点

    • 有意义:输入与立场的切换能抓出边界情况、未同步的调用方、风格违规
    • 抓不到与需求理解相关的错误,因为审查者与生成者共享同一份理解
    • 提高独立性:换一家模型审、给审查者需求原文与验收标准、先跑确定性检查
    • 审查意见是输入不是判决,不要自动应用
  • MCP servers and skills both extend a coding agent. When do you reach for each, and what goes in the project instruction file instead?MCP server 和 skill 都是在给 coding agent 加能力,什么时候该用哪一个?项目说明文件又放什么?
    Common in ChinaCommon overseasBasic#mcp#skills#coding-agent

    How to reason about it · think before answering

    1. This tests separation of abstraction levels, the tooling-side version of the increasingly common 'function calling vs MCP vs skills' question.
    2. Ask what is being added: access to an external system (tickets, databases, internal services) is MCP, a protocol-level tool; a multi-step procedure (release checklist, migration flow) is a skill, a prompt-level workflow package; conventions to obey every session belong in the instruction file.
    3. Contrast triggers: MCP tools are invoked by the model when it needs data; skills are invoked explicitly by name or matched by description; instruction files are loaded unconditionally at session start.
    4. Conclude: rules in the instruction file, external systems via MCP, procedures as skills; keep each fact in one place to avoid contradictions.
    5. Expect the follow-up: can a skill use MCP tools? Yes; a skill's steps can call for a tool, the layers are orthogonal, not substitutes.

    分析过程 · 先想清楚再作答

    1. 这题考的是抽象层次的区分,是国内面试开始高频出现的「Function Call / MCP / Skills 三者区别」的工具侧版本。
    2. 拆法是问「加的是什么」:加的是访问外部系统的能力(查工单、读数据库、调内部服务)就是 MCP,它是协议层的工具;加的是一套多步骤的做法(发版检查、迁移流程)就是 skill,它是提示词层的流程包;每次会话都要遵守的约定就是项目说明文件。
    3. 再给触发方式的差别:MCP 工具由模型在需要数据时调用;skill 由用户显式点名或由模型按描述匹配;说明文件每次会话开头无条件读入。
    4. 结论落到一句话:规矩归说明文件、外部系统归 MCP、流程归 skill;同一件事只放一处,避免三处互相矛盾。
    5. 可预期的追问:skill 里能不能调 MCP 工具?可以,skill 的步骤里可以要求使用某个工具,两者是正交的层次,不是替代关系。

    Key points

    • MCP adds tools that reach external systems, invoked by the model on demand
    • Skills add multi-step procedures, triggered by name or matched by description
    • The instruction file holds conventions, no-go areas and environment facts read every session
    • The three are orthogonal: rules, external systems, procedures each live in one place; a skill may call for an MCP tool

    答题要点

    • MCP 加的是访问外部系统的工具,由模型按需调用
    • skill 加的是多步骤流程,由用户点名或按描述匹配触发
    • 项目说明文件放每次会话都要遵守的约定、禁区与环境事实
    • 三者正交:规矩、外部系统、流程各放一处,skill 里可以要求用某个 MCP 工具

Comments