coordinate-agents
Drive another Sidecar-managed agent from a shell — discover targets, create the layout, start a provider, prompt and wait, read before sending keys, broadcast…
Project switching implementation in sidecar: project discovery, state management, UI flow, modal rendering, filtering, theme preview, and plugin reinitialization. Use when working on the project switcher feature, project management, worktree switching, or the project
$ npx -y skills add marcus/sidecar --skill project-switching --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/project-switchingContext preview
The summary Claude sees to decide when to auto-load this skill.
Project switching implementation in sidecar: project discovery, state management, UI flow, modal rendering, filtering, theme preview, and plugin reinitialization. Use when working on the project switcher feature, project management, worktree switching, or the project
name: project-switching description: > Project switching implementation in sidecar: project discovery, state management, UI flow, modal rendering, filtering, theme preview, and plugin reinitialization. Use when working on the project switcher feature, project management, worktree switching, or the project configuration system. user-invocable: false
Switch between git repositories without restarting sidecar. Press `@` to open the project switcher modal.
The project switcher uses the app's declarative modal library (`internal/modal/`) for rendering and mouse handling.
| File | Contents | |------|----------| | `internal/app/model.go` | State, init, reset, filter, switch, theme preview | | `internal/app/update.go` | Keyboard and mouse handlers | | `internal/app/view.go` | Modal building and section rendering | | `internal/modal/` | Modal library (builder, sections, layout) | | `internal/config/types.go` | ProjectConfig struct | | `internal/config/loader.go` | Config loading with path validation |
// internal/app/model.go showProjectSwitcher bool projectSwitcherCursor int projectSwitcherScroll int projectSwitcherInput textinput.Model projectSwitcherFiltered []config.ProjectConfig projectSwitcherModal *modal.Modal // Cached modal instance projectSwitcherModalWidth int // Width for cache invalidation projectSwitcherMouseHandler *mouse.Handler
Projects are configured in `~/.config/sidecar/config.json`:
{
"projects": {
"list": [
{"name": "sidecar", "path": "~/code/sidecar"},
{"name": "td", "path": "~/code/td", "theme": "dark"}
]
}
}Paths support `~` expansion. Projects can have per-project themes.
case "@":
m.showProjectSwitcher = !m.showProjectSwitcher
if m.showProjectSwitcher {
m.activeContext = "project-switcher"
m.initProjectSwitcher()
} else {
m.resetProjectSwitcher()
m.updateContext()
}`initProjectSwitcher()` clears cached modal, creates text input with "Filter projects..." placeholder, loads all projects, pre-selects current project, and previews its theme.
`resetProjectSwitcher()` resets all state, clears modal cache, and restores current project's theme (undoing any live preview).
Uses `internal/modal/` with a builder pattern and lazy caching.
+-------------------------------------------+ | Switch Project | <- Title | [Filter projects... ] | <- Input section | 3 of 10 projects | <- Count section | ^ 2 more above | <- Scroll indicator | > sidecar | <- Selected item | ~/code/sidecar | | td (current) | <- Current project (green) | v 5 more below | <- Scroll indicator | enter switch up/down navigate esc close | <- Hints section +-------------------------------------------+
`ensureProjectSwitcherModal()` builds modal only when it does not exist or width changed. Call `clearProjectSwitcherModal()` when content changes (filter input, cursor movement with scroll).
| Type | Factory | Purpose | |------|---------|---------| | Input | `modal.Input()` | Text input with focus | | Custom | `modal.Custom()` | Complex content with focusables | | Text | `modal.Text()` | Static text | | Buttons | `modal.Buttons()` | Button row |
Priority: KeyType switch (special keys) -> String switch (named keys) -> Fallthrough to textinput.
| Key | Action | |-----|--------| | `Esc` | Clear filter (if set) or close modal | | `Enter` | Switch to selected project | | `Up/Down` | Arrow navigation | | `ctrl+n/ctrl+p` | Emacs-style navigation | | Other keys | Forwarded to text input for filtering |
First Esc clears filter if set. Second Esc (or first with empty filter) closes modal.
Cursor movement updates `projectSwitcherCursor` and calls `projectSwitcherEnsureCursorVisible()` to maintain scroll window (max 8 visible items).
`filterProjects()` does case-insensitive substring match on both `Name` and `Path` fields. On filter change: clear modal cache, clamp cursor, reset scroll, preview theme.
Uses modal library's `HandleMouse()`. Each project item has a focusable ID (`project-switcher-item-N`). Click on item triggers switch. Hover state managed by modal library via `hoverID` string.
`previewProjectTheme()` applies the selected project's theme live. Called on init, cursor movement, and filter changes. Theme is restored in `resetProjectSwitcher()`.
`switchProject()` performs:
1. Skip if same project (show toast) 2. Save active plugin state for old workdir 3. Check for saved worktree to restore 4. Update `m.ui.WorkDir` and repo name 5. Apply project-specific theme 6. Reinitialize all plugins via `m.registry.Reinit(targetPath)` 7. Send `WindowSizeMsg` for layout recalculation 8. Restore previously active plugin for new workdir 9. Return toast notification
1. All plugins stop (file watchers, git commands, etc.) 2. Plugin context updates to new working directory 3. All plugins reinitialize with new path 4. Previ
Always check if you are running in Sidecar: run sidecar agents for capabilities. You might never open your editor again. Status: Ready for daily use. Please report any issues you encounter. Documentation · Getting Started · Comprehensive List of Features
Drive another Sidecar-managed agent from a shell — discover targets, create the layout, start a provider, prompt and wait, read before sending keys, broadcast…
Create conversation adapters for importing AI chat history from different tools (Claude Code, Cursor, Warp, Codex, etc.). Covers the adapter.Adapter interface,…
Create declarative modals using the modal library API. Covers modal types (confirm, input, select, form), sections (Text, Buttons, Input, Textarea, Checkbox,…
Create new sidecar plugins implementing the plugin.Plugin interface, rendering views with Bubble Tea, handling keyboard input via keymap contexts, and…
Create prompts for sidecar workspaces. Covers prompt structure (name, ticketMode, body), template variables (ticket with fallbacks), config file locations…
Create custom color themes for Sidecar, including base theme selection, color overrides, gradient borders, tab styles, per-project themes, community themes,…