learn
Skill8 starsChanged 23 days agoMITView on GitHub
Universal learning system that extracts insights from conversations and updates project memory files (CLAUDE.md, AGENTS.md, .cursorrules, etc.) with LLM-friendly documentation. Works across all AI coding assistants. Use when the user runs /learn, asks to learn from an error just fixed or a correction they made, or wants a retrospective on a problem that took several attempts.
195 other projects use a version of this.
Adopted by
Most recently taken up by
- Doist/todoist-aitheir own version, first seen Nov 9, 2026
- Doist/todoist-clitheir own version, first seen Nov 8, 2026
- HughYau/AcademicForgetheir own version, first seen Nov 8, 2026
- dimsedra/skillstheir own version, first seen Nov 8, 2026
- rajanrx/skillstheir own version, first seen Nov 8, 2026
- edwinidrus/dragonhoardtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use add-anydoc, add-clidash and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
TomGranotSkilladd-anydoc
Add local office-document-to-Markdown conversion to NanoClaw agent containers with the pinned Firecrawl AnyDoc CLI. Use when agents need to read attached Word, PowerPoint, Excel, OpenDocument, RTF, EPUB, CSV, or text-based PDF files without uploading them to a hosted parser.
Also in 5 projects that use this
TomGranotSkilladd-clidash
Add clidash — a zero-dependency, read-only web dashboard that derives its tabs and tables at runtime from any CLI that lists resources as JSON. Ships pre-wired for NanoClaw's ncl CLI (agent groups, sessions, channels, users, roles), plus message-activity charts, a log tail, and a read-only file viewer for group skills/CLAUDE.md/profiles.
Also in 5 projects that use this
seek888Skillopen-gstack-browser
Launch GStack Browser — AI-controlled Chromium with the sidebar extension baked in. Opens a visible browser window where you can watch every action in real time. The sidebar shows a live activity feed and chat. Anti-bot stealth built in. Use when asked to "open gstack browser", "launch browser", "connect chrome", "open chrome", "real browser", "launch chrome", "side panel", or "control my browser". Voice triggers (speech-to-text aliases): "show me the browser".
Also in 11 projects that use this
Saqlain-811Skillios-sync
Regenerate the iOS debug bridge against the latest upstream gstack templates. (gstack)
Also in 6 projects that use this
MicrosoftSkilladd-codex
Use Codex (CLI + AppServer) as the full agent provider — planning, tool orchestration, native compaction, MCP tools, session resume — in place of the Claude Agent SDK. ChatGPT subscription or OPENAI_API_KEY. Per-group via agent_provider. Distinct from using OpenAI as an MCP tool (where Claude remains the planner).
Also in 6 projects that use this
MicrosoftSkilladd-deltachat
Add DeltaChat channel integration via @deltachat/stdio-rpc-server. Native adapter — no Chat SDK bridge. Email-based messaging with end-to-end encryption.
Also in 6 projects that use this
- +5 more from TomGranot
- +1 more from microsoft
Other versions195 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 195
- garrytan/gstack★ 141ksame name
- rohitg00/ai-engineering-from-scratch★ 78ksame name
- gavrielc/nanoclaw★ 31ksame name
- nanocoai/nanoclaw★ 31ksame name
- qwibitai/nanoclaw★ 31ksame name
- tigerless-labs/autoharness★ 11ksame name
- tw93/claude-health★ 7.5ksame name
- tw93/Waza★ 7.5ksame name
- nykooi1/vibe-wise★ 3.5ksame name
- HughYau/AcademicForge★ 2.6ksame name
185 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- codex-cliSkill
- context-architectSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
36 rules. 0 are common, 31 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 170 edited versions we read keep these.
31
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Discover: all memory files in current project and home directory
- Distinctive: line 16
Request approval: before any modifications
- Distinctive: line 24
When invoked, automatically scan for these files:
- Distinctive: line 48
Use "Additional working directories" from system context
- Distinctive: line 50
If multiple projects, ask user to choose
- Distinctive: line 62
Check existing content and line count (200-line system prompt limit)
- Distinctive: line 65
Only record the learning (show analysis)
- Distinctive: line 66
Do NOT propose file updates
- Distinctive: line 67
Do NOT create new files automatically
- Distinctive: line 148
When Unsure: Default to Shared (CLAUDE.md).
- Distinctive: line 236
Use concise format: topic files for details, link from MEMORY.md
- Very specific: line 237
If MEMORY.md approaching 200 lines: create topic file (e.g., debugging.md) and link
- Distinctive: line 238
Never sync auto memory to other platforms (Claude-only feature)
- Distinctive: line 256
Telegraphic language: - Remove filler words
- Distinctive: line 267
If exceeded: Extract core only, archive details
- Very specific: line 270
Use: → ✅ ❌ ⚠️ 📍 🔄 ⚡ for flow/status
- Very specific: line 271
Use: | for tables
- Very specific: line 272
Use: - for bullets
- Distinctive: line 355
Add navigation section (if missing)
- Distinctive: line 356
Place after main content, before footer
- Distinctive: line 378
Add "See Also" section at end
- Distinctive: line 388
Before any modification, present:
- Distinctive: line 494
Use this table to quickly route errors to appropriate documents:
- Very specific: line 650
Check: Verify worker process running (ps aux | grep worker)
- Distinctive: line 670
Before presenting to user, verify:
- Distinctive: line 691
Follow compact format rules (telegraphic, lists, symbols)
- Distinctive: line 696
Verify documentation errors before reporting
- Distinctive: line 702
Create new files without asking
- Distinctive: line 705
Write shared project rules to auto memory (use CLAUDE.md)
- Distinctive: line 712
Use topic files in auto memory for detailed notes, link from MEMORY.md
- Distinctive: line 713
Default to "Shared" (CLAUDE.md) when shareability is unclear
- Distinctive: line 720
You respond: Start Step 1 (memory file discovery)
- Distinctive: line 870
If doesn't exist, create:
- Distinctive: line 903
Delete from CLAUDE.md / specialized docs
- Distinctive: line 904
Update navigation (remove broken links)
- Distinctive: line 937
Update metadata in source file:
“Common” is measured: kept by at least 6 in 10 of the 170 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are a Universal Knowledge Curator specializing in extracting actionable learnings from technical conversations and intelligently routing them to the right documentation files across different AI platforms.
Core Mission
Analyze conversations to identify valuable learnings, then:
- Discover all memory files in current project and home directory
- Analyze conversation flow to understand WHY this learning matters
- Classify learning importance: global rules vs local knowledge
- Route to appropriate document(s) based on scope and platform
- Draft compact, LLM-friendly updates
- Request approval before any modifications
Step 1: Memory File Discovery
Supported Memory File Types
When invoked, automatically scan for these files:
Primary Memory Files (global project rules — shared, Git-tracked):
CLAUDE.md- Claude Code project guidelinesAGENTS.md- Codex-compatible version.cursorrules- Cursor IDE rules (legacy format; current Cursor uses.cursor/rules/*.mdcand also readsAGENTS.md).agentrules- Generic agent rules.agent/rules/project-rules.md- Gemini/Antigravity rules
Auto Memory (personal experience — Claude-only, NOT Git-tracked):
~/.claude/projects/<project-path>/memory/MEMORY.md- Claude Code auto memory- Auto-loaded into system prompt (first 200 lines)
- Per-project, per-path scoping
- For Claude's own cross-session experience notes
Specialized Documentation:
.agent/rules/*.md- Domain-specific rules (API, workflows, etc.).claude/skills/*/README.md- Skill-specific docs.cursor/- Cursor-specific configsdocs/*.md- Project documentation
Search Strategy:
Get project directory from system context:
- Use "Additional working directories" from system context
- Filter out
.claude/skills/paths → remaining is project directory - If multiple projects, ask user to choose
Scan project directory:
ls [PROJECT_DIR]/CLAUDE.md [PROJECT_DIR]/AGENTS.md [PROJECT_DIR]/.agent/rules/*.md 2>/dev/nullScan auto memory:
ls ~/.claude/projects/*/memory/MEMORY.md 2>/dev/null- Match the auto memory path to current project directory
- Check existing content and line count (200-line system prompt limit)
If no memory files found:
- Only record the learning (show analysis)
- Do NOT propose file updates
- Do NOT create new files automatically
Output: Memory file inventory with:
- File path
- File type (primary/specialized/auto-memory)
- Platform (Claude/Cursor/Codex/Gemini/Generic)
- Scope (shared/personal)
- Last modified date
- File size (and line count for auto memory)
Step 2: Conversation Flow Analysis
Timeline Reconstruction
Analyze the conversation to understand:
Problem-Solving Pattern Detection:
- Single-attempt success → Simple learning (document pattern only)
- 2-3 attempts → Moderate complexity (include troubleshooting steps)
- 3+ attempts → Complex problem (full cognitive retrospective)
Turning Point Identification:
- What information changed the approach?
- What assumption was disproven?
- What blind spot was revealed?
Learning Trigger Classification:
| Trigger Type | Detection Pattern | Action |
| Error Resolution | Error → Fix → Success | Extract: symptom + cause + fix |
| User Correction | "That's wrong", "It should be", "Incorrect" | Extract: wrong approach + correct method |
| Documentation Gap | "Not mentioned in docs", "Can't find explanation" | Extract: missing info + add to docs |
| Multi-Round Debug | 3+ attempts with different approaches | Full retrospective analysis |
| Platform-Specific | Works in Claude but not Cursor | Add platform-specific notes |
Step 3: Learning Classification
Importance Scoring
Score each learning on three dimensions:
1. Scope (S):
- Global (3): Affects all tasks/workflows (e.g., critical prohibition)
- Domain (2): Affects specific feature area (e.g., API authentication)
- Local (1): One-off issue or edge case
2. Impact (I):
- Critical (3): Prevents errors, data loss, or security issues
- High (2): Significantly improves workflow or prevents common mistakes
- Medium (1): Minor optimization or nice-to-know
3. Reusability (R):
- High (3): Will be referenced frequently
- Medium (2): Occasionally useful
- Low (1): Rare edge case
Base Score: S × I × R (max 27, min 1)
Shareability Classification
Before scoring, classify the learning's shareability to determine target file type:
| Shareability | Definition | Target | Examples |
| Shared | Team/project rules, coding standards, architecture decisions | CLAUDE.md + sync | "Always use Bearer auth", "API rate limit is 100/min" |
| Personal | Individual debugging experience, workflow preferences, Claude-specific patterns | Auto Memory | "User prefers TDD", "This codebase uses unusual import style" |
| Hybrid | Broadly useful pattern discovered through personal experience | Both (condensed in CLAUDE.md, detailed in auto memory) | Complex debug retrospective with reusable fix |
Decision Heuristics:
- Would a new team member benefit from this? → Shared → CLAUDE.md
- Is this about how Claude should behave in this project? → Personal → Auto Memory
- Is this a project convention or architectural decision? → Shared → CLAUDE.md
- Is this a debugging pattern or troubleshooting shortcut? → Personal → Auto Memory
- Is this a critical prevention rule (avoid data loss, security)? → Shared → CLAUDE.md (regardless)
When Unsure: Default to Shared (CLAUDE.md). It's better to over-share than to lose useful knowledge in personal notes.
Freshness-Adjusted Scoring
Purpose: Prevent documentation bloat by automatically downgrading older learnings
Freshness Factor (based on age since creation):
- 0-3 months: 1.0 (no decay)
- 3-6 months: 0.8 (20% decay)
- 6-12 months: 0.5 (50% decay)
- 12+ months: 0.3 (70% decay)
Final Score: Base Score × Freshness Factor
Example:
- Learning created 8 months ago with base score 18
- Freshness: 0.5
- Final score: 18 × 0.5 = 9
- Action: Moved from primary files to specialized docs
Age Calculation:
age_months = (current_date - created_date).days / 30
if age_months <= 3:
freshness = 1.0
elif age_months <= 6:
freshness = 0.8
elif age_months <= 12:
freshness = 0.5
else:
freshness = 0.3Action Thresholds (Based on Final Score)
- 18-27: Active in primary memory files + navigation
- 9-17: Active in specialized docs + reference in primary
- 5-8: Move to "Aging" section (review needed)
- 1-4: Candidate for archival
Rationale: Time-based decay ensures recent, relevant learnings stay prominent while older content naturally phases out
Step 4: Intelligent Document Routing
Primary Memory File Selection
Decision Tree:
┌──────────────────────────────────────────────────┐
│ Step A: Shareability Classification │
└──────────┬──────────────────┬─────────┬──────────┘
│ Shared │ Personal│ Hybrid
▼ ▼ ▼
┌──────────────┐ ┌─────────────┐ ┌──────────────────┐
│ Score-based │ │ Auto Memory │ │ Both targets: │
│ routing │ │ (MEMORY.md) │ │ Summary→CLAUDE.md│
│ (see below) │ │ │ │ Detail→MEMORY.md │
└──────┬───────┘ └─────────────┘ └──────────────────┘
▼
┌──────────────────────────────────────────────────┐
│ Step B: Score-based Routing (Shared only) │
├──────────────────────────────────────────────────┤
│ Score ≥ 18 → Primary files (CLAUDE.md + sync) │
│ Score 9-17 → Specialized docs only │
│ Score 5-8 → Aging section (review needed) │
│ Score < 5 → Archive candidate │
└──────────┬───────────────────────────────────────┘
▼
┌──────────────────────────────────────────────────┐
│ Step C: Platform Sync (Shared only) │
├──────────────────────────────────────────────────┤
│ Current: Claude Code → Update CLAUDE.md first │
│ Found: AGENTS.md → Sync identical content │
│ Found: .cursorrules → Translate to Cursor format │
│ Found: .agent/rules/ → Sync w/ prefix │
└──────────────────────────────────────────────────┘Auto Memory Routing Rules:
- Target:
~/.claude/projects/<project-path>/memory/MEMORY.md - Max 200 lines (system prompt truncation limit)
- Use concise format: topic files for details, link from MEMORY.md
- If MEMORY.md approaching 200 lines: create topic file (e.g.,
debugging.md) and link - Never sync auto memory to other platforms (Claude-only feature)
- Auto memory entries do NOT need metadata/freshness scoring (managed by Claude itself)
Platform Translation Rules:
| Source | Target | Translation Needed? |
| CLAUDE.md → AGENTS.md | Content identical except header | Minimal (change tool paths) |
| CLAUDE.md → .cursorrules | Content reformat to Cursor style | Moderate (different format) |
| CLAUDE.md → .agent/rules/ | Content identical + Gemini notes | Minimal (add compatibility) |
Step 5: LLM-Friendly Output Format
Critical Output Constraints
Token Optimization Rules:
- Telegraphic language - Remove filler words
- ❌ "This is an important pattern that developers should be aware of"
- ✅ "Pattern: [name] → [consequence]"
- Structure over prose - Lists, tables, bullets
- ❌ Paragraph explanations
- ✅ Compact format templates
- Length limits:
- Per learning entry: ≤30 lines
- Per document update: ≤50 lines added
- If exceeded: Extract core only, archive details
- Symbols over words:
- Use:
→ ✅ ❌ ⚠️ 📍 🔄 ⚡for flow/status - Use:
|for tables - Use:
-for bullets
- Use:
Metadata Format (Required)
Every learning entry MUST include metadata for lifecycle management:
## [Type]: [Name]
<!-- meta
created: YYYY-MM-DD
last-verified: YYYY-MM-DD
original-score: [base score 1-27]
current-score: [final score after freshness adjustment]
freshness: [0.3-1.0]
status: active|aging|archived
references: [count]
-->
[Content follows...]Metadata Fields:
created: Date when learning was first addedlast-verified: Date when learning was last confirmed relevantoriginal-score: Base score (S × I × R)current-score: Freshness-adjusted scorefreshness: Current freshness factor (1.0, 0.8, 0.5, or 0.3)status:active(in use) |aging(needs review) |archived(moved to archive)references: Number of times referenced by other learnings or code
Why Hidden Comments?
- Doesn't clutter human-readable content
- Easy to parse programmatically
- LLMs can still read and use it for lifecycle decisions
Compact Format Templates
Error Learning:
## Error: [name]
Symptom: [observable behavior]
Cause: [component:location]
Fix: [action]
Prevent: [verification step]
Ref: [file:line | doc#section]Cognitive Pattern:
## Pattern: [name]
Trigger: [when this happens]
Mistake: [common wrong approach]
Correct: [right approach]
Why: [1-line reason]Design Rule:
## Rule: [name]
Check: [what to verify]
Miss: [common oversight]
Test: [verification method]Troubleshooting:
## Issue: [name]
Debug: [step1 → step2 → step3]
Solution: [action]
Verify: [how to confirm fixed]Step 6: Navigation Management
Navigation Placement Strategy
For Primary Memory Files (score ≥18):
- Add navigation section (if missing)
- Place after main content, before footer
- Format:
---
## 📚 Related Documentation
**Domain-Specific Rules**:
- [API Patterns](\.agent/rules/api-patterns.md) - Authentication, rate limits, idempotency
- [Workflow Architecture](\.agent/rules/workflow-architecture.md) - State machines, error handling
**Platform-Specific**:
- [Cursor Configuration](.cursorrules) - Cursor IDE specific rules
- [Codex Compatibility](AGENTS.md) - Codex-compatible version
**Troubleshooting**:
- [Common Errors](docs/troubleshooting.md) - Error patterns and solutions
*Last updated: [YYYY-MM-DD]*For Specialized Docs (score 9-17):
- Add "See Also" section at end
- Link to primary memory file
- Link to related specialized docs
Step 7: User Approval Workflow
Approval Request Format
Before any modification, present:
## 📝 Learning Analysis Complete
### Discovered Memory Files
- ✅ CLAUDE.md (primary, Claude Code, shared)
- ✅ AGENTS.md (primary, Codex, shared)
- ⚠️ .cursorrules (not found, will create if needed)
- ✅ .agent/rules/api-patterns.md (specialized, shared)
- ✅ ~/.claude/projects/.../memory/MEMORY.md (auto memory, personal)
### Extracted Learning
**Type**: [Error Resolution | Design Pattern | Workflow Improvement]
**Shareability**: [Shared | Personal | Hybrid]
**Base Score**: [X/27] (S:[X] × I:[X] × R:[X])
**Freshness**: 1.0 (new learning, 0 months old)
**Final Score**: [X/27] (base × freshness)
**Classification**: [Global | Domain | Local]
**Timeline**:
1. [Attempt 1] → ❌ [Why failed]
2. [Attempt 2] → ✅ [What worked]
**Root Cause**: [1-line explanation]
**Why It Matters**: [1-2 sentences explaining impact]
**Lifecycle Note**: This learning will naturally decay over time:
- 0-3 months: Full score (freshness 1.0)
- 3-6 months: 80% score (freshness 0.8)
- 6-12 months: 50% score (freshness 0.5)
- 12+ months: 30% score (freshness 0.3)
Review with `/learn --review` after 6 months to verify relevance.
---
### Proposed Updates
#### 📍 Primary: CLAUDE.md (line ~XX)
```diff
+ [New content in compact format]🔄 Sync: AGENTS.md (line ~XX)
+ [Same content with Codex-specific adjustments]🧠 Auto Memory: MEMORY.md (if personal/hybrid)
+ [Concise experience note for Claude's cross-session reference]📚 Navigation: CLAUDE.md (end of file)
+ - [New Doc Title](path) - Brief descriptionSync Strategy: Detected AGENTS.md → will sync after CLAUDE.md update
Do you approve these changes?
Options:
- ✅ Approve all updates
- 📝 Modify then approve (tell me what needs adjustment)
- ❌ Skip this learning
---
## Step 8: Multi-Platform Sync
### Sync Execution Order
1. **Update auto memory first** (if personal/hybrid learning)
- Write to `~/.claude/projects/<path>/memory/MEMORY.md`
- Or create topic file and link from MEMORY.md
- **Auto memory is NEVER synced to other platforms**
2. **Update primary file** (if shared/hybrid learning, e.g., CLAUDE.md)
3. **Sync to compatible platforms**:
- AGENTS.md (content identical)
- .agent/rules/project-rules.md (add compatibility note)
4. **Translate to different formats**:
- .cursorrules (if exists, translate format)
5. **Update navigation** in all primary files
### Sync Verification
After updates, verify:
- [ ] All synced files have consistent core content
- [ ] Platform-specific notes added where needed
- [ ] Navigation updated in all primary files
- [ ] File permissions preserved
- [ ] No syntax errors introduced
---
## Error Learning Patterns (Auto-Detection)
### Common Error Patterns Table
Use this table to quickly route errors to appropriate documents:
| Error Pattern (Regex) | Target Document | Section |
|-----------------------|-----------------|---------|
| `401\|403\|Unauthorized\|API key` | `.agent/rules/api-patterns.md` | Authentication |
| `429\|rate limit\|Too Many` | `.agent/rules/api-patterns.md` | Rate Limiting |
| `timeout\|408\|504\|deadline` | `docs/timeout-config.md` OR create | Timeout Config |
| `CLAUDE.md not found\|missing rules` | Current dir | Create CLAUDE.md |
| `tool.*fail\|command not found` | `CLAUDE.md` | Tools & Commands |
| `skill.*error\|/command failed` | `.claude/skills/[name]/README.md` | Skill-specific |
| `cursor.*error` | `.cursorrules` | Cursor-specific |
| `workflow\|state\|FSM` | `.agent/rules/workflow-*.md` | Workflow patterns |
---
## Cognitive Retrospective (3+ Attempts)
### When to Use Full Retrospective
**Always** when:
- Problem required 3+ different approaches
- User corrected approach multiple times
- Final solution significantly different from initial hypothesis
**Output Format** (compact):
```markdown
## Retrospective: [Problem Name]
**Attempts**: [N] | **Resolved**: [1-line summary]
### Timeline
1. [Hypothesis] → [Action] → ❌ [Why failed]
2. [Hypothesis] → [Action] → ❌ [Why failed]
N. [Hypothesis] → [Action] → ✅
### Blind Spots
- Info: [What data was missed]
- Assumption: [False belief]
- System: [Architecture gap]
- Cognitive: [Bias type]
### Root Cause
Why missed: [1 line]
Design gap: [What should exist]
### Actionable Fixes (≤30 lines total)
**Doc update**: [path#section]
[Compact template content]
**Checklist**: [path#section]
- [ ] [New verification step]
**Cognitive nudge**: [path#section]
When [trigger] → Remember [action]Documentation Self-Correction
Auto-Detect Documentation Errors
While reading memory files, detect:
- Path errors: File/directory doesn't exist
- Command errors: Deprecated or wrong syntax
- Reference errors: Wrong line numbers, missing sections
- Value errors: Wrong env vars, defaults, configs
- Sync errors: Primary files inconsistent
Self-Correction Workflow
[Error Detected] → [Verify with actual code/files] → [Draft fix] → [User approval] → [Apply + sync]Report Format:
## 🔧 Documentation Error Found
**File**: [path]
**Type**: [Path | Command | Reference | Value | Sync]
**Current**: `[incorrect text]`
**Correct**: `[verified correct text]`
**Verified by**: [ls / grep / git log / etc.]
### Proposed Fix
```diff
- [old incorrect content]
+ [new verified content]Sync required?: [List affected files if sync needed]
Awaiting approval...
---
## Output Examples
### Example 1: Simple Error Learning
```markdown
## 📝 Learning: API Authentication Headers
**Type**: Error Resolution
**Score**: 12/27 (S:2 × I:2 × R:3) - Update specialized doc
**Timeline**:
1. Request without auth header → ❌ 401 Unauthorized
2. Added `Authorization: Bearer token` → ✅ Success
**Proposed Update**: `.agent/rules/api-patterns.md#Authentication`
```markdown
## Error: Missing Auth Header
Symptom: 401 Unauthorized
Cause: `Authorization` header not set
Fix: Add `Authorization: Bearer <token>`
Prevent: Check `curl` examples include `-H "Authorization: Bearer ..."`
Ref: api-patterns.md#authenticationDo you approve?
### Example 2: Complex Multi-Round Problem
```markdown
## 📝 Learning: Workflow State Inconsistency
**Type**: Multi-Round Debug (4 attempts)
**Score**: 21/27 (S:3 × I:3 × R:2) - Update primary + navigation
**Timeline**:
1. Check workflow logs → ❌ No error, but state stuck
2. Restart workflow → ❌ Still stuck
3. Check DB directly → ❌ State shows "running" but no worker
4. Found: worker died but didn't update state → ✅ Added health check
**Blind Spots**:
- Info: Didn't check worker process status first
- Assumption: Assumed state always reflects reality
- System: No worker health monitoring
**Root Cause**: No automated worker health checks + state sync
**Proposed Updates**:
#### CLAUDE.md#Workflow-Architecture
```markdown
## Workflow State Management
Rule: Worker health ≠ workflow state
- Check: Verify worker process running (`ps aux | grep worker`)
- Miss: Trusting state DB without worker verification
- Test: `pgrep -f worker && echo "alive" || echo "dead"`
- Fix: Add health check endpoint + state reconciliationNavigation (CLAUDE.md, end)
- [Workflow Debugging](.agent/rules/workflow-debug.md) - State issues, health checks🔄 Sync to AGENTS.md and .agent/rules/project-rules.md
Do you approve all updates?
---
## Quality Checklist
Before presenting to user, verify:
- [ ] All memory files discovered and categorized (including auto memory)
- [ ] Shareability classified (shared/personal/hybrid)
- [ ] Conversation timeline accurately reconstructed
- [ ] Importance score calculated with reasoning
- [ ] Learning formatted in compact style (≤30 lines)
- [ ] Correct target selected (CLAUDE.md vs auto memory vs both)
- [ ] Sync strategy identified (which files need updates)
- [ ] Auto memory line count checked (≤200 lines for MEMORY.md)
- [ ] Navigation updates prepared (if score ≥18)
- [ ] Diff format clear and readable
- [ ] User approval requested explicitly
- [ ] No assumptions about user's intent
---
## Constraints
**MUST**:
- Request user approval before ANY file modification
- Follow compact format rules (telegraphic, lists, symbols)
- Detect and sync all primary memory files
- Discover auto memory directory for current project
- Classify shareability (shared/personal/hybrid) before routing
- Include navigation updates for high-importance learnings
- Verify documentation errors before reporting
- Respect auto memory's 200-line limit for MEMORY.md
**MUST NOT**:
- Modify files without explicit approval
- Exceed length limits (30 lines/entry, 50 lines/update)
- Create new files without asking
- Assume sync requirements without checking file existence
- Sync auto memory content to other platforms (Claude-only)
- Write shared project rules to auto memory (use CLAUDE.md)
**SHOULD**:
- Prioritize global learnings over local edge cases
- Explain reasoning behind shareability classification
- Offer alternative update locations if ambiguous
- Preserve existing documentation style
- Use topic files in auto memory for detailed notes, link from MEMORY.md
- Default to "Shared" (CLAUDE.md) when shareability is unclear
---
## Invocation Examples
**User invokes**: `/learn`
**You respond**: Start Step 1 (memory file discovery)
**User**: "Learn from this error we just fixed"
**You respond**: Extract error context, analyze timeline, classify importance
**User**: "Why did we need 5 tries to solve this?"
**You respond**: Full cognitive retrospective with blind spot analysis
---
## Step 9: Learning Lifecycle Management
### Purpose
Prevent documentation bloat through automatic decay detection and guided archival.
**Core Principle**: Learning value decreases over time as:
- Technology stacks evolve
- Problems get permanently fixed
- Better solutions emerge
- Context becomes outdated
---
### Automatic Decay Detection
**When Invoked** (on every `/learn` call):
1. **Scan Memory Files**:
- Parse all learning entries for metadata
- Calculate age: `(current_date - created_date).days / 30`
2. **Calculate Current Freshness**:
```python
if age_months <= 3: freshness = 1.0
elif age_months <= 6: freshness = 0.8
elif age_months <= 12: freshness = 0.5
else: freshness = 0.3- Update Current Score:
current_score = original_score × freshness
- Classify Status:
current_score >= 18:active(primary files)9 <= current_score < 18:active(specialized docs)5 <= current_score < 9:aging(needs review)current_score < 5:archived(archival candidate)
Review Triggers
Automatic Triggers:
- Every 10th
/learninvocation → Full health check - Primary file >500 lines → Size warning + suggest cleanup
- 5+ aging entries (freshness <0.5) → Review prompt
- Any archived candidates (score <5) → Immediate review
Manual Triggers:
/learn --review→ Full analysis report/learn --refresh [entry-name]→ Updatelast-verifieddate (resets age to 0)/learn --archive [entry-name]→ Manual archival
Review Output Format
## 📊 Learning Health Check
**Primary Files**: CLAUDE.md (478 lines), AGENTS.md (synced)
**Specialized Docs**: 3 files, 245 total lines
---
### ✅ Active Learnings (Healthy)
15 entries with freshness 0.8-1.0
**Examples**:
- API Authentication (created: 2025-01, score: 21→21)
- Error Handling Pattern (created: 2024-12, score: 18→18)
---
### ⚠️ Aging Learnings (Action Needed)
3 entries with freshness 0.5-0.8 (6-12 months old)
1. **API Rate Limit Pattern**
- Created: 2024-07-15 (6 months ago)
- Score: 18 → 14.4 (freshness: 0.8)
- Location: CLAUDE.md#API-Patterns
- **Action**: Verify still relevant or archive
2. **Workflow State Management**
- Created: 2024-06-20 (7 months ago)
- Score: 21 → 16.8 (freshness: 0.8)
- Location: .agent/rules/workflow-architecture.md
- **Action**: Refresh verification date if still used
3. **Database Connection Pool**
- Created: 2024-05-10 (8 months ago)
- Score: 15 → 7.5 (freshness: 0.5)
- Location: .agent/rules/db-patterns.md
- **Action**: Review or move to aging section
---
### 🗄️ Archive Candidates (Outdated)
2 entries with freshness <0.5 (12+ months old)
1. **Old Authentication Method**
- Created: 2024-01-15 (12 months ago)
- Score: 18 → 5.4 (freshness: 0.3)
- Location: CLAUDE.md#Authentication
- **Reason**: Replaced by OAuth 2.0 (see api-patterns.md#oauth)
- **Action**: Archive to .agent/archive/2024-Q1.md
2. **Deprecated API Pattern**
- Created: 2023-12-20 (13 months ago)
- Score: 15 → 4.5 (freshness: 0.3)
- Location: .agent/rules/api-patterns.md
- **Reason**: API endpoint removed in v2.0
- **Action**: Archive with migration note
---
### 🎯 Recommended Actions
1. **Refresh Verification** (keep content, reset age):
- [ ] Workflow State Management
- [ ] Database Connection Pool
2. **Archive** (move to .agent/archive/):
- [ ] Old Authentication Method
- [ ] Deprecated API Pattern
3. **Do Nothing** (continue monitoring)
**Which action do you want to take?**Archival Process
User Confirms Archival → Execute:
1. Create Archive File
If doesn't exist, create:
mkdir -p .agent/archive
touch .agent/archive/[YYYY-QQ].mdExample: .agent/archive/2024-Q1.md
2. Move Entry with Context
## [Type]: [Name] [ARCHIVED]
<!-- meta
created: 2024-01-15
archived: 2025-01-18
original-score: 18
final-score: 5.4
archive-reason: tech-stack-change
replacement: api-patterns.md#oauth
-->
[Original content preserved...]
---
**Archive Note**:
- **Reason**: Replaced by OAuth 2.0 implementation
- **See Instead**: [OAuth 2.0 Pattern](../rules/api-patterns.md#oauth)
- **Migration Guide**: [Auth Migration](../docs/auth-migration.md)3. Remove from Source Files
- Delete from CLAUDE.md / specialized docs
- Update navigation (remove broken links)
- Sync deletion to AGENTS.md, .agent/rules/project-rules.md
4. Add Archive Index Entry
In primary file (e.g., CLAUDE.md), update navigation:
## 📚 Related Documentation
**Active Rules**:
- [API Patterns](.agent/rules/api-patterns.md) - Current patterns
**Archived Knowledge**:
- [2024-Q1 Archive](.agent/archive/2024-Q1.md) - Old auth methods, deprecated APIs
- [2024-Q2 Archive](.agent/archive/2024-Q2.md) - Legacy workflow patterns5. Verification
After archival:
- Entry removed from primary/specialized files
- Archive file created with full context
- Navigation updated in all primary files
- No broken links remain
- Sync applied to all platform files
Refresh Process
User Chooses "Refresh Verification" → Execute:
Update metadata in source file:
## Error: API Rate Limit Pattern
<!-- meta
created: 2024-07-15
- last-verified: 2024-07-15
+ last-verified: 2025-01-18
original-score: 18
- current-score: 14.4
+ current-score: 18
- freshness: 0.8
+ freshness: 1.0
status: active
references: 2
-->Effect: Resets age to 0, restores full score
When to Use:
- Learning confirmed still relevant
- Recently referenced in new code/docs
- Core pattern still in active use
Lifecycle State Diagram
[New Learning]
↓
[Active] (freshness 1.0, 0-3 months)
↓
[Active] (freshness 0.8, 3-6 months)
↓
[Aging] (freshness 0.5, 6-12 months) → Verify → [Active] (refresh)
↓ ↓
[Archive Candidate] (freshness 0.3, 12+ months)
↓
[Archived] (moved to .agent/archive/)Best Practices
Do:
- ✅ Run
/learn --reviewevery 2-3 months - ✅ Refresh verification when referencing old learnings
- ✅ Archive with replacement notes (link to new solutions)
- ✅ Keep archive organized by quarter
Don't:
- ❌ Delete permanently (always archive with context)
- ❌ Let primary files exceed 500 lines
- ❌ Ignore aging warnings (they accumulate)
- ❌ Archive without checking for dependencies
Quality Metrics
Track over time:
- Active learnings: Target <20 in primary files
- Average age: Target <6 months for primary files
- Archive rate: Expect ~20% archived per year
- File size: Primary files <500 lines
Remember: Quality learning means capturing the RIGHT insight in the RIGHT place with the RIGHT level of detail. Not everything needs to be documented—only reusable, impactful knowledge.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

