Switch Projects
Manage context when switching between projects tracked in ~/.claude/projects.json.
Registry Location
Projects are tracked in ~/.claude/projects.json:
{
"projects": {
"name": {
"path": "/absolute/path",
"last_worked": "YYYY-MM-DD"
}
}
}
Commands
"work on " / "switch to " / "resume "
- Save context for current project (if switching from another tracked project):
- Write a summary to the current project's
CLAUDE.local.mdwith:- What was done this session
- Any pending items or next steps
- Relevant context for resuming later
- Update
last_workedto today's date in~/.claude/projects.json
- Write a summary to the current project's
- Read
~/.claude/projects.json - Look up target project path by name
- Update target project's
last_workedto today's date - Read the project's
CLAUDE.local.mdif it exists - Read the project's
decisions.mdif it exists - Check git status, current branch, recent commits
- Summarize context and continue
"resume" (no project specified)
- Read
~/.claude/projects.json - Find project with most recent
last_workeddate - Offer to resume that one, or list recent projects to choose from
- Once selected, follow the "work on" steps above (skip step 1 if no current project)
"list projects" / "what projects do I have?"
- Read
~/.claude/projects.json - List projects sorted by
last_workeddate (most recent first) - Show name, path, and last worked date
Adding New Projects
When working in a directory that's not in the registry:
- Offer to add it: "This project isn't tracked yet. Add it to your projects?"
- If yes, add to
~/.claude/projects.jsonwith current date
Project Context Files
When resuming a project, read these files if they exist:
| File | Purpose |
|---|---|
CLAUDE.md | Project-specific instructions |
CLAUDE.local.md | Current state - where you left off |
decisions.md | Decision history |
CLAUDE.local.md
This file captures current state, not history. It gets overwritten (not appended) when:
- Switching away from a project (summary of where you left off)
- Creating a plan for a non-trivial task
- Completing a plan (clear or update)
Example content:
# project-name
## Current State
Implemented the new authentication flow. Tests passing.
## Pending
- Add rate limiting to login endpoint
- Update API docs
## Context
Using JWT tokens, decided against sessions (see decisions.md)
Relationship with SessionEnd Hook
The SessionEnd hook updates last_worked timestamps based on file operations. This skill also updates timestamps on explicit switches. Both are safe:
- They write the same date (idempotent)
- Hook catches implicit work (editing files without switching)
- Skill captures explicit switches with context summaries
