Skip to content

resume --last should scope to current working directory #8700

@janthmueller

Description

@janthmueller

What feature would you like to see?

Problem

codex resume --last currently resumes the globally most recent session.

For users working on multiple projects in parallel, this behavior is often unintuitive and unhelpful. The globally “last” session is frequently unrelated to the current working directory (CWD), which breaks the expectation that Codex sessions are tied to the directory in which the tool is invoked.

By contrast, running codex resume without flags opens a TUI that lists sessions scoped to the current working directory. This behavior aligns much better with typical workflows and is what I initially expected resume --last to do.


Expected Behavior

codex resume --last should behave as follows:

  • Resume the most recent session associated with the current working directory (CWD)

  • Be functionally equivalent to:

    • running codex resume, and
    • automatically selecting the most recent session shown in the CWD-scoped TUI

In other words, --last should resolve the most recent session within the current working directory, rather than the most recent session across all directories.


Why This Matters

For users managing multiple active projects, the global “last session” is rarely the correct one. Requiring interaction with the TUI introduces unnecessary friction into everyday workflows.

The core use case is the ability to resume the correct Codex session for the current working directory with a single, non-interactive command. This is essential for setups where Codex is launched via a keyboard shortcut or script (for example from a terminal multiplexer), where any additional selection step breaks the flow.

Making resume --last CWD-scoped would allow reliable, scriptable, one-command session startup per project, enabling Codex to be used comfortably as a day-to-day development tool.


Suggested Options

  • Change resume --last to be scoped to the current working directory

  • OR introduce an explicit alternative flag, for example:

    • codex resume --last-cwd
    • codex resume --local-last

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIagentIssues related to the core agent loopenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions