memory-flush
${var} - Topic to focus on. If empty, flushes all recent activity.
If ${var} is set, only promote entries related to that topic. Pruning (step 3), the index upkeep (step 6), and the deterministic watermark + rotation (steps 0 and 8) still run globally - a focused flush must never leave the rest of the store stale.
Read memory/MEMORY.md for current memory state. The scan window and log rotation are computed for you in step 0 - you no longer parse the watermark or rotate logs by hand.
Steps
0. Prepare (deterministic bookkeeping - run this first)
Run python3 scripts/memory_prep.py window and read its stdout. It:
- computes your scan window from the structured watermark
memory/memory-flush-state.json(fallback for a first-run migration: the MEMORY.md*Last consolidated:*line; then the last 3 days; a gap over 14 days is clamped to 14 and flagged), and prints the exact in-window log files to read; - has already rotated whole old months out of
memory/logs/intomemory/logs/archive/YYYY-MM.md(content-preserving) once the directory passed ~45 files.
Read exactly the files it lists. Do not recompute the window or rotate logs yourself - that work is now deterministic and unit-tested (scripts/memory_prep.py), so it never silently falls back to 3 days or gets skipped. This closed two old holes: entries older than 3 days were lost whenever the agent skipped runs, and a daily schedule re-scanned the same 3 days every time.