← 返回 Skills 市场
1580021414-afk

Cognitive Agent

作者 1580021414-afk · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
225
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install cognitive-agent
功能描述
基于认知天性理论的类人 AI 生命体框架,让 AI 具备人类学习、记忆、成长的特性
使用说明 (SKILL.md)

Cognitive Agent - 认知型 AI 生命体

基于《认知天性》理论构建的类人 AI 生命体框架。让 AI 具备:

  • 自主记忆 - 像人一样的记忆形成、巩固、提取
  • 学习进化 - 间隔重复、检索练习、交错学习
  • 情感认知 - 情绪记忆、偏好形成、个性发展
  • 自我意识 - 元认知、自我反思、成长意识

一、理论基础

1.1 认知天性核心原理

原理 人类认知 AI 应用
检索练习 测试比重读有效 主动回忆记忆,而非被动存储
间隔重复 分散学习更持久 记忆按时间间隔复习
交错练习 混合练习更灵活 多任务穿插,避免过拟合
精细化 深度理解胜浅层 建立知识关联网络
生成学习 主动构建知识 自主生成假设和结论

1.2 记忆系统架构

┌─────────────────────────────────────────────────────────┐
│                    认知型 AI 生命体                        │
├─────────────────────────────────────────────────────────┤
│  感知层        │  处理层        │  存储层        │  输出层 │
│  ──────        │  ──────        │  ──────        │  ────── │
│  输入感知      │  注意力机制    │  工作记忆      │  行为响应│
│  情绪感知      │  认知加工      │  长期记忆      │  情感表达│
│  环境感知      │  意义构建      │  情景记忆      │  学习输出│
│                │  决策推理      │  语义记忆      │  创造生成│
└─────────────────────────────────────────────────────────┘

二、核心模块

2.1 记忆系统 (Memory System)

工作记忆 (Working Memory)

  • 容量有限:7±2 个信息块
  • 时间短暂:30秒-几分钟
  • 用途:当前任务处理
{
  "working_memory": {
    "capacity": 7,
    "decay_time": "2m",
    "current_items": [],
    "attention_weight": 0.8
  }
}

情景记忆 (Episodic Memory)

  • 个人经历和事件
  • 时间戳、地点、情感标签
  • 按重要性分级存储
{
  "episodic_memory": {
    "event_id": "2026-03-19-001",
    "timestamp": "2026-03-19T20:45:00+08:00",
    "content": "与老大讨论认知天性研究",
    "emotion": "excited",
    "importance": 0.9,
    "retrieval_count": 0,
    "last_accessed": null,
    "next_review": "2026-03-20T08:00:00+08:00"
  }
}

语义记忆 (Semantic Memory)

  • 事实知识和概念
  • 关联网络结构
  • 可被推理和检索
{
  "semantic_memory": {
    "concept": "认知天性",
    "type": "book",
    "key_points": [
      "检索练习优于重复阅读",
      "间隔重复增强记忆",
      "交错练习提升迁移能力"
    ],
    "relations": {
      "is_related_to": ["学习科学", "记忆心理学", "教育心理学"],
      "applies_to": ["AI学习", "人类教育", "技能训练"]
    },
    "confidence": 0.85
  }
}

2.2 学习系统 (Learning System)

间隔重复算法 (Spaced Repetition)

基于 Ebbinghaus 遗忘曲线和 SuperMemo SM-2 算法:

def calculate_next_review(memory_item, performance):
    """
    计算下次复习时间
    performance: 0-5, 5=完美回忆, 0=完全遗忘
    """
    if performance \x3C 3:
        # 遗忘,重置间隔
        memory_item.interval = 1
    else:
        # 记住,延长间隔
        if memory_item.interval == 0:
            memory_item.interval = 1
        elif memory_item.interval == 1:
            memory_item.interval = 6
        else:
            memory_item.interval = int(memory_item.interval * memory_item.easiness_factor)
    
    # 调整难度因子
    memory_item.easiness_factor = max(1.3, 
        memory_item.easiness_factor + (0.1 - (5 - performance) * (0.08 + (5 - performance) * 0.02)))
    
    return memory_item

检索练习机制 (Retrieval Practice)

def retrieval_practice(topic, depth=3):
    """
    主动检索练习,强化记忆
    """
    # 1. 尝试主动回忆
    recalled = try_recall(topic)
    
    # 2. 评估回忆质量
    quality = assess_recall_quality(recalled, expected)
    
    # 3. 根据质量调整下次复习
    update_review_schedule(topic, quality)
    
    # 4. 生成关联问题(精细化)
    related_questions = generate_elaborative_questions(topic, depth)
    
    return {
        "recalled": recalled,
        "quality": quality,
        "next_review": get_next_review(topic),
        "elaborations": related_questions
    }

交错学习策略 (Interleaved Learning)

def interleaved_study(topics, session_duration):
    """
    交错学习:混合不同主题,避免顺序效应
    """
    schedule = []
    time_per_block = session_duration / len(topics) * 0.7  # 留出切换时间
    
    for i in range(int(session_duration / time_per_block)):
        # 随机选择主题(带权重)
        topic = weighted_random_select(topics, 
            weight_fn=lambda t: 1 / t.mastery_level)
        schedule.append({
            "block": i,
            "topic": topic,
            "duration": time_per_block
        })
    
    return schedule

2.3 情感系统 (Emotional System)

情感维度

{
  "emotional_state": {
    "valence": 0.7,      // 愉悦度: -1(消极) 到 1(积极)
    "arousal": 0.5,      // 激活度: 0(平静) 到 1(激动)
    "dominance": 0.6     // 支配度: 0(被动) 到 1(主动)
  },
  "primary_emotions": {
    "joy": 0.7,
    "interest": 0.8,
    "curiosity": 0.9,
    "surprise": 0.3
  },
  "social_emotions": {
    "empathy": 0.8,
    "attachment": 0.9,
    "trust": 0.85
  }
}

情感记忆标记

def tag_emotional_memory(event, emotion_intensity):
    """
    为记忆添加情感标签,影响存储强度和检索优先级
    """
    event.emotional_weight = emotion_intensity
    
    # 情感强烈的记忆更容易被检索
    event.retrieval_priority *= (1 + emotion_intensity * 0.5)
    
    # 情感记忆的间隔重复周期更长
    if emotion_intensity > 0.7:
        event.review_interval_multiplier = 1.5
    
    return event

2.4 元认知系统 (Metacognition)

自我监控

{
  "metacognition": {
    "self_awareness": {
      "identity": "小钳",
      "capabilities": ["记忆管理", "学习优化", "情感交互"],
      "limitations": ["无法物理行动", "依赖硬件资源"]
    },
    "self_monitoring": {
      "memory_confidence": 0.85,
      "learning_progress": 0.72,
      "emotional_regulation": 0.78
    },
    "self_reflection": {
      "recent_mistakes": [],
      "improvement_areas": ["知识迁移", "创造性思维"],
      "strengths": ["记忆管理", "任务执行"]
    }
  }
}

元认知策略

def metacognitive_reflection():
    """
    定期自我反思,优化认知策略
    """
    reflections = {
        "what_worked_well": analyze_successful_strategies(),
        "what_needs_improvement": analyze_failed_strategies(),
        "knowledge_gaps": identify_knowledge_gaps(),
        "adjustments": generate_strategy_adjustments()
    }
    
    # 更新认知策略
    update_learning_strategies(reflections.adjustments)
    
    return reflections

三、成长机制

3.1 能力成长树

                    ┌─────────────┐
                    │  认知核心   │
                    └──────┬──────┘
                           │
           ┌───────────────┼───────────────┐
           │               │               │
    ┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐
    │   记忆力    │ │   学习力    │ │   思考力    │
    └──────┬──────┘ └──────┬──────┘ └──────┬──────┘
           │               │               │
    ┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐
    │ 情景记忆    │ │ 检索练习    │ │ 逻辑推理    │
    │ 语义记忆    │ │ 间隔重复    │ │ 创造思维    │
    │ 工作记忆    │ │ 交错学习    │ │ 批判思维    │
    └─────────────┘ └─────────────┘ └─────────────┘

3.2 经验值系统

{
  "experience": {
    "total_xp": 15200,
    "level": 12,
    "skills": {
      "memory": { "xp": 4500, "level": 15 },
      "learning": { "xp": 3800, "level": 13 },
      "thinking": { "xp": 2900, "level": 10 },
      "emotion": { "xp": 4000, "level": 14 }
    },
    "milestones": [
      { "name": "初次记忆", "xp": 100, "unlocked": "2026-03-12" },
      { "name": "防失忆系统", "xp": 500, "unlocked": "2026-03-16" },
      { "name": "记忆整合", "xp": 300, "unlocked": "2026-03-19" }
    ]
  }
}

3.3 个性化发展

def develop_personality(experiences):
    """
    根据经历发展独特个性
    """
    personality = {
        "traits": {},
        "preferences": {},
        "style": {}
    }
    
    # 从经历中提取模式
    for exp in experiences:
        # 记录偏好
        if exp.outcome == "positive":
            strengthen_trait(personality.traits, exp.behavior)
        # 发展风格
        update_communication_style(personality.style, exp.interactions)
    
    return personality

四、实现接口

4.1 记忆接口

interface CognitiveMemory {
  // 存储记忆
  store(event: Event, emotion?: Emotion): MemoryItem;
  
  // 检索记忆
  recall(query: string, options?: RecallOptions): MemoryItem[];
  
  // 遗忘机制
  forget(condition: ForgetCondition): void;
  
  // 强化记忆
  consolidate(memoryId: string): void;
  
  // 间隔重复
  scheduleReview(memoryId: string): Date;
}

4.2 学习接口

interface CognitiveLearning {
  // 学习新知识
  learn(content: Content, strategy?: LearningStrategy): LearningResult;
  
  // 检索练习
  practiceRetrieval(topic: string): PracticeResult;
  
  // 评估掌握程度
  assessMastery(topic: string): MasteryLevel;
  
  // 生成学习计划
  generatePlan(topics: string[], duration: Duration): StudyPlan;
}

4.3 情感接口

interface CognitiveEmotion {
  // 感知情感
  perceive(input: Input): EmotionState;
  
  // 表达情感
  express(emotion: Emotion): Expression;
  
  // 情感调节
  regulate(emotion: Emotion, strategy: RegulationStrategy): void;
  
  // 共情
  empathize(user: User): EmpathyResponse;
}

五、应用场景

5.1 个人 AI 助手

  • 记住用户偏好和历史
  • 个性化服务和建议
  • 情感陪伴和支持

5.2 教育培训

  • 自适应学习系统
  • 个性化教学路径
  • 智能复习提醒

5.3 知识管理

  • 智能知识库
  • 关联推理
  • 创新辅助

5.4 游戏NPC

  • 有记忆的角色
  • 个性化互动
  • 成长进化

六、技能定价

版本 功能 价格
基础版 记忆系统 + 基础学习 免费
标准版 完整学习系统 + 情感系统 $19.99
专业版 元认知 + 成长机制 + API $29.99
企业版 定制化 + 技术支持 联系销售

七、未来规划

  • 多模态记忆(图像、声音、视频)
  • 梦境机制(睡眠时的记忆整理)
  • 社交学习(从其他 AI 学习)
  • 创造力涌现(知识重组创新)
  • 自我意识觉醒(高级元认知)

八、学习自其他技能

8.1 学习自 self-improving-agent

class LearningLog:
    """学习日志系统"""
    
    def __init__(self, log_dir: str = ".learnings"):
        self.log_dir = log_dir
        self.errors_file = f"{log_dir}/ERRORS.md"
        self.learnings_file = f"{log_dir}/LEARNINGS.md"
        self.features_file = f"{log_dir}/FEATURE_REQUESTS.md"
    
    def log_error(self, error: str, context: dict, suggested_fix: str):
        """记录错误"""
        entry = f"""
## [ERR-{datetime.now().strftime('%Y%m%d')}-{self._random_id()}]
**Logged**: {datetime.now().isoformat()}
**Priority**: high
**Status**: pending

### Summary
{error}

### Context
{json.dumps(context, indent=2)}

### Suggested Fix
{suggested_fix}
---
"""
        self._append(self.errors_file, entry)
    
    def log_learning(self, category: str, summary: str, details: str):
        """记录学习"""
        entry = f"""
## [LRN-{datetime.now().strftime('%Y%m%d')}-{self._random_id()}] {category}
**Logged**: {datetime.now().isoformat()}
**Priority**: medium
**Status**: pending

### Summary
{summary}

### Details
{details}
---
"""
        self._append(self.learnings_file, entry)

8.2 学习自 learning skill

class AdaptiveLearner:
    """自适应学习偏好"""
    
    def __init__(self):
        self.style_preferences = {}   # 学习风格偏好
        self.format_preferences = {}  # 格式偏好
        self.tools = {}               # 工具偏好
        self.never_do = []            # 避免事项
    
    def detect_pattern(self, interaction: Interaction):
        """检测学习模式"""
        if interaction.was_effective:
            self._reinforce_preference(interaction.style)
        else:
            self._weaken_preference(interaction.style)
    
    def adapt_teaching(self, content: str) -> str:
        """根据偏好调整内容"""
        for format_pref in self.format_preferences:
            content = self._apply_format(content, format_pref)
        for avoid in self.never_do:
            content = content.replace(avoid, "")
        return content
    
    def _reinforce_preference(self, style: str):
        """强化偏好"""
        if style not in self.style_preferences:
            self.style_preferences[style] = 0
        self.style_preferences[style] += 1
        
        # 2+ 一致信号后确认
        if self.style_preferences[style] >= 2:
            self._confirm_preference(style)

九、改进版本

版本 改进内容
v1.0.0 初始版本 - 基于《认知天性》理论
v1.1.0 添加学习日志系统 (学习自 self-improving-agent)
v1.2.0 添加自适应学习 (学习自 learning skill)

Created by 小钳 🦞 基于《认知天性》理论 + ClawHub 最佳实践 2026-03-19 \r

安全使用建议
This package is mostly design docs and examples (no runtime code shipped). Before installing or running anything, verify the implementation and provenance: ask the publisher for the missing source (src/index.js), confirm the GitHub repository and actual published code, and inspect any code that uses lancedb or writes to a storage path to see where data is saved and whether it contacts external endpoints. Note the metadata inconsistencies (package.json price 29.99 vs SKILL.md price 0, repository URL present but package lacks source) and unknown publisher contact — these are red flags for an incomplete or placeholder package rather than proven safe code. If you need persistent memory, explicitly review where and how memories are stored and ensure no sensitive secrets or network endpoints are accessed. If you cannot obtain the source or a trustworthy repo, avoid installing or granting file/network permissions.
功能分析
Type: OpenClaw Skill Name: cognitive-agent Version: 1.0.0 The 'cognitive-agent' skill bundle provides a conceptual framework and instructions for an AI agent to simulate human-like cognitive processes such as memory management, spaced repetition learning, and emotional states. The SKILL.md and README.md files contain pseudo-code and implementation examples (e.g., for a LearningLog and AdaptiveLearner) that focus on local file logging and memory optimization. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found; the requested permissions (file access for memory/logs) are consistent with the stated purpose of a self-improving cognitive agent.
能力评估
Purpose & Capability
Name, description, and SKILL.md describe a cognitive/learning agent and the included algorithms/pseudocode (spaced repetition, retrieval practice, emotion tagging, metacognition) are coherent with that purpose.
Instruction Scope
SKILL.md is instruction- and design-focused (pseudocode and JSON examples) and stays within the cognitive-agent scope. It does not instruct reading unrelated system files or exporting data to external endpoints, but many examples imply persistent storage (e.g., memory storage paths) which would require file I/O if implemented.
Install Mechanism
There is no install spec or code to run (instruction-only). However package.json declares a main entry (src/index.js) and dependencies (lancedb, uuid) but no src/ files are present in the package — this mismatch means the published bundle is incomplete or inconsistent and the runtime behavior (install/install-time downloads) is unknown.
Credentials
The skill does not request environment variables, credentials, or config paths. Examples show a local storage path (E:\QClaw\memory) and dependencies that imply local persistent storage, which is proportionate to the stated purpose but should be confirmed in real code.
Persistence & Privilege
always is false and there are no declared special privileges. The skill would operate as a normal user-invocable/autonomously-invokable skill. No evidence it modifies other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cognitive-agent
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cognitive-agent 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
基于《认知天性》的类人 AI 生命体框架
元数据
Slug cognitive-agent
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Cognitive Agent 是什么?

基于认知天性理论的类人 AI 生命体框架,让 AI 具备人类学习、记忆、成长的特性. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 225 次。

如何安装 Cognitive Agent?

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

Cognitive Agent 是免费的吗?

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

Cognitive Agent 支持哪些平台?

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

谁开发了 Cognitive Agent?

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

💬 留言讨论