project-switching
Skill1.1k starsChanged 56 days agoMITView on GitHub
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.
Trending
Less talk lately.about the whole repository
Who's talking about marcus/sidecar
- chenrui333/homebrew-tap“sidecar 1.16.0”GitHub · Oct 5, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.14.0”GitHub · Sep 23, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.13.0”GitHub · Sep 3, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.11.2”GitHub · Aug 31, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.9.0”GitHub · Aug 27, 2026 · 1 reactions
The biggest 5 of 48 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 48
Talked about on GitHub and Bluesky (48 times).
On GitHub · 47
- Oct 5, 2026sidecar 1.16.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Sep 23, 2026sidecar 1.14.0 — chenrui333/homebrew-tap1 reaction · 2 comments
- Sep 3, 2026sidecar 1.13.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 31, 2026sidecar 1.11.2 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 27, 2026sidecar 1.9.0 — chenrui333/homebrew-tap1 reaction · 1 comment
42 more on GitHub
- Aug 26, 2026sidecar 1.8.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 25, 2026sidecar 1.7.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 25, 2026sidecar 1.6.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 24, 2026sidecar 1.5.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 23, 2026sidecar 1.4.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 21, 2026sidecar 1.3.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 21, 2026sidecar 1.2.2 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 20, 2026sidecar 1.2.1 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 20, 2026sidecar 1.2.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 19, 2026sidecar 1.1.1 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 19, 2026sidecar 1.1.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 18, 2026sidecar 1.0.3 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 17, 2026sidecar 1.0.2 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 17, 2026sidecar 1.0.1 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 17, 2026sidecar 1.0.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 14, 2026sidecar 0.99.1 — chenrui333/homebrew-tap1 reaction
- Aug 14, 2026sidecar 0.99.0 — chenrui333/homebrew-tap1 reaction
- Aug 13, 2026sidecar 0.98.0 — chenrui333/homebrew-tap1 reaction
- Aug 12, 2026sidecar 0.97.0 — chenrui333/homebrew-tap1 reaction
- Aug 11, 2026sidecar 0.96.0 — chenrui333/homebrew-tap1 reaction
- Aug 11, 2026sidecar 0.95.0 — chenrui333/homebrew-tap1 reaction
- Aug 8, 2026sidecar 0.93.0 — chenrui333/homebrew-tap1 reaction
- Aug 7, 2026sidecar 0.92.0 — chenrui333/homebrew-tap1 reaction
- Aug 2, 2026sidecar 0.91.0 — chenrui333/homebrew-tap1 reaction
- Jul 31, 2026sidecar 0.90.0 — chenrui333/homebrew-tap1 reaction
- Jul 30, 2026sidecar 0.89.0 — chenrui333/homebrew-tap1 reaction
- Jul 28, 2026sidecar 0.88.2 — chenrui333/homebrew-tap1 reaction
- Jul 27, 2026sidecar 0.88.1 — chenrui333/homebrew-tap1 reaction
- Jul 25, 2026sidecar 0.87.1 — chenrui333/homebrew-tap1 reaction
- Jun 19, 2026sidecar 0.86.0 — chenrui333/homebrew-tap1 reaction
- Oct 3, 2026agent-skills.github.marcus.sidecar: 1.14.0 → 1.15.1 — sudosubin/agents.nix0 reactions
- Oct 1, 2026sidecar 1.15.1 — chenrui333/homebrew-tap0 reactions · 2 comments
- Sep 29, 2026agent-skills.github.marcus.sidecar: init at 1.14.0 — sudosubin/agents.nix0 reactions
- Sep 7, 2026Add Sidecar — manuelmeurer/agentmgmt0 reactions · 1 comment
- Apr 18, 2026sidecar 0.84.0 — chenrui333/homebrew-tap0 reactions
- Apr 17, 2026Feedback — sidequery/ghostree0 reactions
- Mar 24, 2026sidecar 0.83.0 — chenrui333/homebrew-tap0 reactions
- Mar 21, 2026sidecar 0.80.0 — chenrui333/homebrew-tap0 reactions
- Mar 21, 2026sidecar 0.79.0 — chenrui333/homebrew-tap0 reactions
- Mar 10, 2026sidecar 0.78.0 — chenrui333/homebrew-tap0 reactions
- Feb 10, 2026Research: Deep analysis of Sidecar - alignment check and alternatives — JulianDouma/speckle0 reactions
- Feb 9, 2026[Feature]: Persistent plan/todo tracking and checkpoints between plans — code-yeongyu/oh-my-openagent0 reactions · 6 comments
On Bluesky · 1
- Mar 4, 2026Great write up! The failures are especially valuable, watching this very closely. It might make sense to move merges to a subagent of the… — @faz.ms1 likes and repost
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- coordinate-agentsSkill
- create-adapterSkill
- create-modalSkill
- create-pluginSkill
- create-promptSkill
- create-themeSkill
- drag-paneSkill
- feature-flagsSkill
- inline-editorSkill
- keyboard-shortcutsSkill
- merge-strategySkill
- port-herdr-integrationSkill
- profile-memorySkill
- release-sidecarSkill
- shell-integrationSkill
- sidecar-websiteSkill
- ui-featuresSkill
- worktree-switchingSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 161
Check for saved worktree to restore
- Very specific: line 162
Update m.ui.WorkDir and repo name
- Distinctive: line 171
All plugins stop (file watchers, git commands, etc.)
- Distinctive: line 173
All plugins reinitialize with new path
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Project Switching
Switch between git repositories without restarting sidecar. Press @ to open the project switcher modal.
Architecture Overview
The project switcher uses the app's declarative modal library (internal/modal/) for rendering and mouse handling.
Key Files
| 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 |
Model State
// 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.HandlerProject vs Worktree Switching
- Project Switching (
@): Switch between configured projects fromconfig.json(arbitrary repos) - Worktree Switching (
W): Switch between git worktrees within the current repository
Configuration
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.
Core Flow
Opening (@ key)
case "@":
m.showProjectSwitcher = !m.showProjectSwitcher
if m.showProjectSwitcher {
m.activeContext = "project-switcher"
m.initProjectSwitcher()
} else {
m.resetProjectSwitcher()
m.updateContext()
}Initialization (model.go:433-454)
initProjectSwitcher() clears cached modal, creates text input with "Filter projects..." placeholder, loads all projects, pre-selects current project, and previews its theme.
Cleanup (model.go:413-423)
resetProjectSwitcher() resets all state, clears modal cache, and restores current project's theme (undoing any live preview).
Modal Rendering
Uses internal/modal/ with a builder pattern and lazy caching.
Modal Structure
+-------------------------------------------+
| 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
+-------------------------------------------+Caching (view.go:114-137)
ensureProjectSwitcherModal() builds modal only when it does not exist or width changed. Call clearProjectSwitcherModal() when content changes (filter input, cursor movement with scroll).
Section Types
| 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 |
Keyboard Handling (update.go:600-690)
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 |
Esc Behavior
First Esc clears filter if set. Second Esc (or first with empty filter) closes modal.
Navigation
Cursor movement updates projectSwitcherCursor and calls projectSwitcherEnsureCursorVisible() to maintain scroll window (max 8 visible items).
Filtering (model.go:457-470)
filterProjects() does case-insensitive substring match on both Name and Path fields. On filter change: clear modal cache, clamp cursor, reset scroll, preview theme.
Mouse Handling (update.go:1073-1115)
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.
Theme Preview (model.go:580-586)
previewProjectTheme() applies the selected project's theme live. Called on init, cursor movement, and filter changes. Theme is restored in resetProjectSwitcher().
Project Switching (model.go:485-577)
switchProject() performs:
- Skip if same project (show toast)
- Save active plugin state for old workdir
- Check for saved worktree to restore
- Update
m.ui.WorkDirand repo name - Apply project-specific theme
- Reinitialize all plugins via
m.registry.Reinit(targetPath) - Send
WindowSizeMsgfor layout recalculation - Restore previously active plugin for new workdir
- Return toast notification
What Happens on Switch
- All plugins stop (file watchers, git commands, etc.)
- Plugin context updates to new working directory
- All plugins reinitialize with new path
- Previously active plugin for that project is restored
- Toast notification confirms the switch
State Persistence
Per-project state saved in ~/.config/sidecar/state.json:
- Active plugin per project
- File browser cursor position and expanded directories
- Sidebar widths and view preferences
Common Pitfalls
- Forgetting updateContext() -- Call after closing modal to restore app context
- Stale modal cache -- Call
clearProjectSwitcherModal()when content changes - Cursor out of bounds -- Always clamp after filtering
- Printable keys vs navigation -- Keep printable characters routed to textinput
- Theme preview cleanup -- Always restore theme in
resetProjectSwitcher() - Focusable coordinates -- Each project takes 2 lines (name + path)
Adding Features
See references/implementation-details.md for detailed implementation patterns including adding keyboard shortcuts, project metadata, filter algorithms, and new modal sections.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

