Skip to content

Latest commit

 

History

History
151 lines (116 loc) · 5.79 KB

File metadata and controls

151 lines (116 loc) · 5.79 KB

Claude Terminal Add-on: Interactive Session Picker - Development Status

Project Overview

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).

Current Status: 🟡 90% Complete - Authentication Persistence Issue

Completed Tasks

Core Implementation

  • 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_claude boolean option (defaults to true)
    • Maintains backward compatibility
    • Version bumped to 1.1.0-dev
  • Startup Logic (run.sh)

    • Conditional launch based on configuration
    • Fallback mechanisms for missing components
    • Simplified credential management (removed complex system)

Testing & Validation

  • 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

Code Quality

  • Simplified Architecture: Removed complex credential management system
  • Clean Implementation: Let Claude Code handle authentication natively
  • Proper Error Handling: Graceful fallbacks and user feedback

🔴 Critical Issue: Authentication Persistence

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.

🎯 Next Steps (Priority Order)

1. CRITICAL: Investigate Claude Code Credential Storage (High Priority)

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

2. Implement Proper Persistence Solution (High Priority)

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 /root directory (security implications)
  • Mount specific subdirectories based on investigation results

3. Documentation & Release (Medium Priority)

  • Update CLAUDE.md with new feature documentation
  • Test authentication persistence solution
  • Create proper commit for the feature
  • Prepare for merge to main branch

🏗 Implementation Details

Files Modified

  • claude-terminal/config.yaml - Added configuration option
  • claude-terminal/run.sh - Simplified and added session picker logic
  • claude-terminal/scripts/claude-session-picker.sh - New interactive menu
  • Removed: credentials-manager.sh, credentials-service.sh, claude-auth.sh

Architecture Decisions

  • 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

🧪 Testing Strategy

Manual Testing Completed

  1. ✅ Auto-launch mode (backward compatibility)
  2. ✅ Session picker functionality
  3. ✅ Container build and deployment
  4. ✅ OAuth authentication flow

Testing Needed

  1. 🔄 Authentication persistence across restarts
  2. 🔄 All session picker options with real credentials
  3. 🔄 Configuration changes in real Home Assistant environment

🚧 Known Issues

  1. Authentication Loss: Primary blocker for release
  2. Local Testing Limitations: bashio::config doesn't work in local containers
  3. Missing Real HA Testing: Need to test in actual Home Assistant environment

🎯 Success Criteria for Release

  • Authentication persists across container restarts
  • Both auto-launch and session picker modes work reliably
  • Documentation updated
  • Backward compatibility maintained
  • Professional-grade user experience

🔍 Investigation Commands for Tomorrow

# 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 auth

Summary

The 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.