•
zmx is a zero-config cli tool that handles detach/attach of terminal processes and uses libghostty for terminal restoration.
•
With the recent release of v0.5.0 we've added some features to zmx that makes it easier than ever to send commands through zmx sessions. Want to have your local code agent execute commands on remote system? Want to run commands in a persistent session and monitor the results?
run cmd
•
At the core of this new release is the run command:
•
zmx run <session> <cmd...>
•
This will run the command inside the session and immediately tail the output until the command is complete. Then it will exit with the exit code of the command that was sent. The command sends bytes into the zmx session and adds a completion marker so we know when the command is done. Whatever you send through zmx run gets interpreted by your shell.
write cmd
•
We also provide the ability to write files through the session:
•
cat local_file.txt | zmx write <session> <file_path>
•
This will base64 encode, chunk, and pipe the content across the zmx session and on the receiving end use base64 to decode and store the file. All the receiving end needs is base64 and printf to work.
tail cmd
•
We now support connecting to zmx sessions with a read-only client:
•
zmx tail <session>
•
This let's you save the output of a session into a file:
•
zmx tail dev | tee dev_output.log
ai portal
•
These features are perfectly useful to humans, but they are also useful to code agents. All you need to use zmx with code agents is a single prompt:
•
DO NOT RUN TOOLS LOCALLY. Use zmx to run all commands: `zmx help` to learn more. Use session name: XXX
•
zmx a dev # let's SSH [dev] > ssh kings # let's run a container inside of an ssh session kings > podman run --rm -it alpine:latest sh / # echo "lets go!" / #
•
Then run your local code agent with a simple prompt:
•
claude --dangerously-set-permissions DO NOT RUN TOOLS LOCALLY. Use zmx to run all commands: `zmx help` to learn more. Use session name: dev Print some stats about the environment inside of the zmx dev session
•
The wonderful part about using zmx is it doesn't matter where the shell is running on the other end. It could be a local container, a remote SSH session, or even a production kubernetes pod. The agent stays local, with access to configured mcp, skills, tools, etc., and it sends commands through zmx to any shell: welcome to an ai portal.
•
The other awesome part about using zmx is you can attach to the session and audit the agent commands, you can even up-arrow and re-run them at will.
•
There are some minimal requirements:
•
You need the tool commands the agent normally uses (e.g. ls, grep, git)
•
You need base64 and printf for zmx write
•
The shell needs $? or $status so we can track when the command finishes
•
These are very common tools, but aren't always available. For example scratch containers aren't going to work.
prior art
•
Tmux also supports the ability to send commands through sessions, but it's tricky to get the output of those commands or know when the command has finished with an exit code. This makes it more tedious to send commands and tail the output, especially for code agents.
•
Claude code and codex both have SSH integrations to allow users to remotely run commands over ssh. This works but requires setup and is limited to just SSH session.
•
Most of the other similar tools are MCP servers which require configuration and is kind of a pain to get started.
fin
•
That's it. Let me know if you use it with code agents, I'm curious to see how people use these new features.
last updated: