fix: Correct hooks format - add nested hooks array

SessionEnd hooks require { hooks: [...] } format, not direct type/command.
Fixed install-hooks.sh script and setup.md command.
Bump version to 2.1.3

🤖 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-07 00:01:56 +00:00
parent f08704af5e
commit b9284a59f7
4 changed files with 24 additions and 14 deletions

View File

@@ -11,7 +11,7 @@
"name": "learn",
"source": "./plugins/learn",
"description": "Domain-based memory with selective saving, signal detection, and memory hygiene",
"version": "2.1.2",
"version": "2.1.3",
"keywords": ["learn", "memory", "patterns", "gotchas", "domains", "cleanup", "hygiene"]
}
]

View File

@@ -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.2",
"version": "2.1.3",
"author": {
"name": "Romfast Team"
}

View File

@@ -21,11 +21,15 @@ Verifică și instalează hooks-urile necesare pentru plugin-ul Learn în `~/.cl
{
"hooks": {
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "echo '\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n💡 Tip: Rulează /learn:analyze pentru a captura lecțiile din sesiune\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'",
"command": "echo '\\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n💡 Tip: Rulează /learn:analyze pentru a captura lecțiile din sesiune\\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'",
"timeout": 5
}
]
}
],
"PreCompact": [
{
@@ -33,7 +37,7 @@ Verifică și instalează hooks-urile necesare pentru plugin-ul Learn în `~/.cl
"hooks": [
{
"type": "command",
"command": "echo '\n⚠ Context plin! Rulează /learn:analyze ACUM pentru a salva lecțiile înainte de compact!\n'",
"command": "echo '\\n⚠ Context plin! Rulează /learn:analyze ACUM pentru a salva lecțiile înainte de compact!\\n'",
"timeout": 5
}
]

View File

@@ -37,7 +37,9 @@ d = json.load(open('$SETTINGS_FILE'))
hooks = d.get('hooks', {})
session_end = hooks.get('SessionEnd', [])
for h in session_end:
cmd = h.get('command', '')
inner_hooks = h.get('hooks', [])
for ih in inner_hooks:
cmd = ih.get('command', '')
if 'learn:analyze' in cmd:
print('yes')
exit(0)
@@ -60,11 +62,15 @@ settings_file = os.path.expanduser("~/.claude/settings.json")
with open(settings_file, 'r') as f:
settings = json.load(f)
# Define Learn hooks
# Define Learn hooks (format: hooks array inside)
learn_session_end = {
"hooks": [
{
"type": "command",
"command": "echo '\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n💡 Tip: Rulează /learn:analyze pentru a captura lecțiile din sesiune\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'",
"command": "echo '\\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n💡 Tip: Rulează /learn:analyze pentru a captura lecțiile din sesiune\\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'",
"timeout": 5
}
]
}
learn_pre_compact = {