Multiple Agents and Xcode

Alongside my own brain, my next bottleneck is of course DerivedData. Often I ask an agent to build something while I am trying something else in Xcode. The problem is that they both share the same folder.

This can be solved by explicitly stating in AGENTS.MD that the agent must use a secondary folder. If you want to use more than one agent, request that the folder is created dynamically based on CODEX_THREAD_ID.

Finally, add a small routine to keep the parent folder tidy. For example, if a folder is older than 12 hours, clean it.

Two instructions you can add to your AGENTS.MD:

  1. Every xcodebuild command must use -derivedDataPath with "<repo>/.codex/DerivedData/$CODEX_THREAD_ID" so each Codex session has its own DerivedData folder.
  2. Before every xcodebuild command, clean <repo>/.codex/DerivedData by deleting non-current session folders older than 12 hours.

The next bottleneck becomes RAM and disk - but that is a problem money can sort out.