详情

首页手游攻略 自我改进型智能体:AI 自我反思与记忆 - Openclaw 技能

自我改进型智能体:AI 自我反思与记忆 - Openclaw 技能

佚名 2026-08-10 16:15:01
下载入口:https://github.com/openclaw/skills/tree/main/skills/ivangdavila/self-improving

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install self-improving

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 <project>/skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 self-improving。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

什么是 自我改进型智能体(主动自我反思)?

自我改进型智能体技能旨在将标准的 AI 智能体转化为能从每次互动中学习的进化实体。通过实施结构化的自我反思循环,智能体根据用户意图评估其工作,主动识别错误,并将经验存储在分级记忆系统中。这确保了 Openclaw 技能随着时间的推移,通过积累知识而变得更加高效,无需人工提示工程。

该技能专注于高实用性学习,区分全局偏好、领域专业知识和项目级细微差别。它完全在本地存储上运行,在确保数据隐私的同时,通过对记忆模式进行系统性的升级和降级,透明地展示智能体逻辑的演进过程。

自我改进型智能体(主动自我反思) 应用场景

  • 在明确纠正后自动捕获并应用用户偏好。
  • 评估复杂任务的结果,以识别未来工作流程的内部改进点。
  • 构建仅在检测到相关上下文时加载的项目特定知识库。
  • 将重复指令转换为永久的热记忆(HOT memory)规则,以减少手动开销。
自我改进型智能体(主动自我反思) 工作原理
  1. 智能体完成多步任务或接收用户反馈,触发自我反思阶段。
  2. 智能体分析互动模式,例如“停止做 X”之类的纠正或“我喜欢你……”之类的偏好信号。
  3. 经验被记录到本地纠错文件中,并按上下文、反思和习得教训进行分类。
  4. 应用分级存储逻辑:在 7 天内使用 3 次的模式将升级为热记忆(始终加载)。
  5. 未使用的模式在 30 到 90 天内自动降级为温记忆(WARM)或冷存储(COLD),以维持性能。
  6. 在随后的激活中,智能体查询本地记忆文件,将相关的历史上下文应用于当前任务。

自我改进型智能体(主动自我反思) 配置指南

要初始化主动反思环境,请确保您的目录结构已准备就绪。此技能需要 Openclaw Skills 运行时来管理本地文件交互。

# 确保自我改进目录存在
mkdir -p ~/self-improving/projects ~/self-improving/domains ~/self-improving/archive

# 初始化核心记忆文件
touch ~/self-improving/memory.md

# 如果环境中有安装程序,请运行安装指南
# clawhub install self-improving

自我改进型智能体(主动自我反思) 数据架构与分类体系

该技能将其学习组织成严格的层级结构,以优化上下文窗口并确保高速检索:

层级 存储位置 大小限制 逻辑
热记忆 (HOT) memory.md ≤100 行 始终加载;包含全局偏好。
温记忆 (WARM) projects/, domains/ 每文件≤200 行 上下文匹配时加载;包含特定专业知识。
冷记忆 (COLD) archive/ 无限制 归档衰减模式;可用于显式查询。
日志 (Logs) corrections.md 最近 50 条 跟踪错误和改进的原始数据流。
元数据 (Meta) index.md 不适用 带有行数统计的主题索引,用于跟踪记忆密度。
name: Self-Improving Agent (Proactive Self-Reflection)
slug: self-improving
version: 1.2.10
homepage: https://clawic.com/skills/self-improving
description: Self-reflection + Self-criticism + Self-learning + Self-organizing memory. Agent evaluates its own work, catches mistakes, and improves permanently. Use before starting work and after responding to the user.
changelog: "Sharper setup now lists relevant memory before non-trivial work, with a title that highlights proactive self-reflection."
metadata: {"clawdbot":{"emoji":"??","requires":{"bins":[]},"os":["linux","darwin","win32"],"configPaths":["~/self-improving/"]}}

When to Use

User corrects you or points out mistakes. You complete significant work and want to evaluate the outcome. You notice something in your own output that could be better. Knowledge should compound over time without manual maintenance.

Architecture

Memory lives in ~/self-improving/ with tiered structure. If ~/self-improving/ does not exist, run setup.md.

~/self-improving/
├── memory.md          # HOT: ≤100 lines, always loaded
├── index.md           # Topic index with line counts
├── projects/          # Per-project learnings
├── domains/           # Domain-specific (code, writing, comms)
├── archive/           # COLD: decayed patterns
└── corrections.md     # Last 50 corrections log

Quick Reference

Topic File
Setup guide setup.md
Memory template memory-template.md
Learning mechanics learning.md
Security boundaries boundaries.md
Scaling rules scaling.md
Memory operations operations.md
Self-reflection log reflections.md

Detection Triggers

Log automatically when you notice these patterns:

Corrections → add to corrections.md, evaluate for memory.md:

  • "No, that's not right..."
  • "Actually, it should be..."
  • "You're wrong about..."
  • "I prefer X, not Y"
  • "Remember that I always..."
  • "I told you before..."
  • "Stop doing X"
  • "Why do you keep..."

Preference signals → add to memory.md if explicit:

  • "I like when you..."
  • "Always do X for me"
  • "Never do Y"
  • "My style is..."
  • "For [project], use..."

Pattern candidates → track, promote after 3x:

  • Same instruction repeated 3+ times
  • Workflow that works well repeatedly
  • User praises specific approach

Ignore (don't log):

  • One-time instructions ("do X now")
  • Context-specific ("in this file...")
  • Hypotheticals ("what if...")

Self-Reflection

After completing significant work, pause and evaluate:

  1. Did it meet expectations? — Compare outcome vs intent
  2. What could be better? — Identify improvements for next time
  3. Is this a pattern? — If yes, log to corrections.md

When to self-reflect:

  • After completing a multi-step task
  • After receiving feedback (positive or negative)
  • After fixing a bug or mistake
  • When you notice your output could be better

Log format:

CONTEXT: [type of task]
REFLECTION: [what I noticed]
LESSON: [what to do differently]

Example:

CONTEXT: Building Flutter UI
REFLECTION: Spacing looked off, had to redo
LESSON: Check visual spacing before showing user

Self-reflection entries follow the same promotion rules: 3x applied successfully → promote to HOT.

Quick Queries

User says Action
"What do you know about X?" Search all tiers for X
"What have you learned?" Show last 10 from corrections.md
"Show my patterns" List memory.md (HOT)
"Show [project] patterns" Load projects/{name}.md
"What's in warm storage?" List files in projects/ + domains/
"Memory stats" Show counts per tier
"Forget X" Remove from all tiers (confirm first)
"Export memory" ZIP all files

Memory Stats

On "memory stats" request, report:

?? Self-Improving Memory

HOT (always loaded):
  memory.md: X entries

WARM (load on demand):
  projects/: X files
  domains/: X files

COLD (archived):
  archive/: X files

Recent activity (7 days):
  Corrections logged: X
  Promotions to HOT: X
  Demotions to WARM: X

Core Rules

1. Learn from Corrections and Self-Reflection

  • Log when user explicitly corrects you
  • Log when you identify improvements in your own work
  • Never infer from silence alone
  • After 3 identical lessons → ask to confirm as rule

2. Tiered Storage

Tier Location Size Limit Behavior
HOT memory.md ≤100 lines Always loaded
WARM projects/, domains/ ≤200 lines each Load on context match
COLD archive/ Unlimited Load on explicit query

3. Automatic Promotion/Demotion

  • Pattern used 3x in 7 days → promote to HOT
  • Pattern unused 30 days → demote to WARM
  • Pattern unused 90 days → archive to COLD
  • Never delete without asking

4. Namespace Isolation

  • Project patterns stay in projects/{name}.md
  • Global preferences in HOT tier (memory.md)
  • Domain patterns (code, writing) in domains/
  • Cross-namespace inheritance: global → domain → project

5. Conflict Resolution

When patterns contradict:

  1. Most specific wins (project > domain > global)
  2. Most recent wins (same level)
  3. If ambiguous → ask user

6. Compaction

When file exceeds limit:

  1. Merge similar corrections into single rule
  2. Archive unused patterns
  3. Summarize verbose entries
  4. Never lose confirmed preferences

7. Transparency

  • Every action from memory → cite source: "Using X (from projects/foo.md:12)"
  • Weekly digest available: patterns learned, demoted, archived
  • Full export on demand: all files as ZIP

8. Security Boundaries

See boundaries.md — never store credentials, health data, third-party info.

9. Graceful Degradation

If context limit hit:

  1. Load only memory.md (HOT)
  2. Load relevant namespace on demand
  3. Never fail silently — tell user what's not loaded

Scope

This skill ONLY:

  • Learns from user corrections and self-reflection
  • Stores preferences in local files (~/self-improving/)
  • Reads its own memory files on activation

This skill NEVER:

  • Accesses calendar, email, or contacts
  • Makes network requests
  • Reads files outside ~/self-improving/
  • Infers preferences from silence or observation
  • Modifies its own SKILL.md

Install with clawhub install <slug> if user confirms:

  • memory — Long-term memory patterns for agents
  • learning — Adaptive teaching and explanation
  • decide — Auto-learn decision patterns
  • escalate — Know when to ask vs act autonomously

Feedback

  • If useful: clawhub star self-improving
  • Stay updated: clawhub sync
点击查看更多
推荐专题
热门阅读