Memory-Driven Self-Evolution for AI Agent Skills
"I've fixed this exact error three times this week. Why doesn't my AI assistant remember?"
Every developer has been there. You spend 30 minutes debugging an issue, finally fix it, and move on. Two days later, you hit the same problem β and your AI assistant has completely forgotten how you solved it.
Your AI is smart, but it has no memory.
Auto-Evolution changes that. It gives your AI agent a persistent memory that learns from every interaction, detects patterns in your work, and evolves into a smarter assistant over time.
Week 1: You fix TypeError #1 β Agent forgets
Week 2: You fix TypeError #2 β Agent forgets
Week 3: You fix TypeError #3 β Agent forgets
With Auto-Evolution:
Week 1: You fix TypeError #1 β Agent remembers
Week 2: You fix TypeError #2 β Agent notices pattern
Week 3: TypeError #3 β Agent: "I've seen this before. Here's the fix."
| Problem | Without Auto-Evolution | With Auto-Evolution |
|---|---|---|
| Repeated errors | Fix the same bug multiple times | Agent learns from first fix |
| Lost knowledge | Solutions disappear after session | Patterns persist across sessions |
| No personalization | Generic responses every time | Agent adapts to your workflow |
| Manual documentation | You document everything yourself | Auto-generated skill drafts |
| Blind spots | No visibility into what works | Dashboard shows what's effective |
|
Inspired by human cognition:
|
Automatically identifies:
|
|
Real-time visualization of:
|
Only validated knowledge gets promoted:
|
See your agent's evolution in real-time:
curl -fsSL https://raw.githubusercontent.com/ZhanlinCui/Auto-Evolution-Agent-Skills/main/install.sh | bash -s -- --with-hooksπ¦ Alternative: Manual Installation
# Clone repository
git clone https://github.com/ZhanlinCui/Auto-Evolution-Agent-Skills.git
# Copy to your project
cp -r Auto-Evolution-Agent-Skills/skills/evolution your-project/.claude/skills/
# Make hooks executable
chmod +x your-project/.claude/skills/evolution/hooks/*.shAdd to your .claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Read|Write|Edit|Bash",
"hooks": [{"type": "command", "command": "bash .claude/skills/evolution/hooks/capture.sh \"$TOOL_NAME\" \"$TOOL_INPUT\""}]
}
],
"PostToolUse": [
{
"matcher": "Bash",
"hooks": [{"type": "command", "command": "bash .claude/skills/evolution/hooks/capture.sh post-bash \"$TOOL_OUTPUT\" \"$EXIT_CODE\""}]
}
],
"Stop": [
{
"matcher": "",
"hooks": [{"type": "command", "command": "bash .claude/skills/evolution/hooks/reflect.sh"}]
}
]
}
}That's it! Just use Claude Code as you always do. Auto-Evolution works silently in the background.
# Open the dashboard
open .claude/skills/evolution/reports/dashboard.htmlOnce installed, everything happens automatically:
| What Happens | When | Result |
|---|---|---|
| Skill usage tracked | You read any .md skill file |
Recorded in episodic memory |
| Errors captured | Bash command fails | Error + context saved |
| Patterns detected | Same action 3+ times | Pattern hypothesis created |
| Insights generated | Session ends | Draft + suggestions created |
| Command | What It Does | Example |
|---|---|---|
/retrospective |
Generate session review | "What did I learn today?" |
/evolve |
Promote pattern to skill | "Save this fix as a skill" |
/dashboard |
Open visual dashboard | "Show my evolution" |
You: Fix this TypeScript error: "Object is possibly undefined"
Agent: [fixes with optional chaining]
--- After 3 similar fixes ---
Agent: π‘ I noticed you've fixed "possibly undefined" errors 3 times
using optional chaining. Want me to save this as a reusable pattern?
You: Yes, create a skill for it
Agent: β
Created: community/typescript-optional-chaining.md
Next time, I'll suggest this pattern immediately.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β π CAPTURE π ANALYZE π EVOLVE β
β βββββββββββ ββββββββββ βββββββββ β
β Tool usage β Find patterns β Create skills β
β Errors β Detect repeats β Promote drafts β
β Commands β Score success β Retire failures β
β β
β π§ MEMORY β
β βββββββββ β
β Episodic β Semantic β Procedural β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | What It Stores | Retention | Example |
|---|---|---|---|
| Episodic | Raw events | 7 days | "Used layout.md at 14:32" |
| Semantic | Patterns | 30 days | "Grid layouts need Flow + Sizing" |
| Procedural | Skills | Permanent | responsive-grid-pattern.md |
Knowledge must prove itself before becoming permanent:
[Detected] ββ3+ occurrencesβββΆ [Draft] ββvalidatedβββΆ [Approved] ββusedβββΆ [Skill]
β β β β
Pattern Auto-generated Human/AI Permanent
noticed documentation verified knowledge
All settings in evolution/config.json:
{
"memory": {
"episodic_ttl_days": 7, // How long to keep raw events
"semantic_ttl_days": 30, // How long to keep patterns
"pattern_threshold": 3 // Occurrences needed to detect pattern
},
"evolution": {
"auto_draft_on_error": true, // Create draft when errors occur
"auto_pattern_detection": true, // Automatically detect patterns
"require_validation": true // Require validation before promotion
}
}.claude/skills/evolution/
β
βββ π SKILL.md # Entry point & documentation
βββ βοΈ config.json # All configuration
β
βββ π§ memory/ # Three-layer memory system
β βββ episodes.jsonl # Layer 1: Raw events
β βββ patterns.json # Layer 2: Detected patterns
β βββ drafts/ # Layer 3: Skill candidates
β
βββ πͺ hooks/ # Event capture system
β βββ capture.sh # Pre/post tool hooks
β βββ reflect.sh # Session-end analysis
β βββ lib.sh # Shared utilities
β
βββ π reports/ # Visualization & reports
β βββ dashboard.html # Visual dashboard
β βββ improvements.md # Suggestions
β βββ sessions/ # Session reports
β
βββ π templates/ # Skill templates
β βββ skill.md # General skill template
β βββ error.md # Error solution template
β
βββ π community/ # Your contributed skills
βββ README.md # Contribution guide
Discovered a useful pattern? Share it with the community:
- Create
community/{your-handle}-{pattern-name}.md - Use templates from
templates/ - Submit a PR
- β Solves a real, repeatable problem
- β Includes trigger scenarios ("Use when...")
- β Has tested, concrete examples
- β No project-specific hardcoded values
- v2.0 β Three-layer memory system
- v2.0 β Visual dashboard
- v2.0 β Pattern detection
- v2.1 β Cross-project knowledge sync
- v2.2 β LLM-as-judge validation
- v2.3 β Community knowledge federation
Does it work with other AI assistants?
Currently optimized for Claude Code, but the architecture is designed to be portable. Contributions for other platforms welcome!
Where is data stored?
All data stays local in your project's .claude/skills/evolution/memory/ directory. No data is sent externally.
How much overhead does it add?
Minimal. Hooks are shell scripts that append to JSONL files. Pattern detection only runs at session end.
Can I disable it temporarily?
Yes, just remove the hooks from .claude/settings.json. Your memory data is preserved.
MIT License β see LICENSE for details.
Stop re-solving. Start evolving.
