Sync skills between Hermes agent and ai_collection repository. Use when user asks to submit skills to ai_collection, sync skills to GitHub, or push skill updates.
Sync skills from Hermes agent to the ai_collection GitHub repository.
This skill handles the workflow of:
~/.hermes/skills/) and ai_collection (collection/skills/)~/Documents/projects/ai_projects/ai_collection/First, discover all skills in both locations:
from pathlib import Path
hermes_skills_dir = Path("~/.hermes/skills").expanduser()
ai_collection_skills_dir = Path("~/Documents/projects/ai_projects/ai_collection/collection/skills").expanduser()
# Get Hermes skills (recursive search for SKILL.md)
hermes_skills = {}
for skill_md in hermes_skills_dir.rglob("SKILL.md"):
skill_dir = skill_md.parent
skill_name = skill_dir.name
# Skip backup files
if "_backup" in skill_name:
continue
hermes_skills[skill_name] = skill_dir
# Get ai_collection skills
ai_collection_skills = set()
if ai_collection_skills_dir.exists():
for item in ai_collection_skills_dir.iterdir():
if item.is_dir() and not item.name.startswith('.'):
ai_collection_skills.add(item.name)
# Find skills to sync
skills_to_sync = set(hermes_skills.keys()) - ai_collection_skills
print(f"Hermes skills: {len(hermes_skills)}")
print(f"ai_collection skills: {len(ai_collection_skills)}")
print(f"Skills to sync: {len(skills_to_sync)}")
Copy missing skills to ai_collection:
import shutil
copied = []
failed = []
for skill_name in sorted(skills_to_sync):
src = hermes_skills[skill_name]
dst = ai_collection_skills_dir / skill_name
try:
shutil.copytree(src, dst)
copied.append(skill_name)
print(f"✓ Copied: {skill_name}")
except Exception as e:
failed.append((skill_name, str(e)))
print(f"✗ Failed: {skill_name}: {e}")
print(f"\nTotal copied: {len(copied)}")
Add, commit, and push changes:
# Navigate to repository
cd ~/Documents/projects/ai_projects/ai_collection
# Check status
git status --short
# Add all new skills
git add collection/skills/
# Commit
git commit -m "Add X new skills from Hermes agent collection"
# Handle remote updates if needed
git pull origin main --rebase
# Push
git push origin main
Confirm the push was successful:
# Check recent commits
git log --oneline -3
# Count total skills
ls collection/skills/ | wc -l
If push is rejected due to remote changes:
# Stash local changes
git stash
# Pull and rebase
git pull origin main --rebase
# Restore stashed changes
git stash pop
# Push again
git push origin main
#!/usr/bin/env python3
"""Sync skills from Hermes to ai_collection"""
from pathlib import Path
import shutil
import subprocess
def sync_skills():
# Paths
hermes_skills_dir = Path("~/.hermes/skills").expanduser()
ai_collection_dir = Path("~/Documents/projects/ai_projects/ai_collection").expanduser()
ai_collection_skills_dir = ai_collection_dir / "collection/skills"
# Get Hermes skills
hermes_skills = {}
for skill_md in hermes_skills_dir.rglob("SKILL.md"):
skill_dir = skill_md.parent
skill_name = skill_dir.name
if "_backup" in skill_name:
continue
hermes_skills[skill_name] = skill_dir
# Get ai_collection skills
ai_collection_skills = set()
if ai_collection_skills_dir.exists():
for item in ai_collection_skills_dir.iterdir():
if item.is_dir() and not item.name.startswith('.'):
ai_collection_skills.add(item.name)
# Find skills to sync
skills_to_sync = set(hermes_skills.keys()) - ai_collection_skills
if not skills_to_sync:
print("All skills already synced!")
return
# Copy skills
for skill_name in sorted(skills_to_sync):
src = hermes_skills[skill_name]
dst = ai_collection_skills_dir / skill_name
shutil.copytree(src, dst)
print(f"✓ {skill_name}")
# Git operations
subprocess.run(["git", "add", "collection/skills/"], cwd=ai_collection_dir)
subprocess.run([
"git", "commit", "-m",
f"Add {len(skills_to_sync)} new skills from Hermes agent collection"
], cwd=ai_collection_dir)
# Try to push (handle conflicts)
result = subprocess.run(
["git", "push", "origin", "main"],
cwd=ai_collection_dir,
capture_output=True,
text=True
)
if result.returncode != 0 and "rejected" in result.stderr:
# Handle conflict
subprocess.run(["git", "stash"], cwd=ai_collection_dir)
subprocess.run(["git", "pull", "origin", "main", "--rebase"], cwd=ai_collection_dir)
subprocess.run(["git", "stash", "pop"], cwd=ai_collection_dir)
subprocess.run(["git", "push", "origin", "main"], cwd=ai_collection_dir)
print(f"\n✅ Synced {len(skills_to_sync)} skills successfully!")
if __name__ == "__main__":
sync_skills()
*_backup directories