Skip to content
Development
Skill

/continuous-learning-v2

基于本能(Instinct)的学习系统,通过钩子(hooks)观察会话,创建带有置信度评分的原子本能,并将其演化为技能(Skills)、命令(Commands)或智能体(Agents)。v2.1 版本增加了项目作用域(project-scoped)的本能,以防止跨项目污染。

From plugin
everything-claude-code
1.8k59 skills15 agents35 commands6 hooks
Install
$ npx -y skills add xu-xiang/everything-claude-code-zh --skill continuous-learning-v2 --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/continuous-learning-v2

Context preview

The summary Claude sees to decide when to auto-load this skill.

基于本能(Instinct)的学习系统,通过钩子(hooks)观察会话,创建带有置信度评分的原子本能,并将其演化为技能(Skills)、命令(Commands)或智能体(Agents)。v2.1 版本增加了项目作用域(project-scoped)的本能,以防止跨项目污染。

SKILL.md

continuous-learning-v2.SKILL.md
name: continuous-learning-v2
description: 基于本能(Instinct)的学习系统,通过钩子(hooks)观察会话,创建带有置信度评分的原子本能,并将其演化为技能(Skills)、命令(Commands)或智能体(Agents)。v2.1 版本增加了项目作用域(project-scoped)的本能,以防止跨项目污染。
origin: ECC
version: 2.1.0

持续学习(Continuous Learning)v2.1 - 基于本能(Instinct)的架构

一个先进的学习系统,通过原子级“本能(Instincts)”——带有置信度评分的小型学习行为,将你的 Claude Code 会话转化为可复用的知识。

**v2.1** 增加了 **项目作用域本能(project-scoped instincts)** —— React 模式保留在你的 React 项目中,Python 约定保留在你的 Python 项目中,而通用模式(如“始终验证输入”)则在全局共享。

何时激活

  • 设置从 Claude Code 会话中自动学习
  • 配置通过钩子(hooks)提取基于本能的行为
  • 调整学习行为的置信度阈值
  • 查看、导出或导入本能库
  • 将本能演化为完整的技能(Skills)、命令(Commands)或智能体(Agents)
  • 管理项目作用域与全局本能
  • 将本能从项目作用域提升(Promote)到全局作用域

v2.1 的新特性

| 特性 | v2.0 | v2.1 | |---------|------|------| | 存储 | 全局 (~/.claude/homunculus/) | 项目作用域 (projects/<hash>/) | | 作用域 | 所有本能应用于所有地方 | 项目作用域 + 全局 | | 检测 | 无 | git remote URL / 仓库路径 | | 提升 | 不适用 | 当在 2 个以上项目中看到时,由项目 → 全局 | | 命令 | 4 个 (status/evolve/export/import) | 6 个 (+promote/projects) | | 跨项目 | 存在污染风险 | 默认隔离 |

v2 的新特性(对比 v1)

| 特性 | v1 | v2 | |---------|----|----| | 观察 | Stop 钩子(会话结束) | PreToolUse/PostToolUse (100% 可靠) | | 分析 | 主上下文 | 后台智能体 (Haiku) | | 粒度 | 完整技能 | 原子级“本能” | | 置信度 | 无 | 0.3-0.9 加权 | | 演化 | 直接到技能 | 本能 -> 聚类 -> 技能/命令/智能体 | | 分享 | 无 | 导出/导入本能 |

本能模型(The Instinct Model)

本能是一个小型学习行为:

---
id: prefer-functional-style
trigger: "when writing new functions"
confidence: 0.7
domain: "code-style"
source: "session-observation"
scope: project
project_id: "a1b2c3d4e5f6"
project_name: "my-react-app"
---

# 偏好函数式风格

## 动作(Action)
在适当时使用函数式模式而非类(classes)。

## 证据(Evidence)
- 观察到 5 次偏好函数式模式的实例
- 用户在 2025-01-15 将基于类的方案纠正为函数式

**属性:**

  • **原子性(Atomic)** —— 一个触发器,一个动作
  • **置信度加权(Confidence-weighted)** —— 0.3 = 尝试性, 0.9 = 几乎确定
  • **领域标签(Domain-tagged)** —— code-style, testing, git, debugging, workflow 等
  • **证据支持(Evidence-backed)** —— 追踪哪些观察结果创建了它
  • **作用域感知(Scope-aware)** —— `project`(默认)或 `global`

工作原理

会话活动 (在 git 仓库中)
      |
      | 钩子(Hooks)捕获提示词 + 工具使用 (100% 可靠)
      | + 检测项目上下文 (git remote / 仓库路径)
      v
+---------------------------------------------+
|  projects/<project-hash>/observations.jsonl  |
|   (提示词, 工具调用, 结果, 项目)              |
+---------------------------------------------+
      |
      | 观察者智能体读取 (后台, Haiku)
      v
+---------------------------------------------+
|                模式检测                      |
|   * 用户纠正 -> 本能                         |
|   * 错误解决 -> 本能                         |
|   * 重复工作流 -> 本能                       |
|   * 作用域决策:项目还是全局?                |
+---------------------------------------------+
      |
      | 创建/更新
      v
+---------------------------------------------+
|  projects/<project-hash>/instincts/personal/ |
|   * prefer-functional.yaml (0.7) [project]   |
|   * use-react-hooks.yaml (0.9) [project]     |
+---------------------------------------------+
|  instincts/personal/  (全局 GLOBAL)          |
|   * always-validate-input.yaml (0.85) [global]|
|   * grep-before-edit.yaml (0.6) [global]     |
+---------------------------------------------+
      |
      | /evolve 聚类 + /promote 提升
      v
+---------------------------------------------+
|  projects/<hash>/evolved/ (项目作用域)       |
|  evolved/ (全局)                             |
|   * commands/new-feature.md                  |
|   * skills/testing-workflow.md               |
|   * agents/refactor-specialist.md            |
+---------------------------------------------+

项目检测(Project Detection)

系统会自动检测你当前的项目:

1. **`CLAUDE_PROJECT_DIR` 环境变量** (最高优先级) 2. **`git remote get-url origin`** —— 通过哈希创建可移植的项目 ID (不同机器上的同一仓库获得相同的 ID) 3. **`git rev-parse --show-toplevel`** —— 使用仓库路径作为回退方案 (机器特定) 4. **全局回退** —— 如果未检测到项目,本能将进入全局作用域

每个项目获得一个 12 位的哈希 ID (例如 `a1b2c3d4e5f6`)。位于 `~/.claude/homunculus/projects.json` 的注册文件将 ID 映射到人类可读的名称。

快速开始

1. 启用观察钩子(Observation Hooks)

添加到你的 `~/.claude/settings.json`。

**如果作为插件安装** (推荐):

{
  "hooks": {
    "PreToolUse": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh"
      }]
    }],
    "PostToolUse": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh"
      }]
    }]
  }
}

**如果手动安装** 到 `~/.claude/skills`:

{
  "hooks": {
    "PreToolUse": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh"
      }]
    }],
    "PostToolUse": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh"
      }]
    }]
  }
}

2. 初始化目录结构

系统在首次使用时会自动创建目录,但你也可以手动创建:

# 全局目录
mkdir -p ~/.claude/homunculus/{instincts/{personal,inherited},evolved/{agents,skills,commands},projects}

# 项目目录会在钩子首次在 git 仓库中运行时自动创建

3. 使用本能命令

/instinct-status     # 显示已学习的本能 (项目 + 全局)
/evolve              # 将相关的本能聚类为技能/命令
/instinct-export     # 将本能导出到文件
/instinct-import     # 从他人处导入本能
/promote             # 将项目本能提升到全局作用域
/projects            # 列出所有已知的项目及其本能数量

命令

| 命令 | 描述 | |---------|-------------| | `/instinct-status` | 显示所有本能 (项目作用域 + 全局) 及其置信度 | | `/evolve` | 将相关的本能聚类为技能/命令,并建议提升 | | `/instinct-export` | 导出本能 (可按作用域/领域过滤) | | `/instinct-import <file>` | 带有作用域控制地导入本能 | | `/promote [id]` | 将项目本能提升到全局作用域 | | `/projects` | 列出所有已知的项目及其本能数量 |

配置

编辑 `config.json` 以控制后台观察者:

{
  "version": "2.1",
  "observer": {
    "enabled": false,
    "run_interval_minutes": 5,
    "min_observations_to_analyze": 20
  }
}

| 键名 | 默认值 | 描述 | |-----|---------|-------------| | `observer.enabled` | `false` | 启用后台观察者智能体 | | `observer.run_interval_minutes` | `5` | 观察者分析观察结果的频率 | | `observer.min_observations_to_analyze` | `20` | 分析运行前最少需要的观察次数 |

其他行为 (观察捕获、本能阈值、项目作用域划分、提升标准) 通过 `instinct-cli.py` 和 `observe.sh` 中的代码默认值进行配置。

文件结构

~/.claude/homunculus/
+-- identity.j
Read more
Ships witheverything-claude-code

🌐 Language / 语言 / 語言 为 AI 智能体(Agent)框架打造的性能优化系统。源自 Anthropic 黑客松获胜作品。 这不仅仅是配置文件。它是一个完整的系统:包含技能(Skills)、本能(Instincts)、内存优化、持续学习、安全扫描以及研究优先的开发模式。这些生产级的智能体(Agents)、钩子(Hooks)、命令(Commands)、规则(Rules)以及 MCP 配置,是在构建真实产品的 10 个多月高强度日常使用中演化而来的。 适用于 Claude Code, Codex,

Get the whole plugin