Project-root `config/` directory auto-deleted when Codex plugin installed (data loss)
Summary
When the Codex plugin (codex@openai-codex) is installed, a directory named config/ at the project root is automatically deleted by Claude Code shortly after files are written into it via the Write tool. This silently destroys user-created project structures that use config/ for application configuration.
Environment
- Claude Code:
2.1.122 - OS: macOS Darwin 25.3.0 (arm64, Apple Silicon)
- Shell: zsh
- Plugin installed:
codex@openai-codex
Steps to reproduce
- Install Codex plugin:
/plugin install codex@openai-codex - In a project root, create a directory named
config/. - Use the Write tool to create a text file inside it (e.g.
config/settings.txt). - Wait a few seconds, then
ls config/.
Expected behavior
The config/ directory and its contents persist.
Actual behavior
The config/ directory is deleted within seconds. ls config/ returns No such file or directory. Reproducible: each re-creation gets deleted again.
Evidence — fs_usage trace
Captured with sudo fs_usage -w -t 60 | grep "<project>/config". Process name 2.1.122.<thread_id> matches claude --version (2.1.122 (Claude Code)).
12:01:49.517046 mkdir .../config mkdir.40714603 ← user mkdir
12:01:49.522554 unlinkat .../config 2.1.122.40497423 ← deleted 5ms later
12:01:53.425295 mkdir .../config 2.1.122.40497475 ← Write tool re-creates
12:01:53.425525 openat .../config/targets.txt.tmp.... 2.1.122 ← write
12:01:53.425767 rename .../config/targets.txt 2.1.122
12:01:54.789013 openat .../config/exclude.txt.tmp.... 2.1.122
12:01:54.789248 rename .../config/exclude.txt 2.1.122
12:01:58.029729 unlinkat .../config 2.1.122.40497423 ← deleted again
Eliminated causes
- PreToolUse / PostToolUse hooks examined (
enforce-cwd-boundary.sh,notify-customization-change.sh) — no delete logic. .gitignoredoes not listconfig/..claude/settings.local.jsononly containspermissions.- Directories with other names under the same project (
bin/,conf/) are NOT deleted.
Suspected mechanism
Codex plugin's project-root configuration discovery seems to be misclassifying user-created config/ as plugin cache and running cleanup against it. Possibly related to existing plugin-cache issues:
- #29074 — Plugin cache not cleared on uninstall/reinstall
- #37865 — Plugin uninstall leaves orphaned cache directories
- #15369 — Plugin uninstall does not clear cached files
Workaround
Use a different directory name. Confirmed working: conf/, bin/. Avoid config/ at project root while the Codex plugin is installed.
Impact
Silent data loss for user-created configuration directories. Suggested fix: scope Codex's cleanup logic strictly to plugin-managed directories.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗