logoalt Hacker News

Tmux and Claude Code: Sessions, Send-Keys, and the Ceiling

145 points • by ankitg12 • today at 5:55 AM • 107 comments • view on HN

Comments

hatradiowigwam • today at 2:39 PM

If you aren't familiar with tmux(or GNU screen), you owe it to yourself to become familiar. If you are a deveoper/sysop/cli-type it will act as a force multiplier. It takes 10 minutes to get setup and learn the basic hotkeys - and you will save many orders of magnitude of your time. One of the best learn-some-software investments you can make IMHO.

PS: This applies to /alot/ of software though...not just tmux. See: vim, emacs, bash, zsh.... the difference between a new or non-learned user is /vast/ compared to someone that spends 10 minutes and learns the basic of these tools. This is one of your first steps into greybeard mastery.

➕ show 2 replies
Scea91 • today at 2:11 PM

I used Claude Code in tmux since January until August.

Now I am 100% in the ChatGPT desktop app, because it felt I am doing way too much tinkering amd maintenance of my setup instead of doing real work.

Retrospectively, it feels tmux was right choice early this year as the alternatives just weren’t there. It was also fascinating and enjoyable building own workflow from the primitives and I did learn a lot, but the learning has plateued and what was left was mostly chore.

benfrancom • today at 8:13 PM

It's always been a chore to keep sessions (and tmux windows) at a minimum to avoid context switching and the cognitive drag/fatigue that comes with too many. My goal is 2 active sessions to avoid context switching, but it's so easy to just take on more tasks and try to cycle between all of them, and accomplish less overall. I've had upwards of a dozen, and it is very draining. Even more panes within windows to track subtasks becomes unruly. The other problem is that work keeps ballooning as agents pick up related/unplanned work along the way all the time. I try to reign things in by having the agent create tickets that we will revisit during planning sessions later. By keeping tasks minimal, it feels slower, but then I can think deeply about the problem without the cognitive residue coming from all the other sessions.

f311a • today at 9:51 AM

This website is so hard to read on a 15" retina screen.

The text content occupies like 20% of the screen, the rest is empty. Resizing the window helps.

➕ show 6 replies
zackham • today at 11:25 AM

Like others here I created my own terminal multiplexer as well. Daemon that holds all sessions, seamless binary upgrades so those sessions never get lost, everything recorded so recovery is always possible, thin client mode so laptop has a native app that connects to daemon, and a wasm responsive webui with transcription so I can carry on with sessions from phone. Claude/codex sessions started with a uuid so they can be killed/resumed at will (mine autosleep after 12h inactivity to free resouces). CLI allows agent control of everything for a harness independent implementation of claude's channels. A few friends have forked and adopted it as their daily driver. Similar organization to herdr wrt spaces to organize sessions. Optimized for speed/bandwidth when running in thin client mode.

https://github.com/zackham/seance

thomas_witt • today at 7:44 AM

I really liked Tmux and Zellij for the time being, but Herdr does it all so much better out of the box when it comes to agentic coding. I haven't found something I can do with tmux/zellij but can't do with herdr.

➕ show 4 replies
blfr • today at 11:56 AM

You can just install Claude Code on the server and drive it from Claude Desktop via remote control. That way you can control Claude Code on mutiple servers straight from your Claude Desktop, Mobile or Web, and stay fully within Anthropic tools.

Everything works: you get the native view of subagents, you can upload files and images, fork threads, etc.

The massive upside is that the actual work happens on the server so you can close your laptop and it will continue plus it will not fry your thighs. The advantage over sessions (which I haven't tried but theoretically sound) is that you can configure Claude's environment on the server however you like. Give it any tools you need, ssh access to other machines, sudo, whatever.

The only downside is that every new project requires a setup step on the server (to add the systemd service) where you will develop it since Claude can only handle one server per directory. Claude will handle this step however if you give it ssh access to your server.

The machines show up nicely in Claude Desktop/Mobile/Web, and repos/projects are in a dropdown. Unless you work on very many projects at the same time, this setup is golden.

➕ show 3 replies
solumos • today at 4:33 PM

After using Tmux since 2015, I started using herdr for agents, and it's pretty great.

➕ show 1 reply
qudat • today at 2:43 PM

I built zmx because I wanted a simpler session persistence model that also supported remotely running, tailing, and waiting for commands to finish.

It just so happens that it works really well with agentic development as well. I can remote into any shell environment through zmx and tell an agent to execute commands in that environment. `zmx run` executes and waits for the command to complete and also returns the exit code. For humans and agents this is a seamless experience, as if you are running the commands directly.

https://zmx.sh

https://bower.sh/zmx-ai-portal

Apologies for the self-promo.

➕ show 1 reply
klodolph • today at 3:12 PM

I've been using shpool these days (especially for things like Claude / Codex / etc). Shpool only does persistence, not multiplexing. It turns out this is exactly what I want. I want to have one keyboard shortcut, to detach the session, and that's it.

I can do terminal multiplexing better in the GUI—tabs, virtual desktops, or in the browser with xterm.js.

Yes, you can learn all these different tmux shortcuts, and I know them well enough. I like using the shortcuts in my terminal emulator better. All I really want is a way to continue my session after putting my laptop to sleep, and shpool does exactly that and no more.

➕ show 1 reply
vantassell • today at 5:59 PM

If you're using tmux with either worktrees or agents, I strongly recommend you check out workmux. It makes for such a clean setup.

https://github.com/raine/workmux

jdonaldson • today at 5:22 PM

Tmux is a good way to orchestrate sessions and keep them observable and interactive. I can easily adapt it to whatever mental model I need to get the job done.

https://github.com/jdonaldson/headless-horseman

toppa33 • today at 9:05 AM

I used to use tmux & Claude on a Mac mini, but I gave it away when herdr came around - there were just too many tmux sessions to maintain and herdr does a better job at showing you what’s open. Admittedly, your tmux setup looks far more sophisticated than what I was doing. However, the new claude code projects is insane and a step above on having claude being a real project manager across sessions.

kkapelon • today at 2:44 PM

This is essentially an ad for crystl.

I haven't check the whole list of features, but I believe herdr can do all the things described in the article (including what tmux offers)

littlecranky67 • today at 8:43 AM

Been using tmux session to hand over to claude for a while. Paranoid me uses the macbooks secure enclave with fingerprint for the ssh key so claude can't ssh into my remote boxes by himself. I then open named tmux sessions, perform the ssh login via fingerprint, and then tell claude that he is free to take over that session with a given name.

➕ show 1 reply
nedt • today at 2:08 PM

So many commands. I just started claude in a new tmux session with iterm. Told it it's running in tmux with iterm and it should spawn subagents into separate tabs. When I wanted to know the status of the fleet I just asked the primary agent.

Worked pretty well. Now if I want to automate something like that I would just ask it to write a skill at the end of the session. I'm lazy and I can't remember a couple of hotkeys or commands.

➕ show 1 reply
skeledrew • today at 1:39 PM

I've been doing this for a while with jaiver (made by me). Just expanded it recently to work with another tool that allows access via Telegram, because I've been on a crusade to make everything on my desktop mobile-accessible.

- https://gitlab.com/skeledrew/jaiver

pranav7 • today at 1:46 PM

Similar others I have had a lot of success just hand rolling a terminal multiplexer that fit my workflow — somewhat similar to herdr but works a little bit how I had my set up working with git worktrees and agents. Terminal native, and optimised for speed.

https://domux.dev

➕ show 1 reply
wb14123 • today at 2:36 PM

I created my own harness tcode (https://github.com/wb14123/tcode) to leverage tmux and neovim. Have been using it all the time since the beginning of this year.

MiliasGeiger • today at 8:54 AM

If you are interested in this setup I would recommend https://github.com/asheshgoplani/agent-deck.

michaelanckaert • today at 11:13 AM

I created my own “terminal multiplexer for AI agents” after trying out herdr.

For me (like for many others) tmux didn’t suit the multi agent workflow. Herdr then was too buggy in my experience.

My own tool, Jai, connects to multiple machines, handles multiple agents and enables agent to agent communication.

For those interested: https://michael.sinax.be/jai/index.html

➕ show 2 replies
mococa • today at 4:09 PM

I use AI Agents inside tmux since last year, the main motivation at that time was to avoid lost the session if I close the terminal by accident - now all of them have --resume

Ey7NFZ3P0nzAe • today at 5:24 PM

Personally I switched to zellij and haven't looked back. Though any of them is worth it over nothing.

igor_nast • today at 11:11 AM

I work on a GUI multi-agent harness & IDE (claude, codex, opencode,vibe). It has MCP for supervisor agents to delegate tasks and receive feedback.

A nice alternative for ppl who struggle with terminal based solutions. It's a free indie product. https://shikigami.dev <--- more info there

Aperocky • today at 5:24 PM

tmux is also a great primitive to build on top of.

You can have a message routing layer entirely on top of tmux with send keys - this way you don't even ever need to see your terminals (but can still see it if you want to).

nsagent • today at 1:51 PM

Wow, nearly every top level comment is about coding their own version of this.

I'd love some perspective on what problem this setup solves and how do you address sandboxing.

yoyohello13 • today at 3:12 PM

I'm a Zellij man myself, but terminal multiplexers are THE number one best QOL improvement for terminal based work.

mkw5053 • today at 5:16 PM

I've been using ghosty + ssh + mosh + tmux + claude code (sometimes codex) for a while now. It works well but the few things that still piss me off:

1. I have never been able to get copy-paste to work 100% of the time. I'm at about 95% of the time now which has been enough for me to not look into it.

2. Pasting and dragging and dropping non-text content (like images and videos).

At the end of the day I want it to feel like a native, local terminal

➕ show 2 replies
leizzo • today at 8:51 AM

It's great to manage subagents using the Claude team mode and tmux integration.

frangonf • today at 10:24 AM

tmux is great, specially when you need persistence in a remote server where you don't want or can't install any other software, and when you are stuck with some 2010 terminal emulator.

But if you have control over your setup, I would use a capable terminal and ditch in-band multiplexers that sit in the middle of the process and your terminal eating up escape sequences and native features while adding latency. Then use a separate tool for session persistence (I like zmx but there are more for this).

Reebz • today at 10:09 AM

I went down this path over 6 months ago and had a variety of custom setups using tmux, cmux, and more. But since using Orca IDE it feels like a leap in usability and robustness.

➕ show 1 reply
0xpiguy • today at 4:24 PM

does this approach allow you to interact with the sessions(resume existing or create new) through claude apps?(desktop/mobile/web)?

nklmilojevic • today at 10:14 AM

I've made a terminal that is essentially ghostty + herder, but all natively and has a session persistence. https://thurm.rs

there is an ios application in testflight and web client, nothing is on the servers, using tailscale through clients or you can use classic remote hosts.

➕ show 3 replies
piro0919 • today at 12:44 PM

I don't use tmux. I run Claude Code in Cursor windows, and each window title shows the folder name, so that's how I tell them apart. It rarely gets confusing, and an app I built for myself made it a lot easier.

➕ show 1 reply
paweladamczuk • today at 8:58 AM

tmux and pi is already my preferred way to use LLMs, but the config in the article is sweet. I was wondering why the colors were off...

petesergeant • today at 9:58 AM

I am doing tmux + Claude but I wanted a bit more.

Firstly, I want to sandbox my agents from each other and from my hard-drive, and partition (and encrypt) secrets, so I use (and wrote) byre[0], and run a devbox with long-running agents for certain tasks. TermRover[1] is a pretty good SSH client for tmux. For a more native integration I have started using Happier[2] which provides a web front-end and iOS app for my sessions too (unified with real Claude Code, so handover is seamless), and put together a byre skill[3] to make that easy.

[0]: https://github.com/pjlsergeant/byre-happier-claude

[1]: https://termrover.sh/

[2]: https://happier.dev/

[3]: https://github.com/pjlsergeant/byre-happier-claude

symlinkk • today at 3:38 PM

`claude agents` runs a daemon that survives SSH reconnects. You don’t really need tmux anymore

alex7o • today at 2:45 PM

Now we are in the state where we have a thousand multiplexers

teiferer • today at 10:16 AM

Isn't this the wrong architecture? Fundamentally, a coding agent should be running as a headless/detached process, a daemon. If it needs a CLI then that CLI can attach/connect to that daemon and interact with it. If you architect it that way then you can quit and resume the CLI anytime you want, from any machine you want and with whatever UI you want, the daemon doesn't care. Running the agent as an interactive CLI process which you need to stuff into something like tmux is just the wrong approach, and "connecting" to it by reading/scraping its screen is terrible.

➕ show 2 replies
tjoff • today at 10:42 AM

Sigh, painful AI slop that is wrong on so many things and just an ad for crystl.

fixkitai • today at 2:13 PM

[flagged]

arbor-group • today at 2:06 PM

[flagged]

Angelinafox_AI • today at 3:36 PM

[flagged]