Files
claude/lib/memory-feedback-remind.sh
T
bchanot 9f9412aaba fix(memory-feedback): post-fix precision split, 3rd pick retired, bounded transcript cache, strict labels
Precision, triggers and the miss share count only rows after the gate-1
fix merge (d3d5e6c, 2026-11-12T19:53:59Z); their actions wait for 20
post-fix asks, a one-off NEW line marks the sample and the reminder
keeps prompting until then. The 3rd-pick signal is gone. The reader
holds one parsed transcript at a time. labels.tsv rows and state.json
are validated on read. Exact key sets of log records pinned.
2026-11-13 19:47:37 +01:00

32 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# lib/memory-feedback-remind.sh — the phase 4d reminder line of the
# session-start banner (BDR-057: transcripts live 7 days). One line when
# /memory-feedback never ran, or ran REMIND_DAYS+ days ago and the memory
# store changed since. Silent once all three gate marks (prompt, tool,
# post-fix sample) are recorded ("closed":true), with "recall": false, or
# on any error; always rc 0. bash 3.2 safe, portable (find -mtime, no
# stat -c), no JSON parse.
REMIND_DAYS=5
state="$HOME/.claude/memory-feedback/state.json"
store=""
for f in "$HOME"/.claude/plugins/store/memory_skills-dir-*.json; do
[ -f "$f" ] || continue
if [ -z "$store" ] || [ "$f" -nt "$store" ]; then store=$f; fi
done
[ -n "$store" ] || exit 0
# recall off: no record can come (the 4b capture still writes the store)
grep -Eq '"recall"[[:space:]]*:[[:space:]]*false' \
"$HOME/.claude/memory.json" 2>/dev/null && exit 0
if [ ! -f "$state" ]; then
echo "memory feedback: never run → /memory-feedback"
exit 0
fi
[ -r "$state" ] || exit 0
grep -q '"closed":true' "$state" 2>/dev/null && exit 0
[ "$store" -nt "$state" ] || exit 0
[ -n "$(find "$state" -mtime +$((REMIND_DAYS - 1)) 2>/dev/null)" ] || exit 0
echo "memory feedback: last run ${REMIND_DAYS}+ d ago," \
"transcripts expire at 7 → /memory-feedback"
exit 0