# Continuous Learning

> Prompt-driven learning system that extracts reusable patterns from Copilot CLI sessions, creates atomic instincts with confidence scoring, and evolves them into skills/prompts/agents.

- Skill: `andyhsutw/continuous-learning` (Agent Skill)
- Install (CLI): `npx skillmds@latest add andyhsutw/continuous-learning`
- Raw SKILL.md: https://api.skillmd.com/api/skills/andyhsutw/continuous-learning/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: AndyHsuTW (https://skillmd.com/u/andyhsutw)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/andyhsutw/continuous-learning

---


# Continuous Learning for GitHub Copilot CLI

When this skill is invoked, ask the user which action to perform:

| Action | Description |
|--------|-------------|
| **learn** | Analyze current session, extract patterns, save as instincts |
| **status** | Show all learned instincts with confidence scores |
| **evolve** | Cluster related instincts into skills/prompts/agents |
| **export** | Export instincts to shareable YAML file |
| **import** | Import instincts from a file |

Alternatively, the user may directly state what they want (e.g., "extract learnings from this session", "show my instincts"). Match their intent to the appropriate action below.

---

## Action: learn

Analyze the current session and extract patterns worth saving as instincts.

### What to Look For

1. **Error Resolution** (`error_resolution`) - What error occurred? Root cause? Fix? Reusable?
2. **User Corrections** (`user_corrections`) - Did the user correct AI behavior? What was preferred?
3. **Debugging Techniques** (`debugging_techniques`) - Non-obvious steps, tool combinations
4. **Workarounds** (`workarounds`) - Library quirks, API limitations, version-specific fixes
5. **Project Conventions** (`project_specific`) - Codebase conventions, architecture decisions
6. **Tool Preferences** (`tool_preferences`) - Preferred tools, search-before-edit workflows
7. **Repeated Workflows** (`repeated_workflows`) - Multi-step sequences used multiple times

### When to Suggest Learning

After complex work, proactively suggest: "This session had some interesting patterns. Want me to run `/continuous-learning` to save them?"

Do NOT extract:
- Simple typo fixes
- One-time issues (API outages)
- Trivial syntax errors

### Confidence Assignment

- 1 observation: 0.3 (tentative)
- 2-3 observations: 0.5 (moderate)
- User explicitly stated preference: 0.7 (strong)
- Repeated pattern across session: 0.7 (strong)
- Multiple confirming observations: 0.85 (very strong)

### Execution Steps

1. Review the current session for extractable patterns
2. For each pattern, determine: id, trigger, action, confidence, domain
3. Check existing instincts to avoid duplicates (run `node scripts/copilot/instinct-cli.js status`)
4. Present findings to user and ask for confirmation
5. For each confirmed instinct, create a `.yaml` file in the instincts directory

**Storage path** (create directory if missing):
- Windows: `%USERPROFILE%\.copilot\learned\instincts\personal\`
- Unix/macOS: `~/.copilot/learned/instincts/personal/`

**File format** -- save as `<id>.yaml`:

```yaml
---
id: prefer-functional-style
trigger: "when writing new functions"
confidence: 0.7
domain: "code-style"
source: "session-observation"
created: "2025-01-22"
last_validated: "2025-01-22"
observations: 5
---

# Prefer Functional Style

## Action
Use functional patterns over classes when appropriate.

## Evidence
- Observed 5 instances of functional pattern preference
- User corrected class-based approach to functional on 2025-01-22

## When to Apply
When creating new modules, prefer function-based patterns with closures over class-based designs.
```

### Update Rules

If an instinct with the same `id` already exists:
- Increment `observations` count
- Update `last_validated` to today
- Increase `confidence` by 0.05 (cap at 0.95)
- Append new evidence

---

## Action: status

Show all learned instincts grouped by domain with confidence bars.

### Execution

Run the CLI tool:
```
node scripts/copilot/instinct-cli.js status
```

Or if you prefer a specific domain:
```
node scripts/copilot/instinct-cli.js status --domain code-style
```

If the CLI is not available, manually read all `.yaml` files from:
- `~/.copilot/learned/instincts/personal/`
- `~/.copilot/learned/instincts/inherited/`

Parse each file and display grouped by domain, sorted by confidence (highest first).

---

## Action: evolve

Cluster 3+ related instincts into higher-level structures.

### Execution

Run the CLI tool:
```
node scripts/copilot/instinct-cli.js evolve
```

Or manually analyze instincts and determine evolution type:

**-> Skill** (auto-triggered behaviors): When instincts describe code style, error handling, or patterns that should always apply.
- Example: `prefer-functional` + `use-immutable` + `avoid-classes` -> `functional-patterns` skill

**-> Prompt** (user-invoked actions): When instincts describe repeatable user-requested workflows.
- Example: `new-table-migration` + `update-schema` + `regenerate-types` -> `/new-table` prompt

**-> Agent** (complex multi-step): When instincts describe deep, multi-step processes.
- Example: `debug-check-logs` + `debug-isolate` + `debug-reproduce` -> `debugger` agent

### Output Locations

Save evolved structures to `~/.copilot/learned/evolved/`:
- Skills: `evolved/skills/<name>/SKILL.md`
- Prompts: `evolved/prompts/<name>.prompt.md`
- Agents: `evolved/agents/<name>.agent.md`

### 描述撰寫指引（關鍵）

演化產生的每個結構，其 `description` 欄位**必須包含觸發情境與關鍵字**，否則 AI 不會在正確時機載入它。

**差的描述（缺少觸發情境）：**
```
description: Enforce functional programming patterns
```

**好的描述（包含觸發情境與關鍵字）：**
```
description: 撰寫新函式、建立模組、設計資料流時套用函數式程式設計模式。涵蓋不可變性、純函式、避免類別繼承等慣例。
```

**規則：**
1. 開頭用「當...時」或動詞片語描述**何時該載入**此結構
2. 包含使用者可能在提示中使用的**關鍵字**
3. 遵循專案語言設定（若有）撰寫描述
4. 長度建議 40-100 字，避免過短（觸發不到）或過長（噪音太多）

---

## Action: export

Export instincts to a shareable YAML file.

### Execution

```
node scripts/copilot/instinct-cli.js export --output instincts-export.yaml
```

Or with filters:
```
node scripts/copilot/instinct-cli.js export --domain testing --min-confidence 0.7
```

Exported files contain only patterns (no code, no file paths, no session data).

---

## Action: import

Import instincts from a YAML file.

### Execution

```
node scripts/copilot/instinct-cli.js import path/to/instincts.yaml
```

Preview first with `--dry-run`:
```
node scripts/copilot/instinct-cli.js import path/to/instincts.yaml --dry-run
```

Merge strategy:
- **New instincts**: added to `inherited/` directory
- **Duplicates**: keep the one with higher confidence
- **Conflicts**: skip and flag for manual resolution

---

## Instinct Properties

- **Atomic** -- one trigger, one action
- **Confidence-weighted** -- 0.3 = tentative, 0.9 = near certain
- **Domain-tagged** -- code-style, testing, git, debugging, workflow, api-design, security, etc.
- **Evidence-backed** -- tracks what observations created it

## Confidence Scoring

| Score | Meaning | Behavior |
|-------|---------|----------|
| 0.3 | Tentative | Noted but not actively applied |
| 0.5 | Moderate | Applied when clearly relevant |
| 0.7 | Strong | Proactively applied |
| 0.9 | Near-certain | Core behavior, always applied |

Confidence increases when pattern is repeatedly observed or confirmed.
Confidence decreases when user corrects the behavior or it goes unused.

## Compatibility

Instincts use the same YAML format as the Claude Code version (stored in `~/.claude/homunculus/`), enabling cross-tool sharing between Claude Code and Copilot users.

