claude-reflect-system
haddock-development · haddock-development/claude-reflect-system
Một hệ thống AI tự học cho Claude Code, cho phép cải thiện kỹ năng tự động bằng cách ghi nhớ các sửa đổi của người dùng và tránh lặp lại lỗi cũ.
Continual Learning & Self-improving skills system for Claude Code - learn from corrections, never repeat mistakes
Xem trước
Bạn có thể làm gì với nó
- Dạy Claude các công cụ phát triển ưa thích như uv thay vì pip.
- Thực thi các tiêu chuẩn kiểu code cụ thể trên tất cả các phiên code.
- Đảm bảo Claude luôn áp dụng các mẫu dự án hoặc các phương pháp bảo mật.
Kiểm tra an toàn
Dùng được, nhưng nên đọc ghi chú trước.
- ●Không có giấy phép rõ ràng: hỏi tác giả trước khi dùng cho sản phẩm thương mại.
Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.
Trích từ README
Claude Code Self-Learning Skills - Reflect System 🧠
"Correct once, never again" - AI that learns from your corrections and never repeats mistakes
Keywords: Claude Code, AI Learning, Self-Improving AI, LLM Skills, Machine Learning, Continuous Learning, AI Memory, Developer Tools, Code Automation, Python AI
🎯 What is this?
Reflect is a revolutionary self-learning AI system for Claude Code that enables automatic skill improvement through user corrections. Unlike traditional AI coding assistants that forget everything between sessions, Reflect creates permanent learning from your feedback.
Perfect for: Developers, AI engineers, automation enthusiasts, teams using Claude Code, anyone tired of repeating corrections to AI assistants.
Use Cases:
- 🔧 Development workflows - Teach Claude your preferred tools (uv, pytest, ruff)
- 🎨 Code style - Enforce your coding standards automatically
- 📦 Project templates - Remember your preferred project structures
- 🔐 Security practices - Never forget security checks again
- 🚀 CI/CD pipelines - Consistent deployment patterns
The Problem
Session 1: Claude uses pip
You: "No, use uv instead"
Claude: "Ok, using uv"
Session 2: Claude uses pip again 😞
You: "I told you to use uv!"
The Solution
Session 1: Claude uses pip
You: "No, use uv instead"
→ /reflect → Skill learns ✅
Session 2: Claude uses uv ✨
Session 3: Claude uses uv ✨
Forever: Claude uses uv ✨
🚀 Quick Start
Installation
# Copy to your Claude Code skills directory
cp -r reflect ~/.claude/skills/
cp -r python-project-creator ~/.claude/skills/
# Check status
/reflect-status
Basic Usage
- Work with Claude - Let it make a mistake
- Correct it - "No, use X instead of Y"
- Run reflection -
/reflect - Review changes - Approve with
A - Done! - Claude learned permanently
Commands
| Command | Action |
|---|---|
/reflect | Analyze current session manually |
/reflect-on | Enable auto-reflection at session end |
/reflect-off | Disable auto-reflection |
/reflect-status | Show current configuration |
📦 What's Included
🧠 Reflect System
The core learning engine with:
- ✅ Pattern detection (HIGH/MEDIUM/LOW confidence)
- ✅ Safe skill updates with backups
- ✅ Git integration for version control
- ✅ Interactive review flow
- ✅ Auto-reflection via hooks
🐍 Python Project Creator (Demo)
Example skill that demonstrates learning:
Initial state: Uses pip and unittest
After corrections:
- ✅ Learned: Use
uvinstead ofpip - ✅ Learned: Always
pytest, neverunittest
Result: Now always suggests uv and pytest!
🎓 How It Works
Three Confidence Levels
🔴 HIGH - Corrections
"No, use X instead of Y"
"Never do X"
"Always check Y"
→ Creates Critical Corrections section
🟡 MEDIUM - Approvals
"Yes, perfect!"
"That works well"
"Exactly right"
→ Adds to Best Practices
🟢 LOW - Observations
"Have you considered...?"
"What about...?"
→ Notes in Considerations
Safe Application
Every change includes:
- ✅ Timestamped backup
- ✅ YAML validation
- ✅ User approval (manual mode)
- ✅ Automatic rollback on errors
- ✅ Git commit with description
⚡ Features & Benefits
Core Features
- ✅ Pattern Recognition - Automatically detects corrections, approvals, and suggestions
- ✅ Confidence-Based Learning - Three levels (HIGH/MEDIUM/LOW) for intelligent updates
- ✅ Safe Updates - Timestamped backups, YAML validation, automatic rollback
- ✅ Git Integration - Full version control of all learnings
- ✅ Interactive Review - Always see changes before applying
- ✅ Auto-Reflection - Optional automatic learning at session end
- ✅ Zero Configuration - Works out of the box
- ✅ Extensible - Add custom pattern detection easily
Why Choose Reflect?
| Feature | Traditional AI | Reflect System |
|---|---|---|
| Memory | ❌ Forgets between sessions | ✅ Permanent learning |
| Corrections | ❌ Repeat every time | ✅ Once and done |
| Version Control | ❌ No history | ✅ Full Git integration |
| Transparency | ❌ Black box | ✅ See all changes |
| Customization | ❌ Limited | ✅ Fully customizable |
| Team Learning | ❌ Individual only | ✅ Shareable via Git |
Technical Highlights
- 🐍 Pure Python - No complex dependencies
- 🔒 Privacy First - All data stays local
- 📦 Modular Design - Use components independently
- 🚀 Fast - Pattern detection in milliseconds
- 🧪 Battle-Tested - Extensively used in production
📖 Example Learning Journey
Step 1: Initial Mistake
Claude uses pip install:
pip install fastapi
pip freeze > requirements.txt
Step 2: Your Correction
"No, use uv instead of pip! It's faster and modern."
Step 3: Reflection Detects
Signal detected:
- Type: HIGH confidence correction
- Pattern: "use X instead of Y"
- Old: pip
- New: uv
Step 4: Skill Updated
+## Critical Corrections
+
+**Use 'uv' instead of 'pip'**
+- ✗ Don't: pip install
+- ✓ Do: uv pip install
Step 5: Forever Learned
Next session, Claude automatically:
uv pip install fastapi
uv pip freeze > requirements.txt
No reminder needed! ✨
🛠️ Configuration
Manual Mode (Recommended for beginners)
/reflect-status # Should show "Disabled"
Run /reflect after sessions with corrections.
Auto Mode (For continuous learning)
/reflect-on
Runs automatically at session end via Stop hook.
Hook Setup
Already configured if you copied the skills! Check:
cat ~/.claude/settings.local.json | grep -A 5 hooks
Should show hook for reflect/scripts/hook-stop.sh.