feat(mem0-plugin): add PostToolUseFailure, PostCompact, SessionEnd, SubagentStop hooks

Close 4 lifecycle coverage gaps:
- PostToolUseFailure: catch failed mem0 MCP calls, classify errors, inject retry guidance
- PostCompact: inject parallel search commands for context recovery after compaction
- SessionEnd: last-chance transcript capture with dedup against Stop hook
- SubagentStop: remind parent agent to persist subagent learnings

Also patch on_stop.sh to write capture marker for SessionEnd dedup.
This commit is contained in:
kartik-mem0
2026-05-22 01:09:22 +05:30
parent 97a3a2cf8d
commit 93bb3b69c4
6 changed files with 273 additions and 0 deletions
+46
View File
@@ -132,6 +132,52 @@
}
]
}
],
"PostToolUseFailure": [
{
"matcher": "mcp__mem0__",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/on_tool_failure.sh",
"timeout": 5
}
]
}
],
"PostCompact": [
{
"matcher": "manual|auto",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/on_post_compact.sh",
"timeout": 10
}
]
}
],
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/on_session_end.sh",
"timeout": 15
}
]
}
],
"SubagentStop": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/on_subagent_stop.sh",
"timeout": 5
}
]
}
]
}
}