Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .github/skills/continual-learning/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
name: continual-learning
description: Guide for implementing continual learning in AI coding agents — hooks, memory files, reflection patterns, and session persistence. Use when setting up learning infrastructure for agents.
---

# Continual Learning for AI Coding Agents

## Core Concept

Continual learning enables AI coding agents to improve across sessions by capturing corrections, reflecting on patterns, and persisting knowledge. Instead of starting each session from scratch, agents build on accumulated experience.

```
Experience → Capture → Reflect → Persist → Apply
```

## The Learning Loop

### 1. Capture (During Session)

Track corrections, tool outcomes, and user feedback as they happen:
- User corrections: "no, use X not Y", "actually...", "that's wrong"
- Tool failures: repeated failures on the same tool indicate a pattern
- Successful patterns: approaches that worked well

### 2. Reflect (Session End)

At session end, synthesize raw observations into actionable learnings:
- Abstract the general principle (not just the specific instance)
- Determine scope: project-specific or global?
- Check for conflicts with existing rules

### 3. Persist (To Storage)

Store learnings in one or more of:
- **SQLite database** (`~/.copilot/continual-learning.db`) — structured, queryable
- **Memory file** (`.github/memory/learnings.md`) — human-readable, version-controlled
- **Agent memory tools** (`store_memory`, `sql` session store) — agent-native persistence

### 4. Apply (Next Session)

On session start, load accumulated context:
- Query session store for recent project history
- Read persisted learnings from database
- Surface memory file content
- Agent starts with full context of past work

## Implementation Patterns

### Hook-Based (Infrastructure Layer)

Install the `continual-learning` hook set for automatic capture and reflection:

```bash
cp -r hooks/continual-learning .github/hooks/
chmod +x .github/hooks/continual-learning/scripts/*.sh
```

This provides:
- `sessionStart` → loads past learnings
- `postToolUse` → tracks tool outcomes
- `sessionEnd` → reflects and persists

### Agent-Native (Intelligence Layer)

Use the agent's built-in memory tools for higher-quality learnings:

```
# Using the store_memory tool
store_memory(
subject="error handling",
fact="This project uses Result<T> pattern, not exceptions",
category="general"
)
```

```sql
-- Using the SQL session database
INSERT INTO session_state (key, value)
VALUES ('learned_pattern', 'Always use async/await for Azure SDK calls');
```

### Memory File Pattern

Create a living knowledge base the agent reads on startup:

```markdown
# .github/memory/learnings.md

## Conventions
- Use `DefaultAzureCredential` for all Azure auth
- Prefer `create_or_update_*` for idempotent operations

## Common Mistakes
- Don't use `azure-ai-inference` for Foundry agents — use `azure-ai-projects`
- The `search()` parameter is `semantic_configuration_name`, not `semantic_configuration`

## Preferences
- User prefers concise commit messages (50 char limit)
- Always run tests before committing
```

### The Diary Pattern (Advanced)

For deeper reflection across multiple sessions:

1. **Log sessions** — Save session summaries with decisions, challenges, outcomes
2. **Cross-reference** — Identify patterns across sessions (recurring mistakes, preferences)
3. **Synthesize** — Convert patterns into rules
4. **Prune** — Remove redundant or outdated learnings

## Best Practices

1. **Start simple** — Begin with the hook set, add agent-native memory later
2. **Be specific** — "Use `semantic_configuration_name=`" is better than "use the right parameter"
3. **Scope learnings** — Mark whether something is project-specific or global
4. **Prune regularly** — Outdated learnings cause more harm than no learnings
5. **Don't log secrets** — Only store tool names, result types, and abstract patterns
6. **Compound over time** — Small improvements per session create exponential gains
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,7 @@ temp/
# =============================================================================
# AI Agent Working Files
# =============================================================================
.sisyphus/
.sisyphus/
# Astro build artifacts
docs/data-store.json
docs/settings.json
151 changes: 151 additions & 0 deletions docs-site/src/components/HookCard.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
---
interface Props {
id: string;
name: string;
emoji: string;
description: string;
featured: boolean;
tags: string[];
path: string;
}

const { id, name, emoji, description, featured, tags, path } = Astro.props;
const githubUrl = `https://github.com/microsoft/skills/tree/main/${path}`;
---

<a href={githubUrl} target="_blank" rel="noopener" class:list={['hook-card', { featured }]}>
{featured && <div class="featured-badge">Featured</div>}
<div class="hook-header">
<span class="hook-emoji">{emoji}</span>
<h3 class="hook-name">
{name}
<svg class="external-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3" />
</svg>
</h3>
</div>
<p class="hook-desc">{description}</p>
<div class="hook-tags">
{tags.map((tag) => (
<span class="hook-tag">{tag}</span>
))}
</div>
</a>

<style>
.hook-card {
display: flex;
flex-direction: column;
gap: var(--space-md);
padding: var(--space-lg);
background: var(--bg-card);
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
text-decoration: none;
transition: all var(--transition-base);
position: relative;
overflow: hidden;
}

.hook-card:hover {
background: var(--bg-card-hover);
border-color: var(--border-hover);
box-shadow: 0 0 24px var(--accent-glow);
transform: translateY(-2px);
}

.hook-card.featured {
border-color: rgba(168, 85, 247, 0.4);
background: linear-gradient(135deg, rgba(168, 85, 247, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
grid-column: 1 / -1;
}

.hook-card.featured:hover {
border-color: rgba(168, 85, 247, 0.6);
box-shadow: 0 0 32px rgba(168, 85, 247, 0.15), 0 0 16px var(--accent-glow);
}

.featured-badge {
position: absolute;
top: var(--space-md);
right: var(--space-md);
font-size: var(--text-xs);
font-weight: 600;
color: #a855f7;
background: rgba(168, 85, 247, 0.12);
border: 1px solid rgba(168, 85, 247, 0.3);
padding: 2px 10px;
border-radius: var(--radius-sm);
text-transform: uppercase;
letter-spacing: 0.05em;
}

.hook-header {
display: flex;
align-items: center;
gap: var(--space-sm);
}

.hook-emoji {
font-size: var(--text-2xl);
line-height: 1;
}

.featured .hook-emoji {
font-size: 2rem;
}

.hook-name {
display: flex;
align-items: center;
gap: var(--space-xs);
font-size: var(--text-base);
font-weight: 600;
color: var(--text-primary);
margin: 0;
}

.featured .hook-name {
font-size: var(--text-lg);
}

.external-icon {
width: 14px;
height: 14px;
flex-shrink: 0;
opacity: 0.5;
}

.hook-card:hover .external-icon {
opacity: 1;
}

.hook-desc {
font-size: var(--text-sm);
color: var(--text-secondary);
margin: 0;
line-height: 1.6;
}

.hook-tags {
display: flex;
flex-wrap: wrap;
gap: var(--space-xs);
margin-top: auto;
}

.hook-tag {
font-size: var(--text-xs);
color: var(--text-muted);
background: var(--bg-tertiary);
border: 1px solid var(--border-primary);
padding: 1px 8px;
border-radius: var(--radius-sm);
}

.featured .hook-tag {
background: rgba(168, 85, 247, 0.08);
border-color: rgba(168, 85, 247, 0.2);
color: rgba(168, 85, 247, 0.8);
}
</style>
11 changes: 11 additions & 0 deletions docs-site/src/data/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"id": "continual-learning",
"name": "Continual Learning",
"emoji": "🧠",
"description": "Learn, reflect, and persist knowledge across sessions. Captures tool outcomes, detects failure patterns, and surfaces accumulated learnings so each session starts smarter than the last.",
"featured": true,
"tags": ["learning", "memory", "reflection", "productivity"],
"path": "hooks/continual-learning"
}
]
21 changes: 14 additions & 7 deletions docs-site/src/data/skills.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
"path": ".github/plugins/azure-sdk-python/skills/agent-framework-azure-ai-py",
"package": "agent-framework-azure-ai"
},
{
"name": "aspire-ts",
"description": "Orchestrate JavaScript/TypeScript applications with .NET Aspire. Use when building Node.js APIs, React/Vue/Svelte frontends, or Vite apps that need service discovery, telemetry, and deployment orchestration via Aspire's AppHost. Covers AddViteApp, AddNodeApp, AddJavaScriptApp, package managers, OpenTelemetry, and polyglot integration patterns.",
"lang": "ts",
"category": "general",
"path": ".github/skills/aspire-ts"
},
{
"name": "agents-v2-py",
"description": "Build container-based Foundry Agents using Azure AI Projects SDK with ImageBasedHostedAgentDefinition.\nUse when creating hosted agents that run custom code in Azure AI Foundry with your own container images.\nTriggers: \"ImageBasedHostedAgentDefinition\", \"hosted agent\", \"container agent\", \"Foundry Agent\",\n\"create_version\", \"ProtocolVersionRecord\", \"AgentProtocol.RESPONSES\", \"custom agent image\".\n",
Expand Down Expand Up @@ -937,6 +930,13 @@
"path": ".github/plugins/azure-sdk-typescript/skills/azure-web-pubsub-ts",
"package": "@azure/web-pubsub, @azure/web-pubsub-client"
},
{
"name": "continual-learning",
"description": "Guide for implementing continual learning in AI coding agents — hooks, memory files, reflection patterns, and session persistence. Use when setting up learning infrastructure for agents.",
"lang": "core",
"category": "general",
"path": ".github/skills/continual-learning"
},
{
"name": "copilot-sdk",
"description": "Build applications powered by GitHub Copilot using the Copilot SDK. Use when creating programmatic integrations with Copilot across Node.js/TypeScript, Python, Go, or .NET. Covers session management, custom tools, streaming, hooks, MCP servers, BYOK providers, session persistence, custom agents, skills, and deployment patterns. Requires GitHub Copilot CLI installed and a GitHub Copilot subscription (unless using BYOK).",
Expand All @@ -951,6 +951,13 @@
"category": "general",
"path": ".github/plugins/azure-sdk-python/skills/fastapi-router-py"
},
{
"name": "frontend-design-review",
"description": "Review and create distinctive, production-grade frontend interfaces with high design quality and design system compliance. Evaluates using three pillars: frictionless insight-to-action, quality craft, and trustworthy building. USE FOR: PR reviews, design reviews, accessibility audits, design system compliance checks, creative frontend design, UI code review, component reviews, responsive design checks, theme testing, and creating memorable UI. DO NOT USE FOR: Backend API reviews, database schema reviews, infrastructure or DevOps work, pure business logic without UI, or non-frontend code.\n",
"lang": "core",
"category": "general",
"path": ".github/skills/frontend-design-review"
},
{
"name": "frontend-ui-dark-ts",
"description": "Build dark-themed React applications using Tailwind CSS with custom theming, glassmorphism effects, and Framer Motion animations. Use when creating dashboards, admin panels, or data-rich interfaces with a refined dark aesthetic.",
Expand Down
Loading
Loading