Architecture

Session Management

How Pi Island manages multiple sessions
Properties2
Iconi-lucide-folder-tree
Order60

Pi Island provides multi-session support across all projects.

Session Discovery

Sessions are discovered from ~/.pi/agent/sessions/:

~/.pi/agent/sessions/
├── --Users-project-a/
│   └── 2026-01-15T10-30-00_uuid.jsonl
└── --Users-project-b/
    └── 2026-01-25T09-00-00_uuid.jsonl

Session Types

  • Historical: Read from JSONL files
  • Live: Active RPC connection

Resume Flow

  1. Display messages from JSONL immediately
  2. Start RPC connection in background
  3. Show green dot when connected

Session Deletion

Sessions can be deleted from the UI:

  1. UI: Trash icon appears on historical sessions in the list
  2. Action: Clicking trash calls SessionManager.deleteSession(_:)
  3. File deletion: JSONL file is permanently removed from disk
  4. Memory cleanup: Session removed from sessions dictionary and sessionFileIndex
  5. Selection update: If deleted session was selected, selection moves to first live session

Note: Live sessions cannot be deleted directly. Stop the session first, then delete the historical record.

Activity Detection

Pi Island detects session activity without polling:

StateDetectionColor
IdleNo recent activityGray
ThinkingLast message from user + recent file changeBlue
Executing2+ file changes in 5 secondsCyan
Externally ActiveFile modified within 10 secondsYellow
ErrorRPC connection errorRed