claude-code - 💡(How to fix) Fix Project-root `config/` directory auto-deleted when Codex plugin installed (data loss) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54521Fetched 2026-04-30 06:43:20
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×5commented ×2

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.

Root Cause

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.

Fix Action

Workaround

Use a different directory name. Confirmed working: conf/, bin/. Avoid config/ at project root while the Codex plugin is installed.

Code Example

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.40497475Write 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
RAW_BUFFERClick to expand / collapse

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

  1. Install Codex plugin: /plugin install codex@openai-codex
  2. In a project root, create a directory named config/.
  3. Use the Write tool to create a text file inside it (e.g. config/settings.txt).
  4. 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.
  • .gitignore does not list config/.
  • .claude/settings.local.json only contains permissions.
  • 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.

extent analysis

TL;DR

Avoid using a config/ directory at the project root when the Codex plugin is installed, as it may be deleted by the plugin's cleanup logic.

Guidance

  • Verify that the issue is specific to the config/ directory by trying alternative directory names, such as conf/ or bin/, as suggested in the workaround.
  • Check if the issue persists when the Codex plugin is uninstalled or disabled to confirm its involvement.
  • Consider reporting the issue to the plugin maintainers, referencing the suspected mechanism and related issues (#29074, #37865, #15369).
  • As a temporary workaround, use a different directory name for user-created configuration files.

Example

No code snippet is provided, as the issue is related to directory management and plugin behavior.

Notes

The issue seems to be specific to the Codex plugin and its interaction with the config/ directory. The suggested workaround is to use a different directory name, which has been confirmed to work.

Recommendation

Apply the workaround by using a different directory name, such as conf/ or bin/, to avoid silent data loss due to the Codex plugin's cleanup logic.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The config/ directory and its contents persist.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Project-root `config/` directory auto-deleted when Codex plugin installed (data loss) [2 comments, 2 participants]