I Built My Own Editor. Yes, Really. A developer built emx, a from-scratch Emacs-keybinding terminal text editor written in Rust, to handle coding agents such as Claude Code rewriting files while they are open in the editor. The author argues that concurrent agent writes — silent overwrites, blocking "file changed on disk" prompts, lost unsaved edits, and half-written files reloaded as garbage — are now the normal case rather than an edge case, and that GUI editors like Zed do not fit SSH and terminal-multiplexer workflows. The editor is published on GitHub under the emergingrobotics organization. I wrote a text editor last week. An Emacs-keybinding terminal editor, from scratch, in Rust. If you’d told me a year ago I’d say that sentence out loud I’d have laughed at you. Writing your own editor is the classic yak-shave, the thing smart engineers do instead of shipping. And yet… here we are. It’s called emx https://github.com/emergingrobotics/emx , and I’m using it right now to write this post. Me, my editor, and the agents that keep rewriting files out from under it. Let me explain why, because the “why” is the actually interesting part. The Problem Nobody Designed For I’ve been an Emacs user for a very long time. I said back in my naysayers post https://blog.herlein.com/post/agent-naysayers/ that I still use emacs for a lot of editing, and that some things never completely change. That’s still true. What changed is everything around the editor . Here’s my day now. I’ve got a coding agent usually Claude Code running in one terminal, and I’ve got files open in another. The agent rewrites six files in a burst. Three of them are open in my editor. And then one of a few things happens, none of them good: - The change lands silently and I don’t notice until I save over it. - The editor throws up a blocking “file changed on disk” prompt , and I have no idea what changed. Accept? Reject? Dunno. - I had unsaved edits in that buffer, the agent had new content on disk, and one of us loses . Usually it’s whoever I wasn’t paying attention to. - The agent wrote the file in place no temp-file-and-rename , the editor caught it half-written, and reloaded garbage . Every editor I’ve used treats “someone else is writing to this file” as an edge case. A weird thing that happens sometimes, when you git checkout a branch. It is not an edge case anymore. It is the case. It’s the whole job now. And there’s the reverse direction too. The agent has no clean way to say “hey human, look at src/main.rs line 42.” It just… prints it in its chat window and hopes I go find it. And Then There’s Emacs Itself Don’t get me wrong, I love Emacs. But emacs-nox in a terminal has some warts that have bugged me for years: - Startup with a real config is slow. emacs --daemon fixes that by keeping a whole Emacs resident, which is heavy on a Raspberry Pi or a small cloud box. - Big files bog it down. Open a 2 GB log and go get coffee. The vlf package exists, and it’s awkward. - auto-revert-mode is opt-in, and when it does catch a conflict it’s — you guessed it — a blocking prompt. - It’s not on half the boxes I SSH into, and installing it drags in a lot. - I pay for Elisp startup time, memory on every box, and on most of them I use exactly none of it. What About Zed? I know, I know. Somebody’s already typing “just use Zed.” I like Zed https://zed.dev/ . I really do. It’s fast, it’s clean, and it was one of the first editors to take agents seriously. And Gram, the open source fork, I like even more. But Zed is a GUI tool. That’s fine when I’m sitting at my workstation. It is not fine when I’m SSH’d into another host, which is a lot of my day. And it’s really not fine inside a herdr https://github.com/herdrdev/herdr session, where everything I do lives in the terminal and survives me disconnecting. A GUI editor just doesn’t fit there. And here’s the thing about the way Zed integrated agents: it already feels antique. The model was “the agent lives inside the editor, in a panel, and you chat with it.” That made sense eighteen months ago. Now the agent is its own thing, running in its own terminal or eight of them , rewriting files on its own schedule. The editor isn’t the agent’s house anymore. It’s a neighbor . What I need from an editor now isn’t a chat panel. It’s an editor that behaves well when the neighbors are busy. That’s a weird thing to say about a tool that’s barely a few years old. But that’s how fast this is moving. So I had two problems. Editing next to agents, and editing in a terminal on remote and constrained boxes. Turns out they want the same editor. And nothing I could find was that editor. So What Is emx? Here’s the one-liner from the vision doc I wrote before a single line of code: A fast terminal editor with Emacs keybindings, built for humans working alongside coding agents: it watches files that agents, build tools, and git rewrite, shows what changed, never loses either side’s work, and can itself be driven over a socket. The goals are ranked , and when two conflict, the higher one wins. This turned out to be the single most useful thing in the whole design: 1. Never lose work. Not mine, not the agent’s. Ever. 2. Always responsive. No input lag at any file size. 3. Emacs-native feel. My fingers shouldn’t have to relearn anything. 4. Live disk sync. Buffers track the disk automatically. 5. Drivable from outside. Agents and scripts can talk to it. 6. Zero-config, one static binary. scp it anywhere. Notice what’s 1. Not “Emacs compatibility.” Not speed. Never lose work. Once upon a time I had a rule that no file was safe unless it was on three spindles. Does anyone coding today even remember what a spindle was? What It Actually Does With Agents When an agent rewrites files I have open, emx waits for the writes to settle same size and mtime across two checks before reloading, so it never reads a half-written file. Unmodified buffers just update, cursor and scroll preserved. The modeline and file panel mark what changed. Then: emx diff-external src/main.rs what did the agent just do to this file? And C-/ undoes the reload. Just like any other edit. If I undo the agent’s change and then try to save, emx warns me I’m about to clobber newer content on disk. No silent stomping in either direction. If I have unsaved edits and the agent writes the same file, I get a non-blocking indicator and three choices: diff, reload discard mine , or keep mine. No modal prompt freezing my screen. The other half is the socket API. Instead of Lisp, emx’s extensibility story is a little CLI that talks JSON to the running session: emx open src/main.rs:42 show this file in my most recent emx terminal emx reload reread unmodified buffers from disk emx events stream buffer, file and cursor events as JSON lines git diff FILE | emx apply-patch FILE apply a diff to the OPEN buffer, undoably That last one is my favorite. An agent can push a patch into the buffer I have open, on top of my unsaved edits , as one change that a single C-/ undoes. If any hunk doesn’t apply, nothing changes. And it never saves on the agent’s behalf. I’m still the one who decides. Think about that for a minute. The agent can now point at things in my editor, and I can take back anything it does with one keystroke. That’s a fundamentally different working relationship than “the agent dumps files on disk and I find out later.” emx with the file panel open. The marks files an agent changed since I last looked. The Emacs Stuff Works, Too Sessions persist. The first emx starts a small session server; every later emx attaches and shares the same buffers. Drop SSH, reattach, and your unsaved edits are still there. Kill the daemon mid-edit and it replays a per-buffer journal on restart. Nothing lost. Goal 1, again. Big files are normal. The buffer is a piece tree over a pread block cache the same basic design VS Code moved to in 2018 , so a multi-GB log opens instantly and memory scales with your edits, not the file size. It even follows a growing log like tail -f . And I have the stuff I actually use in Emacs every day: kill ring, mark ring, incremental search, query-replace, rectangles, keyboard macros, split windows, a file panel with git status, tree-sitter highlighting for Rust, C, Go, Python, JS, Bash, JSON, TOML and YAML. Kills go to the system clipboard over OSC 52, which works through SSH and tmux. One static binary for x86 64 and aarch64, and brew install or a .deb if you want it. What It Deliberately Does Not Do This is the part I’m proudest of, honestly. The Non-Goals list is long : - No Lisp. No package ecosystem. TOML config plus the socket API, period. - No Org-mode, no Magit, no Gnus. - No LSP, no completion popups, no go-to-definition. It’s an editor, not an IDE. - No M-x compile , no shell, no TRAMP. - No C-h help system. Every Emacs reimplementation I know of zee , remacs , emacs-ng either stalled or was abandoned, and the reason is always the same: scope . Emacs is not an editor, it’s an operating system that happens to have an editor in it. Try to clone that and you die. I don’t need Emacs. I need the 5% of Emacs my fingers use all day, plus the agent-awareness Emacs never had. That’s a much smaller target. Small enough to actually hit. How Do You Know It Feels Like Emacs? This is where I’d normally wave my hands. “It feels right to me ” Baloney. That’s not engineering. So emx has a differential test harness . For each command, the same keystroke sequence runs through real emacs --batch -Q via execute-kbd-macro and through emx, and the harness compares buffer contents, point, mark and kill ring. There’s a tiered list of commands, and the pass rate is a number CI enforces. “Emacs-native feel” stopped being an opinion and became a measurement. Tests are the real spec https://blog.herlein.com/post/coding-is-solved/ . I keep saying it because it keeps being true. Why Would Anyone Build This? OK. Here’s the real answer. Two years ago, building your own editor was a bad idea. Full stop. It was months of work, and you’d end up with something worse than what you already had. Rational people used the tool and lived with its warts. That calculus is dead. I wrote about the emacsification of software https://blog.herlein.com/post/software-manager-ai/ a while back: with agentic tools, you can just build exactly the thing you need . Not a framework with seventeen config knobs. The actual thing, specified the way you want it. emx is that idea taken literally. Literally Emacs-ified, ha. Here’s what it took. The first commit was November 13th. I wrote a vision doc and a design doc first . The ranked goals, the non-goals, the decisions, the risks. Then I let agents build it against that spec and the differential tests. 77 commits later, it’s around 70,000 lines of Rust and on its sixth release. The bulk of it landed in three days. Seriously. Three days. And yes, the irony is not lost on me: I built an editor for working next to agents… by working next to agents… in an editor that kept losing track of what they were doing. That pain is exactly how I knew what to build. You can’t learn to swim from a book, and you can’t design tools for agentic work without doing a ton of agentic work. This is also software for one https://blog.herlein.com/post/senior-engineers-coding-again/ , mostly. I built it for me. It’s open source MIT/Apache because why not, but if nobody else ever uses it, it has already paid for itself in edits I didn’t lose. Wait… Rust? Not Go? Yeah. I can hear the folks who’ve read why I like Go for robotics https://blog.herlein.com/post/why-go-for-robotics/ clearing their throats. Honest answer, part one: I wanted to see if I could. I’ve watched Rust from the sidelines for years. Never shipped anything real in it. A project with a clear spec and solid tests is the perfect excuse to find out, because the tests tell you whether it works no matter how fluent you are in the language. Part two: I’ve been impressed with Rust’s speed and memory efficiency for a long time. An editor that opens multi-GB files instantly and has to stay small on a Raspberry Pi is exactly the place where that pays off. Part three is the one that actually sealed it. Remember Goal 1? Never lose work. In an editor, a crash is not an inconvenience. A crash is lost data. Rust’s whole pitch is that an entire class of the bugs that crash programs simply won’t compile. For this program, that matters more than anything else. So I tried Rust. And now… I might just be in technology love. Does that mean I’ve given up on Go? Nope. BOTH can be true. Go is still my default for services and robots. But for a long-running, never-lose-anything, every-byte-counts program like an editor, Rust earned its spot. Strong opinions, loosely held. What Can Go Wrong Let me be honest about the limits. - Scope is still the risk. The vision doc literally lists “ zee and similar projects stalled on scope” as risk 1. The ranked goals and the non-goals list are my defense. We’ll see if I have the discipline to keep saying no. - It’s Linux-first. macOS builds and mostly works. It’s less tested. Windows isn’t happening. - Terminal weirdness is real. It works in Kitty-protocol terminals and in legacy ones xterm, GNOME Terminal, tmux, screen, the Linux console , but some Ctrl combos just don’t reach any program in some terminals. That’s not emx’s fault, but it’s still emx’s problem. - It’s young. Six days old as I write this. There will be bugs. The journal and the undoable reloads mean they shouldn’t cost you work, but… it’s six days old. Conclusion The point of this post isn’t really “go use my editor,” although you’re welcome to: github.com/emergingrobotics/emx https://github.com/emergingrobotics/emx . The point is that the ground has moved. The tools we all use were designed for one human editing files alone, and that’s not how a lot of us work anymore. The files are shared now, between us and our agents, and our tools mostly pretend that isn’t happening. And the cost of fixing that for yourself has collapsed. A week ago “build your own editor” was a joke. Now it’s a weekend-ish project with a spec, a test harness, and a few agents. If something in your toolchain has been bugging you for ten years… maybe it’s time to stop living with it. If you try emx, or if you’ve built your own “should never have been possible” tool lately, drop me a note on LinkedIn https://www.linkedin.com/in/gherlein/ . I’d love to hear about it.