Skip to content

claude should resume the last session by default; add --new for fresh sessions #52556

Description

@Gary-Armstrong

When a user opens Claude Code in a project directory, they almost always want continuity with their last session there. The current design inverts this: every session starts fresh, and resuming requires an explicit --resume <uuid> flag. This treats continuity as exceptional when it should be the default.

Proposed change

  • claude with no flags resumes the most recent session for the current working directory
  • claude --new starts a fresh session explicitly

This mirrors the behavior of editors (restore last open files), terminals (restore history), and IDEs (restore workspace state). Claude Code is currently the odd one out by defaulting to amnesia.

The UUID friction illustrates the problem

When Claude Code quits, it displays a --resume <uuid> suggestion. If the user closes the terminal or starts a new session without noting that UUID, there is no obvious way to recover it — even though it is already persisted in local files:

  • ~/.claude/history.jsonl — contains sessionId per entry with project path
  • ~/.claude/projects/<project-path>/<uuid>.jsonl — the UUID is the filename itself

A user who wants to resume must have manually recorded a value the tooling already knows. This is avoidable friction that penalizes the common case.

Workaround (until fixed)

claude-resume () {
    local prev_session=$(jq -r 'select(.project == env.PWD) | .sessionId' ~/.claude/history.jsonl | uniq | tail -2 | head -1)
    if [[ -z "$prev_session" ]]; then
        print -ru2 "claude-resume: no previous session found for $PWD"
        return 1
    fi
    echo "Resuming session: $prev_session"
    claude --resume "$prev_session"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions