# Tool Instances with Sessions ## Problem Users currently have no way to launch development tools (code-server, Jupyter, etc.) directly from their repositories. The tool-types system exists but cannot create running container instances. Additionally, there's no concept of a "session" - a running tool linked to a specific repo that appears in navigation for quick access. ## Solution Implement a complete tool instance management system with sessions: 1. **ToolInstance Model** - Links a ToolType to a GitRepository with status tracking 2. **Session Concept** - A running ToolInstance that gets a top-level navigation entry 3. **Docker Integration** - Render compose templates and execute docker compose commands 4. **Lifecycle Management** - Start, stop, restart, and delete instances 5. **Navigation Integration** - Active sessions appear in the app shell for quick access ## Key Features ### Tool Instance Creation - Select a tool type and repository - Generate unique instance name - Render Docker Compose template with variables - Execute `docker compose up -d` - Store container metadata ### Session Management - Sessions are active/running instances - Each session gets a top-level nav entry with the tool icon - Session dropdown in app shell shows active sessions - Clicking a session opens the tool in a new tab/window ### Lifecycle Operations - Start: `docker compose start` - Stop: `docker compose stop` - Restart: `docker compose restart` - Delete: `docker compose down -v` + remove DB record ### Status Monitoring - pending, building, running, stopped, error - Real-time status via Docker API - Last accessed timestamp ## Success Criteria - [ ] Create tool instances from repository page - [ ] Sessions appear in top-level navigation - [ ] Start/stop/restart/delete instances - [ ] Status monitoring works - [ ] Docker Compose templates render correctly - [ ] Navigation updates when sessions change