Skip to content

feat(mux): herdr support - #333

Open
rmarganti wants to merge 2 commits into
folke:mainfrom
rmarganti:herdr
Open

feat(mux): herdr support#333
rmarganti wants to merge 2 commits into
folke:mainfrom
rmarganti:herdr

Conversation

@rmarganti

Copy link
Copy Markdown

Description

This adds herdr as a supported cli.mux.backend

Changes include:

  • a new Herdr session backend at lua/sidekick/cli/session/herdr.lua
  • backend registration alongside tmux and zellij
  • automatic defaulting to herdr when running inside a Herdr environment
  • support for:
    • embedded terminal attach flows
    • external/inherited Herdr sessions
    • opening sessions in a new tab (create = "window")
    • opening sessions in a split (create = "split")
    • session discovery / reuse from existing Herdr panes
    • pane/process inspection for restoring Sidekick sessions
  • health check coverage for herdr
  • docs updates in README.md and doc/sidekick.nvim.txt

Related Issue(s)

  • N/A

Screenshots

HLlIfthWUAA0FWF

@github-actions github-actions Bot added the size/xl Extra large PR (100+ lines changed) label Jun 25, 2026
tbanh-hs added a commit to tbanh-hs/dotfiles that referenced this pull request Jul 19, 2026
Comment thread lua/sidekick/cli/session/herdr.lua Outdated
MrBanh pushed a commit to MrBanh/dotfiles that referenced this pull request Aug 3, 2026
* render-markdown: default icons

* misc

* sidekick: remove <leader>aa, not worth to fix

* sidekick.nvim

* tmux

* snacks input

* herdr

* feat(tmux): add tmux-agent-sidebar plugin

* zsh: add cargo env

* tmux-agent-sidebar customize icons

* misc

* lazygit: fallback to delta's set styling

* delta: add padding for line-numbers

* tmux: hide tmux-agent-sidebar when leaving sidekick.nvim sessions

* sesh: chezmoi session also spawns nvim window

* feat(bat lci): add everforest theme)

* fix(git-delta): update labels, hunk-header-style, and line number formatting

* misc

* delta: merge conflict symbols

* haunt.nvim

* sidekick: add a picker to delete CLI sessions

* tmux

* nvim(treewalker): fallback for arrow keys to default

* lazygit: split main panel to side-by-side

* misc

* tmux: move agent sidebar into a floating popup

The agent-sidebar plugin was injecting a sidebar into every new window,
which split into the floating-tmux popup and fought tmux-resurrect
restores. Run it in a background agent-sidebar session shown in a
centered popup (prefix + e) instead, keeping the per-agent sidebar only
while browsing in that popup.

Renumber the config files so hooks (03) load before plugins (04), replace
sidekick-hide-sidebar.sh with agent-sidebar-hide-outside.sh, and blacklist
the agent-sidebar session in sesh so it isn't offered as a pick.

* tmux: set the prefix key in settings instead of bindings

Establish C-Space as the prefix in 01-settings.conf so it is set before
any bindings load, removing the old C-w intermediary that only existed to
swap the prefix over inside the bindings file.

* tmux: start a fresh opencode session from prefix + M-/

Drop --continue so the shortcut opens a new opencode session rather than
resuming the previous one.

* clean up unnecessary keybinds

* revert agent-sidebar floating tmux

* feat(tmux): agent-manager manager for sesh-like fzf popup to jump between running AI agents

* remove agent-manager

* tmux: copy tmux-agent-sidebar agent-state; update to detect agent start instead of waiting for first prompt

* tmux: enable sound notification for tmux-agent-sidebar (need to fork repo to add this feature)

* remove herdr

* misc

* tmux: flash-copy.tmux for searching/copying text on current tmux pane

* nvim: fix conflict-marker, clean up unused plugins, group pull requests keybinds

* ghostty+wezterm: swap to "Blazer" theme

* git-delta: remove unused themes and update everforest theme

* tmux-agent-sidebar: return-to-work-session - track and jump back to the work session you were in before diving into agents

* delta: remove bold from diff

* zsh:  Set ZSH_TMUX_AUTOQUIT to false, does not auto close terminal when tmux exits

* lazygit: revert horizontal main panel split (gets too crowded with delta side-by-side enabled)

* delta: use default line numbers format separators

* lazygit: everforest theme

* opencode: add everforest-theme skill and palette reference

* snacks.nvim: don't use neovim's colorscheme for lazygit

* delta: update colors

* zshrc: add `cm` alias to run chezmoi with dotfiles-work if it exists

* move starship to ~/.config/starship

* misc

* matugen: auto-generate bat and delta themes for .gitconfig

* matugen: generate theme for gh-dash

* matugen: auto-generate lazygit theme config

* matugen: auto-generate opencode theme

* matugen: auto-generate yazi theme

* matugen: auto-generate everforest.nvim color overrides

* matugen: auto-generate starship theme

* opencode: remove everforest-theme skill

* feat: matugen

* matugen: auto-generate tmux theme

* remove tmux-agent-sidebar

* remove tmux-agent-sidebar

* add Brewfile?

* add `epilande/ccmux`

- Add to brewfile
- Add ~/.config/ccmux/ccmux.json
- Add matugen template for ccmux.json
- Add opencode plugin for ccmux
- Add tmux bindings for ccmux

* matugen: add script to merge generated palette into starship.toml

* matugen: create theme templates for ghostty and wezterm

* ghostty: matugen

* wezterm: matugen

* matugen: add bg colors in palette

* matugen: generate new colors

* lazygit: use --remote for edit commands; also removed snacks lazygit config since it was redundant with lazygit's own config

* misc

* matugen: update everforest colors for better contrast around bg red

* lua_ls: expand hover preview fields and enums limit

* matugen: ccmux update

* Revert "remove herdr"

This reverts commit 156cb6e.

* sidekick.nvim: remove session_picker

* nvim: <CR> and <BS> for LSP Selection Ranges instead of <M-o> and <M-i>

* zsh: remove tmux from plugins; it's added elsewhere in config after it checks if not in a specific environment, like vscode/zed/etc

* herdr: config, plugins, script for popup

Plugins:
- herdr-navigator: jump to anything, like sesh
- vim-herdr-navigation: navigate panes between vim/herdr
- herdr-plus: project templates for dotfiles, downloads, and more like sesh config

Scripts:
- herdr-popup: run a popup terminal like tmux display-popup

* remove herdr until sidekick.nvim supports herdr

See: folke/sidekick.nvim#333

* misc: add `go's /bin` to PATH

* ccmux: enable notifications with sound

* tmux: ccmux-return-track also recognizes agents started in ordinary tmux sessions, not just those in sidekick| sessions
MrBanh pushed a commit to MrBanh/dotfiles that referenced this pull request Aug 5, 2026
* render-markdown: default icons

* misc

* sidekick: remove <leader>aa, not worth to fix

* sidekick.nvim

* tmux

* snacks input

* herdr

* feat(tmux): add tmux-agent-sidebar plugin

* zsh: add cargo env

* tmux-agent-sidebar customize icons

* misc

* lazygit: fallback to delta's set styling

* delta: add padding for line-numbers

* tmux: hide tmux-agent-sidebar when leaving sidekick.nvim sessions

* sesh: chezmoi session also spawns nvim window

* feat(bat lci): add everforest theme)

* fix(git-delta): update labels, hunk-header-style, and line number formatting

* misc

* delta: merge conflict symbols

* haunt.nvim

* sidekick: add a picker to delete CLI sessions

* tmux

* nvim(treewalker): fallback for arrow keys to default

* lazygit: split main panel to side-by-side

* misc

* tmux: move agent sidebar into a floating popup

The agent-sidebar plugin was injecting a sidebar into every new window,
which split into the floating-tmux popup and fought tmux-resurrect
restores. Run it in a background agent-sidebar session shown in a
centered popup (prefix + e) instead, keeping the per-agent sidebar only
while browsing in that popup.

Renumber the config files so hooks (03) load before plugins (04), replace
sidekick-hide-sidebar.sh with agent-sidebar-hide-outside.sh, and blacklist
the agent-sidebar session in sesh so it isn't offered as a pick.

* tmux: set the prefix key in settings instead of bindings

Establish C-Space as the prefix in 01-settings.conf so it is set before
any bindings load, removing the old C-w intermediary that only existed to
swap the prefix over inside the bindings file.

* tmux: start a fresh opencode session from prefix + M-/

Drop --continue so the shortcut opens a new opencode session rather than
resuming the previous one.

* clean up unnecessary keybinds

* revert agent-sidebar floating tmux

* feat(tmux): agent-manager manager for sesh-like fzf popup to jump between running AI agents

* remove agent-manager

* tmux: copy tmux-agent-sidebar agent-state; update to detect agent start instead of waiting for first prompt

* tmux: enable sound notification for tmux-agent-sidebar (need to fork repo to add this feature)

* remove herdr

* misc

* tmux: flash-copy.tmux for searching/copying text on current tmux pane

* nvim: fix conflict-marker, clean up unused plugins, group pull requests keybinds

* ghostty+wezterm: swap to "Blazer" theme

* git-delta: remove unused themes and update everforest theme

* tmux-agent-sidebar: return-to-work-session - track and jump back to the work session you were in before diving into agents

* delta: remove bold from diff

* zsh:  Set ZSH_TMUX_AUTOQUIT to false, does not auto close terminal when tmux exits

* lazygit: revert horizontal main panel split (gets too crowded with delta side-by-side enabled)

* delta: use default line numbers format separators

* lazygit: everforest theme

* opencode: add everforest-theme skill and palette reference

* snacks.nvim: don't use neovim's colorscheme for lazygit

* delta: update colors

* zshrc: add `cm` alias to run chezmoi with dotfiles-work if it exists

* move starship to ~/.config/starship

* misc

* matugen: auto-generate bat and delta themes for .gitconfig

* matugen: generate theme for gh-dash

* matugen: auto-generate lazygit theme config

* matugen: auto-generate opencode theme

* matugen: auto-generate yazi theme

* matugen: auto-generate everforest.nvim color overrides

* matugen: auto-generate starship theme

* opencode: remove everforest-theme skill

* feat: matugen

* matugen: auto-generate tmux theme

* remove tmux-agent-sidebar

* remove tmux-agent-sidebar

* add Brewfile?

* add `epilande/ccmux`

- Add to brewfile
- Add ~/.config/ccmux/ccmux.json
- Add matugen template for ccmux.json
- Add opencode plugin for ccmux
- Add tmux bindings for ccmux

* matugen: add script to merge generated palette into starship.toml

* matugen: create theme templates for ghostty and wezterm

* ghostty: matugen

* wezterm: matugen

* matugen: add bg colors in palette

* matugen: generate new colors

* lazygit: use --remote for edit commands; also removed snacks lazygit config since it was redundant with lazygit's own config

* misc

* matugen: update everforest colors for better contrast around bg red

* lua_ls: expand hover preview fields and enums limit

* matugen: ccmux update

* Revert "remove herdr"

This reverts commit 156cb6e.

* sidekick.nvim: remove session_picker

* nvim: <CR> and <BS> for LSP Selection Ranges instead of <M-o> and <M-i>

* zsh: remove tmux from plugins; it's added elsewhere in config after it checks if not in a specific environment, like vscode/zed/etc

* herdr: config, plugins, script for popup

Plugins:
- herdr-navigator: jump to anything, like sesh
- vim-herdr-navigation: navigate panes between vim/herdr
- herdr-plus: project templates for dotfiles, downloads, and more like sesh config

Scripts:
- herdr-popup: run a popup terminal like tmux display-popup

* remove herdr until sidekick.nvim supports herdr

See: folke/sidekick.nvim#333

* misc: add `go's /bin` to PATH

* ccmux: enable notifications with sound

* tmux: ccmux-return-track also recognizes agents started in ordinary tmux sessions, not just those in sidekick| sessions
@willian

willian commented Aug 6, 2026

Copy link
Copy Markdown

Hi @rmarganti, thanks for working on this. I tested the flow against Homebrew Herdr 0.8.0 and mapped the current CLI contract. The breakage mentioned above goes beyond --cwd:

herdr agent start <NAME> --kind <KIND> --pane <ID> [--timeout <MS>] [-- [AGENT_ARG]...]

agent start now requires --kind and an existing --pane; it no longer creates a pane, and it does not accept --cwd, --no-focus, --split, or --env.

The backend architecture in this PR still looks right. I think the launch path can be adapted to 0.8.0 as a two-step flow:

  1. Create the requested pane with herdr pane split (including --direction, --ratio, --cwd, --env, and --no-focus) or herdr tab create for create = "window".
  2. Start a recognized agent with herdr agent start <sid> --kind <kind> --pane <pane_id> --timeout 30000. For tools outside Herdr's --kind enum, fall back to herdr pane run, with herdr agent wait <pane_id> --until idle --timeout 30000 as a best-effort readiness check.

A few related 0.8.0 details I verified:

  • pane list exposes the agent as pane.agent_session.agent, not pane.agent; it also provides pane.agent_status.
  • agent wait uses --until, not --state.
  • pane split supports --ratio, so cli.mux.split.size can be preserved.
  • terminal attach exists even though it is hidden from --help.
  • create = "terminal" from inside Herdr creates a nested session, so the agent appears in the inner session rather than the current sidebar. I think that mode should warn and recommend split or window for now.

This Sidekick backend work is independent of herdrdev/herdr#803, which is the more general problem of detecting and reporting state for agents that remain embedded behind Neovim or another PTY wrapper.

I'm happy to implement the 0.8.0 changes against your branch if that would help keep this as one PR. If you do not have capacity to continue it right now, I can instead open a new Sidekick PR based on #333, with explicit credit and preserved attribution. Let me know which route you prefer.

@calops

calops commented Aug 6, 2026

Copy link
Copy Markdown

Thanks guys for addressing this. I'm putting this out there only as a reference if it can help, but here is my working implementation in my config until mainstream supports herdr properly: https://github.com/calops/nix/blob/df50d100021894151fae164242e16d48915cbae9/modules/programs/neovim/_config/lua/plugins/ai.lua#L5-L141

I was planning on contributing to this PR properly but not much time for it lately. I'm sure I'm missing a lot of corner cases anyway.

Note though that herdr isn't perfect as a multiplexer for this, as this workaround is needed: https://github.com/calops/nix/blob/df50d100021894151fae164242e16d48915cbae9/modules/programs/neovim/_config/lua/plugins/ai.lua#L169-L177

The method used to view a single pane is sending raw input where some things get lost in translation, while the proper frontend interprets some keybindings properly (in this case, <S-Cr>). I'm not sure there's any hopeful solution to this as it seems to be a structural program in herdr and there doesn't seem to be a way to ship multiplexer-dependent default bindings in sidekick.

@rmarganti

rmarganti commented Aug 6, 2026

Copy link
Copy Markdown
Author

Sorry for delay getting this updated. I've been entrenched in a work meetup all week. I've updated my original PR to support modern Herdr APIs. A couple notes:

  • This pr does not use agent run any longer. The core issue is that Herdr must first create a pane and then launch the agent. When the agent exits, the pane remains, which is not compatible with the sidekick flow.

    Instead we use pane run exec {theAgentCommand}, which replaces the shell with the agent process, meaning the pane closes when the agent exits.

    This does also keep things more flexible for arbitary commands/tools not known to Herdr.

  • calops's issue is out of scope here, since it is a translation issue between Neovim → Herdr → the agent. This issue (from what I've seen) is only when using the create = "terminal" config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl Extra large PR (100+ lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants