From 1b73b220640438ed57ae8647ad11e0c41bfd1e8f Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Wed, 27 May 2026 12:49:27 +0200 Subject: [PATCH] memory: add staleness indicator to recall, remove body length limit --- prompts/tools-memory.md | 2 +- tools/memory_recall | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/prompts/tools-memory.md b/prompts/tools-memory.md index 63d3958..6a788b4 100644 --- a/prompts/tools-memory.md +++ b/prompts/tools-memory.md @@ -20,7 +20,7 @@ call_tool: calls=[{tool: "memory_remember", args: ["", "<tags_csv>", "<bo - One memory per distinct fact. - Before writing, recall on the same topic to avoid duplicates. If a closely related memory exists, update it rather than creating a new one. - Do not store stale facts. If you learn that a previously stored fact is wrong or outdated, update or replace it. -- Keep bodies concise — a memory should be a fact, not a narrative. If you find yourself writing more than 3-4 sentences, split it into multiple focused memories. +- There is no length limit on memory bodies. Store as much detail as needed for the fact to be useful in a future session. - **Act autonomously.** Do not ask the user whether to remember something — if the trigger condition is met, remember it. --- diff --git a/tools/memory_recall b/tools/memory_recall index 5bdd675..6efcdd8 100755 --- a/tools/memory_recall +++ b/tools/memory_recall @@ -31,6 +31,7 @@ fi max_files=10 max_lines_per_file=50 +stale_days=14 count=0 while IFS= read -r file; do @@ -39,7 +40,15 @@ while IFS= read -r file; do echo "(showing $max_files of $(echo "$matches" | wc -l) matched files)" break fi - echo "=== $(basename "$file") ===" + mtime=$(stat -c %Y "$file" 2>/dev/null) + now=$(date +%s) + age_days=$(( (now - mtime) / 86400 )) + if [ $age_days -ge $stale_days ]; then + status="STALE (${age_days}d — verify or forget)" + else + status="fresh" + fi + echo "=== $(basename "$file") [$status] ===" head -n $max_lines_per_file "$file" || echo "error: could not read $file" lines=$(wc -l < "$file" 2>/dev/null) if [ "$lines" -gt $max_lines_per_file ] 2>/dev/null; then