Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Promote important recent log entries into MEMORY.md and prune stale ones
.claude/skills/aeonfun-memory-flush/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 185% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 26% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 111% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 130% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 63% | 0% |
> ${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) and the timestamp/index/rotation upkeep (steps 4, 7) still run globally — a focused flush must never leave the rest of the store stale.
Read memory/MEMORY.md for current memory state.
Scan window — read logs since the last consolidation, not a fixed 3 days. Look at the *Last consolidated: <date>* line near the top of MEMORY.md:
memory/logs/ file dated on or after that date (re-reading the last consolidated day is fine; the dedup check in step 2 makes it idempotent).never, missing, or unparseable → read the last 3 days.This closes two holes in the old fixed 3-day window: entries older than 3 days were lost whenever the agent skipped runs, and a daily schedule re-scanned the same 3 days every time.
Skip if already recorded. Dedup by the fact's subject, not by string match:
a. Open Improvement PRs section: Run gh pr list --state open --search "improve:" --json number,title,url and compare against any "Open Improvement PRs" section in MEMORY.md.
b. Next Priorities section: Cross-check each listed priority against recent logs and current repo state. Remove priorities that are already done (e.g., "Merge open PRs" if 0 open PRs exist). Add any newly urgent priorities surfaced by recent logs. c. Lessons Learned: Remove lessons that are now outdated or resolved (e.g., a workaround for a bug that was later fixed). d. Overflow any section that outgrows its budget (keeps MEMORY.md an index, not a ledger): if a section has grown past the last ~10–15 rows — the Skills Built table is the usual first offender, but the rule is general — archive the oldest rows to memory/topics/<section>-history.md (e.g. skills-history.md) and leave a one-line pointer to that file. Trim newest-kept, oldest-archived.
memory/topics/<topic>.md instead (see step 7 — register it in the index).## Heading already exists anywhere in MEMORY.md — if it does, update that section in place. Never prepend a duplicate heading.*Last consolidated: <date>* line near the top to today's date (${today}). If the line is missing, add it directly under the title. This drives the step-scan window above and is how other skills (e.g. action-converter) tell a live, consolidated store from an untouched template — leaving it at never after a real flush is a bug.Do NOT rewrite the whole file — make targeted additions and removals.
If step 4 created a new memory/topics/<topic>.md (or a *-history.md archive in step 3d), add a one-line pointer to it under the # Reference section of memory/topics/index.md, matching the existing row format. New topic notes that aren't linked from the index become orphans no other run can find.
memory/logs/ stays boundedmemory/logs/ is append-only and grows one file per day forever. Once its durable content has been promoted, roll old dailies up so the directory doesn't grow without limit — content-preserving, never a bare delete (rm isn't granted; use git rm):
memory/logs/archive/YYYY-MM.md (create the dir if needed), then git rm the dailies you just rolled up.memory/logs/${today}.mdLog what you promoted, pruned, archived, and the scan window you used (start date → today). If a >14-day gap was clamped, say so.
If nothing worth promoting or removing and no rotation was due, log MEMORY_FLUSH_OK and end (still stamp the Last consolidated date in step 4 — a clean flush is still a consolidation).
gh pr list uses the gh CLI's built-in auth — no curl env-var expansion. All other work is local file I/O against memory/ (plus git rm for log rotation).
memory/topics/.## Heading or an existing fact — update in place.self-improve) may flag memory-hygiene problems, but structural pruning and archiving of MEMORY.md should land here to avoid two skills thrashing the same file. If self-improve prunes in an audit, treat it as a stopgap, not a reason to skip the next flush.Other measured skills in the registry, with their headline benchmark lift.