Implementation:AMAP ML SkillClaw SkillHub
| Knowledge Sources | |
|---|---|
| Domains | Skill_Sharing, Object_Storage, Synchronization |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete tool for synchronizing AI agent skills between a local directory and a shared object store (local/S3/OSS/Nacos) with incremental transfers and backup-rollback safety, provided by the SkillClaw client package.
Description
The SkillHub class is the central skill synchronization component. `push_skills` uploads new/changed local skills to shared storage, with an optional quality gate (min injections, min effectiveness). `pull_skills` mirrors remote skills to the local directory with backup-rollback safety: before any destructive change, local skills are backed up; if the pull fails partway, the backup is restored. The `from_config` classmethod auto-selects the storage backend (local, S3, OSS, or Nacos) based on config.
Usage
Import and use when you need to:
- Push local skills to shared team storage
- Pull team skills to a local directory
- Enable auto-sync on SkillClaw startup
- Configure multi-backend skill sharing (S3, OSS, Nacos)
Code Reference
Source Location
- Repository: SkillClaw
- File: `skillclaw/skill_hub.py:L68-651`
Signature
class SkillHub:
"""Sync skills between a local directory and a shared object store."""
def __init__(
self,
*,
backend: str,
endpoint: str,
bucket: str,
access_key_id: str,
secret_access_key: str,
region: str = "",
session_token: str = "",
local_root: str = "",
group_id: str = "default",
user_alias: str = "",
) -> None:
@classmethod
def from_config(cls, config) -> "SkillHub":
"""Build SkillHub from SkillClawConfig, auto-selecting backend."""
def push_skills(
self,
skills_dir: str,
skill_filter: Optional[dict[str, Any]] = None,
) -> dict[str, int]:
"""Upload new/changed skills from local directory to shared storage.
Returns: {"uploaded": N, "skipped": M, "filtered": F, "total_local": T}
"""
def pull_skills(
self,
skills_dir: str,
mirror: bool = True,
skip_names: Optional[Collection[str]] = None,
include_names: Optional[Collection[str]] = None,
) -> dict[str, Any]:
"""Mirror cloud skills to local directory with backup + rollback safety.
Returns: {
"downloaded": N, "skipped": M, "deleted": D,
"total_remote": T, "restored_from_backup": bool, "backup_dir": str
}
"""
Import
from skillclaw.skill_hub import SkillHub
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| backend | str | Yes | "local", "s3", "oss", or "nacos" |
| bucket | str | Yes | Storage bucket name |
| group_id | str | No | Namespace for shared skills (default "default") |
| skills_dir | str | Yes (push/pull) | Local skills directory path |
| skill_filter | None | No | Quality gate with stats, min_injections, min_effectiveness |
| mirror | bool | No | Full mirror with deletion (default True) vs incremental only |
| skip_names | None | No | Skills to preserve locally during pull |
Outputs
| Name | Type | Description |
|---|---|---|
| push_skills() returns | dict[str, int] | {uploaded, skipped, filtered, total_local} |
| pull_skills() returns | dict[str, Any] | {downloaded, skipped, deleted, total_remote, restored_from_backup, backup_dir} |
Usage Examples
Push Local Skills
from skillclaw.skill_hub import SkillHub
hub = SkillHub(
backend="s3",
endpoint="",
bucket="skillclaw-shared",
access_key_id="AKIA...",
secret_access_key="...",
group_id="my-team",
user_alias="alice",
)
result = hub.push_skills("/home/user/.skillclaw/skills")
print(f"Uploaded: {result['uploaded']}, Skipped: {result['skipped']}")
Pull With Quality Gate
# Push only skills that meet quality thresholds
hub.push_skills(
skills_dir="/home/user/.skillclaw/skills",
skill_filter={
"stats": manager._stats, # From SkillManager
"min_injections": 3, # Skip skills with < 3 injections
"min_effectiveness": 0.4, # Skip skills below 40% effectiveness
},
)
Pull Remote Skills
# Full mirror: download remote, delete stale local, backup-rollback safety
result = hub.pull_skills(
skills_dir="/home/user/.skillclaw/skills",
mirror=True,
)
print(f"Downloaded: {result['downloaded']}, Deleted: {result['deleted']}")
if result["restored_from_backup"]:
print(f"Backup restored from {result['backup_dir']}")
Auto-Sync from Config
from skillclaw.skill_hub import SkillHub
# Auto-detect backend from config
hub = SkillHub.from_config(cfg)
hub.pull_skills(cfg.skills_dir)