From 48378aced47cbaa828ae34e67d0e99e0f2edeb1e Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Wed, 7 Jan 2026 00:25:40 +0000 Subject: [PATCH] refactor: Remove hooks - SessionEnd/PreCompact not useful for notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hooks execute after Claude Code exits, so output is not visible. Removed: setup command, install-hooks.sh, hooks.json, session-end-reminder.sh Bump version to 2.2.0 ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude-plugin/marketplace.json | 2 +- plugins/learn/.claude-plugin/plugin.json | 2 +- plugins/learn/commands/setup.md | 62 --------- plugins/learn/hooks/hooks.json | 17 --- plugins/learn/scripts/install-hooks.sh | 119 ------------------ plugins/learn/scripts/session-end-reminder.sh | 14 --- 6 files changed, 2 insertions(+), 214 deletions(-) delete mode 100644 plugins/learn/commands/setup.md delete mode 100644 plugins/learn/hooks/hooks.json delete mode 100755 plugins/learn/scripts/install-hooks.sh delete mode 100755 plugins/learn/scripts/session-end-reminder.sh diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 31cdbc4..bdfeaa8 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -11,7 +11,7 @@ "name": "learn", "source": "./plugins/learn", "description": "Domain-based memory with selective saving, signal detection, and memory hygiene", - "version": "2.1.4", + "version": "2.2.0", "keywords": ["learn", "memory", "patterns", "gotchas", "domains", "cleanup", "hygiene"] } ] diff --git a/plugins/learn/.claude-plugin/plugin.json b/plugins/learn/.claude-plugin/plugin.json index dbf8abd..81cebf7 100644 --- a/plugins/learn/.claude-plugin/plugin.json +++ b/plugins/learn/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "learn", "description": "Claude Learn: Session analysis for patterns and gotchas with domain-based memory, selective saving, and memory hygiene", - "version": "2.1.4", + "version": "2.2.0", "author": { "name": "Romfast Team" } diff --git a/plugins/learn/commands/setup.md b/plugins/learn/commands/setup.md deleted file mode 100644 index 1cf920d..0000000 --- a/plugins/learn/commands/setup.md +++ /dev/null @@ -1,62 +0,0 @@ -# /learn:setup - Install Learn Plugin Hooks - -Instaleazฤƒ hooks-urile plugin-ului Learn รฎn configuraศ›ia Claude Code. - -## Task - -Verificฤƒ ศ™i instaleazฤƒ hooks-urile necesare pentru plugin-ul Learn รฎn `~/.claude/settings.json`. - -### Hooks de instalat: - -1. **SessionEnd** - Reminder la sfรขrศ™itul sesiunii sฤƒ rulezi `/learn:analyze` -2. **PreCompact** (auto) - Reminder รฎnainte de auto-compact sฤƒ salvezi lecศ›iile - -### Paศ™i: - -1. Citeศ™te `~/.claude/settings.json` -2. Verificฤƒ dacฤƒ existฤƒ deja secศ›iunea `hooks` -3. Adaugฤƒ sau actualizeazฤƒ hooks-urile pentru Learn plugin: - -```json -{ - "hooks": { - "SessionEnd": [ - { - "hooks": [ - { - "type": "command", - "command": "echo 'Tip: Ruleaza /learn:analyze pentru a captura lectiile din sesiune'", - "timeout": 5 - } - ] - } - ], - "PreCompact": [ - { - "matcher": "auto", - "hooks": [ - { - "type": "command", - "command": "echo 'Context plin! Ruleaza /learn:analyze ACUM pentru a salva lectiile inainte de compact!'", - "timeout": 5 - } - ] - } - ] - } -} -``` - -4. Salveazฤƒ fiศ™ierul actualizat -5. Confirmฤƒ instalarea cu succes - -### Output: - -Afiศ™eazฤƒ: -- Ce hooks au fost instalate -- Dacฤƒ erau deja instalate (skip) -- Instrucศ›iuni pentru a verifica cu `/hooks` - -### Notฤƒ: - -Aceastฤƒ comandฤƒ modificฤƒ `~/.claude/settings.json`. Hooks-urile vor fi active din urmฤƒtoarea sesiune Claude Code. diff --git a/plugins/learn/hooks/hooks.json b/plugins/learn/hooks/hooks.json deleted file mode 100644 index fcb3af6..0000000 --- a/plugins/learn/hooks/hooks.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "Claude Learn hooks - session end reminders", - "hooks": { - "SessionEnd": [ - { - "matcher": "*", - "hooks": [ - { - "type": "command", - "command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/session-end-reminder.sh", - "timeout": 5 - } - ] - } - ] - } -} diff --git a/plugins/learn/scripts/install-hooks.sh b/plugins/learn/scripts/install-hooks.sh deleted file mode 100755 index d0025e5..0000000 --- a/plugins/learn/scripts/install-hooks.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# Claude Learn - Install Hooks -# Adaugฤƒ hooks-urile Learn รฎn ~/.claude/settings.json - -SETTINGS_FILE="$HOME/.claude/settings.json" - -# Colors -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -CYAN='\033[0;36m' -RED='\033[0;31m' -NC='\033[0m' - -echo -e "${CYAN}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${NC}" -echo -e "${CYAN} Claude Learn - Hook Installation${NC}" -echo -e "${CYAN}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${NC}" - -# Check if settings file exists -if [ ! -f "$SETTINGS_FILE" ]; then - echo -e "${RED}Error: $SETTINGS_FILE not found${NC}" - exit 1 -fi - -# Backup -cp "$SETTINGS_FILE" "$SETTINGS_FILE.backup" -echo -e "${GREEN}โœ“${NC} Backup created: settings.json.backup" - -# Check if hooks already exist -if python3 -c "import json; d=json.load(open('$SETTINGS_FILE')); exit(0 if 'hooks' in d else 1)" 2>/dev/null; then - echo -e "${YELLOW}โš ${NC} Hooks section already exists in settings.json" - echo -e " Checking for Learn hooks..." - - # Check if SessionEnd already has our hook - HAS_LEARN=$(python3 -c " -import json -d = json.load(open('$SETTINGS_FILE')) -hooks = d.get('hooks', {}) -session_end = hooks.get('SessionEnd', []) -for h in session_end: - inner_hooks = h.get('hooks', []) - for ih in inner_hooks: - cmd = ih.get('command', '') - if 'learn:analyze' in cmd: - print('yes') - exit(0) -print('no') -" 2>/dev/null) - - if [ "$HAS_LEARN" = "yes" ]; then - echo -e "${GREEN}โœ“${NC} Learn hooks already installed!" - exit 0 - fi -fi - -# Add hooks using Python -python3 << 'PYTHON_SCRIPT' -import json -import os - -settings_file = os.path.expanduser("~/.claude/settings.json") - -with open(settings_file, 'r') as f: - settings = json.load(f) - -# Define Learn hooks (format: hooks array inside) -learn_session_end = { - "hooks": [ - { - "type": "command", - "command": "echo 'Tip: Ruleaza /learn:analyze pentru a captura lectiile din sesiune'", - "timeout": 5 - } - ] -} - -learn_pre_compact = { - "matcher": "auto", - "hooks": [ - { - "type": "command", - "command": "echo 'Context plin! Ruleaza /learn:analyze ACUM pentru a salva lectiile inainte de compact!'", - "timeout": 5 - } - ] -} - -# Initialize hooks if not exists -if 'hooks' not in settings: - settings['hooks'] = {} - -# Add SessionEnd hook -if 'SessionEnd' not in settings['hooks']: - settings['hooks']['SessionEnd'] = [] -settings['hooks']['SessionEnd'].append(learn_session_end) - -# Add PreCompact hook -if 'PreCompact' not in settings['hooks']: - settings['hooks']['PreCompact'] = [] -settings['hooks']['PreCompact'].append(learn_pre_compact) - -# Write back -with open(settings_file, 'w') as f: - json.dump(settings, f, indent=2) - -print("Hooks added successfully!") -PYTHON_SCRIPT - -if [ $? -eq 0 ]; then - echo -e "${GREEN}โœ“${NC} SessionEnd hook installed" - echo -e "${GREEN}โœ“${NC} PreCompact hook installed" - echo "" - echo -e "${CYAN}Hooks-urile vor fi active din urmฤƒtoarea sesiune Claude Code.${NC}" - echo -e "Verificฤƒ cu: ${YELLOW}/hooks${NC}" -else - echo -e "${RED}Error installing hooks${NC}" - # Restore backup - mv "$SETTINGS_FILE.backup" "$SETTINGS_FILE" - exit 1 -fi diff --git a/plugins/learn/scripts/session-end-reminder.sh b/plugins/learn/scripts/session-end-reminder.sh deleted file mode 100755 index 8809dcb..0000000 --- a/plugins/learn/scripts/session-end-reminder.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Claude Learn - Session End Reminder -# This script runs at session end and reminds the user to save lessons - -# Colors for terminal output -YELLOW='\033[1;33m' -CYAN='\033[0;36m' -NC='\033[0m' # No Color - -echo "" -echo -e "${YELLOW}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${NC}" -echo -e "${CYAN}๐Ÿ’ก Tip: Ruleazฤƒ ${YELLOW}/learn:analyze${CYAN} pentru a captura lecศ›iile din sesiune${NC}" -echo -e "${YELLOW}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${NC}" -echo ""