Claude Code project switcher
Peter Hartree
To work on a project, one must run claude in the project directory. That can be a lot of cd.
So I've made a helper for that.
I type cc in the terminal. This opens a project switcher:
Current: /Users/ph/Documents/www/AI Wow/wow.pjh.is
Press Enter to start here, or select:
Projects:
1. AI Wow blog
2. Claude Skills
3. Plans and reviews
4. [many other projects...]
Recent:
5. /Users/ph/.claude/hooks/bash-safety
6. /Users/ph/Documents/Projects/inbox-when-ready
^A all recent ^Z archived (3) ^C quit
I press a number and hit Enter. The helper changes directory and launches Claude.
The "projects" list is populated from my projects.yaml file. 1 The "recents" list contains non-project directories where I recently ran claude (for example, my tries).
Setup
Add this to your .zshrc:
cc() {
local result
result=$(python3 ~/.claude/scripts/claude_launcher.py "$PWD")
local exit_code=$?
if [ $exit_code -eq 0 ] && [ -n "$result" ] && [ -d "$result" ]; then
echo "$result" >> ~/.cc_recent_dirs
cd "$result" && claude
fi
}
And the claude_launcher.py script is here.
Footnotes
Managed by my project-management plugin. ↩
