Created
April 16, 2026 08:17
-
-
Save mattpass/016dc78acb6a4687458a0af6a47189b8 to your computer and use it in GitHub Desktop.
Codex single root
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Override for Codex to have a single root, so /resume covers any folder | |
| function codex() { | |
| local launch_dir="$PWD" | |
| ( | |
| cd "$HOME/Projects" || exit 1 | |
| # If launched from ~/Projects or one of its subdirectories, just start there normally. | |
| if [ "$launch_dir" = "$HOME/Projects" ] || [[ "$launch_dir" == "$HOME/Projects/"* ]]; then | |
| command codex "$@" | |
| else | |
| # If launched elsewhere, still root the session in ~/Projects but also allow access to the original directory. | |
| command codex --add-dir "$launch_dir" "$@" | |
| fi | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment