continuous-learning

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Continuous Learning Skill - DEPRECATED

持续学习技能 - 已废弃

DEPRECATED 2026-04-28. Use
continuous-learning-v2
instead. v2 is a strict superset: stop-hook observation becomes PreToolUse/PostToolUse observation, full skills become atomic instincts with confidence scoring, and global-only storage becomes project-scoped plus global promotion.
This file is kept for archival reference and backward compatibility with existing installs.

已废弃 2026-04-28。 请改用
continuous-learning-v2
。v2是严格的超集:停止钩子观测变为PreToolUse/PostToolUse观测,完整技能变为带有置信度评分的原子本能,仅全局存储变为项目范围存储加全局推广。
保留此文件仅用于存档参考和与现有安装的向后兼容。

Original v1 Documentation (archival)

原始v1文档(存档)

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

When to Activate

激活场景

  • Setting up automatic pattern extraction from Claude Code sessions
  • Configuring the Stop hook for session evaluation
  • Reviewing or curating learned skills in
    ~/.claude/skills/learned/
  • Adjusting extraction thresholds or pattern categories
  • Comparing v1 (this) vs v2 (instinct-based) approaches
  • 从Claude Code会话中设置自动模式提取
  • 配置用于会话评估的Stop钩子
  • 查看或管理
    ~/.claude/skills/learned/
    中的已学习技能
  • 调整提取阈值或模式类别
  • 对比v1(本版本)与v2(基于本能)的实现方式

Status

状态

This v1 skill is still supported, but
continuous-learning-v2
is the preferred path for new installs. Keep v1 when you explicitly want the simpler Stop-hook extraction flow or need compatibility with older learned-skill workflows.
此v1技能仍受支持,但
continuous-learning-v2
是新安装的首选方案。当您明确需要更简单的停止钩子提取流程,或需要与旧版已学习技能工作流兼容时,可保留v1。

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钩子在每个会话结束时运行:
  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

钩子设置

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钩子?

  • 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

与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钩子(会话结束时)PreToolUse/PostToolUse钩子(100%可靠)
分析方式主上下文后台Agent(Haiku)
粒度完整技能原子化“本能”
置信度0.3-0.9加权评分
演化路径直接生成技能本能 → 聚类 → 技能/命令/Agent
共享功能导出/导入本能
来自Homunculus的关键见解:
"v1依赖技能进行观测。技能是概率性的——触发率约为50-80%。v2使用钩子进行观测(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:
docs/continuous-learning-v2-spec.md
for full spec.
  1. 基于本能的学习 - 更小的原子化行为,带有置信度评分
  2. 后台观测器 - Haiku Agent并行分析
  3. 置信度衰减 - 若本能被反驳,其置信度会降低
  4. 领域标记 - 代码风格、测试、Git、调试等
  5. 演化路径 - 将相关本能聚类为技能/命令
详情请见:
docs/continuous-learning-v2-spec.md
完整规范。