Claude Code setup
Claude Code has native Switchman integration via MCP, so agents can coordinate automatically instead of relying on shell rituals or hand-managed work splits.
switchman start "Your goal", but the manual switchman setup --agents N flow still works too.1. Create your agent workspaces
cd my-project
switchman setup --agents 5
switchman verify-setup
This creates isolated workspaces, the shared Switchman database, and project-local .mcp.json files so Claude Code can discover Switchman automatically.
2. Optional global fallback
If you prefer a global fallback, add this to ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"switchman": {
"command": "switchman-mcp",
"args": []
}
}
}
Project-local config is still the preferred path because it travels with the repo and generated workspaces.
3. Generate a repo-aware CLAUDE.md
switchman claude refresh
This generates a repo-aware guide in the repo root so agents know which Switchman tools and repo conventions to follow. Keep it in the repo root and do not have agents talk to .switchman/switchman.db directly.
4. Claude Code tools
Once the local MCP config is in place, Claude Code can use tools like:
| Tool | What it does |
|---|---|
| switchman_task_next | Get the next pending task from the queue |
| switchman_task_claim | Claim files the agent will edit |
| switchman_task_done | Mark a task complete and release claims |
| switchman_task_fail | Mark a task failed and release claims |
| switchman_write_file | Write a file through the governance gateway |
| switchman_status | Get a full system overview |
| switchman_scan | Scan for conflicts across all worktrees |
| switchman_lease_heartbeat | Refresh the agent's active lease |
CLAUDE.md typically tells Claude Code things like:
- How to call
switchman_task_nextat the start of each session - How to claim files before editing them
- When to call
switchman_lease_heartbeat - How to mark tasks done or failed
- What to do if a file claim is blocked
CLAUDE.md to your repo. Every time Claude Code opens a workspace it will read these instructions and follow the coordination protocol automatically.5. Add your tasks
switchman task add "Fix the login bug" --priority 8
switchman task add "Add rate limiting" --priority 6
switchman task add "Update README" --priority 2
6. Open one window per workspace
Open a separate Claude Code window for each agent workspace:
# Open these folders in separate Claude Code windows:
../my-project-agent1
../my-project-agent2
../my-project-agent3
.mcp.json pointing to the shared coordination database.With CLAUDE.md in place, Claude Code will:
- Call
switchman_task_nextto claim a task - Call
switchman_task_claimto register the files it will edit - Prefer the governed write tools when appropriate
- Call
switchman_task_donewhen finished - Repeat for the next task
Watching agents coordinate
Keep this running in a separate terminal while agents work:
switchman status --watch
You'll see each agent's active task, which files are claimed, and any blocked collision attempts in real time.
Troubleshooting
Claude Code isn't picking up the MCP tools
Check the .mcp.json exists in the workspace folder:
cat .mcp.json
It should point to the switchman-mcp binary. If it's missing, run switchman setup --agents 3 again from the main repo.
Agent says "no pending tasks"
Either all tasks are claimed by other agents or the queue is empty. Check:
switchman task list
File claim is blocked
Another agent already owns that file. The blocked agent should pick a different task or wait. Run switchman status to see who owns the file.