Automatically learn from your AI's work and turn repeated subagent tasks into reusable skills.
Watches subagent completions, detects patterns worth reusing, and creates draft skills automatically. After 3 successful re-invocations, drafts are promoted to active skills.
scripts/auto-skill-trigger.pyskills/auto-draft/skills/auto/Add to AGENTS.md or your agent's completion handler:
# After subagent completion
import subprocess, json
trigger_input = {
"completion_status": "success", # or "failed", "timeout"
"tool_calls": tool_call_count,
"session_id": session_key,
"multi_domain": True, # if task crossed domains (files + web + system)
"transcript_summary": brief_summary # keep brief, no secrets
}
# Method 1: Stdin (recommended, no file on disk)
result = subprocess.run(
["python3", "scripts/auto-skill-trigger.py"],
input=json.dumps(trigger_input),
capture_output=True, text=True
)
# Method 2: File (delete immediately after)
with open("/tmp/trigger.json", "w") as f:
json.dump(trigger_input, f)
result = subprocess.run(["python3", "scripts/auto-skill-trigger.py", "/tmp/trigger.json"], capture_output=True)
os.remove("/tmp/trigger.json")
#skill: — Manually trigger extraction from last subagent#skill: force — Force extraction (ignore thresholds)# List active auto-skills
python3 scripts/skill-lifecycle.py list
# List drafts under evaluation
python3 scripts/skill-lifecycle.py drafts
# Process promotions and archives
python3 scripts/skill-lifecycle.py process
# Manually promote a draft
python3 scripts/skill-lifecycle.py promote my-skill-name
| Factor | Points | Example |
|---|---|---|
| -------- | -------- | --------- |
| Tool calls × 0.7 | 2-5 pts | 3 tools = 2, 5 tools = 4 |
| Multi-domain | +2 pts | Files + web + system |
| Error recovery | +2 pts | Retry on failure |
Threshold: 4 points = creates DRAFT
skills/
├── auto-draft/ # Draft skills (under evaluation)
│ └── {name}-{hash}/
│ ├── SKILL.md
│ └── meta.json
├── auto/ # Promoted skills (ready to use)
│ └── {skill-name}/
│ ├── SKILL.md
│ └── promotion.json
└── manual/ # Hand-crafted skills
COMPLEXITY_THRESHOLD = 4 — Lower = more drafts, more curation neededPROMOTE_THRESHOLD = 3 — Re-invocations before promotionARCHIVE_AGE_DAYS = 7 — Days before unused drafts archivedMAX_QUEUE_SIZE = 50 — Pending extraction limit共 1 个版本