Learning Interface
The
times_applied counter tracks how often a learning is referenced. Use incrementTimesApplied() to update it.Store Methods
All methods are available on theStore instance returned by createStore().
addLearning
Learning data to insert.
id, created_at, and times_applied are auto-generated.Project name (e.g.,
"my-app") or null for global learnings.Category for grouping. Common values:
Testing, Git, Editing, Architecture, Performance, Claude-Code.One-line description of the correct behavior. This is the primary searchable field.
What went wrong. Can be
null for proactive learnings.How the mistake was fixed. Can be
null for proactive learnings.The inserted learning with auto-generated
id and created_at.getLearning
Learning ID to retrieve.
The learning if found, otherwise
undefined.getAllLearnings
Filter by project name. If omitted, returns all learnings.
Array of learnings sorted by
created_at DESC.When filtering by project, learnings with
project: null are always included (global learnings).updateLearning
Learning ID to update.
Fields to update. Only
category, rule, mistake, and correction can be updated.true if the update succeeded, false if the learning was not found.deleteLearning
Learning ID to delete.
true if deleted, false if not found.incrementTimesApplied
Learning ID to increment.
No return value. The counter is incremented atomically.
Use this when a learning is successfully applied in a session. Helps surface frequently-used patterns.
Categories
Recommended categories for consistency:Standard Categories
Standard Categories
| Category | Use For |
|---|---|
| Navigation | File paths, finding code |
| Editing | Code change patterns |
| Testing | Test approaches, coverage |
| Git | Commits, branches, merges |
| Quality | Lint, types, style |
| Context | When to clarify requirements |
| Architecture | Design decisions |
| Performance | Optimization patterns |
| Claude-Code | Sessions, modes, CLAUDE.md |
| Prompting | Scope, constraints, acceptance criteria |
| Debugging | Root cause analysis |
| Security | Auth, secrets, validation |
Examples
Next Steps
Search API
Full-text search for learnings
Sessions API
Track session activity
Commands
Use learnings in slash commands
Agents
Preload learnings into agents