Bug: install.ts --update overwrites custom CORE skill despite claiming to preserve config
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:
- CORE skill is the primary identity/configuration file
- Contains irreplaceable user-specific context
- No backup created in update mode (by design)
- 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_ZONEvalue - But at least
.envis smaller and easier to recreate
Discovered during attempted upgrade to PAI 2.1.0 on existing installation.
I trying to work on my own fix, I will push a branch, with the changes, if it's helpful.
Otherwise I can just get it working till 2.1.0 stabilizes.
I had been thinking about this problem too. Maybe these files should be always generated automatically instead of being pasted as-is.
Or maybe some way to set conventions in title and preserving them. Some data structure where the title text, optional note that one would be warned not to change, and the example text we can check for existence, and not replace that chunk when absent. Basically a way to grab all Markdown text between title (with predictable pattern) and next title with some logic
Thanks for reporting! The Bundles/install.ts system was completely replaced in v3.0 (now released) with a new installer that doesn't overwrite custom configurations. Please upgrade to v3.0.