28 lines
805 B
Bash
28 lines
805 B
Bash
|
|
#!/bin/bash
|
||
|
|
# Daily memory metrics check — runs from cron, notifies if attention needed
|
||
|
|
#
|
||
|
|
# Cron entry (add with crontab -e):
|
||
|
|
# 0 9 * * * /home/kent/poc/memory/scripts/daily-check.sh
|
||
|
|
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
REPORT=$(poc-memory daily-check 2>&1)
|
||
|
|
|
||
|
|
# Always log
|
||
|
|
echo "$(date -Iseconds) $REPORT" >> ~/.claude/memory/daily-check.log
|
||
|
|
|
||
|
|
# Notify if attention needed
|
||
|
|
if echo "$REPORT" | grep -q "needs attention"; then
|
||
|
|
# Send via telegram
|
||
|
|
if [ -x ~/.claude/telegram/send.sh ]; then
|
||
|
|
~/.claude/telegram/send.sh "Memory daily check:
|
||
|
|
$REPORT"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Also leave a notification file for the idle timer
|
||
|
|
NOTIF_DIR=~/.claude/notifications
|
||
|
|
mkdir -p "$NOTIF_DIR"
|
||
|
|
echo "$(date -Iseconds) Memory needs consolidation — run poc-memory consolidate-session" \
|
||
|
|
>> "$NOTIF_DIR/memory"
|
||
|
|
fi
|