continuous-learning

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Continuous Learning Skill

持续学习技能

Automatically evaluates Claude Code sessions on end to extract reusable patterns that can be saved as learned skills.
自动评估Claude Code会话,从中提取可复用模式并保存为已学习技能。

How It Works

工作原理

This skill runs as a Stop hook at the end of each session:
  1. Session Evaluation: Checks if session has enough messages (default: 10+)
  2. Pattern Detection: Identifies extractable patterns from the session
  3. Skill Extraction: Saves useful patterns to
    ~/.claude/skills/learned/
该技能作为Stop hook在每个会话结束时运行:
  1. 会话评估:检查会话是否包含足够数量的消息(默认:10条及以上)
  2. 模式检测:从会话中识别可提取的模式
  3. 技能提取:将有用的模式保存至
    ~/.claude/skills/learned/

Configuration

配置

Edit
config.json
to customize:
json
{
  "min_session_length": 10,
  "extraction_threshold": "medium",
  "auto_approve": false,
  "learned_skills_path": "~/.claude/skills/learned/",
  "patterns_to_detect": [
    "error_resolution",
    "user_corrections",
    "workarounds",
    "debugging_techniques",
    "project_specific"
  ],
  "ignore_patterns": [
    "simple_typos",
    "one_time_fixes",
    "external_api_issues"
  ]
}
编辑
config.json
进行自定义:
json
{
  "min_session_length": 10,
  "extraction_threshold": "medium",
  "auto_approve": false,
  "learned_skills_path": "~/.claude/skills/learned/",
  "patterns_to_detect": [
    "error_resolution",
    "user_corrections",
    "workarounds",
    "debugging_techniques",
    "project_specific"
  ],
  "ignore_patterns": [
    "simple_typos",
    "one_time_fixes",
    "external_api_issues"
  ]
}

Pattern Types

模式类型

PatternDescription
error_resolution
How specific errors were resolved
user_corrections
Patterns from user corrections
workarounds
Solutions to framework/library quirks
debugging_techniques
Effective debugging approaches
project_specific
Project-specific conventions
模式描述
error_resolution
特定错误的解决方式
user_corrections
来自用户修正的模式
workarounds
框架/库特性问题的解决方案
debugging_techniques
有效的调试方法
project_specific
项目特定的约定

Hook Setup

Hook设置

Add to your
~/.claude/settings.json
:
json
{
  "hooks": {
    "Stop": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/skills/continuous-learning/evaluate-session.sh"
      }]
    }]
  }
}
添加至你的
~/.claude/settings.json
json
{
  "hooks": {
    "Stop": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/skills/continuous-learning/evaluate-session.sh"
      }]
    }]
  }
}

Why Stop Hook?

为何使用Stop Hook?

  • Lightweight: Runs once at session end
  • Non-blocking: Doesn't add latency to every message
  • Complete context: Has access to full session transcript
  • 轻量:仅在会话结束时运行一次
  • 非阻塞:不会增加每条消息的延迟
  • 完整上下文:可访问完整的会话记录

Related

相关链接

  • The Longform Guide - Section on continuous learning
  • /learn
    command - Manual pattern extraction mid-session

  • 长篇指南 - 持续学习相关章节
  • /learn
    命令 - 会话中途手动提取模式

Comparison Notes (Research: Jan 2025)

对比说明(研究:2025年1月)

vs Homunculus (github.com/humanplane/homunculus)

与Homunculus(github.com/humanplane/homunculus)对比

Homunculus v2 takes a more sophisticated approach:
FeatureOur ApproachHomunculus v2
ObservationStop hook (end of session)PreToolUse/PostToolUse hooks (100% reliable)
AnalysisMain contextBackground agent (Haiku)
GranularityFull skillsAtomic "instincts"
ConfidenceNone0.3-0.9 weighted
EvolutionDirect to skillInstincts → cluster → skill/command/agent
SharingNoneExport/import instincts
Key insight from homunculus:
"v1 relied on skills to observe. Skills are probabilistic—they fire ~50-80% of the time. v2 uses hooks for observation (100% reliable) and instincts as the atomic unit of learned behavior."
Homunculus v2采用了更复杂的方法:
特性我们的方法Homunculus v2
观察方式Stop hook(会话结束时)PreToolUse/PostToolUse hooks(100%可靠)
分析方式主上下文后台Agent(Haiku)
粒度完整技能原子化“本能”
置信度0.3-0.9加权
演进方式直接转为技能本能→聚类→技能/命令/Agent
共享功能导出/导入本能
来自Homunculus的关键见解:
“v1依赖技能进行观察。技能具有概率性——触发概率约为50-80%。v2使用hooks进行观察(100%可靠),并将本能作为已学习行为的原子单元。”

Potential v2 Enhancements

潜在的v2增强功能

  1. Instinct-based learning - Smaller, atomic behaviors with confidence scoring
  2. Background observer - Haiku agent analyzing in parallel
  3. Confidence decay - Instincts lose confidence if contradicted
  4. Domain tagging - code-style, testing, git, debugging, etc.
  5. Evolution path - Cluster related instincts into skills/commands
See:
/Users/affoon/Documents/tasks/12-continuous-learning-v2.md
for full spec.
  1. 基于本能的学习 - 更小的原子化行为,带置信度评分
  2. 后台观察者 - Haiku Agent并行分析
  3. 置信度衰减 - 若本能被反驳,其置信度会降低
  4. 领域标记 - 代码风格、测试、Git、调试等
  5. 演进路径 - 将相关本能聚类为技能/命令
详见:
/Users/affoon/Documents/tasks/12-continuous-learning-v2.md
获取完整规格。