self-improving-agent

from charon-fan/agent-playbook

No description

4 stars1 forksUpdated Jan 22, 2026
npx skills add https://github.com/charon-fan/agent-playbook --skill self-improving-agent

SKILL.md

Self-Improving Agent

"An AI agent that learns from every interaction, accumulating patterns and insights to continuously improve its own capabilities." — Based on 2025 lifelong learning research

Overview

This is a universal self-improvement system that learns from ALL skill experiences, not just PRDs. It implements a complete feedback loop with:

  • Multi-Memory Architecture: Semantic + Episodic + Working memory
  • Self-Correction: Detects and fixes skill guidance errors
  • Self-Validation: Periodically verifies skill accuracy
  • Hooks Integration: Auto-triggers on skill events (before_start, after_complete, on_error)
  • Evolution Markers: Traceable changes with source attribution

Research-Based Design

Based on 2025 research:

ResearchKey InsightApplication
SimpleMemEfficient lifelong memoryPattern accumulation system
Multi-Memory SurveySemantic + Episodic memoryWorld knowledge + experiences
Lifelong LearningContinuous task stream learningLearn from every skill use
Evo-MemoryTest-time lifelong learningReal-time adaptation

The Self-Improvement Loop

┌─────────────────────────────────────────────────────────────────┐
│                    UNIVERSAL SELF-IMPROVEMENT                    │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   Skill Event → Extract Experience → Abstract Pattern → Update  │
│        │                  │                │         │          │
│        ▼                  ▼                ▼         ▼          │
│   ┌─────────────────────────────────────────────────────┐       │
│   │              MULTI-MEMORY SYSTEM                      │       │
│   ├─────────────────────────────────────────────────────┤       │
│   │  Semantic Memory   │  Episodic Memory  │ Working Memory │  │
│   │  (Patterns/Rules)  │  (Experiences)    │  (Current)     │  │
│   │  memory/semantic/  │  memory/episodic/ │  memory/working/│  │
│   └─────────────────────────────────────────────────────┘       │
│                                                                 │
│   ┌─────────────────────────────────────────────────────┐       │
│   │              FEEDBACK LOOP                            │       │
│   │  User Feedback → Confidence Update → Pattern Adapt   │       │
│   └─────────────────────────────────────────────────────┘       │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

When This Activates

Automatic Triggers (via hooks)

EventTriggerAction
before_startAny skill startsLog session start
after_completeAny skill completesExtract patterns, update skills
on_errorBash returns non-zero exitCapture error context, trigger self-correction

Manual Triggers

  • User says "自我进化", "self-improve", "从经验中学习"
  • User says "分析今天的经验", "总结教训"
  • User asks to improve a specific skill

Evolution Priority Matrix

Trigger evolution when new reusable knowledge appears:

TriggerTarget SkillPriorityAction
New PRD pattern discoveredprd-plannerHighAdd to quality checklist
Architecture tradeoff clarifiedarchitecting-solutionsHighAdd to decision patterns
API design rule learnedapi-designerHighUpdate template
Debugging fix discovereddebuggerHighAdd to anti-patterns
Review checklist gapcode-reviewerHighAdd checklist item
Perf/security insightperformance-engineer, security-auditorHighAdd to patterns
UI/UX spec issueprd-planner, architecting-solutionsHighAdd visual spec requirements
React/state patterndebugger, refactoring-specialistMediumAdd to patterns
Test strategy improvementtest-automator, qa-expertMediumUpdate approach
CI/deploy fixdeployment-engineerMediumAdd to troubleshooting

Multi-Memory Architecture

1. Semantic Memory (memory/semantic-patterns.json)

Stores abstract patterns and rules reusable across contexts:

{
  "patterns": {
    "pattern_id": {
      "id": "pat-2025-01-11-001",
      "name": "Pattern Name",
      "source": "user_feedback|implementation_review|retrospective",
      "confidence": 0.95,
      "applications": 5,
      "created": "2025-01-11",
      "category": "prd_structure|react_patterns|async_patterns|...",
      "pattern": "One-line summary",
      "problem": "What problem does this solve?",
      "solution": { ... },
      "quality_rules": [ ... ],
      "target_skills": [ ... ]
    }
  }
}

2. Episodic

...

Read full content

Repository Stats

Stars4
Forks1