Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Bug: install.ts --update overwrites custom CORE skill despite claiming to preserve config

Open eccentricnode opened this issue 3 weeks ago • 2 comments

Summary

The install.ts --update mode claims to preserve existing configuration and "only update infrastructure files," but it overwrites the custom skills/CORE/SKILL.md file with a basic template, losing all user customizations.

Version

  • PAI Bundle: v2.1.0
  • File: Bundles/Official/install.ts
  • Tested: 2026-01-15

Expected Behavior

According to the installer output when run with --update:

📦 Update mode: Preserving existing configuration.

   ✓ Skipping backup (your files stay in place)
   ✓ Will use existing .env values as defaults
   ✓ Only updating infrastructure files

The user's custom CORE skill (containing identity, goals, projects, personality calibration, etc.) should be preserved.

Actual Behavior

The installer overwrites ~/.claude/skills/CORE/SKILL.md with a minimal template:

  • Before: 287 lines, 8920 bytes of custom configuration
  • After: 70 lines, 1604 bytes generic template

All custom content lost:

  • Detailed identity and goals
  • Current projects and priorities
  • Personality calibration settings
  • Custom contacts and infrastructure navigation
  • 5-year vision and learning philosophy

Impact

Critical data loss for users running --update:

  1. CORE skill is the primary identity/configuration file
  2. Contains irreplaceable user-specific context
  3. No backup created in update mode (by design)
  4. File history may not capture SKILL.md (depends on if it was edited via Claude Code)

Reproduction

# 1. Create custom CORE skill with personal content
echo "Custom content..." > ~/.claude/skills/CORE/SKILL.md

# 2. Run update (claims to preserve config)
cd /path/to/PAI/Bundles/Official
bun run install.ts --update

# 3. CORE skill is now the default template
cat ~/.claude/skills/CORE/SKILL.md  # Shows generic template

Root Cause

The installer's "update infrastructure" logic doesn't distinguish between:

  • Infrastructure files (that should be updated)
  • User configuration files (that should be preserved)

The CORE SKILL.md is treated as infrastructure and gets overwritten.

Suggested Fixes

Option A: Exclude CORE from updates

// In install.ts, skip CORE skill if it exists and differs from template
const coreSkillPath = `${paiDir}/skills/CORE/SKILL.md`;
if (isUpdateMode && existsSync(coreSkillPath)) {
  const existing = await Bun.file(coreSkillPath).text();
  const template = await Bun.file(coreSk illTemplate).text();
  
  if (existing !== template) {
    console.log("   ✓ Preserving custom CORE skill");
    // Skip overwriting CORE
  }
}

Option B: Merge instead of replace

Preserve user sections (## Identity, ## Goals, etc.) while updating structure.

Option C: Always backup in update mode

Even though docs say "no backup", create timestamped backup of critical files:

~/.claude/skills/CORE/SKILL.md.backup-20260115

Workaround

Users must manually back up CORE skill before running --update:

cp ~/.claude/skills/CORE/SKILL.md ~/SKILL.md.backup
bun run install.ts --update
# Restore custom content manually

Additional Context

The .env file has similar issues:

  • Lost PAI_DIR="$HOME/.claude" line
  • Lost quotes around TIME_ZONE value
  • But at least .env is smaller and easier to recreate

Discovered during attempted upgrade to PAI 2.1.0 on existing installation.

eccentricnode avatar Jan 15 '26 10:01 eccentricnode