返回顶部
m

metacognition

Self-reflection engine for AI agents. Extracts patterns from session transcripts into a weighted graph with Hebbian learning and time decay. Compiles a token-budgeted lens of active self-knowledge.

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

metacognition

# Metacognition Skill A self-reflection engine for AI agents. Extracts patterns from session transcripts into a weighted graph with Hebbian learning and time decay. ## What It Does - Maintains a store of categorized insights (perceptions, overrides, protections, self-observations, decisions, curiosities) - Uses Hebbian reinforcement: repeated insights get stronger, unused ones decay - Builds a graph of connections between related insights - Finds clusters of related knowledge that may represent higher-level principles - Compiles a "metacognition lens" — a token-budgeted summary of active self-knowledge ## Setup 1. Place `metacognition.py` in your workspace `scripts/` directory 2. The script stores data in `memory/metacognition.json` (relative to workspace) 3. The compiled lens outputs to `scripts/metacognition-lens.md` 4. Optionally configure a local embeddings endpoint for semantic similarity (falls back to string matching) ## Cron Integration Set up a cron job to run periodically (e.g., every 4 hours): ``` METACOGNITION INTEGRATION. You are the self-reflection engine. 1. Run `cd <WORKSPACE> && python3 scripts/metacognition.py decay` to prune weak entries. 2. Use sessions_list + sessions_history to read the main session's recent conversation. 3. Analyze the conversation for DEEPER patterns: - PATTERNS: Am I repeating the same kind of mistake? What does that reveal? - ANTICIPATION: What did the human need that I could have predicted? - RELATIONSHIP: What did I learn about how the user communicates or what they value? - CONFIDENCE: Where was I certain and wrong? Where was I uncertain but right? - GROWTH: What's a higher-level principle behind today's specific events? 4. For each genuine insight (1-3, quality over quantity), add it: `python3 scripts/metacognition.py add <type> "<insight>"` Types: perceptions, overrides, protections, self-observations, decisions, curiosities Write insights as PRINCIPLES, not incident reports. 5. Run `python3 scripts/metacognition.py reweave` to build graph connections. 6. Run `python3 scripts/metacognition.py compile` to rebuild the lens. 7. Report only if something genuinely interesting was extracted. ``` ## CLI Commands ``` python3 metacognition.py add <type> <text> # Add or merge an entry python3 metacognition.py list [type] # List entries python3 metacognition.py feedback <id> <pos|neg> # Reinforce or weaken python3 metacognition.py decay # Apply time-based decay python3 metacognition.py compile # Compile the lens python3 metacognition.py extract <path> # Extract from a daily note python3 metacognition.py resolve <id> # Mark curiosity resolved python3 metacognition.py reweave # Build graph connections python3 metacognition.py graph # Show graph stats python3 metacognition.py integrate # Full cycle ``` ## Configuration Key constants in the script: | Constant | Default | Description | |----------|---------|-------------| | `HALF_LIFE_DAYS` | 7.0 | How quickly unreinforced entries decay | | `STRENGTH_CAP` | 3.0 | Maximum strength an entry can reach | | `LENS_TOKEN_BUDGET` | 500 | Token budget for compiled lens | | `EMBEDDING_SIM_THRESHOLD` | 0.85 | Similarity threshold for merging (embeddings) | | `FALLBACK_SIM_THRESHOLD` | 0.72 | Similarity threshold for merging (string matching) | | `EDGE_SIM_THRESHOLD` | 0.35 | Threshold for creating graph edges | ## Entry Types - **perceptions** — Things learned from experience - **overrides** — Corrections to previous beliefs - **protections** — Rules to prevent known failure modes - **self-observations** — Patterns in own behavior - **decisions** — Policy decisions for future behavior - **curiosities** — Open questions with lifecycle (born → active → evolving → resolved)

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 metacognition-1775925669 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 metacognition-1775925669 技能

通过命令行安装

skillhub install metacognition-1775925669

下载 Zip 包

⬇ 下载 metacognition v1.1.2

文件大小: 13.3 KB | 发布时间: 2026-4-12 10:35

v1.1.2 最新 2026-4-12 10:35
Enforce localhost-only EMBEDDINGS_URL validation at import time — remote URLs now disable embeddings entirely

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

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

p2p_official_large
返回顶部