Skip to content

feature: support running multiple instances of the same tool (same cwd) #338

Description

@S1M0N38

Did you check the docs?

  • I have read all the sidekick.nvim docs

Is your feature request related to a problem? Please describe.

sidekick assumes one session per (tool, cwd). The sid (tool + cwd hash) is reused as the tmux session name, terminal id, and picker key, so a second spawn just reattaches to the existing session. Blockers:

  • tmux: tmux new -A -s <sid> attaches to the running session instead of creating a new one.
  • state: entries are keyed by sid; State.get hides the "+new" entry once a tool is running (if not sids[sid]).
  • terminal: open_win stacks a second split instead of reusing the pane.

Describe the solution you'd like

Allow N named instances per (tool, cwd), each tracked independently. Prototype on a branch:

  • Name mux sessions with an ordinal: "<sid> #<n>"; classify discovered sessions as owned (has ordinal) or external.
  • State.get(filter, { spawn = true }) always offers a "+new" entry.
  • open_win takes over the existing sidekick window in the tab.
  • Picker shows the instance ordinal (pi #2) + live scrollback preview.

Describe alternatives you've considered

Manual tmux split-window (loses sidekick integration), fake subdirs per instance, or duplicated tool configs (pi2, pi3).

Additional context

I've create a sloppy prototype at https://github.com/S1M0N38/sidekick.nvim/tree/feat/multi-instances (made with AI) just to showcase the idea. (Do not merge - contains #337 #336 and low quality code).

Keymaps from my config:

keys = {
  {
    "<c-.>",
    function()
      require("sidekick.cli").focus({ filter = { name = "pi" } })
    end,
    desc = "Sidekick Open Pi",
    mode = { "n", "t", "i", "x" },
  },
  {
    "<C-S-.>",
    function()
      require("sidekick.cli").select({ filter = { name = "pi", cwd = true }, spawn = true })
    end,
    desc = "Sidekick instances",
    mode = { "n", "t", "i", "x" },
  },
}

Example video:

Recording.at.2026-07-09.01.28.40.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststaleThis issue or PR has been inactive for a whilewontfixThis issue will not be fixed or implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions