# Claude Learn A Claude Code plugin for capturing lessons learned during development sessions with **domain-based memory**, **selective saving**, and **memory hygiene**. ## Installation ```bash claude plugin install learn@romfast-plugins ``` ## Commands | Command | Description | |---------|-------------| | `/learn:analyze` | Analyze conversation and propose lessons (selective) | | `/learn:status` | Show memory statistics by domain | | `/learn:import ` | Import from another memory file | | `/learn:reflect` | Consolidate and clean up memory | | `/learn:cleanup` | Review and remove low-value entries | ## Features ### Domain-based Memory - Organized by backend, frontend, database, testing, etc. - Selective loading via `paths` frontmatter - Automatic domain detection from files in conversation ### Selective Saving (v2.1.0) The plugin now uses intelligent signal detection to save only valuable lessons: **What Gets Saved (High Priority):** - Explicit commands: "ține minte", "remember this", "memorează" - Stated preferences: "întotdeauna fă X", "always do Y" - Repeated corrections: Same issue corrected 2+ times - Historical references: "cum am discutat", "as we discussed" **What Gets Filtered Out:** - One-time typo fixes - Single-file specific bugs - Import path corrections - Hardcoded value adjustments ### Memory Hygiene (v2.1.0) Each entry now tracks metadata for cleanup: | Field | Description | |-------|-------------| | `source` | How it was captured: explicit, inferred, or repeated | | `confidence` | Signal strength: high, medium, or low | | `reinforced` | Times used in subsequent sessions | | `trigger` | Original phrase that triggered saving | Run `/learn:cleanup` periodically to review and remove low-value entries. ### SessionEnd Hook When you exit a session (`/exit`, `/clear`, `Ctrl+D`), the plugin shows a reminder: ``` ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Tip: Rulează /learn:analyze pentru a captura lecțiile din sesiune ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ``` **Note**: Requires Claude Code 2.0.50+ for `/clear` to trigger the hook. ## Plugin Structure ``` learn/ ├── .claude-plugin/plugin.json ├── commands/ │ ├── analyze.md # Main analysis with signal detection │ ├── cleanup.md # Memory hygiene command │ ├── import.md # Import from other formats │ ├── reflect.md # Cross-domain consolidation │ └── status.md # Statistics display ├── hooks/hooks.json # SessionEnd hook config ├── scripts/ │ └── session-end-reminder.sh # Reminder script ├── rules/memory-format.md ├── templates/ │ ├── domain-memory.md │ ├── domains-config.md │ └── memory-entry.json └── README.md ``` ## Memory Format Entries are saved with metadata: ```markdown ### API Response Format Standard **Discovered**: 2025-01-06 (feature: user-api) **Source**: explicit | **Confidence**: high | **Reinforced**: 3 **Trigger**: "ține minte să folosești acest format" **Description**: All API responses must use {data, error, meta} structure **Example** (`src/api/users.ts:45`): ```typescript return { data: users, error: null, meta: { count: 10 } } ``` **Tags**: api, response, format ``` ## Development ```bash # Test the plugin claude --plugin-dir ./plugins/learn # Verify commands /learn:status /learn:analyze /learn:cleanup --dry-run ``` ## Changelog ### v2.1.0 - Added selective saving with signal detection - Added `/learn:cleanup` command for memory hygiene - Added metadata tracking (source, confidence, reinforced, trigger) - Improved Stop hook with specific criteria - Backward compatible with v2.0.0 entries ### v2.0.0 - Domain-based memory organization - Selective loading via paths frontmatter - Automatic domain detection ## License MIT