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 从公开仓库中收录这些内容。

举报或申请下架