Expose directories added via /add-dir in statusline JSON
Feature Request
When using /add-dir (or --add-dir) to add additional directories to a session, there is no way to programmatically query which directories have been added.
Use case
I have a custom statusline script that displays session context (git branch, model, cost, context usage, etc). I'd like to also show which additional directories are part of the current session, especially when working across multiple repos or monorepo subdirectories.
Current behaviour
The statusline JSON input includes:
workspace.current_dir— current working directoryworkspace.project_dir— directory where Claude Code was launched
Neither of these reflect directories added via /add-dir.
Proposed solution
Add a field to the statusline JSON, e.g.:
{
"workspace": {
"current_dir": "/home/user/project",
"project_dir": "/home/user/project",
"added_dirs": ["/home/user/other-repo", "/home/user/shared-lib"]
}
}
This would allow statusline scripts and other tooling to display and react to the full set of directories in the session.
Alternatives considered
- Tracking added directories manually via environment variables or wrapper scripts — fragile and doesn't capture interactive
/add-dirusage - Reading session transcripts — no structured field for this exists there either
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗