Skip to content

Course · Codex · Getting started

Connect Codex to your editor

You can drive Codex entirely from a terminal. Most engineers want the agent beside the files they edit. This lesson covers two placements and one habit: review the diff before you accept, even when the UI looks like autocomplete.

Codex is the same agent described at install - CLI, IDE, and headless share configuration and sign-in.

Integrated terminal: open your editor’s terminal, cd to the repo root (for the budgetcli examples, the small Python teaching repo this chapter’s intro describes, that is the directory with AGENTS.md), run codex (if the binary or sign-in is not yet in place, install and authenticate first). The agent is one pane; you review edits where you already read code.

IDE extension: OpenAI ships editor integrations; VS Code is commonly supported, and JetBrains IDEs have a path as well. Cursor is widely used as a VS Code-style editor; whether the Codex extension installs there depends on the editor’s extension compatibility - check the official IDE docs for the current editor list and features (open files as context, native diff UI, and so on).

The durable point: run the agent where the code lives, not in a detached window you forget to watch.

Inline AI completion finishes the line you are typing. Codex is an agent: you hand it a task, it reads across files, coordinates edits, and may run tests. Different jobs:

  • Keep completion for keystroke flow - the obvious next line, the stub you are filling in.
  • Reach for the agent when the unit of work is a task - fix the CSV date bug and add a test, trace a balance mismatch, wire an importer.

In the editor, proposed edits often render inline, in a visual language similar to completion suggestions. That is where review discipline frays: accept feels like tab to complete, but the blast radius is a multi-file change. Read the diff on purpose before approving - the interface got friendlier; the stakes did not.

One fact sets up everything next: a new session starts with nothing from your last conversation except what is written in files Codex loads by default. The sessions and context chapter is about what persists across closes, what must be re-read, and how to keep tomorrow’s session from paying today’s discovery cost again.