claude-code - 💡(How to fix) Fix Safety: /resume shows sessions from all directories — risk of modifying wrong project [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46774Fetched 2026-04-12 13:33:23
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
closed ×2commented ×2labeled ×2reopened ×1
RAW_BUFFERClick to expand / collapse

Problem

The /resume command shows sessions from all projects/directories by default, not just the current working directory. A user in project B can accidentally resume a session from project A, causing the agent to read/modify files in the wrong codebase.

This is a safety issue, not just a UX inconvenience — the resumed agent retains the original session's context but operates in the current terminal's working directory.

Steps to reproduce

  1. Start a Claude Code session in /path/to/project-a, do some work, exit
  2. cd /path/to/project-b
  3. Start Claude Code, type /resume
  4. The picker shows sessions from project-a and all other directories by default
  5. Selecting a project-a session resumes it while the working directory is project-b

Current behavior

The /resume picker defaults to showing all sessions across all directories. Filtering controls exist in the footer:

  • Ctrl+A — narrow to current directory only
  • Ctrl+B — filter to current branch
  • Ctrl+W — filter to current worktree

However, these filters do not persist between invocations — every /resume resets to showing everything.

Expected behavior

  • Default to current directory only — the safe default is scoped, not global
  • Ctrl+A (or similar) to expand to all directories when intentionally needed
  • Persist the user's filter choice across invocations, or at minimum default to the safe option

The current default inverts the safety model: the dangerous action (cross-directory resume) is the default, and the safe action requires an extra keystroke every time.

Environment

  • Claude Code CLI
  • Discovered while running multiple agent sessions across different project directories

extent analysis

TL;DR

Modify the /resume command to default to showing sessions only from the current working directory, with an option to expand to all directories.

Guidance

  • Update the filtering logic to persist the user's last choice or default to the current directory filter (Ctrl+A) to ensure safe behavior.
  • Consider adding a configuration option to set the default filter behavior, allowing users to choose between current directory and all directories.
  • Review the current implementation of the /resume command to identify why it resets to showing all sessions across all directories by default.
  • Test the updated behavior to ensure it correctly scopes sessions to the current working directory and persists filter choices.

Example

No code snippet is provided as the issue does not include specific implementation details.

Notes

The solution may require changes to the Claude Code CLI's filtering logic and configuration options. The exact implementation will depend on the underlying codebase and technology stack.

Recommendation

Apply a workaround by using the Ctrl+A filter to narrow the sessions to the current directory every time the /resume command is used, until a permanent fix is implemented. This ensures safe behavior while waiting for the default behavior to be updated.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Default to current directory only — the safe default is scoped, not global
  • Ctrl+A (or similar) to expand to all directories when intentionally needed
  • Persist the user's filter choice across invocations, or at minimum default to the safe option

The current default inverts the safety model: the dangerous action (cross-directory resume) is the default, and the safe action requires an extra keystroke every time.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING