DEV Community

Cover image for I built a small macOS terminal that lets you take back a prompt you sent to Claude Code
Soohwan Kim
Soohwan Kim

Posted on Edited on

I built a small macOS terminal that lets you take back a prompt you sent to Claude Code

lmux is a small macOS terminal I use to run a bunch of Claude Code and Codex sessions at once. The feature I reach for most is taking back a prompt I sent to the wrong session.

The layout is borrowed from cmux: workspaces in a sidebar, splits, tabs in each pane. A few people on Reddit called it a cmux clone. Fair at first glance, but it's written from scratch with no cmux code. Here's what's different.

lmux with several Claude Code and Codex sessions

Taking back a prompt

When you run several Claude Code sessions side by side, sooner or later you type a prompt into the wrong one.

In lmux you hover over the prompt you sent and click ×. Claude Code rewinds to just before that prompt and keeps running, no restart. lmux is just driving Claude Code's own rewind, so you don't have to hunt for the message in the Esc Esc menu. If you click ✎ instead, it rewinds the same way and puts the prompt back in the input so you can fix it and send it again.

The first version left your files alone, and someone on Reddit asked the obvious question: what about the files Claude already changed? As of 0.2.0, if Claude edited files after that prompt, × also offers Remove and Restore Files. It uses Claude Code's own "restore code and conversation", so files Claude edited with its own tools go back. Changes made by shell commands stay. Any later edits to those files get overwritten too, so it asks first. Plain Remove is still the default and never touches your files.

0.2.0 also adds Fork Session: right-click a tab and you get a new tab with a copy of the conversation (claude --resume <id> --fork-session), in the same folder with the same flags. The original keeps running.

Staying light

I built lmux for myself because cmux was more app than I needed. lmux is a native Swift/AppKit app on libghostty, and it's 25 MB. With 20 workspaces open it idles at about 0.1% CPU on my M4 Pro. cmux 0.65.2 sat around 8% in the same setup. The method is in scripts/BENCH.md if you want to check it on your machine. CI also fails any change that pushes idle CPU over budget.

It makes no network calls.

The rest

  • A status ring and badge on each workspace show whether an agent is running, needs you, is done, or failed. This comes from Claude Code's hooks and from Codex. ⇧⌘J jumps to the one that's waiting.
  • Any other program can report status too, by printing an OSC 7501 escape sequence. See docs/agents.md.
  • Sessions come back after you quit, update, or reboot.
  • It reads your Ghostty config.
  • It never wraps claude or codex. To get status it adds a few hooks to settings.json, and it shows you the diff before it writes anything.
  • If you're coming from cmux, there's a one-click import.
  • Korean input actually works, no dropped or mangled syllables. Chinese and Japanese IMEs got the same fixes.

What I left out on purpose

No built-in browser and no SSH workspaces. Both are useful, but they're the kind of thing that made cmux feel heavy to me. I'd rather keep lmux a terminal.

Limits

It's macOS 14+ on Apple silicon only. Rewind, restore and fork only work with Claude Code for now.

Try it

It's free and MIT licensed. Grab the dmg from GitHub Releases, or:

brew install --cask sooftware/tap/lmux
Enter fullscreen mode Exit fullscreen mode

I'm Soohwan, an ML engineer in Seoul. If you run a bunch of agent sessions at once, I'd really like to hear what breaks and what's missing. Issues and comments both welcome.

Top comments (0)