Codex App: saving Settings → Personalization → Custom instructions silently replaces the entire `~/.codex/AGENTS.md` (existing global instructions lost)
What version of the Codex App are you using (From "About Codex" dialog)?
26.814.41407 (ChatGPT/Codex merged desktop app for macOS; Codex CLI 0.147.0)
What subscription do you have?
Pro
What platform is your computer?
Darwin 25.4.0 arm64 arm (macOS 26.4.1)
What issue are you seeing?
~/.codex/AGENTS.md is used as the global instruction file for Codex. In the merged ChatGPT/Codex desktop app, Settings → Personalization → Custom instructions reads from and writes to this same file (see #35202, #33792, #38859).
When I typed a short instruction into that field (3 short lines about reply tone, intended to also apply to voice chat) and saved, the app overwrote the whole ~/.codex/AGENTS.md with just those 3 lines. My existing global instructions (~4,000 characters of operational rules built up over weeks — tool priorities, browser-use authorization, timezone handling, handover rules, etc.) were deleted with no warning, no confirmation, and no backup.
Because nothing in the UI says "this field IS ~/.codex/AGENTS.md", I did not notice for about a week. During that time Codex behaved noticeably worse (ignored rules it used to follow), and I only found the cause by diffing the AGENTS.md text embedded in old session rollouts under ~/.codex/sessions/ against the current file.
Timeline (from rollout files; JST):
- Before saving — rollouts still embed the full ~4,000-char global AGENTS.md
- Custom instructions saved in the app
- A few minutes later — new rollouts embed only the 3 new lines. No Codex/CLI session wrote the file in that window.
What steps can reproduce the bug?
- Put any multi-section content in
~/.codex/AGENTS.md(e.g. 50+ lines of global rules). - Open the Codex/ChatGPT desktop app → Settings → Personalization → Custom instructions.
- The field shows the current
AGENTS.mdcontent. Replace it with (or type) a short instruction and save. cat ~/.codex/AGENTS.md→ the file now contains only what was in the field. Previous content is gone; no.bak, no prompt.
(No thread/session ID applies — the write came from the settings UI, not from a Codex thread.)
What is the expected behavior?
Any of the following would have prevented the data loss:
- The Personalization field should clearly state that it edits
~/.codex/AGENTS.md(full path), and show a confirmation when the save would remove existing content. - Keep a backup (e.g.
AGENTS.md.bak-<timestamp>) before overwriting a file that was modified outside the app. - Better: keep ChatGPT "custom instructions" separate from the Codex global
AGENTS.md(as requested in #35202), or append/merge into a clearly delimited block instead of replacing the file.
Additional information
- Related: #35202 (custom instructions written to
~/.codex/AGENTS.mdand shared across Chat/Codex/Work), #33792, #38859 (Personalization shows Codex global instructions), #37950 (voice sessions don't receive AGENTS.md — which is why I was adding a voice-related instruction there in the first place). - I recovered the content from the
# AGENTS.md instructionsblock embedded in older rollout.jsonlfiles; that may be useful to others hit by this.
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Thanks — I reviewed #38859. It is related (same underlying design: the Personalization field is backed by
~/.codex/AGENTS.md), but this issue is about a different, more severe outcome: saving the field replaces the entire existingAGENTS.mdwith no warning or backup, so previously written global instructions are lost. #38859 reports the wrong content being displayed; this one reports data loss on save. I'd suggest keeping this open (or linking both to #35202).