r/opencode • u/s12eb • 18d ago
OpenCode Nap (plugin that returns RAM from TUI for free)
I built a plugin that's basically free RAM (if you often run many OpenCode clients simultaneously).
The plugin (https://github.com/shanebishop1/opencode-nap) works by automatically transferring your headed OpenCode TUI sessions into headless sessions when you aren't directly interacting with them, and then swapping them back when you want to use them again.
Sessions keep running normally on the server when napping, while the memory used by the client TUI gets released. Idle windows get swapped out for a tiny shell, and when you come back, it reopens the same session. There are similar, more general projects out there, but this one works natively within OpenCode and is dead simple to install/enable.
10 OpenCode sessions went from 894MB to 3MB on my machine. It works instantly on Linux/Mac, whether your sessions live in tmux, herdr, or directly in a terminal. By default, the plugin naps sessions after not seeing user input for 15 mins, but you can also configure it to nap whenever focus leaves the window.
Hopefully this helps give your machine a bit of a breather!




