memory-gc
Skill5 starsChanged 3 months agoApache-2.0View on GitHub
记忆系统自动 GC — audit 当前 MEMORY.md / shared/ / disk memory 文件健康度。**Pressure-driven 不是 time-driven** — 没积累就不该清, cold ≠ garbage, 没新东西不要找事清。当用户说「memory audit」「记忆 GC」「记忆清理」「sleep gc」「/memory gc」「/memory audit」「check memory health」时触发。
2 other projects use a version of this.
Adopted by
Most recently taken up by
- AlvaroBalbin/claude-memorytheir own version, first seen Jul 9, 2026
- enckequity/samebraintheir own version, first seen Jun 10, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- AlvaroBalbin/claude-memory★ 0same name
- enckequity/samebrain★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository54 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agent-teamsSkill
- bilibili-channelSkill
- bot-configSkill
- browser-cliSkill
- bwrap-bypassSkill
- cc-pages-backupSkill
- chat-styleSkill
- chinese-dictationSkill
- code-wiki-reconSkill
- deck-builderSkill
- docx-form-fillerSkill
- evolutionSkill
- explainer-distillSkill
- feishu-bitableSkill
- feishu-docSkill
- feishu-mailSkill
- feishu-sheetSkill
- feishu-user-msgSkill
- fireworks-tech-graphSkill
- frontend-slidesSkill
- gemini-ui-reviewerSkill
- hk-busSkill
- hk-share-award-tax-dipn38Skill
- imagen-generatorSkill
- issue-handlerSkill
- lecture-videoSkill
- lecture-voiceSkill
- lesson-read-aloudSkill
- live-canvasSkill
- lustre-mounterSkill
- manim-teaching-figuresSkill
- math-video-tutorSkill
- memory-lintSkill
- multimodal-explainerSkill
- music-generatorSkill
- notifySkill
- page-styleSkill
- paper-explainerSkill
- session-handoffSkill
- skill-creatorSkill
- smoke-testSkill
- study-materialSkill
- tmux-installerSkill
- tmux-orchestratorSkill
- tpuguruSkill
- tts-generatorSkill
- veo-generatorSkill
- vscode-referenceSkill
- weather-forecastSkill
- wechat-readerSkill
- wikiSkill
- youtube-channelSkill
- zsh-installerSkill
The file
Files
Memory GC — 记忆系统自动体检
核心哲学: GC 按 pressure 触发, 不是按 time 触发. 类比 Chrome 的 mark-and-sweep — 不是 timer 触发, 是 heap 压力到阈值才触发. 没积累就不该清, cold ≠ garbage.
何时触发
- 用户说「memory audit」「记忆体检」「记忆清理」「sleep gc」
- weekly cron
7 0 * * 1UTC (= 周一 8:07 HKT) — 一周一次, 给积累有时间发酵 - 任何 session 觉得「MEMORY.md 长了/重了」想做一次清理时
默认模式: --action-only (cron 用这个)
只显示 🚨 ACTIONABLE 段 (dead/dup/stale). 如果 actionable=0 → 直接 silent 输出 "🟢 健康无需 cleanup", 不展开 cold links 列表防止形成清理冲动.
# cron / 每日 check 用这个 (默认 silent if healthy)
python3 ~/CloseCrab/scripts/memory-audit.py --action-only
# 完整 3 段报告 (按需展开看 cold/orphan, 比如周末手工审)
python3 ~/CloseCrab/scripts/memory-audit.py
# JSON / 调窗口
python3 ~/CloseCrab/scripts/memory-audit.py --json
python3 ~/CloseCrab/scripts/memory-audit.py --cold-days 30
python3 ~/CloseCrab/scripts/memory-audit.py --stale-days 143 类信号 (按风险分级)
| 类别 | 信号 | 处理 |
| 🚨 ACTIONABLE (必清, 无风险) | stale_timestamp / duplicates / dead_index | 看到立刻清, 任何 session 都可干 |
| 👀 NEEDS REVIEW (case-by-case) | orphans (disk 有 MEMORY 没) | 看 head + mtime, active 补索引 / 废弃 rm disk |
| ℹ️ INFO ONLY (绝不强清) | cold_links (近 N 天 0 Read) | cold ≠ garbage. 只 user 主动 ask 才看. 平时 cron 报告默认不展开. R5 实证 cold shared/ 改触发关键词后命中率 17%→83%, 不是该删. |
R5 教训 (不要瞎删)
cold ≠ stale。R5 验证 cold shared/ 文件改触发关键词后命中率从 17%→83%。100 个冷 feedback link 里大部分是「平时不 trigger 但一旦 trigger 就救命」的深度知识。只删有明确证据过期的:
- 闭环项目接续指针(已 supersede)
- 重复索引(同 slug 多次)
- 死索引(文件已删)
- 命名违规的孤儿(日期文件名等)
执行清理时的工作流
- 跑 audit → 拿 markdown 报告
- 按信号优先级处理:
- stale_timestamp → 直接 demote/删 (Edit MEMORY.md)
- duplicates → 合并到 1 个 + 删另一个 (Edit)
- dead_index → 删 link (Edit) 或恢复 disk file
- orphans → 看 mtime + head 文件判断 active/废弃, active 补索引, 废弃
rmdisk file - cold_links → 不要批量清,逐个看是否真过期
- 改完再跑一次 audit 看是否归零
- sponge memory 记录这次清掉了什么 + 为什么
参考
- 完整 GC 设计哲学: [[feedback-memory-system-overfit-r1-r5]]
- 重要纠错: [[feedback-memory-gc-pressure-not-time]] — Chris 2026-05-21 反思: daily cron 会形成"每天必清"冲动, 没新东西时清的就是稳定记忆. 改 weekly + action-only + cold ≠ garbage
- weekly cron:
job_id e642aac85244, target=jarvis, cron="7 0 * * 1 UTC" (= 周一 8:07 HKT)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

