Skip to content
continuous-learning-v2 logo

持續學習 v2 - 基於本能的架構

continuous-learning-v2

Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

SKILL.md

Full skill instructions

持續學習 v2 - 基於本能的架構

進階學習系統,透過原子「本能」(帶信心評分的小型學習行為)將你的 Claude Code 工作階段轉化為可重用知識。

v2 的新功能

功能v1v2
觀察Stop hook(工作階段結束)PreToolUse/​PostToolUse(100% 可靠)
分析主要上下文背景 agent(Haiku)
粒度完整技能原子「本能」
信心無0.3-0.9 加權
演化直接到技能本能 → 聚類 → 技能/指令/​agent
分享無匯出/匯入本能

本能模型

本能是一個小型學習行為:

---
id: prefer-functional-style
trigger: "when writing new functions"
confidence: 0.7
domain: "code-style"
source: "session-observation"
---

# 偏好函式風格

## 動作
適當時使用函式模式而非類別。

## 證據
- 觀察到 5 次函式模式偏好
- 使用者在 2025-01-15 將基於類別的方法修正為函式

屬性:

  • 原子性 — 一個觸發器,一個動作
  • 信心加權 — 0.3 = 試探性,0.9 = 近乎確定
  • 領域標記 — code-style、testing、git、debugging、workflow 等
  • 證據支持 — 追蹤建立它的觀察

運作方式

工作階段活動
      │
      │ Hooks 捕獲提示 + 工具使用(100% 可靠)
      ▼
┌─────────────────────────────────────────┐
│         observations.jsonl              │
│   (提示、工具呼叫、結果)               │
└─────────────────────────────────────────┘
      │
      │ Observer agent 讀取(背景、Haiku)
      ▼
┌─────────────────────────────────────────┐
│          模式偵測                        │
│   • 使用者修正 → 本能                   │
│   • 錯誤解決 → 本能                     │
│   • 重複工作流程 → 本能                 │
└─────────────────────────────────────────┘
      │
      │ 建立/更新
      ▼
┌─────────────────────────────────────────┐
│         instincts/​personal/             │
│   • prefer-functional.md (0.7)          │
│   • always-test-first.md (0.9)          │
│   • use-zod-validation.md (0.6)         │
└─────────────────────────────────────────┘
      │
      │ /​evolve 聚類
      ▼
┌─────────────────────────────────────────┐
│              evolved/                   │
│   • commands/​new-feature.md             │
│   • skills/​testing-workflow.md          │
│   • agents/​refactor-specialist.md       │
└─────────────────────────────────────────┘

快速開始

1. 啟用觀察 Hooks

新增到你的 ~/​.claude/​settings.json:

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

2. 初始化目錄結構

mkdir -p ~/​.claude/​homunculus/​{instincts/​{personal,inherited},evolved/​{agents,skills,commands}}
touch ~/​.claude/​homunculus/​observations.jsonl

3. 執行 Observer Agent(可選)

觀察者可以在背景執行並分析觀察:

# 啟動背景觀察者
~/​.claude/​skills/​continuous-learning-v2/​agents/​start-observer.sh

指令

指令描述
/​instinct-status顯示所有學習本能及其信心
/​evolve將相關本能聚類為技能/指令
/​instinct-export匯出本能以分享
/​instinct-import <file>從他人匯入本能

設定

編輯 config.json:

{
  "version": "2.0",
  "observation": {
    "enabled": true,
    "store_path": "~/​.claude/​homunculus/​observations.jsonl",
    "max_file_size_mb": 10,
    "archive_after_days": 7
  },
  "instincts": {
    "personal_path": "~/​.claude/​homunculus/​instincts/​personal/",
    "inherited_path": "~/​.claude/​homunculus/​instincts/​inherited/",
    "min_confidence": 0.3,
    "auto_approve_threshold": 0.7,
    "confidence_decay_rate": 0.05
  },
  "observer": {
    "enabled": true,
    "model": "haiku",
    "run_interval_minutes": 5,
    "patterns_to_detect": [
      "user_corrections",
      "error_resolutions",
      "repeated_workflows",
      "tool_preferences"
    ]
  },
  "evolution": {
    "cluster_threshold": 3,
    "evolved_path": "~/​.claude/​homunculus/​evolved/"
  }
}

檔案結構

~/​.claude/​homunculus/
├── identity.json           # 你的個人資料、技術水平
├── observations.jsonl      # 當前工作階段觀察
├── observations.archive/   # 已處理觀察
├── instincts/
│   ├── personal/           # 自動學習本能
│   └── inherited/          # 從他人匯入
└── evolved/
    ├── agents/             # 產生的專業 agents
    ├── skills/             # 產生的技能
    └── commands/           # 產生的指令

與 Skill Creator 整合

當你使用 Skill Creator GitHub App 時,它現在產生兩者:

  • 傳統 SKILL.md 檔案(用於向後相容)
  • 本能集合(用於 v2 學習系統)

從倉庫分析的本能有 source: "repo-analysis" 並包含來源倉庫 URL。

信心評分

信心隨時間演化:

分數意義行為
0.3試探性建議但不強制
0.5中等相關時應用
0.7強烈自動批准應用
0.9近乎確定核心行為

信心增加當:

  • 重複觀察到模式
  • 使用者不修正建議行為
  • 來自其他來源的類似本能同意

信心減少當:

  • 使用者明確修正行為
  • 長期未觀察到模式
  • 出現矛盾證據

為何 Hooks vs Skills 用於觀察?

"v1 依賴技能進行觀察。技能是機率性的——它們根據 Claude 的判斷觸發約 50-80% 的時間。"

Hooks 100% 的時間確定性地觸發。這意味著:

  • 每個工具呼叫都被觀察
  • 無模式被遺漏
  • 學習是全面的

向後相容性

v2 完全相容 v1:

  • 現有 ~/​.claude/​skills/​learned/ 技能仍可運作
  • Stop hook 仍執行(但現在也餵入 v2)
  • 漸進遷移路徑:兩者並行執行

隱私

  • 觀察保持在你的機器本機
  • 只有本能(模式)可被匯出
  • 不會分享實際程式碼或對話內容
  • 你控制匯出內容

相關


基於本能的學習:一次一個觀察,教導 Claude 你的模式。

More Productivity & Planning skills

brainstorming logo
Productivity & Planning

brainstorming

Structured design dialogue that validates ideas before implementation begins.

295.4K 385.7K
View
ui-ux-pro-max logo
Productivity & Planning

ui-ux-pro-max

Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.

133.1K 383.9K
View
writing-plans logo
Productivity & Planning

writing-plans

Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.

295.4K 268K
View
using-superpowers logo
Productivity & Planning

using-superpowers

Introduction to the obra skills system with mandatory skill invocation rules and best practices.

295.4K 259.8K
View
executing-plans logo
Productivity & Planning

executing-plans

Execute a written implementation plan with critical review and task checkpoints.

295.4K 229.1K
View
dispatching-parallel-agents logo
Productivity & Planning

dispatching-parallel-agents

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View
using-git-worktrees logo
Productivity & Planning

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View
webapp-testing logo
Productivity & Planning

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View
content-strategy logo
Productivity & Planning

content-strategy

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View
repo-intake-and-plan logo
Productivity & Planning

repo-intake-and-plan

README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.

497 139.6K
View
marketing-ideas logo
Productivity & Planning

marketing-ideas

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
site-architecture logo
Productivity & Planning

site-architecture

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View

Productivity AI tools

Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View
SaveDay logo
Productivity

SaveDay

Capture, organize, and utilize your knowledge effortlessly.

Free
View
Any Summary logo
Productivity

Any Summary

Instant Summaries of Audio & Video Interviews with AnySummary

Freemium
View
M
Productivity

Map This

Transform PDFs into engaging mind maps.

Freemium
View
ChatPDF logo
Productivity

ChatPDF

Chat with any PDF instantly

Free
View
I
Productivity

intellisay

Create an optimal daily plan using your voice

Paid
View
A
Productivity

Aurora AI

A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.

Paid
View
AskYourPDF logo
Productivity

AskYourPDF

AskYourPDF Pricing Plans: Tailored to Your Needs

Free
View