Library Auto-Push

Library Auto-Push 
 Owner: FlowForge
 Implemented: 2026-04-17 (Hive Activation Phase 2 T4)
 Plist: ~/Library/LaunchAgents/com.alai.library-sync.plist 
 Wrapper: ~/system/tools/library-sync-wrapper.sh 
 Purpose 
 Before this daemon, library.js sync was manual. Result: 26-day-old distributions. Every company ran skills that diverged from the global source. 
 Now library.js sync --fix runs every 5 min, and immediately after, discover.js --rebuild-index refreshes the search index. 
 Schedule 
 
 StartInterval : 300 seconds 
 ThrottleInterval : 60 seconds (prevents overlap if one run exceeds 5 min) 
 Logs: ~/system/logs/library-sync.log (stdout) + library-sync.err (stderr) 
 
 Wrapper flow 
 node ~/system/tools/library.js sync --fix # distribute skills across companies
node ~/system/tools/discover.js --rebuild-index # refresh search index
 
 Pre-first-run snapshot 
 Before the daemon's very first run, a snapshot of every company's .claude/skills/ was saved to: 
 ~/system/backups/library-pre-autopush-20260417-0041/
 
 If auto-push ever overwrites a legitimate company customization, restore from there. 
 Operation 
 # Status
launchctl list | grep library-sync
# LastExitStatus should be 0

# Force a run
launchctl start com.alai.library-sync

# Tail log
tail -50 ~/system/logs/library-sync.log

# Current sync state
node ~/system/tools/library.js status
 
 Drift handling 
 library.js sync --fix will flag company overrides (the company's version of a skill differs from global). Current drift at first-run: 8 items across CodeCraft + Lexicon. This is expected — these are intentional overrides, not bugs. The daemon logs them but doesn't force-overwrite. 
 If you WANT to force-normalize a company: node ~/system/tools/library.js push <skill> --company <name> . 
 Rollback procedure 
 If auto-push corrupts company skills: 
 launchctl unload ~/Library/LaunchAgents/com.alai.library-sync.plist
# restore from snapshot
cp -a ~/system/backups/library-pre-autopush-20260417-0041/<company>/ ~/ALAI/<company>/.claude/skills/
# or selective restore per skill
 
 Re-enable: launchctl load the plist. 
 Known issues 
 
 FORGE sync ( library.js forge-sync 10.0.0.2 ) currently unreachable — ~/system/ops/forge-connectivity-debt.md . Auto-push runs OK locally; FORGE deploy waits for network fix. 
 library.js sync --fix currently swallows stderr in FORGE path. CodeCraft may want verbose mode in a future sprint.