siniyayousuf/everything_claudecode/continuous-learning-v2

Claude Code and agent skill by siniyayousuf/everything_claudecode

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

基于本能的学习系统,通过钩子观察会话,创建带置信度评分的原子本能,并将其进化为技能/命令/代理。v2.1版本增加了项目范围的本能,以防止跨项目污染。

Install

npx vskill@latest install siniyayousuf/everything_claudecode/continuous-learning-v2

SKILL.md

The same SKILL.md was published earlier as siniyayousuf/everything_claudecode/continuous-learning-v2.

持续学习 v2.1 - 基于本能

的架构

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

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

何时激活

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

v2.1 的新特性

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

v2 的新特性(对比 v1)

特性v1v2
观察停止钩子(会话结束)PreToolUse/PostToolUse (100% 可靠)
分析主上下文后台代理 (Haiku)
粒度完整技能原子化“本能”
置信度无0.3-0.9 加权
进化直接进化为技能本能 -> 聚类 -> 技能/命令/代理
共享无导出/导入本能

本能模型

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

yaml
---
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"
---
# Prefer Functional Style
## Action
Use functional patterns over classes when appropriate.
## Evidence
- Observed 5 instances of functional pattern preference
- User corrected class-based approach to functional on 2025-01-15

属性:

  • 原子化 -- 一个触发条件,一个动作
  • 置信度加权 -- 0.3 = 试探性,0.9 = 几乎确定
  • 领域标记 -- 代码风格、测试、git、调试、工作流等
  • 有证据支持 -- 追踪是哪些观察创建了它
  • 作用域感知 -- project (默认) 或 global

工作原理

Session Activity (in a git repo)
|
| Hooks capture prompts + tool use (100% reliable)
| + detect project context (git remote / repo path)
v
+---------------------------------------------+
| projects/<project-hash>/observations.jsonl |
| (prompts, tool calls, outcomes, project) |
+---------------------------------------------+
|
| Observer agent reads (background, Haiku)
v
+---------------------------------------------+
| PATTERN DETECTION |
| * User corrections -> instinct |
| * Error resolutions -> instinct |
| * Repeated workflows -> instinct |
| * Scope decision: project or global? |
+---------------------------------------------+
|
| Creates/updates
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 clusters + /promote
v
+---------------------------------------------+
| projects/<hash>/evolved/ (project-scoped) |
| evolved/ (global) |
| * commands/new-feature.md |
| * skills/testing-workflow.md |
| * agents/refactor-specialist.md |
+---------------------------------------------+

项目检测

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

  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. 启用观察钩子

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

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

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:

json
{
"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. 初始化目录结构

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

bash
# Global directories
mkdir -p ~/.claude/homunculus/{instincts/{personal,inherited},evolved/{agents,skills,commands},projects}
# Project directories are auto-created when the hook first runs in a git repo
3. 使用本能命令
bash
/instinct-status # Show learned instincts (project + global)
/evolve # Cluster related instincts into skills/commands
/instinct-export # Export instincts to file
/instinct-import # Import instincts from others
/promote # Promote project instincts to global scope
/projects # List all known projects and their instinct counts

命令

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

配置

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

json
{
"version": "2.1",
"observer": {
"enabled": false,
"run_interval_minutes": 5,
"min_observations_to_analyze": 20
}
}
键默认值描述
observer.enabledfalse启用后台观察器代理
observer.run_interval_minutes5观察器分析观察结果的频率
observer.min_observations_to_analyze20运行分析所需的最小观察次数

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

文件结构

~/.claude/homunculus/
+-- identity.json # Your profile, technical level
+-- projects.json # Registry: project hash -> name/path/remote
+-- observations.jsonl # Global observations (fallback)
+-- instincts/
| +-- personal/ # Global auto-learned instincts
| +-- inherited/ # Global imported instincts
+-- evolved/
| +-- agents/ # Global generated agents
| +-- skills/ # Global generated skills
| +-- commands/ # Global generated commands
+-- projects/
+-- a1b2c3d4e5f6/ # Project hash (from git remote URL)
| +-- project.json # Per-project metadata mirror (id/name/root/remote)
| +-- observations.jsonl
| +-- observations.archive/
| +-- instincts/
| | +-- personal/ # Project-specific auto-learned
| | +-- inherited/ # Project-specific imported
| +-- evolved/
| +-- skills/
| +-- commands/
| +-- agents/
+-- f6e5d4c3b2a1/ # Another project
+-- ...

作用域决策指南

模式类型作用域示例
语言/框架约定项目"使用 React hooks", "遵循 Django REST 模式"
文件结构偏好项目"测试放在 __tests__/", "组件放在 src/components/"
代码风格项目"使用函数式风格", "首选数据类"
错误处理策略项目"对错误使用 Result 类型"
安全实践全局"验证用户输入", "清理 SQL"
通用最佳实践全局"先写测试", "始终处理错误"
工具工作流偏好全局"编辑前先 Grep", "写入前先读取"
Git 实践全局"约定式提交", "小而专注的提交"

本能提升 (项目 -> 全局)

当同一个本能在多个项目中以高置信度出现时,它就有资格被提升到全局作用域。

自动提升标准:

  • 相同的本能 ID 出现在 2+ 个项目中
  • 平均置信度 >= 0.8

如何提升:

bash
# Promote a specific instinct
python3 instinct-cli.py promote prefer-explicit-errors
# Auto-promote all qualifying instincts
python3 instinct-cli.py promote
# Preview without changes
python3 instinct-cli.py promote --dry-run

/evolve 命令也会建议可提升的候选本能。

置信度评分

置信度随时间演变:

分数含义行为
0.3尝试性的建议但不强制执行
0.5中等的相关时应用
0.7强烈的自动批准应用
0.9近乎确定的核心行为

置信度增加当:

  • 模式被反复观察到
  • 用户未纠正建议的行为
  • 来自其他来源的相似本能一致

置信度降低当:

  • 用户明确纠正该行为
  • 长时间未观察到该模式
  • 出现矛盾证据

为什么用钩子而非技能进行观察?

"v1 依赖技能来观察。技能是概率性的 -- 根据 Claude 的判断,它们触发的概率约为 50-80%。"

钩子100% 触发,是确定性的。这意味着:

  • 每次工具调用都被观察到
  • 不会错过任何模式
  • 学习是全面的

向后兼容性

v2.1 与 v2.0 和 v1 完全兼容:

  • ~/.claude/homunculus/instincts/ 中现有的全局本能仍然作为全局本能工作
  • 来自 v1 的现有 ~/.claude/skills/learned/ 技能仍然有效
  • 停止钩子仍然运行 (但现在也会输入到 v2)
  • 逐步迁移:并行运行两者

隐私

  • 观察结果本地保留在您的机器上
  • 项目作用域的本能按项目隔离
  • 只有本能 (模式) 可以被导出 — 而不是原始观察数据
  • 不会共享实际的代码或对话内容
  • 您控制导出和提升的内容

相关链接

  • 技能创建器 - 从仓库历史生成本能
  • Homunculus - 启发了 v2 基于本能的架构的社区项目(原子观察、置信度评分、本能进化管道)
  • 长篇指南 - 持续学习部分

基于本能的学习:一次一个项目,教会 Claude 您的模式。

Security

  • Security scanPassed, 96 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/siniyayousuf/everything_claudecode/continuous-learning-v2/badge)](https://verified-skill.com/skills/siniyayousuf/everything_claudecode/continuous-learning-v2)

Something wrong with this skill or its page? Tell us.