Codex and Claude Code: coding agents explained

A coding agent reads a codebase, edits files and runs commands. Useful, fast, and requiring exactly the review discipline you would give a new colleague.

intermediate9 minChecked 2026-09-06

What you will be able to do

Describe what a coding agent does differently from a chat assistant, and set up a safe first task.

Before you start

  • Comfort with a terminal helps.
  • A repository under version control. This is not optional.

Claude Code · OpenAI Codex

current

Both products change frequently. Check current official documentation before relying on specific behaviour.

Official documentationChecked 2026-09-06

Agency is the difference

A chat assistant suggests code and you paste it. An agent reads files, makes edits, runs tests and iterates on what it finds. The loop is closed, which is why it is faster and why review matters more.

Claude Code runs in the terminal against your repository. Codex is OpenAI's coding agent with its own surfaces. Both do the same category of work; specifics differ and change.

Version control is the safety net

Work on a branch. Commit before you start. Review the diff, not the summary of the diff.

An agent that has been running for twenty minutes can have touched more than you expect. Git is what makes that recoverable, and it is the reason this is not a nervous experience.

Where agents are strongest

Well-specified changes with a test that can confirm them. Refactors with a clear rule. Boilerplate. Reading unfamiliar code and explaining it. Reproducing and fixing a bug you can describe precisely.

Weakest where the specification is the hard part — which is most architecture work.

Step by step

  1. Commit your current work and create a branch.
  2. Pick a task with a clear finish line: a failing test to make pass, a rename, a small feature.
  3. Describe the outcome and the constraints, including what not to touch.
  4. Let it work, then read the full diff.
  5. Run the tests yourself rather than trusting the report.
  6. Commit in small pieces so a bad change is cheap to unwind.
A well-scoped agent task
On the current branch only.

Goal: make the failing test in tests/rates.test.ts pass without changing the test.

Constraints: do not modify anything outside src/lib/rates.ts. Do not add dependencies. Keep the existing public function signature.

When you finish, show me the diff and explain in two sentences why the original failed.

What good looks like

  • You are on a branch with a clean starting commit.
  • The task has a check that can be run — a test, a build, an obvious visual result.
  • You read the diff before merging.

What it cannot do

  • It cannot know intent you did not write down.
  • It will confidently satisfy a badly specified test.
  • Capability and interface change frequently; verify against current documentation.

When it goes wrong

It rewrote more than asked.
Constrain the file scope in the prompt, and use small commits so reverting is cheap.
Tests pass but behaviour is wrong.
The test was weak. Agents optimise for the check you gave them, which is a good reason to write the check carefully.

Privacy and data handling

Agents read your repository. Keep secrets in environment variables and out of the code. Check what your employer permits before pointing an agent at proprietary source.

Sources3 referenced
  1. Claude Code documentation

    Anthropic · official product documentation · link checked 2026-09-06

  2. OpenAI platform documentation

    OpenAI · official product documentation · link checked 2026-09-06

  3. Guidelines for secure AI system development

    National Cyber Security Centre · security guidance · link checked 2026-09-06

Links are checked at build time. If one has moved, tell us.

Written by
BLACK LDN
Last checked
2026-09-06
Content state
editorial

Product behaviour changes. If something here no longer matches the documentation, send a correction.

Read next

Choosing a tool9 min

Claude Cowork: from request to finished files

A different shape of assistant. Instead of a conversation you copy out of, you hand over a task with a scope and get reviewable work back.

beginner

Checked 2026-09-06

Building something10 min

Build and deploy your first website

A real site, on a real address, built with help and understood by you. No framework, no build step, no prior experience.

beginner

Checked 2026-09-06

Next: The anatomy of a useful prompt