Implementing an interactive session picker feature for the Claude Terminal Home Assistant add-on that allows users to choose how to launch Claude (new session, continue, resume, custom command, or shell access).
-
✅ Session Picker Script (
claude-session-picker.sh)- Interactive menu with 6 options (new, continue, resume, custom, shell, exit)
- Proper error handling and user input validation
- Clean UI with emojis and banner
- All menu options functional
-
✅ Configuration System (
config.yaml)- Added
auto_launch_claudeboolean option (defaults totrue) - Maintains backward compatibility
- Version bumped to
1.1.0-dev
- Added
-
✅ Startup Logic (
run.sh)- Conditional launch based on configuration
- Fallback mechanisms for missing components
- Simplified credential management (removed complex system)
- ✅ Static Analysis: All shell scripts pass syntax validation
- ✅ Container Build: Successfully builds with Podman
- ✅ Auto-launch Mode: Backward compatibility confirmed
- ✅ Session Picker: Interactive menu works correctly
- ✅ OAuth Authentication: Claude Code's native authentication flows work
- ✅ Simplified Architecture: Removed complex credential management system
- ✅ Clean Implementation: Let Claude Code handle authentication natively
- ✅ Proper Error Handling: Graceful fallbacks and user feedback
Problem: Claude Code's OAuth authentication doesn't persist across container restarts.
Evidence:
- First run: OAuth works perfectly
- Container restart: Authentication lost, requires re-authentication
Root Cause: Unknown - need to investigate where Claude Code actually stores OAuth tokens.
Objective: Determine where Claude Code stores OAuth tokens after successful authentication.
Investigation Commands:
# After successful OAuth, run inside container:
find /root -name "*claude*" -o -name "*anthropic*" 2>/dev/null
find /config -name "*" -type f 2>/dev/null
find /root -name "*.json" -o -name ".*" -type f | head -20
ls -la /root/.config/
ls -la /root/Expected Locations:
/root/.config/anthropic/(current assumption)/root/.claude*files- Browser-based storage locations
- Node.js application data directories
Options to Evaluate:
Option A: Enhanced Directory Mapping
- Map additional directories that Claude Code might use
- Investigate Node.js config directories, browser cache locations
Option B: Minimal Credential Monitoring
- Lightweight version of old system
- Only copy files that actually exist after OAuth
- No complex searching, just known locations
Option C: Volume Mount Strategy
- Mount entire
/rootdirectory (security implications) - Mount specific subdirectories based on investigation results
- Update
CLAUDE.mdwith new feature documentation - Test authentication persistence solution
- Create proper commit for the feature
- Prepare for merge to main branch
claude-terminal/config.yaml- Added configuration optionclaude-terminal/run.sh- Simplified and added session picker logicclaude-terminal/scripts/claude-session-picker.sh- New interactive menu- Removed:
credentials-manager.sh,credentials-service.sh,claude-auth.sh
- Simplified Credential Management: Removed complex background monitoring
- Native Authentication: Let Claude Code handle OAuth directly
- Backward Compatibility: Default auto-launch preserves existing behavior
- Clean Separation: Session picker as separate script for modularity
- ✅ Auto-launch mode (backward compatibility)
- ✅ Session picker functionality
- ✅ Container build and deployment
- ✅ OAuth authentication flow
- 🔄 Authentication persistence across restarts
- 🔄 All session picker options with real credentials
- 🔄 Configuration changes in real Home Assistant environment
- Authentication Loss: Primary blocker for release
- Local Testing Limitations:
bashio::configdoesn't work in local containers - Missing Real HA Testing: Need to test in actual Home Assistant environment
- Authentication persists across container restarts
- Both auto-launch and session picker modes work reliably
- Documentation updated
- Backward compatibility maintained
- Professional-grade user experience
# 1. Authenticate with Claude and immediately check storage
podman exec -it $(podman ps -q) bash
# (after OAuth success)
find /root -type f -newer /etc/passwd 2>/dev/null | grep -v /proc | grep -v /sys
ls -laR /root/.config/
# 2. Test different environment variables
ANTHROPIC_HOME=/config/claude-config run-addon
# 3. Check Claude Code documentation
claude --help | grep -i config
claude --help | grep -i authThe feature is 90% complete with excellent functionality, but authentication persistence is the critical blocker. The simplified architecture is much cleaner than the original complex credential management system. Once we solve the persistence issue, this will be ready for production deployment.