continual-learning
microsoft/skills
透過鉤子(hooks)、兩層記憶體(全域與局部)以及自動模式偵測,為人工智慧編碼代理實作持續學習迴圈,以在不同執行階段之間保留並應用所學知識。
...展開全部人工智慧編碼代理的持續學習
您的代理程式會在不同執行階段之間遺忘所有資訊。持續學習能解決這個問題。
The Loop
Experience → Capture → Reflect → Persist → Apply
↑ │
└───────────────────────────────────────┘
快速入門
安裝掛鉤(一步完成):
cp -r hooks/continual-learning .github/hooks/
首次會話時自動初始化。無需任何設定。
兩層記憶體
全域變數 (~/.copilot/learnings.db)—— 隨您穿梭於所有專案之間:
- 工具模式(哪些工具會失敗、哪些能正常運作)
- 跨專案規範
- 一般程式編寫偏好
本儲存庫 (.copilot-memory/learnings.db)——僅適用於此儲存庫:
- 專案特定規範
- 此程式碼庫常見的錯誤
- 團隊偏好設定
學習成果的儲存方式
自動(透過鉤子)
該鉤子會監測工具的執行結果並偵測失敗模式:
Session 1: bash tool fails 4 times → learning stored: "bash frequently fails"
Session 2: hook surfaces that learning at start → agent adjusts approach
代理原生(透過 store_memory / SQL)
代理程式可直接寫入學習成果:
INSERT INTO learnings (scope, category, content, source)
VALUES ('local', 'convention', 'This project uses Result not exceptions', 'user_correction');
分類: pattern, mistake, preference, tool_insight
手動(記憶體檔案)
適用於人類可讀且受版本控制的知識:
# .copilot-memory/conventions.md
- Use DefaultAzureCredential for all Azure auth
- Parameter is semantic_configuration_name=, not semantic_configuration=
壓縮
學習成果會隨時間衰減:
- 超過 60 天且命中次數低的條目將被刪除
- 高價值的學習成果(被頻繁引用者)將永久保留
- 工具日誌將於 7 天後被刪除
此舉可防止資料量無限制增長,同時保留重要內容。
最佳實務
- 安裝只需一步 — 若耗時超過
cp -r,便不會被採用 - 範圍界定須正確 — 工具模式採用全局規範,專案慣例則採用局部規範
- 具體明確 —
"Use semantic_configuration_name="勝過"use the right parameter" - 讓效果累積——每次工作時段的小幅改善,數週後將產生指數級的成效
---
name: continual-learning
description: Implements a continual learning loop for AI coding agents using hooks, two-tier memory (global and local), and automatic pattern detection to persist and apply learnings across sessions.
---
# Continual Learning for AI Coding Agents
Your agent forgets everything between sessions. Continual learning fixes that.
## The Loop
```
Experience → Capture → Reflect → Persist → Apply
↑ │
└───────────────────────────────────────┘
```
## Quick Start
Install the hook (one step):
```bash
cp -r hooks/continual-learning .github/hooks/
```
Auto-initializes on first session. No config needed.
## Two-Tier Memory
**Global** (`~/.copilot/learnings.db`) — follows you across all projects:
- Tool patterns (which tools fail, which work)
- Cross-project conventions
- General coding preferences
**Local** (`.copilot-memory/learnings.db`) — stays with this repo:
- Project-specific conventions
- Common mistakes for this codebase
- Team preferences
## How Learnings Get Stored
### Automatic (via hooks)
The hook observes tool outcomes and detects failure patterns:
```
Session 1: bash tool fails 4 times → learning stored: "bash frequently fails"
Session 2: hook surfaces that learning at start → agent adjusts approach
```
### Agent-native (via store_memory / SQL)
The agent can write learnings directly:
```sql
INSERT INTO learnings (scope, category, content, source)
VALUES ('local', 'convention', 'This project uses Result<T> not exceptions', 'user_correction');
```
Categories: `pattern`, `mistake`, `preference`, `tool_insight`
### Manual (memory files)
For human-readable, version-controlled knowledge:
```markdown
# .copilot-memory/conventions.md
- Use DefaultAzureCredential for all Azure auth
- Parameter is semantic_configuration_name=, not semantic_configuration=
```
## Compaction
Learnings decay over time:
- Entries older than 60 days with low hit count are pruned
- High-value learnings (frequently referenced) persist indefinitely
- Tool logs are pruned after 7 days
This prevents unbounded growth while preserving what matters.
## Best Practices
1. **One step to install** — if it takes more than `cp -r`, it won't get adopted
2. **Scope correctly** — global for tool patterns, local for project conventions
3. **Be specific** — `"Use semantic_configuration_name="` beats `"use the right parameter"`
4. **Let it compound** — small improvements per session create exponential gains over weeks
所有檔案
1 個檔案安裝 continual-learning
請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。
下載 ZIP複製儲存庫並將技能檔案複製到您的專案中。
git clone https://github.com/microsoft/skills/tree/main/.github/skills/continual-learning # Copy SKILL.md to your .claude/skills/ directory
複製





首頁
