Route a CLI through a wrapper via PATH-shim symlink
Injecting per-context CLI behavior into existing scripts without modifying them.
To make every codex call in an existing benchmark sweep route through a wrapper (codex --profile azure) without touching the calling script, create a private dir, symlink the wrapper as codex inside it, and prepend that dir to PATH before invoking the sweep. The calling script keeps doing codex exec ... unchanged but the resolved binary is now your wrapper. This avoids forking the script for each variant and works for any CLI swap — vLLM endpoint, Ollama, Azure profile, mock-codex for tests. Mechanism is one mkdir + one ln -sf + one PATH= prefix.
For per-context CLI routing, reach for the PATH-shim symlink pattern before adding flags or env-checks to the calling code. The shim dir can live anywhere the calling script writes (often scripts/.shim/) and gets cleaned up with the rest of the run output.