Evolve Skill - Instinct-to-Skill Promotion
Purpose
Transform proven instincts (confidence >= 0.7) into permanent, reusable skill files. This is the second stage of the Continuous Learning System.
Trigger
- User types
/evolve - Can also be suggested automatically when 3+ instincts reach confidence >= 0.7 in a tag group
Algorithm
- Read instincts: Load
~/.claude/learnings/instincts.json - Filter candidates: Select instincts where confidence >= 0.7 AND evolved_to is null/missing
- Check threshold: If fewer than 3 candidates total, show message and suggest using
/learnmore - Group by tags: Group candidates by ALL their tags (see Multi-Tag Grouping)
- An instinct contributes to every tag group it belongs to
- For each group with 3+ instincts:
a. Generate skill name:
{tag}-learned(e.g.,parallelism-learned) b. Check if skill already exists at~/.claude/skills/{tag}-learned/SKILL.md- If exists: merge new patterns into existing skill (see Skill File Merging below)
- If not: create new skill directory and SKILL.md (Write tool)
c. Generate skill file with YAML frontmatter and consolidated patterns
d. Mark each source instinct: append
"{tag}-learned"to"evolved_to"array e. Update metadata: increment total_evolved, set last_evolution date
- Save: Write updated instincts.json
- Display summary: Show evolution results
Generated Skill Format
---
name: {tag}-learned
description: Auto-evolved best practices for {tag}, learned from {N} confirmed patterns.
user-invocable: false
allowed-tools: Read
---
# {Tag} Best Practices (Learned)
Auto-generated by the Continuous Learning System on YYYY-MM-DD.
Source: {N} instincts with average confidence {avg}.
## Patterns
### 1. {instinct.pattern}
- **Confidence:** {instinct.confidence}
- **Evidence:** {instinct.evidence count} confirmations
- **First seen:** {instinct.created}
### 2. {instinct.pattern}
...
## Application
These patterns should be applied automatically when the orchestrator
detects relevant context matching the tags: {tags}.
Grouping Rules
- An instinct contributes to ALL tag groups it belongs to (not just primary)
- Minimum 3 instincts per group to trigger evolution
- Groups with fewer than 3 are skipped (instincts remain for future evolution)
- An instinct is excluded from a tag group only if that specific tag appears in its evolved_to array
Multi-Tag Grouping
An instinct contributes to ALL its tag groups (not just primary).
Example: instinct with tags ["testing", "parallelism"] contributes to both groups.
Mark evolved_to as array: "evolved_to": ["testing-learned", "parallelism-learned"]
When an instinct evolves via one tag group, it remains eligible for other tag groups until all its tags have been evolved or it is explicitly excluded.
Output Format - Success
EVOLUTION COMPLETE
Instincts processed: N (of M total candidates)
Skills created: K
Skills updated: J
Created Skills:
- skills/parallelism-learned/SKILL.md (from 4 instincts)
- skills/testing-learned/SKILL.md (from 3 instincts)
Remaining candidates: X instincts (need more confirmations or group members)
Tip: Continue using /learn to build more instincts. Next evolution check at 3+ per tag.
Output Format - Not Ready
EVOLUTION CHECK
High-confidence instincts (>= 0.7): N
Groups meeting threshold (3+): 0
Breakdown by tag:
- parallelism: 2 instincts (need 1 more)
- testing: 1 instinct (need 2 more)
Tip: Use /learn to capture more patterns. Instincts grow with repeated confirmation.
Skill File Merging
When appending to an existing evolved skill:
- Read existing skill file
- Find last numbered pattern (e.g.,
### 5.) - Assign next number to new patterns (e.g.,
### 6.) - Append before "## Application" section
- Update "auto-generated" and "Last updated" timestamps
- Increment "Sources" count
Edge Cases
- If instincts.json does not exist or is empty, report "No instincts found. Use /learn first."
- If a skill directory already exists but SKILL.md is missing, create it fresh
- If all high-confidence instincts are already evolved, report "All patterns already evolved."
- Maximum 10 patterns per evolved skill file; if more, split into Part 1, Part 2