---
title: "Configuration" component_type: hook version: "1.0.0" audience: contributor status: stable summary: " Session Auto-Recall Hook - Anti-Forgetting System" keywords: ['auto', 'database', 'recall', 'session'] tokens: ~1500 created: 2025-12-22 updated: 2025-12-22
Session Auto-Recall Hook - Anti-Forgetting System
Automatically retrieves relevant context at session start to prevent catastrophic forgetting. Injects previous decisions, patterns, and error solutions into the current session.
Hook Type: PreToolUse (runs before first tool call) Trigger: First user message or explicit /recall
Usage in settings.json: { "hooks": { "PreToolUse": [ { "command": "python3 hooks/session-auto-recall.py", "timeout": 10000 } ] } }
Environment Variables:
- CODITECT_AUTO_RECALL: Set to "false" to disable
- CODITECT_RECALL_LIMIT: Number of items to recall (default: 5)
File: session-auto-recall.py
Functions
get_session_state()
Get or create session state.
save_session_state(state)
Save session state.
should_auto_recall()
Determine if auto-recall should run.
get_db()
Get database connection.
get_recent_decisions(conn, limit)
Get recent architectural/technology decisions.
get_relevant_patterns(conn, limit)
Get most-used code patterns.
get_common_errors(conn, limit)
Get common error-solution pairs.
get_session_links(conn, limit)
Get recent session links.
format_recall_context()
Format recalled context for injection.
main()
Main hook entry point.
Usage
python session-auto-recall.py