SuperAPI AI Directory

Self-Evolving Skill

Coding & development

View repository

Updated 10-15 22:39

About this skill

Self-Evolving Skill

Metacognitive Self-Learning System - Predictive coding and value-driven automatic Skill evolution.

Features

  • ResidualPyramid pyramid decomposition, quantifies cognitive gaps -: residual Adaptive reflection triggering: automatically determines when learning is needed based on residual energy
  • Experience replay: caches learned patterns, reduces repeated triggering
  • Value gating: only accepts mutations if they improve long-term value
  • Persistence: automatic experience saving/loading

Installation

# 技能已安装到 ~/.openclaw/skills/self-evolving-skill
# 或使用ClawHub
clawhub install self-evolving-skill

Architecture

self-evolving-skill/
├── core/                      # Python核心
│   ├── residual_pyramid.py     # 残差金字塔(SVD分解)
│   ├── reflection_trigger.py  # 自适应触发器
│   ├── experience_replay.py   # 经验回放缓存
│   ├── skill_engine.py        # 核心引擎+ValueGate
│   ├── storage.py             # 持久化
│   └── mcp_server.py          # MCP服务器
├── src/                       # TypeScript SDK
│   ├── index.ts               # 主入口
│   ├── cli.ts                 # CLI
│   └── mcp-tools.ts           # 工具定义
├── skills/                    # OpenClaw Skill
│   └── self-evolving-skill/    # 技能封装
├── MCP_CONFIG.md              # MCP配置
└── README.md                   # 文档

MCP Tools

Tool Description Parameters
skill_create Create Skill name, description
skill_execute Execute and learn skill_id, context, success, value
skill_analyze Analyze embedding embedding
skill_list List Skills -
skill_stats System statistics -
skill_save Persistently save skill_id
skill_load Load skill_id

Usage

CLI

# 列出所有Skill
openclaw skill self-evolving-skill list

# 创建Skill
openclaw skill self-evolving-skill create --name "MySkill"

# 执行
openclaw skill self-evolving-skill execute <id> --success

# 分析
openclaw skill self-evolving-skill analyze --embedding '[0.1,0.2,...]'

# 统计
openclaw skill self-evolving-skill stats

MCP Server

# 启动MCP服务器
cd ~/.openclaw/skills/self-evolving-skill
./run_mcp.sh

# 或使用适配器
python3 mcporter_adapter.py skill_list '{}'

Programming

import { SelfEvolvingSkillEngine } from 'self-evolving-skill';

const engine = new SelfEvolvingSkillEngine();
await engine.init();

const { skillId } = await engine.createSkill({ name: 'Analyzer' });
const stats = await engine.stats();

Core Algorithms

1. Residual Pyramid Decomposition

pyramid = ResidualPyramid(max_layers=5, use_pca=True)
decomposition = pyramid.decompose(embedding)

# 输出:
# - residual_ratio: 残差能量比率
# - suggested_abstraction: POLICY / SUB_SKILL / PREDICATE
# - novelty_score: 综合新颖性

2. Three-Layer Transition Rules

Coverage Abstraction level Operation
>80% POLICY Adjust strategy weights
40-80% SUB_SKILL Generate sub-Skills
<40% PREDICATE Induce new predicates

3. Adaptive Thresholds

trigger = ReflectionTrigger(
  min_energy_ratio=0.10,     # 初始阈值
  value_gain_threshold=0.20, # 触发阈值
  target_trigger_rate=0.15   # 目标15%触发率
)

File Locations

Path Description
~/.openclaw/skills/self-evolving-skill Skills root directory
~/.openclaw/mcp_servers/self-evolving-skill.json MCP server configuration
~/.openclaw/workspace/self-evolving-skill/storage Data storage

Related Documentation