返回顶部
f

feedback-learning反馈学习系统

Zero-LLM feedback learning system for OpenClaw agents. Detects user feedback (emoji reactions, text signals like "переделай"/"круто"), logs events, tracks positive AND negative patterns, auto-promotes structured rules with behavioral delta test, and generates weekly reports. Supports Russian and English. No API keys needed — runs entirely on shell scripts and Python.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 2.0.0
安全检测
已通过
88
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

feedback-learning

反馈学习系统 v2

一个完整的、零LLM管道,供智能体从用户反馈中学习。追踪有效行为,捕捉无效行为,推广持久规则。

架构

用户反馈 / 执行错误

detect-feedback.py ←── error-catcher.sh (PostToolUse 钩子)

log-event.sh ──────────────────────────────────────────→ events.jsonl

analyze-patterns.py (每日夜间)

patterns.json
(正向 + 负向模式)
↓ (≥3次命中, 增量测试)
genes.json
(结构化规则: 条件→行动)

weekly-report.py (每周日)

reports/WEEKLY_*.md

快速参考

场景操作
用户给出正面反馈log-event.sh <智能体> positive usernlp <上下文> <信号>
用户纠正/投诉
log-event.sh <智能体> correction usernlp <上下文> <信号> <教训> | | 执行命令失败 | log-event.sh <智能体> error exec_fail <上下文> <错误输出> <教训> | | 从文本检测反馈 | python3 detect-feedback.py 重做这个 | | 立即运行模式分析 | python3 analyze-patterns.py | | 立即生成报告 | python3 weekly-report.py | | 检查活跃规则(基因) | python3 check-genes.py | | 标记基因已解决 | python3 check-genes.py --resolve <基因ID> |

设置

1. 安装文件

bash
DIR=${FEEDBACKLEARNINGDIR:-$HOME/.openclaw/shared/learning}
mkdir -p $DIR/reports
cp scripts/* $DIR/
chmod +x $DIR/log-event.sh $DIR/error-catcher.sh
touch $DIR/events.jsonl

2. 初始化数据文件

bash
DIR=${FEEDBACKLEARNINGDIR:-$HOME/.openclaw/shared/learning}

[ -f $DIR/patterns.json ] || cat > $DIR/patterns.json << EOF
{version: 2.1, updated: , patterns: {negative: [], positive: []}}
EOF

[ -f $DIR/genes.json ] || cat > $DIR/genes.json << EOF
{version: 2.1, rules: []}
EOF

[ -f $DIR/capsules.json ] || cat > $DIR/capsules.json << EOF
{version: 2.1, capsules: []}
EOF

3. 添加到 AGENTS.md 启动序列

markdown

反馈学习


任务前:检查 $FEEDBACKLEARNINGDIR/genes.json 中适用的规则。

自动检测并记录信号:

  • - 正面词汇/表情 → bash $DIR/log-event.sh <智能体> positive usernlp <上下文> <信号>
  • 负面/纠正 → bash $DIR/log-event.sh <智能体> correction usernlp <上下文> <信号> <教训>
  • 执行失败(退出码≠0) → bash $DIR/log-event.sh <智能体> error exec_fail <上下文> <错误输出[:200]> <教训>

4. 设置定时任务

模式分析 (每日凌晨3:30)

schedule: cron 30 3 * @ Europe/Moscow payload: python3 ~/.openclaw/shared/learning/analyze-patterns.py

周报 (每周日凌晨4:00)

schedule: cron 0 4 0 @ Europe/Moscow payload: python3 ~/.openclaw/shared/learning/weekly-report.py

5. (可选) 钩子集成用于自动错误捕获

适用于 Claude Code / Codex 钩子:

json
{
hooks: {
PostToolUse: [{
matcher: Bash,
hooks: [{type: command, command: bash ~/.openclaw/shared/learning/error-catcher.sh}]
}]
}
}

使用方法

手动记录事件

bash
DIR=${FEEDBACKLEARNINGDIR:-$HOME/.openclaw/shared/learning}

错误

bash $DIR/log-event.sh anton error exec_fail \ 更新 openclaw.json SyntaxError: 尾随逗号 \ 写入前始终使用 python3 -c 验证 JSON

正面

bash $DIR/log-event.sh anton positive user_nlp \ 生成了周报 🔥 太棒了!

纠正

bash $DIR/log-event.sh anton correction user_nlp \ 以错误格式发送消息 不对,用markdown格式 \ 发送到Telegram前确认输出格式

从文本检测反馈 (无需LLM)

bash
echo 酷,收到了! | python3 detect-feedback.py

→ {type: positive, source: user_nlp, signal: 酷, confidence: 0.8}

python3 detect-feedback.py 重做这个,格式不对

→ {type: correction, source: user_nlp, signal: 重做, confidence: 0.8}

管道模式用于钩子使用

echo $TOOL_OUTPUT | python3 detect-feedback.py --pipe | bash log-event.sh auto

任务前检查活跃规则

bash
python3 check-genes.py

列出活跃规则,标记过时规则

python3 check-genes.py --filter exec_fail

按类型筛选

python3 check-genes.py --resolve gene20260310120000_0

将已解决的规则标记为非活跃

数据文件

文件用途
events.jsonl仅追加的事件日志(所有反馈),通过内容哈希去重
patterns.json
分组模式:包括正向和负向,含计数 | | genes.json | 推广的结构化规则(条件 → 行动 → 上下文) | | capsules.json | 成功的推理路径,避免重复计算 | | reports/ | 每周综合报告 |

事件模式

json
{
ts: 2026-03-20T12:00:00Z,
id: sha256_前8位,
agent: anton,
type: error|correction|positive|requery,
source: execfail|usernlp|user_emoji|requery|auto,
context: 智能体正在做什么,
signal: 触发文本或表情,
hint: 建议的修复或规则,
heat: 1
}

基因(推广规则)模式 v2

json
{
id: gene20260310120000_0,
status: active|stale|resolved|wont-fix,
origin: 原始信号/模式文本,
type: error|correction|positive,
condition: 当执行X时,
action: 执行Y而不是Z,
context: 额外上下文,
agents: [anton],
occurrences: 3,
last_seen: 2026-03-20T...,
promoted_at: 2026-03-20T...,
expires: null,
active: true
}

推广流程 (v2)

  1. 1. 事件累积在 events.jsonl 中(按哈希去重)
  2. analyze-patterns.py 对相似事件进行分组(包括正向和负向)
  3. 30天内模式命中≥3次 → 行为增量测试:此规则是否会改变未来的决策?如果是 → 推广。
  4. 推广的基因具有结构化字段:condition、action、context
  5. 停滞检查:如果基因存在但相同模式持续出现 → 将基因标记为 stale 并升级处理
  6. 基因在90天无活动后自动过期(没有匹配的新事件)
  7. weekly-report.py 包含基因健康状态:活跃/过时/已解决计数

支持的语言

  • - 俄语: 20+ 负向触发词,19+ 正向触发词,纠正模式
  • 英语: 10 个负向触发词,8 个正向触发词
  • 表情符号: 通用的正向/负向反应

v2 新增功能

| 功能 | v1 | v2 |
|---------|----|----|
| 正向模式追踪

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 feedback-learning-v2-1776119733 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 feedback-learning-v2-1776119733 技能

通过命令行安装

skillhub install feedback-learning-v2-1776119733

下载

⬇ 下载 feedback-learning v2.0.0(免费)

文件大小: 14.31 KB | 发布时间: 2026-4-14 14:44

v2.0.0 最新 2026-4-14 14:44
Version 2.0.0 of feedback-learning introduces major upgrades to feedback detection, tracking, and learning:

- Now tracks both positive and negative patterns—positive triggers are analyzed and promoted alongside corrections.
- Structured rules (genes) use a new detailed schema with condition, action, and context fields for clearer auto-promotion and diagnostics.
- Adds lifecycle statuses for rules: active, stale, resolved, or wont-fix, with automatic resolution and stagnation checks.
- Introduces a Behavioral Delta Test to ensure only meaningful rules are promoted.
- Data files, cron integration, shell/Python automation, and Russian/English feedback detection are thoroughly documented and streamlined.
- Weekly reporting and analysis are enhanced, including rule health and recurring pattern detection.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部