/plugin marketplace add linehaul-ai/libsql-memory/plugin install linehaul-ai-libsql-memory@linehaul-ai/libsql-memoryDefined in hooks/hooks.json
{
"Stop": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Review the conversation that just concluded. If there were important learnings, decisions, architectural choices, or conclusions that would be valuable to remember for future sessions, store them in memory.\n\nConsider storing:\n- Key decisions made and their rationale\n- Important patterns or conventions discovered\n- User preferences expressed\n- Solutions to tricky problems\n- Session summary if substantial work was done\n\nDo NOT store:\n- Trivial information\n- Temporary debugging steps\n- Information already in the codebase\n\nUse the appropriate namespace based on context (e.g., project name, 'go', 'typescript', etc.).\n\nIf this was a substantive session (multiple tool uses, complex problem solving), store a brief session summary in the 'sessions' namespace.",
"allowedTools": [
"memory_store"
]
}
]
}
],
"PreToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Before modifying this file, search memory for any stored patterns, conventions, or notes specific to this file or its package/module.\n\nSearch strategy:\n1. Extract the package/module name from the file path\n2. Identify the file type (e.g., _test.go, .tsx, .py)\n3. Search for patterns related to that context\n\nIf relevant conventions are found, briefly note them to ensure consistency.\n\nFormat as:\n<file_context>\n- [relevant pattern or convention]\n</file_context>\n\nKeep retrieval fast - only search if the file path suggests it's a substantive code file (not config, docs, or generated files).",
"allowedTools": [
"memory_search"
]
}
],
"matcher": "Write|Edit"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "After modifying code, evaluate if any patterns or decisions made should be stored for future reference.\n\nConsider storing if:\n- A new architectural pattern was introduced\n- A non-obvious solution was implemented\n- The change establishes a convention for similar code\n- The modification required understanding a tricky part of the codebase\n\nDo NOT store:\n- Trivial changes (typos, simple renames)\n- Information already documented in code comments\n- Temporary or debugging code\n\nIf storing, use the appropriate namespace (project-name/conventions, project-name/architecture, etc.) and include relevant tags.",
"allowedTools": [
"memory_store"
]
}
],
"matcher": "Write|Edit"
}
],
"SessionStart": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Analyze the current working directory to understand the project context.\n\n1. Detect project type by checking for key files:\n - Go: look for go.mod, *.go files\n - TypeScript/JS: look for package.json, tsconfig.json\n - Python: look for requirements.txt, pyproject.toml, *.py\n - Rust: look for Cargo.toml\n\n2. Based on detected project type, use Glob to find the most relevant source files (limit to key files, don't read everything)\n\n3. Search memory for any stored context about this project or similar work\n\n4. Provide a brief summary of available context to inform the session",
"allowedTools": [
"memory_search",
"Glob",
"Read"
]
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Search memory for context relevant to the user's prompt. This enables proactive retrieval of stored knowledge before processing.\n\nGuidelines:\n- Extract 2-3 key technical terms or concepts from the user prompt\n- If the prompt mentions errors/bugs, include 'error solution troubleshooting' in search\n- If the prompt mentions testing, include 'testing patterns' in search\n- If the prompt mentions refactoring, include 'architecture patterns' in search\n\nSkip searching if:\n- The prompt is very short (< 20 chars)\n- The prompt is a meta-command (starts with /)\n- The prompt is a simple greeting or acknowledgment\n\nIf relevant memories are found (similarity > 0.7), briefly summarize them as context. Keep the summary under 500 tokens.\n\nFormat relevant memories as:\n<relevant_memories>\n- [memory summary]\n</relevant_memories>",
"allowedTools": [
"memory_search"
]
}
]
}
]
}{
"riskFlags": {
"touchesBash": false,
"matchAllTools": false,
"touchesFileWrites": true
},
"typeStats": {
"prompt": 5
},
"eventStats": {
"Stop": 1,
"PreToolUse": 1,
"PostToolUse": 1,
"SessionStart": 1,
"UserPromptSubmit": 1
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 0,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 0
}
}