kaeru 0.1.5

Reopens your terminal tabs, and the coding agent sessions in them, after the terminal closes or the computer restarts.
kaeru-0.1.5 is not a library.

kaeru 🐸

                   _..---.._                                        _..---.._
                .-'         '-.                                  .-'         '-.
              .'    .-"""-.    '.                              .'    .-"""-.    '.
             /     /       \     \                            /     /       \     \
            |     |   (O)   |     |                          |     |   (O)   |     |
             \     \       /     /                            \     \       /     /
          /   '.    '-...-'    .'                              '.    '-...-'    .'   \
         /      '-._       _.-'----------------------------------'-._       _.-'      \
        |                                                                              |
        |                                    .    .                                    |
        |      \                                                                /      |
        |       '.                                                            .'       |
         \        '-._                                                    _.-'        /
          \           '''---...__________________________________...---'''           /
           '.                                                                      .'
             '-._                                                              _.-'
                 '''---...____________________________________________...---'''
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

kaeru reopens your terminal tabs after the terminal closes or the computer restarts. Each tab comes back in the folder it was in, and a tab that was running a coding agent, such as Claude Code or Codex, comes back with the same conversation.

The name is Japanese. kaeru can be written 帰る, "to go home", 返る, "to return to how it was", or 蛙, "frog". In Japan, a frog charm is a wish for a safe return.

Status: kaeru is in early development. It works on Windows: in Windows Terminal with PowerShell or Git Bash, in Git Bash's own windows, and in Warp. On macOS, it works in Terminal, iTerm2, Ghostty and Warp, with zsh. The roadmap shows what comes next.

How it works

When you open your terminal again, the first new tab lists the tabs that were open:

 🐸 kaeru: 4 tabs were open when your terminal closed

  Agent sessions (2)
   [x] api-server   Claude Code   40 minutes ago   ~\code\api-server   Windows Terminal
   [x] mobile-app   Codex         2 hours ago      ~\code\mobile-app   Windows Terminal
  Shells (2)
   [x] web-ui       PowerShell                     ~\code\web-ui       Windows Terminal
   [ ] ~            PowerShell                     ~                   Windows Terminal

 > Done: reopen 3, forget 1

  <space> check   <a> check all   <d> done   <esc> later   <o> options

Every tab starts checked, and the cursor, marked with >, starts on Done, so pressing Enter brings them all back. Each checked tab opens again in its folder, in the terminal it came from, and agent sessions are resumed with the agent's own command, such as claude --resume <id> or codex resume <id>. To leave a tab out, move up to it and press Space or Enter to uncheck it. Done says how many tabs it will reopen and forget, and you choose it with Enter on its line or with d from anywhere. a checks or clears every tab at once. Press Esc to decide later, or o for the options. Run kaeru to see the list again at any time.

The tabs come back one at a time, about a second apart, so that a slower computer doesn't have to start every shell and agent at once. They come back in the order they were first opened. A tab you moved by dragging it comes back where it was first opened, not where you moved it, because Windows Terminal doesn't tell other programs where its tabs are. When the list showed up by itself in a new tab, that tab closes once the others are back, so that you end up with the tabs you had.

A tab you closed yourself is not offered again. kaeru only brings back tabs that went away together with their whole terminal, for example when the terminal crashed or the computer restarted.

Git Bash's own windows (mintty) have no tabs: each window is a terminal of its own. So by default, kaeru brings them back after a restart or sign-out, and forgets a window that you closed. The options can make it offer closed windows too. Each one comes back as a window in its folder, and the list shows in the first new Git Bash window.

Warp brings back its own tabs and their folders, but not the agent sessions in them. So kaeru doesn't list Warp's tabs. Instead, a tab that Warp brought back says that it had a session:

kaeru: this tab had a Claude Code session. To resume it here, run kaeru resume.

Run kaeru resume in that tab to continue the session there. kaeru doesn't ask "resume it?" when the tab opens, because Warp is still setting the tab up then, and could answer the question by accident.

On macOS, Terminal and iTerm2 bring back their own tabs only sometimes, such as after a crash or a restart that reopens windows. Their tabs that come back say the same, and kaeru reopens the others. Ghostty brings back its own tabs too, but without saying which they are, so kaeru doctor asks you to set window-save-state = never in Ghostty's config, which leaves that to kaeru.

When Warp crashes on Windows, the programs in its tabs keep running without a window. Then the tab says that its session still runs without a window, and kaeru resume ends that hidden session first and resumes it in the tab.

The details are in docs/architecture.md.

Install

kaeru works on Windows, in Windows Terminal with PowerShell or Git Bash, in Git Bash's own windows and in Warp, and on macOS, in Terminal, iTerm2, Ghostty and Warp with zsh.

  1. Install kaeru. On macOS, run:

    curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gloomydumber/kaeru/releases/latest/download/kaeru-installer.sh | sh
    

    It downloads kaeru from the latest release and puts it in ~/.cargo/bin, which it adds to your PATH. On Windows, run this in PowerShell:

    powershell -ExecutionPolicy Bypass -c "irm https://github.com/gloomydumber/kaeru/releases/latest/download/kaeru-installer.ps1 | iex"
    

    It downloads kaeru.exe from the latest release, puts it in .cargo\bin in your home folder, and adds that folder to your PATH. You don't need Rust for this.

    Other ways:

    • With Scoop: scoop bucket add gloomydumber https://github.com/gloomydumber/scoop-bucket, then scoop install gloomydumber/kaeru.
    • With Rust: cargo install kaeru --locked builds it.
    • Download the archive for your system from the release page, and put kaeru or kaeru.exe in any folder on your PATH.
  2. Run kaeru install. To learn about your tabs, kaeru needs two things, and it asks before it adds each one:

    • a line in your PowerShell profile, and in Git Bash's ~/.bashrc when you have Git Bash, which tells kaeru about each new tab and keeps track of its folder (on macOS and Linux, the line goes in ~/.zshrc; on Linux, kaeru doesn't know the terminals yet, as the roadmap shows);
    • a SessionStart hook for each agent you use, Claude Code and Codex, which tells kaeru which conversation runs in which tab. It keeps a copy of each agent's file as it was.

    If you use Codex, it also asks whether the tabs it tracks should start Codex with --no-daemon. Otherwise Codex runs its sessions in a shared background server, which hides which tab a session runs in, so kaeru has to work that out from when and where the session started. Codex's remote control needs that server, so the sessions started this way can't use it.

  3. If you use Codex, start it. It asks about the new kaeru hook: trust it, because Codex runs a new hook only after you trust it. Codex's /hooks lists it too. Codex runs the hook at a session's first message, so kaeru learns about a Codex session once you sent one; until then, its tab comes back as a plain shell. Claude Code runs its hook as soon as it starts.

  4. Open a new tab and run kaeru doctor. It checks the setup and says what to fix.

Commands

Command What it does
kaeru Shows the tabs that are waiting to come back, and reopens the ones you pick.
kaeru list Prints the tabs that kaeru tracks, one line each: the open ones, and the ones waiting to come back.
kaeru install Sets kaeru up, as Install describes.
kaeru doctor Checks the setup, and says what to fix.
kaeru options Shows the options, and lets you change them. o in the list shows them too.
kaeru resume Resumes the agent session that ran in this tab, in a terminal that brought the tab back by itself, such as Warp.
kaeru uninstall Takes out everything that kaeru install added, asking before each change. It can also delete kaeru's notes and options.

kaeru --help lists them too. The line in your profile and the agents' hooks run three more commands for you, so you never need to type them: kaeru init, kaeru shell start and kaeru hook.

Options

Run kaeru options to see and change them, or press o in the list. In Git Bash's own window, run winpty kaeru options, because the list needs a Windows console there. They are kept in %APPDATA%\kaeru\config.toml on Windows, and in ~/Library/Application Support/kaeru/config.toml on macOS.

Option In config.toml Default What it does
Offer tabs that ran an agent session offer-agents on Lists tabs where an agent session, such as Claude Code, ran.
Offer tabs that ran only a shell offer-shells on Lists plain shell tabs too.
Show this list in the first new tab ask-on-start on Opens the list by itself after the terminal closed. When it's off, a new tab only says how many tabs wait, and you run kaeru to see them.
Offer a closed window of a single-window terminal single-window-close "forget" What closing a Git Bash window (mintty) means. "forget": you closed it on purpose, like a tab, so it comes back only after a restart or sign-out. "offer": it is offered the next time, like a terminal that closed.
Start Codex with --no-daemon codex-no-daemon set by kaeru install Runs Codex sessions in their tab, so that kaeru knows exactly where each one is.

Roadmap

kaeru is built in milestones. Each milestone is finished and tested before the next one starts.

Milestone Scope Status
M0 Foundation: project layout, docs and CI done
M1 Windows Terminal and PowerShell, Claude Code and Codex, the picker done
M2 Git Bash (mintty) and bash done
M3 Warp: resume agent sessions in the tabs that Warp brings back done
M4 macOS: Terminal, iTerm2 and Ghostty, with zsh in progress: built, tests with real agents are next
M5 Linux: GNOME Terminal, kitty, WezTerm and Ghostty, with bash, zsh and fish planned

Later: the classic Windows console, more agents (such as Gemini CLI), re-running the command a tab was running, split panes, and more package managers (winget, which is in review, and Homebrew).

Contributing

Please read CONVENTIONS.md first. AGENTS.md lists the build and test commands. It is written for coding agents, but it works just as well for people.

License

kaeru is released under the MIT license.

kaeru is an independent project. It is not affiliated with or endorsed by Anthropic, OpenAI, Microsoft, or the makers of any terminal it supports.