Possible creation of empty ~/.git and ~/.agents directories on host during/around Codex startup

Resolved 💬 3 comments Opened May 20, 2026 by ahwmrklas Closed May 20, 2026

## Summary

I observed empty ~/.git and ~/.agents directories appear in my home directory around the time I started several Codex sessions.

I cannot prove with certainty that Codex created them, but the timing was suspicious, and the empty ~/.git affected Codex project-name / terminal title behavior.

## What I observed

In my normal shell outside Codex, I found:

  • ~/.git
  • ~/.agents

Both were empty directories.

Their timestamps were close to the time I had started several Codex sessions.

## Why this mattered

Codex terminal title was configured to show project-name.

A Codex session started in a subdirectory like:

  • ~/tmp/example-project

showed the home-directory (my user name) as the project name instead of the current directory name.

After I removed the empty ~/.git, Codex fell back to the current directory name as expected.

This suggests the empty ~/.git may have caused Codex to treat the home directory as the nearest project root.

## What I tested

I removed the empty directories:

```bash
rmdir ~/.git
rmdir ~/.agents

Then I started Codex again manually from a subdirectory.
After that launch, neither directory was recreated:

ls -ld ~/.git ~/.agents
# both missing

I also tried sandbox read-only tests and did not reproduce the issue. Because in this timespan I was working with sandbox defaults in my ~/.codex/config.toml file.

## Important caveat

I cannot prove with certainty that Codex created these directories. (But codex itself suggested this bug report)

However:

  • they were empty
  • their timestamps were close to Codex activity
  • the empty ~/.git affected Codex project-name behavior
  • Codex sandboxing appears to involve .git / .agents paths internally, which is why I am reporting this

## Expected behavior

Codex should not create empty ~/.git or ~/.agents directories in the user’s home directory unless explicitly required and documented.

If internal sandbox/mount setup needs temporary paths, they should not be left behind on the host filesystem.

## Actual behavior

I observed empty host-side ~/.git and ~/.agents directories appear unexpectedly.

## Environment

  • Codex CLI version: 0.132.0
  • Shell: bash
  • Terminal: GNOME Terminal
  • OS: Linux
  • Session type: Wayland

## Notes

This may be intermittent or tied to a specific startup path, wrapper, or earlier launch sequence, because I was not able to reproduce it reliably afterward.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗