I have been using the atuin utility for a couple years at
this point. I love it. For those who haven’t yet had the pleasure, it’s a free,
open-source terminal command history fuzzy search, but that description by
itself doesn’t really do it justice. Besides simply fuzzy searching your command
history, you can scope the search to for example commands you’ve executed on
your current host vs some other host you use, since one additional feature that
it has is syncing across devices (should you so choose, completely free). It
keeps statistics on command usage, you can optionally also have it capture
command output which is then also searchable, and you can manage the backing
database. It even has a tmux mode you can enable that will pop up a floating
pane in tmux to show the history rather than the standard default listing in
your current terminal pane.
It’s actively maintained at https://github.com/atuinsh/atuin with 32K+ stars.
But the point of this brief post isn’t about all that. It’s about a recent addition to the tool, and of course it is related to AI.
My Biggest Coding Agent Gripe
I have not used all coding agents by any means. I love the terminal and the terminal coding agents I’ve used are Claude, OpenCode and Pi. Regardless of the tool and whether it’s a desktop app or a CLI, the issue is with the way sessions are managed. They’re tied to the directory where you started the session. If you try and resume a session that was created in a different directory you’re up that legendary creek without a paddle.
Sometimes it’s easy to know which directory you were working in, if the session was related to a coding project. But I also use coding agents to help with non-software projects, like helping me with my ssh config or my neovim config or working to resolve OS configuration issues. I could be in ~/.config or ~ or /etc or who knows where. And sometimes I’m in a different coding agent. I’ve stopped using OpenCode and my two main are Claude and Pi, though I’m using Pi more and more.
Enter atuin.
Searching Across Sessions
Just as atuin allows you to fuzzy search across your shell history potentially
across all your machines, atuin can now let you search and resume your coding
agent sessions! My biggest gripe solved!
This is done with the new atuin threads sub-command. If you don’t see that
sub-command, then update your atuin install. The available options to atuin threads are:
atuin threads
Search, read and resume your coding agents' captured threads
Usage: atuin threads <COMMAND>
list List captured threads, newest first
show Show a thread and its messages. Accepts an id, a harness id or latest
search Full-text search across captured threads, most relevant first.
tail Follow threads and messages as they are recorded (until interrupted)
import Import every thread the agents have on this machine, including those capture leaves alone: the ones nobody has gone on with since it was turned on
push Capture messages an agent hands over, one JSON object per line on stdin, as capture does its transcript's. Messages already captured are skipped
resume Pick a captured thread and resume it
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
The various atuin threads commands are pretty obvious, but really the killer
feature that impressed me and made me write this post is atuin threads resume.
Resuming Sessions
With the atuin threads resume command my biggest issue with the coding agent
sessions is solved. Not only will atuin show all my agent sessions across all
(supported) coding harnesses and across machines, but it will resume the session
in the correct coding harness or in another harness. That’s right - if you
started a session in, say, Claude Code and you want to continue working on it
but using pi, atuin threads resume will do that. You’re given three options
when you select a session to resume:
- resume in the original harness
- resume in the original harness but in a fork/branch (e.g.
/forkcommand) - resume in a new harness
I don’t know about you but I think that’s simply brilliant.
In addition, atuin threads resume will show a preview of the session as part
of the session finder UI. The left “pane” is the session list and as you
navigate the sessions, the right side will show a preview of the session
conversation.
Setup
If you never used atuin before, the initial atuin setup will already prompt
you regarding the threads feature. If you have been using atuin for a while
already, you can re-run atuin setup or edit the config directly. You can just
use your editor on the config file ~/.config/atuin/config.toml or use atuin
itself:
atuin config set threads.capture true
Final Thoughts
There’s a lot to like about atuin. It took something mundane like shell
history search and brought it to the 21st century. Goodbye history | grep and
then not finding something because your shell history only captures 1000 entries
or whatever you’ve configured. Goodbye knowing you ran a command but can’t
remember it and then realizing it was on your work machine not your home machine.
But at least you could do history | grep or ctrl-p or something to go back
through the history. There really isn’t any good option for finding your agent
sessions and certainly not across the different tools. Have you tried using
find and grep (or fd and rg if you want to be cool) to look through all
those jsonl files in all those different locations? Well - problem solved.
Thanks, atuin folks!