Extract and persist insights from the current conversation to the knowledge base
Extract insights from the current conversation and persist them to the project's knowledge base.
/learn # Quick extraction from recent conversation
/learn --deep # Thorough analysis with forked context (uses Explore agent)
When --deep is specified, the extraction runs in a forked context using the Explore agent:
Use --deep when you've had a significant debugging session or made architectural decisions you want fully documented.
Analyzes the conversation context to identify:
These insights survive session boundaries and context compaction, building a persistent understanding of the project over time.
Analyze the conversation looking for:
Categorize each insight as pattern, quirk, or decision
Format and append to the appropriate file in knowledge/learnings/:
patterns.md - What works wellquirks.md - Unexpected behaviorsdecisions.md - Choices with rationaleUpdate metadata in each file's frontmatter (entry_count, last_updated)
Update state in knowledge/state.json:
last_extraction to current timestampextraction_countqueries_since_extraction to 0Report what was learned to the user
## Pattern: [Short descriptive title]
- **Discovered:** [ISO date]
- **Context:** [What task/problem led to this discovery]
- **Insight:** [What approach works well and why]
- **Confidence:** high|medium|low
## Quirk: [Short descriptive title]
- **Discovered:** [ISO date]
- **Location:** [File/module/area where this applies]
- **Behavior:** [What's unusual or unexpected]
- **Workaround:** [How to handle it]
- **Confidence:** high|medium|low
## Decision: [Short descriptive title]
- **Made:** [ISO date]
- **Context:** [What prompted this decision]
- **Choice:** [What was decided]
- **Rationale:** [Why this choice over alternatives]
- **Confidence:** high|medium|low
Only high and medium confidence insights influence routing decisions.
knowledge/state.jsonKnowledge Extraction Complete
─────────────────────────────
Extracted:
[Pattern] "Title of pattern learned"
[Quirk] "Title of quirk discovered"
[Decision] "Title of decision recorded"
Knowledge base now contains:
- X patterns
- Y quirks
- Z decisions
From a conversation where we debugged an auth issue:
Quirk extracted:
## Quirk: Auth tokens require base64 padding
- **Discovered:** 2026-01-08
- **Location:** src/auth/tokenService.ts
- **Behavior:** JWT tokens in this codebase use non-standard base64 without padding, causing standard decoders to fail
- **Workaround:** Use the custom `decodeToken()` helper instead of atob()
- **Confidence:** high
/learn-on instead