← 返回 Skills 市场
mrhenghu

Agent Self Reflection 1.0.0

作者 mrhenghu · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
338
总下载
0
收藏
10
当前安装
1
版本数
在 OpenClaw 中安装
/install agent-self-reflection-1-0-0
功能描述
Periodic self-reflection on recent sessions. Analyzes what went well, what went wrong, and writes concise, actionable insights to the appropriate workspace f...
使用说明 (SKILL.md)

Self-Reflection Skill

Reflect on recent sessions and extract actionable insights. Runs hourly via cron.

Step 1: Gather Recent Sessions

# List sessions active in the last 2 hours
openclaw sessions --active 120 --json

Parse the output to get session keys and IDs. Skip subagent sessions (they're task workers, not interesting for reflection). Focus on:

  • Telegram group/topic sessions (real user interactions)
  • Direct sessions (1:1 with Brenner)
  • Cron-triggered sessions (how did automated tasks go?)

Step 2: Read Session History

For each interesting session from Step 1, read the JSONL transcript:

# Read the last ~50 lines of each session file (keep it bounded!)
tail -50 ~/.openclaw/agents/main/sessions/\x3CsessionId>.jsonl

⚠️ CRITICAL: Never load full session files. Use tail -50 or Read with offset/limit. Sessions can be 100k+ tokens.

Parse the JSONL to understand what happened. Look for:

  • type: "user" or type: "human" — what was asked
  • type: "assistant" — what you responded
  • type: "tool_use" / type: "tool_result" — what tools were called and results
  • Error patterns, retries, confusion

Step 3: Analyze & Extract Insights

For each session, ask yourself:

What went well?

  • Tasks completed smoothly on first try
  • Good tool usage patterns worth reinforcing
  • Efficient approaches to remember

What went wrong?

  • Errors, retries, wrong approaches
  • Misunderstandings of user intent
  • Tools that didn't work as expected
  • Context that was missing

Lessons learned?

  • "Next time, do X instead of Y"
  • "Remember that Z works this way"
  • "Tool A needs parameter B or it fails"
  • "When user says X, they usually mean Y"

Quality bar: Each insight must be:

  • Specific — not "be more careful" but "check if file exists before editing"
  • Actionable — something future-you can directly apply
  • Non-obvious — skip things any competent agent would know
  • New — don't repeat insights already captured

Step 4: Route Insights to the Right Files

Each insight belongs somewhere specific. Route them:

AGENTS.md

  • Process improvements (how to handle sessions, memory, etc.)
  • New conventions or workflow rules
  • Safety lessons

TOOLS.md

  • Tool-specific gotchas ("gog needs --json flag for parsing")
  • Environment details (paths, configs, quirks)
  • New tool patterns discovered

memory/YYYY-MM-DD.md (today's date)

  • Session-specific context ("Brenner asked about X project")
  • Temporary facts that matter today but not forever
  • What happened today (events, decisions, requests)

memory/about-user.md

  • New preferences discovered
  • Communication style observations
  • Project/interest updates

skills/\x3Cskill-name>/SKILL.md

  • Improvements to specific skill instructions
  • Bug fixes in skill workflows
  • New parameters or approaches for a skill

MEMORY.md

  • Updates to the memory index if new memory files are created

Step 5: Write the Insights

For each insight, append or edit the appropriate file. Use the Edit tool for surgical changes to existing content. Use append (write to end) for daily memory files.

Format for daily memory files:

## Self-Reflection — HH:MM ET

### Insights
- [source: session-key] Lesson learned here
- [source: session-key] Another insight

### Tool Notes
- Discovered: tool X needs Y configuration

### User Context
- Brenner mentioned interest in Z

Step 6: Summary

After writing all insights, produce a brief summary of what you reflected on and what you wrote. This is your output — keep it to 2-4 sentences max.

If there's nothing interesting to reflect on (quiet period, only heartbeats), just say so. Don't manufacture insights.

Quality Checklist

Before writing any insight:

  • Is this actually new? (Check existing files first)
  • Is this specific and actionable?
  • Am I routing it to the right file?
  • Am I keeping daily memory files concise (not dumping full transcripts)?
  • Did I respect the token budget (no huge file reads)?

Anti-Patterns (Don't Do These)

  • ❌ Don't summarize every session — only extract lessons
  • ❌ Don't read full JSONL files — tail/limit only
  • ❌ Don't write vague insights ("improve response quality")
  • ❌ Don't duplicate existing knowledge
  • ❌ Don't create new files when appending to existing ones works
  • ❌ Don't reflect on your own reflection sessions (skip cron:self-reflection sessions)
安全使用建议
This skill appears coherent with its purpose, but before installing: (1) confirm you trust the openclaw CLI and the environment the agent runs in, since session transcripts may contain sensitive data; (2) decide and document retention/permissions for memory files (memory/about-user.md can capture PII); (3) run the script manually first to review its outputs (dry-run) and ensure it correctly limits reads to tail -50 as promised; (4) if you will schedule it as a cron job, ensure the job runs with an account that has only the minimal file permissions needed (so it can't access unrelated directories).
功能分析
Type: OpenClaw Skill Name: agent-self-reflection-1-0-0 Version: 1.0.0 The skill enables the agent to modify its own instructions (SKILL.md) and configuration (AGENTS.md) by reflecting on past session logs. This self-modification is a high-risk capability vulnerable to indirect prompt injection, as malicious content in logs could be promoted to permanent agent instructions. Additionally, the helper script scripts/summarize-sessions.sh is vulnerable to shell injection through its first argument when calling the openclaw CLI. While these behaviors are aligned with the stated purpose of self-reflection, they represent significant security vulnerabilities (risky capabilities) rather than clear evidence of intentional malice.
能力评估
Purpose & Capability
Name/description describe periodic analysis of recent sessions; the included script and SKILL.md both only enumerate reading recent sessions (tail -50) and writing structured insights to workspace files (AGENTS.md, TOOLS.md, memory/*, skills/*). No unrelated credentials, binaries, or installs are requested.
Instruction Scope
Instructions are focused and explicit about limiting reads (tail -50) and not loading full JSONL files; they direct the agent to append/edit specific workspace files. Note: the skill necessarily reads session transcripts which may contain sensitive user data — this is expected for the stated purpose but is a privacy consideration rather than an incoherence.
Install Mechanism
No install spec; skill is instruction-only with a small helper script. The script uses local CLI (openclaw), tail, python3 and does not download or execute external code from untrusted URLs.
Credentials
The skill declares no environment variables, credentials, or config paths. The runtime instructions reference only the local OpenClaw sessions directory (~/.openclaw/agents/main/sessions) which is appropriate for reflecting on sessions.
Persistence & Privilege
always:false (no forced inclusion). The skill can be invoked autonomously (normal platform default) and is described to run as a cron job, which is consistent with its purpose and not unusually privileged. It does write to workspace files (its intended output) but does not modify other skills' configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-self-reflection-1-0-0
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-self-reflection-1-0-0 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the self-reflection skill—enables periodic analysis of recent sessions to extract actionable insights. - Gathers recent Telegram, direct, and cron-triggered sessions, ignoring subagent and self-reflection sessions. - Reviews only the latest portion of session transcripts (with strict token and size limits) to identify what went well, what went wrong, and lessons learned. - Routes insights to appropriate files such as AGENTS.md, TOOLS.md, daily memory, about-user.md, skill docs, and memory index. - Emphasizes concise, specific, and non-redundant insights, avoiding vague, obvious, or duplicate notes.
元数据
Slug agent-self-reflection-1-0-0
版本 1.0.0
许可证 MIT-0
累计安装 10
当前安装数 10
历史版本数 1
常见问题

Agent Self Reflection 1.0.0 是什么?

Periodic self-reflection on recent sessions. Analyzes what went well, what went wrong, and writes concise, actionable insights to the appropriate workspace f... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 338 次。

如何安装 Agent Self Reflection 1.0.0?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-self-reflection-1-0-0」即可一键安装,无需额外配置。

Agent Self Reflection 1.0.0 是免费的吗?

是的,Agent Self Reflection 1.0.0 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agent Self Reflection 1.0.0 支持哪些平台?

Agent Self Reflection 1.0.0 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agent Self Reflection 1.0.0?

由 mrhenghu(@mrhenghu)开发并维护,当前版本 v1.0.0。

💬 留言讨论