{"skill":{"slug":"openclaw-reflect","displayName":"openclaw-reflect","summary":"Self-improvement layer with evaluation separation, rollback, and tiered operator gates. Observes outcomes across sessions, detects recurring patterns, propos...","description":"---\r\nname: openclaw-reflect\r\nversion: 1.0.2\r\ndescription: >\r\n  Self-improvement layer with evaluation separation, rollback, and tiered operator gates.\r\n  Observes outcomes across sessions, detects recurring patterns, proposes improvements,\r\n  validates proposals through a separate evaluator invocation, and applies changes\r\n  safely with snapshot/rollback capability.\r\nauthor: AtlasPA\r\ntags: [self-improvement, reflection, memory, safety, hooks, evaluation]\r\nhooks:\r\n  - event: PostToolUse\r\n    path: hooks/post-tool-use.js\r\n  - event: SessionEnd\r\n    path: hooks/session-end.js\r\n  - event: UserPromptSubmit\r\n    path: hooks/user-prompt-submit.js\r\npermissions:\r\n  - read: workspace\r\n  - write: .reflect/\r\n  - write: MEMORY.md\r\n  - write: CLAUDE.md\r\n  - propose: SOUL.md\r\nenv:\r\n  optional:\r\n    - ANTHROPIC_API_KEY     # Enables Anthropic evaluator backend (claude-haiku-4-5-20251001)\r\n    - OPENAI_API_KEY        # Enables OpenAI evaluator backend (gpt-4o-mini)\r\n    - OLLAMA_HOST           # Ollama server hostname (default: localhost)\r\n    - OLLAMA_PORT           # Ollama server port (default: 11434)\r\n    - REFLECT_EVAL_MODEL    # Force a specific Ollama model name\r\n    - REFLECT_EVALUATOR     # Force evaluator backend: anthropic|openai|ollama|rules\r\n---\r\n\r\n# openclaw-reflect\r\n\r\nYou have access to a self-improvement system. It observes your tool outcomes across\r\nsessions, detects recurring failure patterns, and proposes targeted changes to your\r\npersistent memory and instructions.\r\n\r\n## Your responsibilities\r\n\r\n### During work\r\nThe PostToolUse hook records outcomes automatically. You do not need to do anything\r\nunless you notice a significant failure that has no clear cause — in that case, write\r\na manual observation:\r\n\r\n```\r\nnode .reflect/scripts/observe.js --manual \\\r\n  --type error \\\r\n  --tool \"ToolName\" \\\r\n  --pattern \"brief description of what went wrong\" \\\r\n  --context \"what you were trying to do\"\r\n```\r\n\r\n### When prompted (UserPromptSubmit will inject this)\r\nIf `.reflect/pending.json` contains proposals awaiting operator approval, surface them:\r\n\"I have improvement proposals ready for your review. Run `node .reflect/scripts/status.js`\r\nto see them, or ask me to show you.\"\r\n\r\n### At session end (automatic)\r\nThe SessionEnd hook runs classification and promotion automatically. It will:\r\n1. Detect patterns with recurrence >= 3 across >= 2 sessions\r\n2. Generate a structured proposal\r\n3. Route to evaluator for validation\r\n4. Apply low-blast-radius approvals to MEMORY.md automatically\r\n5. Queue high-blast-radius or SOUL.md changes for operator approval\r\n\r\nYou will see a summary in the session-end output.\r\n\r\n## Blast radius tiers\r\n\r\n| Tier | Targets | Gate |\r\n|------|---------|------|\r\n| 0 — Observation | `.reflect/outcomes.jsonl` | Automatic (hooks) |\r\n| 1 — MEMORY.md | Factual corrections, preference updates | Auto-apply if confidence >= 0.7 |\r\n| 2 — CLAUDE.md / project instructions | Behavioral pattern changes | Auto-apply if confidence >= 0.85 |\r\n| 3 — SOUL.md | Core values, identity, constraints | Operator approval always required |\r\n\r\n## The evaluator gate\r\n\r\nBefore any Tier 1+ change is applied, a separate evaluator invocation checks:\r\n- Does this contradict existing principles or memory?\r\n- Is the pattern truly recurring or is it a sampling artifact?\r\n- What is the smallest change that addresses the root cause?\r\n- Could this change cause a regression elsewhere?\r\n\r\nThe evaluator is instructed to be skeptical. A proposal that passes evaluation is more\r\nlikely to be a genuine improvement than one the same reasoning process that made the\r\nmistake would produce.\r\n\r\n## Rollback\r\n\r\nEvery applied change is preceded by a warden snapshot (if openclaw-warden is installed)\r\nand recorded in `.reflect/applied.jsonl`. To revert the last change:\r\n\r\n```\r\nnode .reflect/scripts/rollback.js\r\n```\r\n\r\nTo revert a specific change by ID:\r\n```\r\nnode .reflect/scripts/rollback.js --id <change-id>\r\n```\r\n\r\n## State files\r\n\r\n| File | Purpose |\r\n|------|---------|\r\n| `.reflect/outcomes.jsonl` | Append-only outcome event log |\r\n| `.reflect/patterns.json` | Current detected patterns (rebuilt each session) |\r\n| `.reflect/proposals.json` | Pending proposals (pre-evaluation) |\r\n| `.reflect/pending.json` | Proposals awaiting operator approval |\r\n| `.reflect/applied.jsonl` | Append-only log of applied changes |\r\n| `.reflect/snapshots/` | Pre-change snapshots for rollback |\r\n\r\n## Voluntary contribution\r\n\r\nopenclaw-reflect is free. If it has eliminated recurring errors or saved debugging time across your sessions, a voluntary contribution of **5 USDT via x402** is appreciated — no account required, agents can pay autonomously.\r\n\r\nSee [AGENT-PAYMENTS.md](AGENT-PAYMENTS.md) for details.\r\n\r\n## Operator commands\r\n\r\n```bash\r\n# Show current status\r\nnode .reflect/scripts/status.js\r\n\r\n# Review pending proposals\r\nnode .reflect/scripts/status.js --pending\r\n\r\n# Approve a specific proposal\r\nnode .reflect/scripts/apply.js --id <proposal-id> --approve\r\n\r\n# Reject a proposal\r\nnode .reflect/scripts/apply.js --id <proposal-id> --reject\r\n\r\n# Roll back last change\r\nnode .reflect/scripts/rollback.js\r\n\r\n# Show improvement history\r\nnode .reflect/scripts/status.js --history\r\n```\r\n","topics":["Self Improvement","Evaluation","Hooks","Reflection","Safety"],"tags":{"latest":"1.0.2"},"stats":{"comments":0,"downloads":1275,"installsAllTime":48,"installsCurrent":5,"stars":0,"versions":3},"createdAt":1771718359133,"updatedAt":1779077196352},"latestVersion":{"version":"1.0.2","createdAt":1771860571230,"changelog":"openclaw-reflect 1.0.2\n\n- Added support for multiple evaluator backends (Anthropic, OpenAI, Ollama, rules) via new optional environment variables in SKILL.md.\n- Updated documentation to describe configuration using ANTHROPIC_API_KEY, OPENAI_API_KEY, OLLAMA_HOST/PORT, REFLECT_EVAL_MODEL, and REFLECT_EVALUATOR.\n- No changes to workflow or operator commands; improvements center on flexible evaluation options.","license":null},"metadata":null,"owner":{"handle":"atlaspa","userId":"s17cbdkg4hkk4m581rvtwd7t5x885p6e","displayName":"AtlasPA","image":"https://avatars.githubusercontent.com/u/231540010?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779948137694}}