Skip to content

How to keep coding agents running when the window closes

Keeping agents running when the window closes means their work doesn’t depend on the window you watch it in. In a terminal, it depends on the agent: a Claude Code session ends with its terminal unless you send it to the background, where Claude Code’s background sessions, listed in its agent view, run with no terminal open; Codex usually runs its chats through a background server it starts itself; and any agent keeps running under a tool such as tmux. Moontors, an agentic development environment (ADE), runs every session, whichever agent it runs, in one background service, so closing the window doesn’t stop the agents.

Start your sessions, then close the window. The sessions keep working in the background service, on every system. Whether Moontors’ notifications still arrive with the window closed depends on your system; see Notifications.

Open Moontors again and every session is there, with everything it did while you were away.

The background service exits once no window is open, no phone is connected, no terminal is running, and nothing is under way: no session running or waiting for you, and no background task, side question, sign-in, agent install or change Moontors is making to a session, such as an archive. A session that’s Scheduled, as Claude Code’s /loop leaves one, keeps it running too, so its loop goes on firing with the window closed until the job ends or you archive the session, and so does a time tracker timer that’s running. Signed in to a Moontors account whose plan reaches this computer from anywhere, with a phone paired, it stays running for your phones until you sign out or unpair the last of them (see Reaching your computer from anywhere). The sessions themselves stay: the next prompt starts the agent again in the same conversation. Nothing starts the service again until you open Moontors, not even at login; a paired phone then connects again by itself.

  • Sleep: Moontors doesn’t keep your computer awake. While it sleeps, the agents can’t work, and a turn under way can fail when its connection drops. If agents should work while you’re away, keep the computer awake with your system’s own power settings.
  • Restarting or logging out: the background service stops with your session on the computer. A turn that was running shows as Stopped, and the next prompt carries the conversation on. A Claude Code session that was Scheduled starts again by itself once you open Moontors, and Claude Code sets its jobs again, so they fire on; the runs missed while it was stopped aren’t made up.
  • An update: where Moontors installs its own updates, Restart to update waits until running work ends, so it never cuts a turn off. Terminals still running end with the restart, and Moontors says how many before it restarts. It doesn’t wait for a scheduled job: a Claude Code session that was Scheduled starts again after the update and fires on. See Updates.

Moontors sends a desktop notification when a session needs you, as Notifications describes. While a session waits, its agent waits too, so answer it to keep the work going.

Away from your computer, the phone shows the board and each session, and answers what a session asks, on the same local network as your computer, through Tailscale, or, with a plan that includes it, through Moontors’ relay.

Do the agents keep running when I quit Moontors?

Section titled “Do the agents keep running when I quit Moontors?”

Yes. A background service runs the sessions, so quitting the app or closing its window doesn’t stop them.

Do they keep running while my computer sleeps?

Section titled “Do they keep running while my computer sleeps?”

No. Moontors doesn’t keep your computer awake, so if agents should work while you’re away, keep it awake with your system’s own power settings.

Will I hear when a session needs me with the window closed?

Section titled “Will I hear when a session needs me with the window closed?”

On macOS, yes; on Windows and Linux, not until you open Moontors again, as Notifications says. The sessions keep working either way.