Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Preserve user preferences (YouTube channels, etc.) across version upgrades

Open thebenjaminlee opened this issue 10 months ago • 3 comments

Problem

User preferences stored in release-specific directories are lost during PAI version upgrades. For example, youtube-channels.json in skills/PAIUpgrade/ ships empty with each release, requiring users to manually re-add their channel subscriptions.

Current behavior:

  • Preferences stored in: Releases/v2.3/.claude/skills/PAIUpgrade/youtube-channels.json
  • This file ships empty and gets overwritten on upgrade
  • User's actual channel history exists in ~/.claude/MEMORY/learnings/youtube-channel-learnings-*.md but isn't migrated

Proposed Solution

1. Move user preferences to persistent location

Store user-specific preferences outside the release directory:

~/.claude/MEMORY/preferences/
├── youtube-channels.json
├── custom-skills.json
└── user-settings.json

2. Add migration logic to install.ts

// During upgrade, extract channels from existing learning files
async function migrateYouTubeChannels() {
  const prefsPath = join(homedir(), '.claude/MEMORY/preferences/youtube-channels.json');
  
  // If preferences already exist, skip migration
  if (existsSync(prefsPath)) return;
  
  // Extract from learning files
  const learningFiles = await glob('~/.claude/MEMORY/learnings/youtube-channel-learnings-*.md');
  const channels = new Set<string>();
  
  for (const file of learningFiles) {
    const content = await Bun.file(file).text();
    const match = content.match(/Channels Analyzed:\s*(.+)/);
    if (match) {
      match[1].split(',').forEach(h => channels.add(h.trim()));
    }
  }
  
  // Write migrated preferences
  if (channels.size > 0) {
    await Bun.write(prefsPath, JSON.stringify({ 
      channels: Array.from(channels).map(handle => ({
        handle,
        migratedFrom: 'learnings',
        migratedDate: new Date().toISOString()
      }))
    }, null, 2));
  }
}

3. Update PAIUpgrade skill to read from persistent location

Modify the skill to check user preferences first, falling back to release defaults:

const userPrefs = join(homedir(), '.claude/MEMORY/preferences/youtube-channels.json');
const defaultPrefs = join(__dirname, 'youtube-channels.json');

const channels = existsSync(userPrefs) 
  ? JSON.parse(readFileSync(userPrefs, 'utf-8'))
  : JSON.parse(readFileSync(defaultPrefs, 'utf-8'));

Benefits

  • User preferences survive version upgrades
  • Automatic migration from existing learning files
  • Clear separation between release defaults and user customizations
  • Pattern can extend to other user preferences (custom prompts, tool configs, etc.)

Additional Context

Discovered this during v2.3 upgrade - had to manually recover YouTube channel subscriptions from learning files and re-add them to the new format.

thebenjaminlee avatar Jan 18 '26 12:01 thebenjaminlee

There's already logic here for what you're looking for: Releases/v2.3/.claude/skills/CORE/USER/SKILLCUSTOMIZATIONS/README.md

ecielam avatar Jan 18 '26 17:01 ecielam

Thanks for this feedback! We're currently working on PAI v3.0, which includes significant architectural changes. We're evaluating this issue in the context of the new architecture and will provide an update once v3.0 is closer to release.

Please stand by — we haven't forgotten about this and appreciate your contribution to making PAI better!

danielmiessler avatar Feb 10 '26 21:02 danielmiessler

Thanks for the feedback! In v3.0 (now released), user preferences live in USER/ subdirectories that are separate from system files, making upgrades much cleaner. The installer also handles migration better. Please upgrade to v3.0.

kaimagnus avatar Feb 15 '26 17:02 kaimagnus