mirror of
https://github.com/harivansh-afk/claude-continual-learning.git
synced 2026-04-15 03:00:44 +00:00
update hook to remove duplicate retrospectives
This commit is contained in:
parent
b1d8e549e4
commit
df061cab9f
1 changed files with 24 additions and 0 deletions
|
|
@ -30,6 +30,23 @@ log "Transcript: $TRANSCRIPT"
|
|||
log "Session ID: $SESSION_ID"
|
||||
log "Project dir: $PROJECT_DIR"
|
||||
|
||||
# Prevent duplicate triggers for the same session using a lock file
|
||||
LOCK_DIR="${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/locks"
|
||||
mkdir -p "$LOCK_DIR"
|
||||
LOCK_FILE="$LOCK_DIR/$SESSION_ID.lock"
|
||||
|
||||
if [ -f "$LOCK_FILE" ]; then
|
||||
log "Session already processed (lock exists) - skipping duplicate trigger"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create lock file immediately
|
||||
echo "$(date)" > "$LOCK_FILE"
|
||||
log "Lock file created"
|
||||
|
||||
# Clean up old lock files (older than 1 hour)
|
||||
find "$LOCK_DIR" -name "*.lock" -mmin +60 -delete 2>/dev/null
|
||||
|
||||
# Validate transcript exists
|
||||
if [ -z "$TRANSCRIPT" ]; then
|
||||
log "ERROR: No transcript path in input"
|
||||
|
|
@ -49,6 +66,13 @@ if [ "$LINE_COUNT" -lt 10 ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# CRITICAL: Detect if this session was itself a retrospective to prevent chain reaction
|
||||
# Check if the transcript contains /retrospective command (indicates this was a retrospective session)
|
||||
if grep -q '"/retrospective' "$TRANSCRIPT" 2>/dev/null || grep -q '"skill":"retrospective"' "$TRANSCRIPT" 2>/dev/null; then
|
||||
log "Session was a retrospective - skipping to prevent chain reaction"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if learnings.md exists (system is properly set up)
|
||||
LEARNINGS_FILE="$PROJECT_DIR/.claude/skills/codebase-agent/learnings.md"
|
||||
if [ ! -f "$LEARNINGS_FILE" ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue