memory-manager
Skill2 starsChanged 3 months agoMITView on GitHub
Agent记忆健康管理(Memory Manager)。用户说'记忆太乱''整理记忆''检查记忆''记忆清理'时使用。扫描 Hermes 记忆文件(MEMORY.md/USER.md),统计 token 占用、找过期/冗余/超长条目、体检会话库(state.db 体积与索引占比)、并从会话历史挖掘用户纠正与长期要求(提示哪些还没进记忆)。Memory health check for AI agents: token cost per turn, stale/redundant entries, session-DB size diagnosis, and correction mining from chat history.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- wulaosiji/skillstheir own version, first seen Nov 1, 2026
- diegovasquez-ai/skills-apptheir own version, first seen Oct 25, 2026
- 2017java/super-agent-memory-managertheir own version, first seen Oct 20, 2026
- luolin-ai/openclawWeComzhtheir own version, first seen Oct 8, 2026
- chinkan/RustFoxtheir own version, first seen Sep 22, 2026
- GulajavaMinistudio/awesome-copilot-idtheir own version, first seen Aug 4, 2026
Used with
Projects with it also use skill-creator.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SentrySkillskill-creator
Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- luolin-ai/openclawWeComzh★ 108same name
- GulajavaMinistudio/awesome-copilot-id★ 92same name
- 9thLevelSoftware/legion★ 76same name
- TenureAI/PhD-Zero★ 52same name
- wulaosiji/skills★ 28same name
- kunwl123456/zeroclaw-skills-collection★ 27same name
- diegovasquez-ai/skills-app★ 14same name
- chinkan/RustFox★ 11same name
- claude-office-skills/claude-office-plugin★ 9same name
- claude-world/claude-agent★ 5same name
1 more not listed
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 repository8 other files it gives its agents.
- ai-project-advisorSkill
- ai-video-ad-productionSkill
- de-ai-writerSkill
- doc-ocrSkill
- ecommerce-material-studioSkill
- memory-graphSkill
- video-to-textSkill
- voice-personaSkill
The file
Files
Memory Manager 记忆健康管理
Agent 的记忆会注入每个会话的 system prompt——太大 = 每轮浪费 token、挤占上下文、还可能存过期信息误导判断。本技能定期检查记忆健康,保持记忆精简有效。
📁 安装:
hermes skills install jiawood2006/hermes-skills/skills/memory-manager或按 README 方式二复制 → 默认在~/.hermes/skills/utilities/memory-manager/。
触发条件
- "检查记忆""记忆清理""整理记忆"
- 发现 Agent 回答变慢 / 上下文被挤占
- 定期记忆健康检查(建议每月一次)
使用步骤
1. 记忆健康检查
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py --full # 完整报告(逐条分析)输出:
- 每条记忆文件的 token 占用/条目数
- 超长条目(>800 字,建议精简)
- 含 30 天前日期的条目(可能是过期信息)
- state.db 体积(>500MB 建议清理,见第 2 节)
- 每轮记忆注入总 tokens(建议 <2000)
2. 会话库体检(--state-db)
不只是报体积——会拆到表级告诉你是"正文大"还是"索引大",给出对症方案:
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py --state-db实测样例(1.2GB 的库):
🗄️ state.db(会话历史): 1.2GB
页: 316858×4096B | 空闲页: 2770 | 可直接回收: 约 10.8MB
体积占比 Top 表:
478.1MB messages_fts_trigram_data
331.8MB messages
162.7MB messages_fts_trigram_content
162.7MB messages_fts_content
⚠️ 其中 FTS 全文索引占 872.6MB(71%)——索引比正文还大,先处理索引,别急着删会话- 索引占大头(常见)→ 先
rebuild索引 / 去掉 trigram,再 VACUUM,不用删历史 - 正文占大头 → 才清理旧会话
- 无
dbstat支持时自动降级(只报体积与行数),不会报错
3. 从纠正中学习(--corrections)
重复两次的纠正 = 该进记忆的长期偏好。 扫描会话历史,把用户的纠正/长期要求挖出来,并标记哪些疑似还没进记忆:
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py --corrections
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py --corrections --corrections-days 90
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py --corrections --full # 看全部候选输出示例:
候选 30 条,其中 **30 条疑似未进记忆**
[未记录 ] 2026-09-06 (否定/纠错/禁止类/长期规则) 这个工作以后必须在类似工作中你来主动开展,不要让我提醒…
[已在记忆] 2026-08-24 (禁止类) 公开仓库 demo 图禁止品牌产品图…识别 7 类信号:否定/纠错、重复强调、显式要求记住、禁止类、长期规则、强约束、不满追问。
⚠️ 这是候选清单,不是自动写入——必须人工判断:属于长期偏好/规则的写进记忆;一次性的任务要求不要写(那是任务,不是偏好)。"未记录"是关键词粗判,措辞不同但意思已记的情况会误报,以人工判断为准。
4. 记忆分层原则(什么时候该存/不该存)
| 该存(事实/偏好) | 不该存(过程/临时) |
| 用户偏好、纠正、习惯 | 任务进度、完成日志 |
| 环境事实(路径/凭证位置) | PR 号、commit sha、临时状态 |
| 工具怪癖、踩坑教训 | 会话细节(用 session_search 回忆) |
| 稳定的约定/规范 | 可复用流程(应存为 skill) |
5. 压缩技巧
- 过期信息:日期类("当前余额")→ 删除或改为历史
- 超长条目:压缩成要点(保留关键事实,去掉过程描述)
- 合并:同主题多条 → 合并成一条
- 迁移:方法论 → skill;会话细节 → session_search
已知陷阱
- 记忆工具限流:写前先删/合并(memory 工具按最终字符数检查,批量操作一次完成)
- 凭证纪律:token/密码/API key 一律不落记忆明文
- 记忆 vs skill:流程类知识存 skill(按需加载),事实类存记忆(每轮注入)——放错地方都浪费
快速验证 / Smoke Test
# 1) 记忆健康 + 会话库体检(无 LLM key 也可跑)
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py --state-db
# 期望:token 统计 + 冗余建议 + state.db 表级体积与对症方案
# 2) 纠正挖掘(需要 ~/.hermes/state.db 有历史)
python3 ~/.hermes/skills/utilities/memory-manager/scripts/memcheck.py --corrections --corrections-days 7
# 期望:列出候选纠正/长期要求,并标 [未记录] / [已在记忆]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.

