Adding a `/cd` command
Open 💬 3 comments Opened Aug 14, 2026 by ZachMcM
What variant of Codex are you using?
CLI
What feature would you like to see?
A /cd command that moves the existing conversation into another working directory.
Additional information
_No response_
3 Comments
You can effectively, but a little less ergonomically, do this by just exiting the session and using codex resume session# --cd /path
Doesn't invalidate cache or any other effect I notice.
Its actually impossible ---
if you want a certain folder - just
cd ~/docs/Code/vibecodedproject1234009
optionally you may use alias
alias cdcodex="cd ~/docs/Code/vibecodedproject1234009 && codex"
optionally I recomend developing the memory for the commands
for example you can do
alias folder12='cd ~/vibe'
and then like $
folder12becomes a cd to the folderI am sure you can ask chatgpt for some fun tricks :)
as for the thread - I dont think Codex should be over complicated with more commands -- how does the user feel and think /cd acts and do? will some users fail and do something they dont want because of it, not understand if they made harm or not? I think the more commands they more chance there is for confusion --- not that I wouldnt want something like /export for transcript export
<img width="1044" height="600" alt="Image" src="https://github.com/user-attachments/assets/a60ebc2a-0e03-4a31-a6e1-d657d9f5e5bf" />
~/
The backend plumbing for this already exists, so it's mostly a TUI surface gap:
ThreadSettingsOverridessupports mid-thread updates of the fallbackcwd/environments pair, plusprofile_workspace_rootsandsandbox_policyin the same struct (https://github.com/openai/codex/blob/1f41cc5d92/codex-rs/protocol/src/protocol.rs#L468-L495) — app-server clients can already re-point a live thread.A
/cdimplementation would need: (1) the slash command itself (tui/src/slash_command.rs) resolving the target and submitting the override; (2) a project-trust check on the new directory — same gate as startup, sincecd-ing into an untrusted tree silently inherits the session's approval mode; (3) refreshed workspace roots so sandbox writable-path rules follow the move; (4) an environment-context refresh so the model actually learns the new cwd rather than keeping stale paths from turn one.