claude agents: add workspace scoping to filter sessions by directory

Status Fixed / completed
Maintainer reply ✓ Yes — bogini
Activity 6 comments · opened May 11, 2026 · closed May 12, 2026
💡 Likely answer: A maintainer (bogini, collaborator) responded on this thread — see the highlighted reply below.

Summary

claude agents shows all background sessions globally. There's no way to scope the view to sessions started from a specific workspace or directory.

When working across multiple projects, the session list gets noisy. It would be helpful to filter sessions by the directory they were started in.

Proposed behavior

Add a flag (e.g. --cwd or --workspace) to filter sessions by their working directory:

# Show only sessions started from the current directory
claude agents --cwd .

# Show only sessions started from a specific path
claude agents --cwd ~/code/my-project

Alternatively, claude agents could default to showing sessions from the current directory, with a --all flag to show everything.

Current behavior

claude agents always shows all background sessions regardless of which directory it's run from.

View original on GitHub ↗

6 Comments

github-actions[bot] · 3 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13644
  2. https://github.com/anthropics/claude-code/issues/46911

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

jonathanlaniado · 3 months ago

The global view is useful for a bird's eye, but the default should probably be scoped to the cwd you opened it from. That's almost always what you want when you're heads-down in a project. --all for the rare cross-project check makes more sense than the reverse.

jakubdotpy3d · 3 months ago

It already does. press ctrl + s

jonathanlaniado · 3 months ago

Ctrl+S groups by directory, but it still shows every session globally. The ask here is to filter, not group. If I have 20 sessions across 5 repos and I'm working in one of them, I want to see only those sessions, not all 20 organized into 5 buckets.

bogini collaborator · 3 months ago

This is shipping in v2.1.141claude agents --cwd <path> scopes the view to sessions whose dispatch origin is <path> or a subdirectory. Worktree-dispatched jobs are matched against their parent project (so a job running in ~/projects/my-app/.claude/worktrees/foo still shows under --cwd ~/projects/my-app).

claude agents --cwd .                    # sessions from current directory
claude agents --cwd ~/projects/my-app    # sessions from a specific project

Thanks for the request!

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.