Guides for Codex: instructions, sessions and configuration
Codex runs in a terminal, an IDE extension, a desktop app, and the cloud. The same problem can look different on each surface: a rule that loads in the CLI is missing in the app, a chat that resumes in one surface is held open in another, a config file that works in one project is skipped in the next.
Each Codex guide starts from one symptom in the terminal, IDE, desktop app or cloud and traces it back to the instruction, config or session state that produced it.
Checked against Codex's documentation on 26 October 2026.
Instructions and configuration#
- Why Codex ignores part of your AGENTS.md — the global-to-project chain, the combined 32 KiB limit on the project chain, what falls outside it, and how to prove what reached the model.
- Which config.toml Codex is actually reading — the seven layers, why a project file is skipped until the project is trusted, and where the desktop app differs from the CLI.
The concepts page on instruction files, skills and memory compares what each agent reads and what it remembers.
Sessions and context#
- Resume a Codex session, and get past "already has an active writer" — how
--lastand--allscope the picker, what the recorded working directory changes, and how to free a chat held by another surface. - Context compaction: what your coding agent drops — what a long session loses when older turns are replaced by a summary, and how to make the important parts survive. The page covers Codex and the other major agents.
Permissions, hooks and undo#
- Why Codex keeps asking for approval — the sandbox (the boundary around what commands can touch) and the approval policy are two controls, not one label, and a third set of prompts comes from tools.
- Codex hooks that don't fire — where hooks (commands that run at set points in a session) load, why an untrusted or edited hook is skipped, and how to check the event, matcher, handler, and output.
- How to undo in Codex, and what you can't get back — the difference between taking back a message, restoring files, and reversing something Git never saw.
Memory and handoff#
Persistent memory for Claude Code and Codex compares instruction files, Claude Code auto memory, Codex's own memory options, MCP memory servers (an external memory service the agent reaches over the Model Context Protocol), and ai-memory. It is the right starting point when the question is not "why did this file not load" but "which mechanism should remember this at all".
Hand off work between Claude Code and Codex is the written baton for work that has to move between tools or sessions. It covers what to write, where to put it, and how to check it arrived.
If you are coming from the other tool, the Claude Code guides cover the same problems on that side: nested CLAUDE.md files, auto memory, subagents (helper agents with their own context), sessions, permissions, and hooks. The OpenCode guides cover the same ground for OpenCode. The GitHub Copilot CLI guides cover instructions and AGENTS.md loading, sessions, custom agents, permissions and hooks. The Gemini CLI guides cover GEMINI.md and AGENTS.md loading, sessions, permissions, models, skills and hooks. The Qwen Code guides cover its own QWEN.md and AGENTS.md defaults, project-scoped sessions, permissions and hooks. The Cursor guides cover AGENTS.md, rules, skills, chat history, permissions, hooks and MCP.
Where to start#
If Codex is ignoring a rule, start with AGENTS.md. If a setting is not taking effect, start with config.toml. If the work disappeared, start with session resume. The order is deliberate: instructions first, then the configuration they run under, then the session that carries them.