docs/zh-CN/skills/continuous-learning-v2/SKILL.md
基于本能的学习系统,通过钩子观察会话,创建带置信度评分的原子本能,并将其进化为技能/命令/代理。v2.1版本增加了项目范围的本能,以防止跨项目污染。
npx skillsauth add marshall0524/everythingclaudecode continuous-learning-v2Install 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.
的架构
一个高级学习系统,通过原子化的“本能”——带有置信度评分的小型习得行为——将你的 Claude Code 会话转化为可重用的知识。
v2.1 新增了项目作用域的本能 — React 模式保留在你的 React 项目中,Python 约定保留在你的 Python 项目中,而通用模式(如“始终验证输入”)则全局共享。
| 特性 | v2.0 | v2.1 | |---------|------|------| | 存储 | 全局 (~/.claude/homunculus/) | 项目作用域 (projects/<hash>/) | | 作用域 | 所有本能随处适用 | 项目作用域 + 全局 | | 检测 | 无 | git remote URL / 仓库路径 | | 提升 | 不适用 | 在 2+ 个项目中出现时,项目 → 全局 | | 命令 | 4个 (status/evolve/export/import) | 6个 (+promote/projects) | | 跨项目 | 存在污染风险 | 默认隔离 |
| 特性 | v1 | v2 | |---------|----|----| | 观察 | 停止钩子(会话结束) | PreToolUse/PostToolUse (100% 可靠) | | 分析 | 主上下文 | 后台代理 (Haiku) | | 粒度 | 完整技能 | 原子化“本能” | | 置信度 | 无 | 0.3-0.9 加权 | | 进化 | 直接进化为技能 | 本能 -> 聚类 -> 技能/命令/代理 | | 共享 | 无 | 导出/导入本能 |
一个本能是一个小型习得行为:
---
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
属性:
project (默认) 或 globalSession 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 |
+---------------------------------------------+
系统会自动检测您当前的项目:
CLAUDE_PROJECT_DIR 环境变量 (最高优先级)git remote get-url origin -- 哈希化以创建可移植的项目 ID (同一仓库在不同机器上获得相同的 ID)git rev-parse --show-toplevel -- 使用仓库路径作为后备方案 (机器特定)每个项目都会获得一个 12 字符的哈希 ID (例如 a1b2c3d4e5f6)。~/.claude/homunculus/projects.json 处的注册表文件将 ID 映射到人类可读的名称。
添加到你的 ~/.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"
}]
}]
}
}
系统会在首次使用时自动创建目录,但您也可以手动创建:
# 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
/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 以控制后台观察器:
{
"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.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)
| +-- 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 实践 | 全局 | "约定式提交", "小而专注的提交" |
当同一个本能在多个项目中以高置信度出现时,它就有资格被提升到全局作用域。
自动提升标准:
如何提升:
# 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/ 中现有的全局本能仍然作为全局本能工作~/.claude/skills/learned/ 技能仍然有效基于本能的学习:一次一个项目,教会 Claude 您的模式。
documentation
Translate visa application documents (images) to English and create a bilingual PDF with original and translation
tools
See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.
development
A comprehensive verification system for Claude Code sessions.
development
Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.