Skip to content

Lesson 35 · Frameworks and Deployment

Coding Agents: Codex and Claude Code

Learn how Codex and Claude Code work as coding agents: instruction files, sandboxes, permission modes, a safe task workflow and how to review their changes.

A coding agent is an agent whose environment is a software project. It can read files, search code, edit, run commands such as tests, and use the results to decide what to do next. OpenAI's coding agent is Codex. Anthropic's is Claude Code.

Both follow the loop you built earlier. This lesson covers the shared ideas and a few documented differences, as of December 2026. Neither product runs on this site, and this tutorial is independent of both vendors.

Where they run

OpenAI's help center says Codex works with local folders, repositories, terminals and developer tools, and that it is available in the ChatGPT desktop app. Codex Cloud runs tasks on OpenAI-managed computers, so they can continue while your computer is asleep. OpenAI's developer documentation also covers a command-line tool and an editor extension.

Anthropic's documentation lists Claude Code in the terminal, VS Code, JetBrains IDEs, a desktop app and the web. Sign-in, plan and provider requirements differ between these, so check the current setup page.

After installation, a basic terminal start for Claude Code looks like this (read-only here):

Terminal
cd your-project
claude

Project instruction files

An agent starts without your team's habits. Both products can read a Markdown file in the project:

  • Codex reads AGENTS.md. It combines a global file with project files from the project root down to the current folder. Guidance closer to the current folder comes later and takes priority. There is a size limit on the combined project instructions.
  • Claude Code reads CLAUDE.md at the start of a session. Its documentation says recent versions can also read an existing AGENTS.md in place of CLAUDE.md, by default only when no CLAUDE.md or CLAUDE.local.md is in the working folder or above it. See that page for the exact rules.

Keep such files short and factual:

TEXT
# Project notes
- Run tests: python -m unittest
- Source is in src/, tests are in tests/.
- Match the style of nearby code. Ask before adding a dependency.
- Never edit migration files that are already released.

These files guide the agent. They do not enforce a rule. Use permissions, sandboxes, tests and branch protection for enforcement.

Sandboxes and permissions

Codex's documentation separates two controls: the sandbox mode (what commands can technically do) and the approval policy (when the agent must ask). With the workspace-write sandbox and on-request approvals, it can edit and run commands in the workspace and asks before going beyond that boundary. Network access is off by default there, and some paths stay protected. A read-only mode suits exploration. A full-access option removes both protections, and the documentation does not recommend it.

Claude Code has permission modes. These are some of them, as documented:

Mode In brief
plan For exploring and planning before changes
default (Manual) Reads in working folders run freely; other actions generally ask
acceptEdits File edits and common file commands in working folders run without asking
auto Runs without routine prompts while a separate classifier blocks risky actions
bypassPermissions Skips prompts; only for isolated containers and virtual machines

There are further options, such as one for locked-down scripts, and deny rules. Defaults depend on version and on how you start the tool: Anthropic's page says recent interactive terminal and VS Code sessions start in auto mode. Check the mode in your session instead of assuming it asks first.

The two sets of controls do not map one-to-one. Read each security page before using an agent on important code.

A safe task workflow

Delegate code safely

Isolate Clean branch or worktree
Plan Explore before editing
Verify Tests and checks
Review Read the diff yourself
1 / 2

A branch or worktree keeps changes apart, but it is not a security sandbox. Use both when you need both.

A good task states the problem, how to reproduce it, the boundaries and the proof:

TEXT
Bug: total_price() charges for one item when quantity is 0.
Reproduce: add a failing test first in tests/test_cart.py.
Limit: change only src/cart.py and that test file. No new packages.
Done: all tests pass. Report the cause and anything you did not check.

For a larger change, ask for a plan first and correct it before any edits. Both products also offer ways to extend the agent. Claude Code documents skills, hooks that run commands around its actions, subagents and MCP connections. Codex documents its own extensions, including skills and subagents. Add these only when you understand what they can run and reach.

Review the change

An agent can make tests pass in bad ways, for example by deleting a test or hard-coding the expected value. A program can flag changes that need a closer look. The file list below is invented.

Python Stand-in: flag risky changes in an agent's diff

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

No flags does not mean safe. Read the whole diff, run the tests yourself or in trusted CI, and check any new dependency. The agent's summary is a claim; the diff and test run are the evidence.

Security habits

  • Keep production credentials out of the agent's reach. When access is needed, use limited, short-lived credentials.
  • Treat repository files, issue text, web pages and tool results as possible prompt injection.
  • Be careful with an unfamiliar repository: its scripts and agent configuration may run commands.
  • Check your employer's rules before an agent reads private code, and know where cloud tasks run.

You remain responsible for the code you merge. Require human review before changes reach a shared main branch or production.

To compare the two for your team, give each the same real tasks from the same starting commit, with limits as similar as you can make them. Score passing tests, review effort, unwanted changes, time and cost. Results on your tasks do not show which is better for everyone. The code review agent project shows how some checks can be automated.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is the role of AGENTS.md or CLAUDE.md?

    Instruction files guide behavior. Enforcement needs permissions, sandboxes and repository controls.
  2. 2. In Codex's documentation, what does the sandbox mode control?

    The sandbox sets technical limits; the approval policy sets when to ask.
  3. 3. Before trusting that Claude Code will ask before acting, what should you do?

    Defaults vary by version and by how you start the tool.
  4. 4. An agent reports that all tests pass. What next?

    Passing tests can hide weakened tests or unwanted changes.

Summary

  • Codex and Claude Code read code, edit it and run commands in a loop.
  • AGENTS.md and CLAUDE.md give guidance; sandboxes and permissions set limits.
  • Isolate the work, state boundaries and proof, then review the diff.
  • Protect secrets and compare agents fairly on your own tasks.

Next: Structured Agent Workflows and Graphs

Your progress is saved in this browser. No account needed.