Repository navigation
claude: --mux herdr runs Claude in herdr instead of tmux - #1233
Merged
Merged
Conversation
Ported from boxctl. A multiplexer keeps Claude running on the box between attaches; tmux stays the default. --mux herdr (or ONCTL_MUX= herdr) runs it in herdr (herdr.dev), installed on the box the first time: one server per box, a workspace per session labeled with the session's name, so an attached herdr shows every task with what its Claude is doing, and claude ls reads the status (working, blocked, idle) from one `herdr workspace list`. Ctrl-b q detaches. The box records which multiplexer its sessions started in (/root/.boxctl/mux, read by the project check), so later runs and claude ls look there without being told; --mux given explicitly against a session running in the other one is refused rather than starting a second Claude beside it. Unlike boxctl, a box here always outlives the run, so herdr's pane only runs Claude: when it exits the server stays for the box's other sessions, and the attached client shows a shell workspace to detach from. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQo63nquy9oDWspMWnWfxD
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1233 +/- ##
==========================================
+ Coverage 47.22% 47.67% +0.44%
==========================================
Files 77 78 +1
Lines 9044 9165 +121
==========================================
+ Hits 4271 4369 +98
- Misses 4773 4796 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ports boxctl's
--muxtoonctl claude. tmux stays the default;--mux herdr(orONCTL_MUX=herdr) runs Claude in herdr instead, installed on the box the first time. One herdr server per box, one workspace per session labeled with the session's name (claude,claude-<task>), so an attached herdr shows every task on the box with what its Claude is doing, andonctl claude lsshows herdr's status (working, blocked, idle) in the ACTIVE column instead of tmux's last-activity time. Ctrl-b q detaches.The box records which multiplexer its sessions started in (
/root/.boxctl/mux, returned by the project check), so later runs,--reporuns andclaude lslook for the session where it is without being told.--muxgiven explicitly while Claude runs in the other one is refused rather than starting a second Claude beside it.Difference from boxctl: a box here always outlives the run, so herdr's pane only runs Claude. When Claude exits, the server stays for the box's other sessions and the attached client shows a plain shell workspace to detach from. boxctl's
shellAfteris not ported.Changes
cmd/mux.go(new): themultiplexerinterface,tmuxMux,herdrMux,--muxresolution and the box marker.cmd/claudesession.go: the session field isname(its label in either multiplexer);tmuxCommandmoved intotmuxMux.start.cmd/claude.go:--muxflag with completion,resolveMux,sessionRunning,useBoxMux;checkProjectalso returns the box's multiplexer;claudeSetupScriptis a function that includesmux.setup(); help text.cmd/clauderepo.go,cmd/claudels.go: use the multiplexer.Tests
cmd/mux_test.goports boxctl's suite against a fakeherdron PATH: first start brings the server up and types the command into a new workspace, second start only focuses, detached start doesn't attach, restart of the server closes restored workspaces first,running/list/parseListfor both,muxNamed,ONCTL_MUXdefault, the project check reporting the marker, and the setup script installing herdr only under--mux herdr. Existing tests adjusted for the renamed field andclaudeSetupScript().go test ./cmd/andgolangci-lint runpass.Verified on a real box (ac)
onctl -p ac claude --repo cdalar/onctl --box claude-muxtest --mux herdr -don a fresh Ubuntu container: herdr was installed to/usr/local/bin, the box markedherdr, aherdr serverstarted, Claude ran inside itsclaudeworkspace, and a second run reportedClaude is running on claude-muxtestwithout starting another.Not verified: how long the first detached start took to return. That run was killed by my own 9-minute timeout before printing, and the box lost its network attachment shortly after (the Apple
container0.1.0 network helper issues from #1231's thread), so I couldn't time a clean detached start in isolation. The start script is byte-for-byte boxctl's apart from the pane command, so I expect no hang, but it's worth one--detachrun on a box with a healthy network.🤖 Generated with Claude Code
https://claude.ai/code/session_01CQo63nquy9oDWspMWnWfxD