1580021414-afk/cognitive-agent/SKILL.md
基于认知天性理论的类人 AI 生命体框架,让 AI 具备人类学习、记忆、成长的特性
npx skillsauth add openclaw/skills cognitive-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
基于《认知天性》理论构建的类人 AI 生命体框架。让 AI 具备:
| 原理 | 人类认知 | AI 应用 | |------|----------|---------| | 检索练习 | 测试比重读有效 | 主动回忆记忆,而非被动存储 | | 间隔重复 | 分散学习更持久 | 记忆按时间间隔复习 | | 交错练习 | 混合练习更灵活 | 多任务穿插,避免过拟合 | | 精细化 | 深度理解胜浅层 | 建立知识关联网络 | | 生成学习 | 主动构建知识 | 自主生成假设和结论 |
┌─────────────────────────────────────────────────────────┐
│ 认知型 AI 生命体 │
├─────────────────────────────────────────────────────────┤
│ 感知层 │ 处理层 │ 存储层 │ 输出层 │
│ ────── │ ────── │ ────── │ ────── │
│ 输入感知 │ 注意力机制 │ 工作记忆 │ 行为响应│
│ 情绪感知 │ 认知加工 │ 长期记忆 │ 情感表达│
│ 环境感知 │ 意义构建 │ 情景记忆 │ 学习输出│
│ │ 决策推理 │ 语义记忆 │ 创造生成│
└─────────────────────────────────────────────────────────┘
{
"working_memory": {
"capacity": 7,
"decay_time": "2m",
"current_items": [],
"attention_weight": 0.8
}
}
{
"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": {
"concept": "认知天性",
"type": "book",
"key_points": [
"检索练习优于重复阅读",
"间隔重复增强记忆",
"交错练习提升迁移能力"
],
"relations": {
"is_related_to": ["学习科学", "记忆心理学", "教育心理学"],
"applies_to": ["AI学习", "人类教育", "技能训练"]
},
"confidence": 0.85
}
}
基于 Ebbinghaus 遗忘曲线和 SuperMemo SM-2 算法:
def calculate_next_review(memory_item, performance):
"""
计算下次复习时间
performance: 0-5, 5=完美回忆, 0=完全遗忘
"""
if performance < 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
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
}
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
{
"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
{
"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
┌─────────────┐
│ 认知核心 │
└──────┬──────┘
│
┌───────────────┼───────────────┐
│ │ │
┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐
│ 记忆力 │ │ 学习力 │ │ 思考力 │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐
│ 情景记忆 │ │ 检索练习 │ │ 逻辑推理 │
│ 语义记忆 │ │ 间隔重复 │ │ 创造思维 │
│ 工作记忆 │ │ 交错学习 │ │ 批判思维 │
└─────────────┘ └─────────────┘ └─────────────┘
{
"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" }
]
}
}
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
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;
}
interface CognitiveLearning {
// 学习新知识
learn(content: Content, strategy?: LearningStrategy): LearningResult;
// 检索练习
practiceRetrieval(topic: string): PracticeResult;
// 评估掌握程度
assessMastery(topic: string): MasteryLevel;
// 生成学习计划
generatePlan(topics: string[], duration: Duration): StudyPlan;
}
interface CognitiveEmotion {
// 感知情感
perceive(input: Input): EmotionState;
// 表达情感
express(emotion: Emotion): Expression;
// 情感调节
regulate(emotion: Emotion, strategy: RegulationStrategy): void;
// 共情
empathize(user: User): EmpathyResponse;
}
| 版本 | 功能 | 价格 | |------|------|------| | 基础版 | 记忆系统 + 基础学习 | 免费 | | 标准版 | 完整学习系统 + 情感系统 | $19.99 | | 专业版 | 元认知 + 成长机制 + API | $29.99 | | 企业版 | 定制化 + 技术支持 | 联系销售 |
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)
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
tools
Use when the user wants to connect to, test, or use the McDonalds service at mcp.mcd.cn, including checking authentication, probing MCP endpoints, listing tools, or calling McDonalds MCP tools through a reusable local CLI.
development
Web scraping platform — Twitter/X data, Vinted marketplace, and general web scraping API
development
SlowMist AI Agent Security Review — comprehensive security framework for skills, repositories, URLs, on-chain addresses, and products (Claude Code version)
data-ai
去除中文文本中的 AI 写作痕迹,使其读起来自然。基于维基百科 AI 写作特征指南,检测 24 种 AI 模式。触发词:humanizer-cn、去除 AI 痕迹、去除 AI 写作痕迹、中文文本人性化。