# Memory Flush

Promote important recent log entries into MEMORY.md and prune stale ones

- Repository: https://github.com/aeonfun/aeon (787 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add aeonfun/aeon --skill memory-flush -g -a claude-code -y`
Codex: `npx skills add aeonfun/aeon --skill memory-flush -g -a codex -y`
Cursor: `npx skills add aeonfun/aeon --skill memory-flush -g -a cursor -y`
Gemini CLI: `npx skills add aeonfun/aeon --skill memory-flush -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add aeonfun/aeon`

## Description

Promote important recent log entries into MEMORY.md and prune stale ones

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

> **${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/` into `memory/logs/archive/YYYY-MM.md` (content-preserving) once the directory passed ~45 files.
- prints `MEMORY.md size` (bytes, lines, over-long lines) against the budget step 3e holds.

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.

### 1. Scan the in-window logs for entries worth promoting to long-term memory

- New lessons learned (errors encountered, workarounds found)
- Topics covered (articles, digests) - add to the recent output/articles/digests tables
- Features built or tools created
- Important findings from monitors (on-chain, GitHub, papers)
- Ideas captured that are still relevant
- Goals completed or progress milestones

The rest: https://github.com/aeonfun/aeon/blob/HEAD/skills/memory-flush/SKILL.md
