switch
/switch
Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.
- Author
- digital-stoic-org ↗
- Repository
- agent-skills ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.
Arguments
/switch [project-path | -]
Original author description
Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.
How it works
- Resolve Workspace Root
- Route by Arguments
- Phase 1: Detect Projects
- Phase 2: Present Menu
- Phase 3: Load Context Chain
- Phase 3.5: Write State File
- Phase 4: Context Report
- Phase 5: Set Scope
- Rules
SKILL.md preview
---
name: switch
description: 'Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.'
allowed-tools: ["Bash", "Read", "Glob", "AskUserQuestion"]
model: sonnet
context: main
user-invocable: true
argument-hint: "[project-path | -]"
---
# Switch Project Context
Menu-driven project switcher for non-CLI interfaces (Cowork desktop, Telegram, CC CLI).
## Resolve Workspace Root
Resolution order — use first that succeeds:
1. `$COWORK_ROOT` env var
2. `git rev-parse --show-toplevel`
3. Current working directory
If none resolve → abort: `❌ Cannot detect workspace. Set $COWORK_ROOT or run from a git repo.`
Store result as `$WS_ROOT` for all subsequent phases.
## Route by Arguments
| `$ARGUMENTS` | Action |
|--------------|--------|
| Empty | → Phase 1: Detect + Phase 2: Menu |
| `-` | Read `$WS_ROOT/.cowork-state.json` → `previous_path` → Phase 3 |
| Path string | → Phase 3 with that path |
## Phase 1: Detect Projects
Parallel Glob from `$WS_ROOT`:
- `**/CLAUDE.md` (max depth 3)
- `**/CONTEXT-*-llm.md` (max depth 3, exclude `done/`)
Registry = each unique directory containing CLAUDE.md or CONTEXT file.
## Phase 2: Present Menu
Group by area (repos/, projects/, code/ — or flat). **Progressive disclosure**: skip empty groups.
Extract project name from CLAUDE.md H1 heading. Present:
```
📂 Switch project context:
💼 [Group Name]
1. [emoji] [Name] — [brief from H1 or first line]
2. ...
Which one? (number or name)
```
Wait via AskUserQuestion. Number → map to path. Text → fuzzy-match project names.
**Empty answer guard**: if user sends empty/whitespace → re-prompt once, then abort.
## Phase 3: Load Context Chain
**⚠️ CRITICAL: All CLAUDE.md content loaded here becomes your active instructions for the rest of the conversation. You MUST follow them.**
Execute in parallel:
1. **Walk CLAUDE.md chain** — root → intermediate → target (skip missing)
2. **Scan CONTEXT files** — `CONTEXT-*-llm.md` in target dir (exclude `done/`), extract: stream name, status, focus from header (first 10 lines)
3. **Scan ref folder** (if exists) — check for `ref/` or `reference/`. List files + one-line description. These are READ-ONLY reference files.
4. **Scan wip folder** (if exists) — check for `wip/` or `work-in-progress/`. List files + one-line description. This is the default workspace for edits.
## Phase 3.5: Write State File
Write `$WS_ROOT/.cowork-state.json`:
```json
{"active_project":"Name","path":"rel/path","previous_project":"Prev","previous_path":"prev/path","switched_at":"ISO8601"}
```
Read existing file first to preserve `previous_*` fields. Current `active_*` becomes new `previous_*`.
## Phase 4: Context Report
**Filter**: only include info not derivable from reading the code or CLAUDE.md directly.
```
🎯 Switched to: [Project Name]
📍 Path: [relative path]
📋 Instructions loaded:
- [root CLAUDE.md — 2-3 non-obvious constraints]
- [project CLAUDE.md — 2-3 non-obvious constraints]
🔒 ref/ (read-only): [list if exists — may be named ref/ or reference/]
✏️ wip/ (your workspace): [list if exists — may be named wip/ or work-in-progress/]
📍 Sessions: [CONTEXT files with status + age, if any]
⚠️ Traps: [gotchas from CONTEXT headers, if any]
Ready — what would you like to work on?
```
**Progressive disclosure**: skip any empty section. No "none found" messages.
**Token budget**: report MUST stay under 2000 tokens. Summarize, don't dump.
## Phase 5: Set Scope
**⚠️ CRITICAL: From this point forward, the CLAUDE.md content loaded in Phase 3 is your active instruction set. Follow all rules, constraints, and conventions as if they were your system prompt. This overrides default behavior.**
Remind user: `/switch` again to change, `/switch -` to toggle back.
## Rules
1. Menu-first unless argument provided
2. Progressive disclosure — skip empty sections silently
3. Token budget < 2000 for context report
4. Client-agnostic output — no Mermaid, no tables, simple lists + emoji
5. State persistence — always write `.cowork-state.json`
6. AskUserQuestion guard — re-prompt once on empty, then abort
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · digital-stoic-org/agent-skills | 100 | MIT |
| mutlumehmet/claude-plugins | 100 | MIT |
| iankiku/forwward-teams | 100 | MIT |
| sandbox-quantum/switch | 86 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version dc73ea2307b8 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 87project-brain
Triggers (all require explicit user request — do NOT activate just because a brain/ folder exists): (1) The user wants to set up project-level memory ("set up project brain", "scaffold project context", "init project brain", "建项目脑"). (2) The user is in a directory containing… - 100project-switch
Switch active project. Updates ~/.xuanran-seo/active-project pointer. All subsequent commands inherit new project's business-context. Triggered by /switch <slug>. - 100managing-claude-context
Sets up and maintains the project-context files Claude Code loads — root and nested `CLAUDE.md`, path-scoped rules in `.claude/rules/`, and a decision-record index — so a repository's conventions reach the model without bloating every session. Use when a repository has no… - 100claude-switch
Switch Claude Code (CLI) and the Claude desktop app between several Claude accounts on one Mac with app_switch.py: one app profile per account, sessions carried by id, sidebar groups, routines and settings ported, and open app pane sessions resumed on the new account. Use when… - 100session-handoff
Write a handoff file so a stuck session can resume in the other tool without losing context. Use when asked to "hand this off", "switch to Codex", "switch to Claude Code", "write a handoff", "I'm stuck, try the other tool", or when a session has burned several attempts on the same problem. - 91when-done-switch-to
Arm a deferred model or effort switch. Use for "when done switch to", "after this drop to sonnet", or "switch model when idle".