Skip to content

Instantly share code, notes, and snippets.

@mattpass
Created April 16, 2026 08:17
Show Gist options
  • Select an option

  • Save mattpass/016dc78acb6a4687458a0af6a47189b8 to your computer and use it in GitHub Desktop.

Select an option

Save mattpass/016dc78acb6a4687458a0af6a47189b8 to your computer and use it in GitHub Desktop.
Codex single root
# 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