Skip to content

Adding a /cd command #38585

Open
Open

Description

@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

Activity

  1. added
    enhancement
    on Aug 14, 2026
  2. added
    CLI
    session
    on Aug 14, 2026
  3. mwcrutcher commented on Aug 14, 2026

    @mwcrutcher

    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.

  4. Mahkhmood9 commented on Aug 14, 2026

    @Mahkhmood9

    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 $ folder12 becomes a cd to the folder

    I 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

    Image

    ~/

  5. jdcodes1 commented on Aug 18, 2026

    @jdcodes1

    The backend plumbing for this already exists, so it's mostly a TUI surface gap: ThreadSettingsOverrides supports mid-thread updates of the fallback cwd/environments pair, plus profile_workspace_roots and sandbox_policy in 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 /cd implementation 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, since cd-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIenhancementsession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions