Skip to content
Notes archive
NoteengineeringEnglish

A Practical Introduction to Working With Codex

A practical development workflow with Codex, from preparing AGENTS.md and understanding a repository to planning, implementation, verification, and review.

Published

Updated

Reading time

10 min read

The first useful task to give a coding agent is small enough that you can recognize a good result. Adding a language filter to a notes archive is a better starting point than asking it to improve an entire website. You can describe the expected behavior, follow the implementation, and check whether the result actually works.

Codex can inspect a repository, edit its files, and run development tools. That changes the way a task progresses: the conversation can lead directly to a working change, with commands, diffs, and test results available for review. The official CLI introduction shows this inspect–edit–run loop.

This introduction follows one example through that loop. The example is a Markdown-based portfolio whose notes can be written in English or Simplified Chinese. The task is to let readers filter the archive by language while preserving existing article URLs and the site's design.

AI disclosure: This article was drafted and revised with assistance from AI.

A development workflow you can repeat

A useful rhythm is to understand the project, decide what should change, implement a bounded piece, verify its behavior, and review the result. Each stage should leave something concrete for the next one: an explanation grounded in code, a decision with acceptance criteria, a focused diff, and evidence that the change works.

Before starting, establish the baseline. Check the current branch and working tree, identify unfinished work, and make sure the documented development commands are usable. For a new project, write down its purpose and first useful user flow before scaffolding. For an existing project, read its instructions and inspect the implementation before proposing replacements.

The language-filter task then follows a simple sequence:

  1. Understand: trace metadata through the parser and archive to learn what already exists.
  2. Plan: settle the filter's behavior, state management, compatibility, and acceptance criteria.
  3. Implement: make the smallest coherent change on an isolated branch, including meaningful regression coverage where needed.
  4. Verify: exercise language defaults, filtering, and empty results, run the relevant checks, and inspect the rendered interface.
  5. Review and hand off: examine the diff, explain remaining limitations, update documentation affected by the change, and follow the project's PR and deployment rules.

These stages need not become five separate approval exchanges. A well-defined small fix can move through them in one request. An unclear product direction or a substantial architectural change benefits from a planning discussion first. The point is to resolve uncertainty before it becomes expensive code, and to make completion assessable.

If a test exposes an incorrect assumption, return to that decision rather than pushing ahead with the original plan. After a milestone, record the implemented behavior and next step in the repository. That gives the next session a reliable starting point instead of making the conversation the only record of how the project works.

Start where the project already lives

Choose the interface that makes it easiest to inspect the result. The IDE extension brings open files and selections into the conversation and keeps edits close to the code you are reviewing. The CLI fits a terminal workflow. A desktop Codex chat provides another way to work with a project. These are ways of accessing the agent; they should not be confused with its planning or permission settings. See the IDE introduction for the editor workflow.

There is a second choice: where the work runs. In the desktop app, Local works in the current project directory; Worktree gives the task a separate Git checkout on the same computer. Cloud uses a remote workspace prepared through a published environment. Local and Worktree can use your local development setup. A cloud task does not automatically inherit your local files, browser sessions, or VPN access. The environment guide explains these boundaries.

For the language filter, a local checkout is sufficient when no other change is in progress. If the current checkout contains an unfinished redesign, a worktree lets the filter start from a clean branch. It isolates files, but you still need to avoid conflicts over shared resources such as a development-server port or database. The worktree guide covers parallel checkouts and moving work between them.

Make AGENTS.md the project's working agreement

AGENTS.md deserves attention before the first implementation task. It gives Codex a durable introduction to the repository: what the product does, where its important files live, which conventions matter, and how to establish that a change is ready. A prompt can describe today's feature; the instruction file carries the agreements that should survive the next feature and the next session.

Keep the responsibilities of the project documents clear. README.md explains what the project is and how to run it. AGENTS.md explains how an agent should work in it. Architecture notes explain system boundaries and decisions; a roadmap records current priorities; DESIGN.md, when the project uses one, defines its visual language. Link to these documents rather than duplicating all of them in one instruction file.

For a small Markdown-based site, a starting point might look like this. The paths and commands are examples: replace them with the ones that actually exist in your repository.

markdown
# AGENTS.md

## Project
A static-first portfolio with English and Simplified Chinese notes.
Markdown is canonical; preserve existing published article URLs.

## Structure and references
- src/content/notes/: article sources
- src/components/: shared interface components
- Read DESIGN.md before changing layouts or typography.
- Read docs/architecture.md before changing content loading.

## Working agreements
- Inspect relevant code and tests before editing.
- Use a focused branch; preserve unrelated work.
- Reuse existing components and keep changes scoped.
- Discuss substantial architecture or dependency changes first.
- Do not read or commit credentials.

## Verification and handoff
- Run npm run lint, npm test, and npm run build when applicable.
- Inspect rendered pages after layout or typography changes.
- Update documentation when behavior or commands change.
- Report checks performed, failures, and remaining review needs.
- Prepare a PR for owner review; do not merge or deploy by default.

Specific instructions are more useful than broad demands for “clean code.” Requiring published slugs to stay stable explains a compatibility constraint. Pointing to DESIGN.md gives a UI task a reference it can inspect. Naming actual verification commands turns “check your work” into an executable expectation. Describe exceptions too, especially where the usual convention would lead to the wrong result.

Start with one repository-level file. Codex also supports global guidance, normally at ~/.codex/AGENTS.md, and more specific instructions in nested directories. Within its discovered instruction chain, more local guidance takes precedence over broader guidance. The official instruction-discovery documentation explains the search path, overrides, and limits. A repository file remains a useful default even when you have personal global preferences.

Ask Codex to summarize the instructions it found before a substantial task. If its answer misses a critical rule, check discovery and wording before relying on it. Keep the file current as the project evolves: a command that no longer runs or an obsolete deployment rule can misdirect later work. Instructions guide the agent; tests, CI, permission controls, and human review still provide independent checks.

For this portfolio, the agreement that shared navigation stays English while notes can be English or Chinese is particularly useful. Together with stable slugs and canonical Markdown, it keeps the filter task focused on browsing existing content.

Configuration serves a different purpose. Use it for settings the client supports, rather than copying an old starter file whose permission values may have changed. Begin with the client controls and current documentation; add configuration when you can explain the behavior you need.

Understand the code before choosing a solution

A useful first request describes what you need to learn:

text
Inspect how the Notes archive loads Markdown and handles article language.
Explain the relevant entry points, existing filters, and tests.
Identify what would need to change to add English and Chinese filtering.
Do not edit files yet.

The answer should point to actual code: the frontmatter parser, the archive loader, the component that renders results, and any existing taxonomy or filter behavior. An explanation that could apply to any Next.js project is a reason to ask for more evidence.

This stage also gives you a chance to correct assumptions. Perhaps language already exists in metadata but older notes omit it. Perhaps the archive is entirely server-rendered. Those details determine whether the change needs a small client component, a URL parameter, or an extension of an existing mechanism. Starting with a preferred implementation can hide a simpler path.

Choose a working mode for the next decision

Several controls use the word “mode,” but they answer different questions. Plan mode helps shape multi-step work before implementation. Code review mode examines changes for problems. Goal mode keeps a longer task oriented toward a defined outcome. Local, Worktree, and Cloud choose the execution environment; permissions choose the agent's authority. Turning on planning does not select a different filesystem boundary.

For the filter, planning is useful once the current architecture is understood:

text
Plan a language filter for the Notes archive.
Keep existing article URLs and the current visual language.
Treat notes without language metadata as English.
Cover the empty state and keyboard interaction.
Explain the tradeoff between URL state and component state before editing.

Review whether the proposal solves the actual problem. If readers need shareable filtered views, URL state matters. If this is a small in-page browsing aid, component state may be enough. Planning should settle that decision and identify meaningful verification, rather than produce an elaborate task list for a minor edit.

The current desktop command reference lists /plan for planning and /review for code review. Commands vary by interface and access, so use the command picker in the client you actually have rather than assuming every command works everywhere. See the slash-command reference.

For a larger task, such as migrating a project to strict TypeScript, Goal mode can hold a measurable completion target across many steps. “Preserve behavior and make strict typechecking and the test suite pass” gives the agent a clearer stopping condition than “improve the types.” The long-running work guide documents /goal in the desktop app, CLI, and IDE extension. A goal still needs review criteria and appropriate access; persistence alone cannot establish correctness.

Give implementation a clear finish line

Once the design decision is settled, authorize the work with concrete acceptance criteria:

text
Implement the agreed Notes language filter on a focused branch.
Offer All, English, and Chinese, using existing design primitives.
Preserve article URLs and the default treatment of legacy English notes.
Show a useful empty state and retain keyboard-accessible controls.
Verify filtering behavior and run the relevant project checks.
Summarize the diff, results, and anything that still needs browser review.

This is a task contract. It says what a reader should be able to do and which existing behavior must survive. The agent can choose the implementation details that follow from the repository.

Watch for scope growth while it works. A filter should not quietly become a new internationalization framework or a content-model migration. If a genuine constraint changes the plan, resolve it explicitly. You can steer a running task with follow-up context; the CLI's October 15, 2026 release specifically added immediate steering while it responds. That release also added searchable settings through /config. These are useful everyday improvements, described in the current changelog, rather than prerequisites for completing this example.

Keep permissions separate from confidence

Permissions govern what the agent can do, even when a task sounds harmless. The sandbox controls file and network access; approval settings determine how requests to cross a boundary are reviewed.

Current documentation distinguishes Ask for approval, Approve for me, Full access, and custom configuration. Approve for me routes eligible requests through automatic review while retaining the workspace-write sandbox. It does not silently grant access to every file. Availability also depends on the environment and managed policy. The permissions guide is the reference for these controls.

For a local filter, the agent needs the project and its verification tools. It generally does not need production credentials or unrelated directories. A successful implementation also does not decide whether you want it deployed. State publication or deployment authority separately, especially when a task can affect an external system.

Add capabilities when a concrete need appears

Once the basic loop works, extensions become easier to judge. A skill packages reusable instructions and resources for a recurring workflow. A plugin can distribute skills and connectors. An MCP connection supplies access to external tools or information. These solve related but different problems; the skills documentation explains the packaging model.

For example, an article-authoring workflow can be a skill if the same metadata, source checking, and publishing procedure recur. A connection to an issue tracker becomes useful when tasks repeatedly depend on information outside Git. Neither is necessary just to add a language filter.

Subagents are useful when parts of a task can proceed independently. You might ask one to inspect a parser while another reviews the relevant tests, then have the main agent reconcile the findings. Current Codex clients delegate on a direct request or applicable project or skill instructions. Start with separate research or review tasks: agents writing to the same files create coordination work, and each agent consumes additional tokens. The subagent guide explains the workflow and client controls.

Scheduled tasks are useful after a workflow has proved reliable manually. A recurring report about failing CI checks is a better initial candidate than unattended production changes. Local scheduled work requires the computer to be on and the app running; web tasks use their accessible context and connected tools, rather than directly opening a local folder. The CLI and IDE extension do not provide the Scheduled management interface. See the scheduled-task guide.

Cloud tasks are another option when work should continue independently of your computer. Prepare the repositories, dependencies, and access in a reusable environment, then review each task's changes and checks. The Cloud introduction describes this workflow. Remote execution changes where the work happens; it does not remove the need to review it.

Review the evidence before accepting the change

For the language filter, start with behavior: can a reader switch languages, return to All, and understand an empty result? Then inspect the diff for unnecessary dependencies, duplicated metadata logic, or changes outside the agreed scope.

Ask the agent to review its own diff with those failure cases in mind. Where code review mode is available, use it to focus the conversation on findings. Review is more useful when it explains a concrete trigger and consequence than when it simply praises the code.

Tests can establish that language defaults and filtering work. A build can catch integration problems. Neither proves that labels fit on a narrow phone, that focus is visible, or that Chinese and English text wrap comfortably. Those require inspecting the rendered page. The final handoff should distinguish commands that passed from checks still outstanding.

A good first result leaves you with a small understandable diff, evidence for the behavior you requested, and a clear next decision. Repeating that process builds the judgment needed for larger tasks: when to explore, when to plan, what to delegate, and how to recognize that the work is ready.

Documentation checked on October 19, 2026. Interface labels, availability, and commands can change; the linked official documentation is the reference for your installed client.