Skip to content

Codex: Intermediate

Intermediate

You’ve run a few tasks. Now make Codex dependable. The difference between a lucky session and a reliable one is context: what Codex knows about your project before it starts, and how well you manage the window that holds it. This is context engineering in practice.

AGENTS.md is Codex’s persistent instructions file: the place you write the conventions, commands, and guardrails you’d otherwise repeat every session. Run /init to draft a starter, then trim it to what matters.

A useful AGENTS.md is short and concrete. Ten lines like these already change how Codex behaves on every run:

AGENTS.md
## Commands
- Dev server: `npm run dev` (port 4321)
- Before you finish a task: `npm run build && npm run test`
## Conventions
- TypeScript strict mode; no `any`
- UI text lives in `src/i18n/`, never hardcoded (site is DE/EN)
- Conventional commits: `feat:`, `fix:`, `docs:`

Every line earns its place: Codex now runs the right check before declaring a task done, respects the bilingual content rule, and writes commit messages you don’t have to fix.

How Codex reads it:

  • It merges files from your git root down to your working directory, so a directory closer to your code can override broader guidance.
  • Only one file per directory is read; an AGENTS.override.md wins over a plain AGENTS.md in the same directory.
  • Loading stops once the combined size hits project_doc_max_bytes (default 32768, i.e. 32 KiB). Anything past the cap is ignored.

Beyond AGENTS.md, you can hand Codex:

  • Attached files, images, screenshots, and design specs
  • URLs and web search (live or cached)
  • @-mentions of files, skills, or plugins to pull them into the prompt

The skill is selection, not volume. Add what the task needs and leave the rest out; every token spent on noise is a token the model can’t spend on your problem.

Codex’s default model as of mid-2026 is GPT-5.6 Sol, with Terra and Luna as the balanced and fast variants (GPT-5.5 remains available). The window is a moving target: the headline figures are large, but Codex sessions currently report an effective budget of roughly 258K input tokens, well below the advertised numbers. Treat ~258K as your working ceiling and confirm it in your own session rather than trusting the marketing figure; model names and limits shift often, so verify against the current docs.

When a session gets long:

  • Run /compact to summarize and reclaim space; Codex also compacts automatically.
  • Start a new thread per task instead of one ever-growing conversation.
  • Archive old threads so they don’t clutter your workspace.
  • Use Plan mode to get a plan and clarifying questions before any code changes.
  • Switch reasoning effort and model mid-session with slash commands: plan at high reasoning, then drop down to execute.
  • Steer mid-task: type a new message while Codex is working to redirect it without starting over.
  • Close each loop with /review (a separate reviewer reads your diff) before you move on.

Codex has three different things people call “memory.” Don’t treat them as one:

  • Session resume: codex resume continues a prior session.
  • Memories: cross-session auto-memory that retains preferences and conventions, introduced 2026-04-16. Availability expanded to the EEA, UK, and Switzerland on 2026-06-16 (opt-in there), but confirm it’s enabled for your tenant before relying on it.
  • Chronicle: a separate opt-in preview (shipped 2026-06-16, ChatGPT Pro on macOS only) that builds memories from recent screen context. Narrow scope.

The memory you can actually review and version-control is AGENTS.md plus Skills. Make that your steering layer.

  • ✅ Your project has an AGENTS.md that Codex reads on every run
  • ✅ You manage the window with /compact and fresh threads
  • ✅ You know which “memory” features apply to you in Switzerland

Ready to configure Codex, connect it to your tools over MCP, and make verification automatic?