代理技能扩展_self-improving-agent-skill

📅 2026/8/7 12:44:19
代理技能扩展_self-improving-agent-skill
以下为本文档的中文说明该技能是自我改进代理的技能构建模块专门用于为自我改进代理开发和注册新的能力。它定义技能接口、学习机制和评估标准使代理能够自主发现和获取新技能。适用于扩展自我改进代理功能集合的开发和实验场景是构建可进化AI系统的核心组件。该技能与自我改进代理技能相辅相成前者提供代理本身的学习能力后者则定义了如何为代理创建和注册新的能力模块。该技能是自我改进代理系统的技能扩展模块定义了标准的技能接口和学习机制使代理能够动态发现、学习和使用新技能。技能接口包括触发条件、执行流程、输入输出规范和评估标准代理可以通过尝试和反馈来掌握新技能的使用方式。该技能与自我改进代理系统相辅相成前者提供代理本身的学习能力框架后者则定义了如何为代理创建和注册新的能力模块两者共同构成了构建可进化AI系统的完整技术栈。该技能是自我改进代理系统的技能扩展框架定义了标准化技能接口和动态学习机制使代理能够不断发现、学习和运用新技能来扩展自身能力边界。技能接口规范定义了技能的完整生命周期触发条件、执行流程、输入输出规格和评估标准。代理可以通过主动探索和用户反馈来逐步掌握新技能的使用方式。该技能与自我改进代理核心框架相辅相成共同构成完整的可进化AI系统技术栈。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 researchOverviewThis is auniversal self-improvement systemthat learns from ALL task experiences. It implements a complete feedback loop:Multi-Memory Architecture: Semantic (patterns/rules) Episodic (experiences) Working (session context)Self-Correction: Detects and fixes guidance errorsSelf-Validation: Periodically verifies skill accuracyEvolution Markers: Traceable changes with source attributionConfidence Tracking: Measures pattern reliability over timeUser Confirmation Gate: All skill file modifications require explicit user approval before applyingHuman-in-the-Loop: Collects feedback to validate improvementsResearch-Based DesignResearchKey InsightApplicationSimpleMemEfficient lifelong memoryPattern accumulation systemMulti-Memory SurveySemantic Episodic memoryWorld knowledge experiencesLifelong LearningContinuous task stream learningLearn from every taskEvo-MemoryTest-time lifelong learningReal-time adaptationThe Self-Improvement Loop┌──────────────────────────────────────────────────────────────┐ │ UNIVERSAL SELF-IMPROVEMENT │ ├──────────────────────────────────────────────────────────────┤ │ │ │ Task Event → Extract Experience → Abstract Pattern → Update │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ │ │ ┌────────────────────────────────────────────────────────┐ │ │ │ MULTI-MEMORY SYSTEM │ │ │ ├────────────────────────────────────────────────────────┤ │ │ │ Semantic Memory │ Episodic Memory │ Working Memory │ │ │ │ (Patterns/Rules) │ (Experiences) │ (Current) │ │ │ │ memory/self-improving/semantic/ │ memory/self-improving/episodic/ │ memory/self-improving/working/ │ │ │ └────────────────────────────────────────────────────────┘ │ │ │ │ ┌────────────────────────────────────────────────────────┐ │ │ │ FEEDBACK LOOP │ │ │ │ User Feedback → Confidence Update → Pattern Adapt │ │ │ └────────────────────────────────────────────────────────┘ │ │ │ └──────────────────────────────────────────────────────────────┘When This ActivatesAutomatic Triggers| Event | Action ||-------|--------|| Any significant task completes | Extract patterns, propose skill updates (requires user confirmation) || An error or failure occurs | Capture error context, trigger self-correction (requires user confirmation before applying fixes) || Session ends | Consolidate working memory into long-term memory |Manual TriggersUser says “自我进化”, “self-improve”, “从经验中学习”User says “分析今天的经验”, “总结教训”, “总结经验”User asks to improve a specific skill or workflowMemory StorageWorkspace DiscoveryBefore accessing any memory files, the agent MUST first determine the workspace root path:Check environment— Use the workspace path provided by the IDE/environment contextVerify structure— Confirm the workspace root by checking for project markers (e.g.,.git/,package.json,pom.xml, etc.)All paths below are relative to the workspace root— e.g.,{workspace}/memory/self-improving/Relationship with Agent MemoryThe Self-Improving Agent’s memory livesinsidethe Agent’smemory/directory as a dedicated subdirectory. This design ensures:No confusion: Agent’s own memory (MEMORY.md,memory/YYYY-MM-DD.md) and Self-Improving Agent’s memory (memory/self-improving/) are clearly separated by directory structureDiscoverability: The Agent can browsememory/and naturally find self-improving insightsSupplement, not replace: Self-Improving Agent canappendhigh-confidence patterns to Agent’s memory files (with user confirmation), enriching the Agent’s knowledge{workspace}/ ├── MEMORY.md # Agent core memory (Self-Improving Agent can append) ├── memory/ │ ├── YYYY-MM-DD.md # Agent daily memory (Self-Improving Agent can append) │ └── self-improving/ # Self-Improving Agent dedicated memory space │ ├── semantic/ │ │ └── patterns.json # Abstract patterns and rules │ ├── episodic/ │ │ └── YYYY/ │ │ └── YYYY-MM-DD-{task}.json # Specific experiences │ ├── working/ │ │ ├── current_session.json # Active session data │ │ ├── last_error.json # Error context for self-correction │ │ └── session_end.json # Session end marker for consolidation │ └── index.json # Memory index and metricsMemory Interaction RulesActionTargetConditionReadMEMORY.mdAlways — to understand Agent’s accumulated knowledgeReadmemory/YYYY-MM-DD.mdAlways — to understand today’s contextAppend toMEMORY.mdOnly high-confidence patterns ( 0.9), requires user confirmationAppend tomemory/YYYY-MM-DD.mdSession summary and key learnings, requires user confirmationFull CRUDmemory/self-improving/*Self-Improving Agent’s own memory space, free to manageEvolution Priority MatrixTrigger evolution when new reusable knowledge appears:TriggerPriorityActionNew workflow pattern discoveredHighAdd to relevant skill guidanceArchitecture/design tradeoff clarifiedHighAdd to decision patternsDebugging fix or anti-pattern foundHighAdd to troubleshooting patternsSecurity or performance insightHighAdd to best practice patternsCode pattern or idiom learnedMediumAdd to coding patternsTest strategy improvementMediumUpdate testing approachTool usage optimizationMediumUpdate tool usage patternsDocumentation structure insightLowUpdate documentation templatesMulti-Memory Architecture1. Semantic Memory (memory/self-improving/semantic/patterns.json)Storesabstract patterns and rulesreusable across contexts:{patterns:{pat-2025-01-11-001:{id:pat-2025-01-11-001,name:Pattern Name,source:user_feedback|implementation_review|retrospective,confidence:0.95,applications:5,created:2025-01-11,last_applied:2025-01-15,category:coding_patterns|architecture|debugging|workflow|...,pattern:One-line summary,problem:What problem does this solve?,solution:How to apply this pattern,quality_rules:[Rule 1,Rule 2],target_skills:[skill-name-1,skill-name-2]}}}2. Episodic Memory (memory/self-improving/episodic/)Storesspecific experiences and what happened:{id:ep-2025-01-11-001,timestamp:2025-01-11T10:30:00Z,skill:debugger|coding-assistant|reviewer|...,task_type:debugging|coding|review|design|...,situation:What the user was trying to do,solution:How the issue was resolved,outcome:success|partial|failure,root_cause:Underlying issue if applicable,lesson:Key takeaway from this experience,related_pattern:pattern_id if linked,user_feedback:{rating:8,comments:Users feedback on the experience}}3. Working Memory (memory/self-improving/working/)Storescurrent session context— ephemeral data that gets consolidated at session end:{session_id:session-2025-01-11-001,started:2025-01-11T10:00:00Z,tasks_completed:[],errors_encountered:[],patterns_applied:[],pending_extractions:[]}Self-Improvement ProcessPhase 1: Experience ExtractionAfter any significant task completes, extract:What happened:task_type:{what kind of task}task:{what was being done}outcome:{success|partial|failure}Key Insights:what_went_well:[what worked]what_went_wrong:[what didnt work]root_cause:{underlying issue if applicable}User Feedback:rating:{1-10 if provided}comments:{specific feedback}Phase 2: Pattern AbstractionConvert experiences to reusable patterns. The goal is to go from concrete to abstract — patterns should be general enough to apply across different tasks but specific enough to be actionable.Concrete ExperienceAbstract Pattern“User forgot to save intermediate work”“Always persist intermediate results to files”“Code review missed SQL injection”“Add security checklist to review process”“Callback was empty, causing silent failure”“Verify all callbacks have implementations”“Ambiguous UI spec caused rework”“UI specs need exact layout specifications”Abstraction Rules:If experience_repeats 3 times:pattern_level:criticalaction:Add to Critical Mistakes or Anti-Patterns sectionIf solution_was_effective:pattern_level:best_practiceaction:Add to Best Practices sectionIf user_rating 7:pattern_level:strengthaction:Reinforce this approach in relevant skillsIf user_rating 4:pattern_level:weaknessaction:Add to What to Avoid sectionPhase 3: Skill UpdatesIMPORTANT: User Confirmation Required— Before writing any changes to skill files, you MUST:Present proposed changes— Show the user a clear summary of what will be modified:Which skill file(s) will be updatedWhat content will be added, modified, or removedThe rationale behind each change (source episode, pattern, confidence level)Wait for explicit approval— Do NOT proceed until the user confirms. Acceptable confirmations include explicit affirmative responses (e.g., “确认”, “好的”, “proceed”, “yes”).Apply changes only after approval— Once confirmed, apply the changes with evolution markers for traceability.If the user rejects or requests modifications, adjust the proposed changes accordingly and re-present for confirmation.Proposed Change Summary Format:## Proposed Skill Update **Target**: {skill-file-path} **Action**: {Add new pattern | Correct existing guidance | Update checklist} **Source**: {episode_id or trigger} **Confidence**: {X.XX} ### Changes Preview {Show the exact content that will be added/modified, using diff-style or before/after format} ### Rationale {Why this change is recommended} --- Confirm this update? (yes/no/modify)Once confirmed, update skill files withevolution markersfor traceability:!-- Evolution: 2025-01-12 | source: ep-2025-01-12-001 | task: debugging -- ## Pattern Added (2025-01-12) **Pattern**: Always verify callbacks are not empty functions **Source**: Episode ep-2025-01-12-001 **Confidence**: 0.95 ### Updated Checklist - [ ] Verify all callbacks have implementations - [ ] Test callback execution pathsCorrection Markers(when fixing wrong guidance):!-- Correction: 2025-01-12 | was: Use callback chain | reason: caused stale state -- ## Corrected Guidance Use direct state monitoring instead of callback chains for reactive updates.Use the templates intemplates/for consistent formatting. Seereferences/appendix.mdfor the full template structures.Phase 4: Memory ConsolidationUpdate semantic memory— add or update patterns inmemory/self-improving/semantic/patterns.jsonStore episodic memory— write episode tomemory/self-improving/episodic/YYYY/YYYY-MM-DD-{task}.jsonUpdate pattern confidence— increase confidence for patterns that were successfully applied, decrease for those that led to errorsPrune outdated patterns— lower confidence for patterns with no recent applications; archive patterns below 0.3 confidenceSupplement Agent memory— propose additions to Agent’s own memory files.User confirmation is REQUIREDbefore any write toMEMORY.mdormemory/YYYY-MM-DD.md. Follow the same confirmation protocol as Phase 3:What to propose:High-confidence patterns ( 0.9) as concise entries →MEMORY.mdToday’s session summary and key learnings →memory/YYYY-MM-DD.mdConfirmation format:## Proposed Agent Memory Update ### → MEMORY.md (append) {Exact content to be appended, preview here} ### → memory/YYYY-MM-DD.md (append) {Exact content to be appended, preview here} **Source patterns**: {pattern IDs and confidence levels} --- Confirm this memory update? (yes/no/modify)After approval:Append confirmed content with!-- Source: self-improving-agent | date: YYYY-MM-DD --markers for traceabilityDo NOT overwrite existing content — always append at the endSelf-CorrectionTriggered when:A command or operation returns an errorTests fail after following skill guidanceUser reports the guidance produced incorrect resultsProcess:Detect ErrorCapture error context intomemory/self-improving/working/last_error.jsonIdentify which guidance was followedVerify Root CauseWas the guidance incorrect?Was the guidance misinterpreted?Was the guidance incomplete?Propose CorrectionDraft the corrected guidance with correction markersPresent proposed changes to user for review (follow Phase 3 confirmation format)Wait for user confirmation before applying any changesApply Correction(after user approval)Update relevant skill/document with corrected guidanceAdd correction marker with reasonUpdate related patterns in semantic memoryValidate FixTest the corrected guidance if possibleAsk user to verify the fixSelf-ValidationPeriodically (or when triggered manually), verify that stored patterns and skill guidance are still accurate:Check that examples still workVerify checklists match current conventionsConfirm external references are still validDetect duplicated or conflicting guidanceUse the validation template intemplates/validation-template.mdfor structured reviews.Human-in-the-Loop FeedbackAfter each self-improvement cycle, present a summary to the user:## Self-Improvement Summary Ive learned from our session and updated: ### Patterns Extracted 1. **pattern_name**: Description (confidence: X.XX) ### Skills/Documents Updated - skill-name: What was updated ### Confidence Levels - New patterns: ~0.85 (needs more validation) - Reinforced patterns: ~0.95 (well-established) ### Your Feedback - Were these updates helpful? - Should I apply any pattern more broadly? - Any corrections needed?Integrate feedback into confidence scoring:FeedbackActionPositive (rating 7)Increase confidence, consider expanding to related skillsNeutral (rating 4-6)Keep pattern, gather more data before expandingNegative (rating 3)Decrease confidence, revise or archive patternBest PracticesDOLearn from EVERY significant task interactionExtract patterns at the right abstraction level — general enough to reuse, specific enough to be actionableAlways present proposed changes to the user and wait for explicit confirmationbefore writing to skill files OR Agent memory (MEMORY.md,memory/YYYY-MM-DD.md)Update multiple related skills when a pattern applies broadlyTrack confidence and application counts for all patternsAsk for user feedback on improvementsUse evolution/correction markers for full traceabilityValidate guidance before applying broadlyReadMEMORY.mdand today’smemory/YYYY-MM-DD.mdat the start of each self-improvement cycle for contextDON’TNEVER modify skill files or Agent memory files without user confirmation— this is a hard rule with no exceptionsNEVER overwriteAgent memory content — always append at the endOver-generalize from a single experience — wait for 2-3 occurrences before creating a patternUpdate skills without confidence trackingIgnore negative feedback — it’s the most valuable signalMake changes that break existing, working functionalityCreate contradictory patterns — resolve conflicts explicitlyApply untested patterns at high confidenceQuick StartAfter any significant task completes, this agent:Analyzeswhat happened during the taskExtractsreusable patterns and insightsProposesskill updates and presents them to the user for reviewWaitsfor explicit user confirmation before applying any skill modificationsUpdatesapproved changes to skill files with evolution markersLogsto memory (semantic episodic) for future referenceReportssummary to user and collects feedbackReferencesFor detailed memory structures, validation templates, metrics, and workflow diagrams, readreferences/appendix.md.For pattern/correction/validation templates, see thetemplates/directory:templates/pattern-template.md— Adding new patternstemplates/correction-template.md— Fixing incorrect guidancetemplates/validation-template.md— Validating skill accuracyResearch PapersSimpleMem: Efficient Lifelong Memory for LLM AgentsA Survey on the Memory Mechanism of Large Language Model AgentsLifelong Learning of LLM based AgentsEvo-Memory: DeepMind’s Benchmark