rocky-know-how

Learning knowledge skill v3.1.0 — memoryFlush-driven experience recording, bootstrap injection, draft buffering for multi-round debugging, triple-layer storage (HOT/WARM/COLD), auto-promotion/demotion. Tested & verified: deepseek-v4, glm-5.1, minimax-m2.7. Safety: regex injection prevention, path traversal filtering, concurrent write lock.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "rocky-know-how" with this command: npx skills add rockytian-top/rocky-evo

rocky-know-how v3.1.0

Experience & Knowledge Auto-Learning System for OpenClaw Agents

让 AI Agent 从失败中学习,在成功后自动记录,形成经验闭环。


🎯 When to Use / 适用场景

Scenario 场景Action 操作
Failed 2+ times 失败≥2次bash scripts/search.sh "关键词"
Solved after failures 解决后bash scripts/record.sh "问题" "踩坑" "方案" "预防" "tags" "area"
Auto on compaction 压缩时memoryFlush driven — auto extract → judge → write or draft
Auto on reset 重置时Fully automatic — Hook saves pending context
Tag used 3x/7days 晋升bash scripts/promote.sh
Tag unused 30days 降级bash scripts/demote.sh

🏗️ Architecture / 架构

Triple-Layer Storage / 三层存储

~/.openclaw/.learnings/
├── experiences.md    ← Main data (v1 compatible, all experiences)
├── memory.md         ← HOT layer (≤100 lines, always loaded)
├── domains/          ← WARM layer (by area: infra, code, wx...)
│   ├── infra.md
│   ├── code.md
│   └── global.md
├── projects/         ← WARM layer (by project)
├── archive/          ← COLD layer (90+ days)
├── drafts/           ← Auto-generated drafts (LLM judged)
├── pending/          ← Session context (before processing)
└── corrections.md    ← Correction log (auto-dedup)

Event-Driven Integration / 事件驱动

Event 事件Trigger 触发Function 功能
agent:bootstrapAgent startup 启动Inject experience reminder into systemPrompt + process old drafts
memoryFlushBefore compaction (config required)Core: extract experience → judge → write formal or draft
before_resetBefore session reset 重置前Save context as pending (fallback)

⚠️ Note: before_compaction / after_compaction hooks are gated by ownsCompaction in OpenClaw's source code and are not currently functional. We use memoryFlush instead.


🔄 Experience Recording Flow / 经验记录流程

memoryFlush-Driven (Core) / memoryFlush 驱动(核心)

Requires config — see Setup section below.

memoryFlush triggers (token threshold reached)
    │
    ▼
① Process old drafts 处理旧草稿
    ├─ Old draft + current NOT mentioning same issue → Resolved → record.sh (formal)
    └─ Old draft + current still working on it → Keep draft
    │
    ▼
② Extract new experience 提取新经验
    ├─ No draft + solved in 1 round → record.sh (formal directly)
    ├─ Same issue has draft (multi-round) → Write/update draft
    └─ Nothing worth recording → Skip
    │
    ▼
③ Write memory file 写记忆文件
    └─ Append to memory/YYYY-MM-DD.md
    │
    ▼
④ Reply NO_REPLY → Compaction begins

bootstrap (Startup) / 启动时

agent:bootstrap triggers
    ├─ Load domains/*.md → inject experience reminder into systemPrompt
    └─ Check drafts/ → process old drafts (fallback)

before_reset (Fallback) / 重置兜底

/reset or /new triggers
    └─ handler.js saves context → pending/*.json

🛡️ Safety & Security / 安全机制

Mechanism 机制Implementation 实现
Regex injection prevention 正则注入防护escape_grep() sed escaping
Path traversal filtering 路径穿越过滤replace(/[^a-zA-Z0-9_-]/g, '')
Concurrent write lock 并发写锁.write_lock/ directory atomic lock
Tag dedup promotion Tag去重晋升record.sh dedup + promote.sh threshold
Graceful degradation 降级容错LLM → keyword → write fallback chain

📊 Scripts Reference / 脚本说明

Script 脚本Lines 行数Function 功能
handler.js1,110Core hook handler (4 events, LLM integration)
search.sh539Search experiences (keyword / preview / all)
record.sh476Write new experience (with dedup & lock)
demote.sh371Demote HOT tags to WARM
compact.sh348Compress layers when exceeding limits
clean.sh247Remove test/invalid entries
vectors.sh232Vector search via LM Studio embeddings
promote.sh185Promote WARM tags to HOT (≥3x/7days)
import.sh172Import experiences from other sources
archive.sh167Archive old experiences to COLD
install.sh161Install skill to workspace
stats.sh153Show statistics dashboard
auto-review.sh136Auto-review pending drafts
append-record.sh100Append solution to existing experience
summarize-drafts.sh80Summarize and process drafts
update-record.sh77Update existing experience
common.sh41Shared utility functions
uninstall.sh37Remove skill
Total 共计4,632

✅ Verified Testing / 测试验证

Models Tested / 已测试模型

Model 模型ProviderForward Test 正向Reverse Test 逆向Status
deepseek-v4deepseek (api-key)✅ Pass✅ Pass (144/150)Verified
glm-5.1zai (api-key)✅ Pass✅ Pass (146/150)Verified
MiniMax-M2.7-highspeedminimax-portal (OAuth)✅ Pass✅ Pass (146/150)Verified

Test Coverage / 测试覆盖

Test 测试Result 结果
agent:bootstrap → systemPrompt injection✅ 12→952 chars
before_compaction → pending save✅ task/tools/errors extracted
after_compaction → LLM dual-judge → write✅ EXP auto-created
before_reset → fallback save✅ pending saved
record.sh write + search✅ Write & find
auto-review.sh process draft✅ Draft → archive
compact.sh dry-run✅ All layers healthy
promote.sh tag promotion✅ Threshold check
stats.sh dashboard✅ Full panel
5 safety mechanisms✅ All present

🚀 Installation / 安装(下载即用)

一键安装

# Clone
git clone https://gitee.com/rocky_tian/skill.git
cd skill/rocky-know-how

# 一键安装(自动配置 Hook + memoryFlush + 重启网关)
bash scripts/install.sh

# 验证安装
bash scripts/stats.sh

install.sh 自动完成:

  • ✅ 创建经验诀窍目录结构
  • ✅ 初始化存储文件
  • ✅ 配置 Hook(agent:bootstrap / before_compaction / after_compaction / before_reset)
  • ✅ 配置 memoryFlush(softThresholdTokens: 8000)
  • ✅ 重启网关使配置生效

📈 Key Advantages / 核心优势

  1. memoryFlush-driven auto-learning — Experience recording triggered before every compaction
  2. LLM dual-judgment — First judges if worth saving, then decides create vs append
  3. Triple degradation — LLM → keyword → write, never loses data
  4. Multi-provider — Supports OpenAI, Anthropic, OAuth providers (zai/stepfun/minimax)
  5. Production proven — 45+ real experiences, 2.6MB data, stable operation
  6. Safety first — 5 security mechanisms (regex injection, path traversal, write lock, etc.)

Version: 3.1.0 | Tested: 2026-04-24 | License: MIT

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Research

抖音搜索关键词

抖音公开数据智能分析工具。支持关键词搜索排序、抖人作品抓取、实时热榜获取,适用于短视频营销、竞品分析和热点监控,助力爆款内容策划与流量追踪。

Registry SourceRecently Updated
7884um-why
Research

hello-skills

helloskills provides quantitative strategy analysis and signal generation based on input parameters, returning execution status and data.

Registry SourceRecently Updated
Research

IMA知识库上传

上传Markdown文件到IMA知识库的标准流程。 方法A(推荐):笔记import_doc → add_knowledge(支持markdown,最简单) 方法B:create_media → COS上传 → add_knowledge(支持任意文件) ⚠️ title必须等于file_name。

Registry SourceRecently Updated
00Profile unavailable
Research

exam-question-generator

读取 knowledge_map.json,按三套差异化规则生成模拟题(基础巩固/综合能力/冲刺模拟), AI 生成题目内容写入 questions.json,运行脚本渲染三 Tab 独立 HTML, 生成后引导用户选择下一步。

Registry SourceRecently Updated
00Profile unavailable