feat: v2.1.0 - Selective saving, cleanup command, and SessionEnd hook

New features:
- /learn:analyze now uses signal detection to save only valuable lessons
  - Explicit commands: "ține minte", "remember", "memorează"
  - Stated preferences: "întotdeauna", "always", "never"
  - Repeated corrections (2+ times)
  - Historical references: "cum am discutat", "as we discussed"
- New /learn:cleanup command for memory hygiene
  - Scoring system for entry quality
  - Conservative mode with confirmation
  - Upgrade option to rewrite entries
- SessionEnd hook shows reminder on /exit, /clear, Ctrl+D
- Metadata tracking: source, confidence, reinforced, trigger

Changes:
- analyze.md: Added Pas 3.5 for signal detection
- cleanup.md: New command for reviewing/deleting entries
- hooks.json: Changed from Stop to SessionEnd
- scripts/session-end-reminder.sh: New reminder script
- Templates updated with metadata fields
- Documentation updated for v2.1.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-01-06 23:12:31 +00:00
parent d6c71536e7
commit 7aafcd5562
11 changed files with 746 additions and 43 deletions

View File

@@ -1,6 +1,6 @@
# Claude Learn
A Claude Code plugin for capturing lessons learned during development sessions with **domain-based memory** and **selective loading**.
A Claude Code plugin for capturing lessons learned during development sessions with **domain-based memory**, **selective saving**, and **memory hygiene**.
## Installation
@@ -12,17 +12,59 @@ claude plugin install learn@romfast-plugins
| Command | Description |
|---------|-------------|
| `/learn:analyze` | Analyze conversation and propose lessons |
| `/learn:analyze` | Analyze conversation and propose lessons (selective) |
| `/learn:status` | Show memory statistics by domain |
| `/learn:import <file>` | 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**: Only relevant memories load via `paths` frontmatter
- **Automatic domain detection**: Detects domain from files in conversation
- **Auto-generated patterns**: Glob patterns suggested when creating new domains
### 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
@@ -30,11 +72,14 @@ claude plugin install learn@romfast-plugins
learn/
├── .claude-plugin/plugin.json
├── commands/
│ ├── analyze.md
│ ├── import.md
│ ├── reflect.md
── status.md
├── hooks/hooks.json
│ ├── 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
@@ -43,12 +88,51 @@ learn/
└── 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