Continual Learning

作者 microsoft354361d83247無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Guide for implementing continual learning in AI coding agents — hooks, memory scoping, reflection patterns. Use when setting up learning infrastructure for agents.

精選僅含說明AI & Agents
AI 產生的概覽

指導如何透過鉤子、分層記憶儲存與反思模式,為 AI 程式代理加入持續學習能力。

功能
這是一份為 AI 程式代理建立持續學習的說明性指南。內容描述「經驗—擷取—反思—保存—套用」的循環、包含全域與專案層級儲存的兩層記憶模型,以及透過鉤子自動記錄、由代理直接寫入或使用人工記憶檔三種記錄學習成果的方式。文中也說明記憶的衰減與清理規則,以及導入時的實務建議。
適用情境
適合在為 AI 程式代理建立學習或記憶基礎設施、讓它跨工作階段保留經驗時使用。也適合希望長期保存工具失敗模式、專案慣例與偏好的團隊。
執行需求
僅為說明文件,未附任何指令碼。所述做法涉及將 hooks 目錄複製到 .github/hooks、使用 SQLite 形式的學習資料庫,以及代理環境對鉤子的支援。

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

來源與署名

來源:microsoft/skills位於.github/skills/continual-learning提交354361d

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架