ClawSkills logoClawSkills

Self Reflection

通过结构化反思和记忆实现持续的自我提升

介绍

# 🪞 Self-Reflection

一项持续自我提升的技能。代理通过定期由心跳触发的反思来追踪错误、吸取的教训以及随时间的改进。

## 快速开始

```bash # Check if reflection is needed self-reflection check

# Log a new reflection self-reflection log "error-handling" "Forgot timeout on API call" "Always add timeout=30"

# Read recent lessons self-reflection read

# View statistics self-reflection stats ```

## 工作原理

``` Heartbeat (60m) → Agent reads HEARTBEAT.md → Runs self-reflection check │ ┌─────────┴─────────┐ ▼ ▼ OK ALERT │ │ Continue Reflect │ ┌─────────┴─────────┐ ▼ ▼ read log (past lessons) (new insights) ```

## 命令

| 命令 | 描述 | |---------|-------------| | `check [--quiet]` | 检查是否需要进行反思 (OK 或 ALERT) | | `log <tag> <miss> <fix>` | 记录一条新的反思 | | `read [n]` | 读取最近的 n 条反思 (默认:5) | | `stats` | 显示反思统计 | | `reset` | 重置计时器 |

## OpenClaw 集成

在 `~/.openclaw/openclaw.json` 中启用心跳:

```json { "agents": { "defaults": { "heartbeat": { "every": "60m", "activeHours": { "start": "08:00", "end": "22:00" } } } } } ```

将以下内容添加到您的工作区 `HEARTBEAT.md`:

```markdown ## Self-Reflection Check (required) Run `self-reflection check` at each heartbeat. If ALERT: read past lessons, reflect, then log insights. ```

## 配置

创建 `~/.openclaw/self-reflection.json`:

```json { "threshold_minutes": 60, "memory_file": "~/workspace/memory/self-review.md", "state_file": "~/.openclaw/self-review-state.json", "max_entries_context": 5 } ```

## 作者

由 [hopyky](https://github.com/hopyky) 创建

## 许可证

MIT

更多产品