At the end of a session, automatically evaluate the Claude Code session and extract reusable patterns that can be saved as Learned Skills.
When to Activate
- Set up automatic pattern extraction from Claude Code sessions
- Configure
StopHook for session evaluation - View or organize
~/.claude/skills/learned/Learned Skills - Adjust extraction thresholds or pattern categories
- Compare the v1 (current) and v2 (Instinct-based) approaches
How It Works
This skill runs as a Stop Hook at the end of each session:
- Session Evaluation: Check whether the session has enough messages (default: more than 10)
- Pattern Detection: Identify extractable patterns from the session
- Skill Extraction: Save useful patterns to
~/.claude/skills/learned/
Configuration
Edit config.json to customize:
{
"min_session_length": 10,
"extraction_threshold": "medium",
"auto_approve": false,
"learned_skills_path": "~/.claude/skills/learned/",
"patterns_to_detect": [
"error_resolution",
"user_corrections",
"workarounds",
"debugging_techniques",
"project_specific"
],
"ignore_patterns": [
"simple_typos",
"one_time_fixes",
"external_api_issues"
]
}
Pattern Types
| Pattern | Description |
|---|---|
error_resolution |
Solutions for specific errors |
user_corrections |
Patterns from user corrections |
workarounds |
Solutions for framework/library defects |
debugging_techniques |
Effective debugging methods |
project_specific |
Project-specific conventions |
Hook Setup
Add to your ~/.claude/settings.json:
{
"hooks": {
"Stop": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/continuous-learning/evaluate-session.sh"
}]
}]
}
}
Why Use a Stop Hook?
- Lightweight: Runs only once at the end of a session
- Non-blocking: Does not add latency to every message
- Full context: Can access the complete session record
Related Content
- The Longform Guide - Chapters on continuous learning
/learncommand - Manually extract patterns mid-session
Comparison Notes (Research: January 2025)
Comparison with Homunculus
Homunculus v2 uses a more complex approach:
| Feature | Our Approach | Homunculus v2 |
|---|---|---|
| Observation Mechanism | Stop Hook (end of session) |
PreToolUse/PostToolUse Hook (100% reliable) |
| Analysis Method | Main context | Background agent (Haiku agent) |
| Granularity | Full skills | Atomic "instincts" |
| Confidence | None | 0.3-0.9 weight |
| Evolution Path | Directly generate skills | Instinct → Clustering → Skill/Command/Agent |
| Sharing Method | None | Export/import instincts |
Key insight from Homunculus:
"v1 relies on Skills for observation. Skills are probabilistic—they trigger about 50-80% of the time. v2 uses Hooks for observation (100% reliable) and treats 'Instincts' as the atomic unit of learned behavior."
Potential v2 enhancements
- Intuition-based learning - Smaller, atomic behaviors with confidence scoring
- Background observer - Haiku agent analyzing in parallel
- Confidence decay - Intuition confidence decreases if conflicts occur
- Domain tags - Code style, testing, Git, debugging, etc.
- Evolution path - Cluster related intuitions into skills/commands
See:/Users/affoon/Documents/tasks/12-continuous-learning-v2.md for the full specification.