- Introduced backend patterns skill with guidelines on API design, database optimization, and server-side best practices. - Added coding standards skill outlining universal coding principles for TypeScript, NestJS, and Node.js development. - Implemented continuous learning skill to automatically extract reusable patterns from Cursor sessions. - Created NestJS best practices skill detailing architecture patterns, dependency injection, error handling, and security measures. - Included various rules and templates for NestJS best practices to ensure production-ready applications.
29 lines
1.0 KiB
Bash
Executable File
29 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# PreCompact Hook - Save state before context compaction
|
|
#
|
|
# Runs before Claude compacts context, giving you a chance to
|
|
# preserve important state that might get lost in summarization.
|
|
#
|
|
# Configured in .cursor/hooks.json:
|
|
# preCompact -> node .cursor/scripts/hooks/pre-compact.js
|
|
# This shell version is a fallback for environments without Node.
|
|
|
|
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
SESSIONS_DIR="${ROOT}/.cursor/sessions"
|
|
COMPACTION_LOG="${SESSIONS_DIR}/compaction-log.txt"
|
|
|
|
mkdir -p "$SESSIONS_DIR"
|
|
|
|
# Log compaction event with timestamp
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Context compaction triggered" >> "$COMPACTION_LOG"
|
|
|
|
# If there's an active session file, note the compaction
|
|
ACTIVE_SESSION=$(ls -t "$SESSIONS_DIR"/*.tmp 2>/dev/null | head -1)
|
|
if [ -n "$ACTIVE_SESSION" ]; then
|
|
echo "" >> "$ACTIVE_SESSION"
|
|
echo "---" >> "$ACTIVE_SESSION"
|
|
echo "**[Compaction occurred at $(date '+%H:%M')]** - Context was summarized" >> "$ACTIVE_SESSION"
|
|
fi
|
|
|
|
echo "[PreCompact] State saved before compaction" >&2
|