<!-- AUTO-GENERATED by scripts/gen-adapters.js - DO NOT EDIT -->
---
description: Use when user asks to "learn about topic", "research subject", "create learning guide", "build knowledge base", "study topic", or wants to gather online resources on any subject.
agent: general
---

> **OpenCode Note**: Invoke agents using `@agent-name` syntax.
> Available agents: task-discoverer, exploration-agent, planning-agent,
> implementation-agent, deslop-agent, delivery-validator, sync-docs-agent, consult-agent
> Example: `@exploration-agent analyze the codebase`


# /learn - Learning Guide Generator

Research any topic by gathering online resources and synthesize into a comprehensive learning guide with RAG-optimized indexes.

## Depth Levels

| Level | Sources | Use Case |
|-------|---------|----------|
| `brief` | 10 | Quick overview, time-sensitive |
| `medium` | 20 | **Default** - balanced coverage |
| `deep` | 40 | Comprehensive, academic depth |

## Arguments

Parse from $ARGUMENTS:

- **topic**: The subject to learn about (required)
- **--depth**: `brief` (10 sources), `medium` (20, default), or `deep` (40)
- **--no-enhance**: Skip enhancement pass (default: enhance enabled)

## Execution

### Phase 1: Parse Arguments

*(JavaScript reference - not executable in OpenCode)*

### Phase 2: Check Existing Guide

- Use AskUserQuestion tool for user input


### Phase 3: Spawn Learn Agent

*(JavaScript reference - not executable in OpenCode)*

### Phase 4: Parse Results

*(JavaScript reference - not executable in OpenCode)*

### Phase 5: Present Results

```markdown
## Learning Guide Created

**Topic**: {topic}
**File**: agent-knowledge/{slug}.md
**Sources**: {sourceCount} resources analyzed

### Quality Assessment

| Metric | Rating |
|--------|--------|
| Coverage | {coverage}/10 |
| Source Diversity | {diversity}/10 |
| Example Quality | {examples}/10 |
| Confidence | {confidence}/10 |

### Source Breakdown

| Type | Count |
|------|-------|
| Official Docs | {n} |
| Tutorials | {n} |
| Q&A/Stack Overflow | {n} |
| Blog Posts | {n} |
| GitHub Examples | {n} |

### Next Steps

- [ ] Review the guide at `agent-knowledge/{slug}.md`
- [ ] Check source quality in `agent-knowledge/resources/{slug}-sources.json`
- [ ] Run `/learn {related-topic}` to expand your knowledge base
```

## Output Structure

Each `/learn` run creates/updates:

```
agent-knowledge/
  CLAUDE.md           # Master index (updated)
  AGENTS.md           # Master index for OpenCode/Codex (updated)
  {slug}.md           # Topic-specific guide (created)
  resources/
    {slug}-sources.json  # Source metadata (created)
```

## Error Handling

| Error | Action |
|-------|--------|
| No topic provided | Show usage help |
| WebSearch fails | Retry with alternative queries |
| Insufficient sources | Warn user, proceed with available |
| Enhancement fails | Skip enhancement, note in output |

## Example Usage

```bash
/learn recursion
/learn react hooks --depth=deep
/learn "kubernetes networking" --depth=brief
/learn python async --no-enhance
```