---
created: 2026-04-13T04:28:46.570Z
title: Capsule reattach existing psmux session
area: capsule
milestone: v1.9
files: []
---

## Problem

When `capsule.bat`/`capsule.exe` launches, it spawns a new detached psmux session. If a session with the same name/id/agent_id already exists (e.g., from a previous run that wasn't cleaned up, or a deliberate re-invocation), this creates a duplicate session instead of reconnecting to the existing one.

## Solution

Before spawning a new detached psmux session, check if one with the same name already exists. If it does, attach to it instead of creating a new one. This prevents duplicate sessions and allows seamless re-entry into an existing agent workspace.
