选项
首页首页 Skill 开发者工具 continual-learning

continual-learning

microsoft/skills microsoft/skills

通过使用钩子、两级内存(全局和局部)以及自动模式检测,为人工智能编码代理实现了一个持续学习循环,以便在不同会话之间保留并应用所学知识。

...展开全部
40
更新时间 2026-09-10

人工智能编程代理的持续学习

您的智能体在不同会话之间会忘记所有内容。持续学习可以解决这个问题。

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天后被清理

这既能防止数据无限制增长,又能保留关键内容。

最佳实践

  1. 只需一步即可安装——如果耗时超过 cp -r,就难以被采纳
  2. 正确界定范围——工具模式采用全局范围,项目规范采用本地范围
  3. 具体明确—— "Use semantic_configuration_name=" 胜过 "use the right parameter"
  4. 让效果累积——每次工作时段的小改进,数周后将产生指数级的收益
在 GitHub 上查看
---
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

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ Claude 会自动检测并使用该技能

相关技能

algorithmic-art
更新时间 2026-08-27
systematic-debugging
更新时间 2026-09-03
tech-debt-tracker
更新时间 2026-08-29
receiving-code-review
更新时间 2026-09-03
OR