What happens to an agent when I close the terminal tab?

The agent process receives a hangup and stops mid-task. Files it already wrote stay written, and the turn it was in the middle of is lost, but the transcript is on disk, so the conversation is recoverable even though the process is not. Closing a tab is not a pause.

To survive tab closes deliberately, either start the agent detached (claude --bg, managed with claude agents) or run it inside a multiplexer session you can reattach to. See tmux for AI agents. In crystl, a closed shard lands on a per-gem undo-close list and comes back with its name, isolation, and agent session intact: see resurrecting shards.