consolidate-memory

consolidate-memory is a skill for Claude Code, Codex from Songhonglei/better-agent-skills. It costs 131 tokens per session (1,474 once invoked), scanned A, original, MIT.

A memory-maintenance workflow for an agent's stored notes. It removes duplicates, updates relative dates to exact dates, retires stale entries, and trims supported memory files while respecting read-only and append-only boundaries.

In plain words
What is it for?
Use it to整理 user-level and workspace memory files, identify outdated or sensitive notes, and produce candidates for older log information without rewriting those logs.
Why use it?
It keeps stored context small and easier to search in later sessions. It also avoids changing protected identity files, cloud memory, or immutable daily logs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code.

Good fit Use it to整理 user-level and workspace memory files, identify outdated or sensitive notes, and produce candidates for older log information without rewriting those logs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/songhonglei/better-agent-skills/consolidate-memory
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Songhonglei/better-agent-skills --skill consolidate-memory
Clone the repo
git clone --depth 1 https://github.com/Songhonglei/better-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for consolidate-memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/consolidate-memory/github.svg)](https://agentmods.dev/skills/songhonglei/better-agent-skills/consolidate-memory)
Your own site
<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/consolidate-memory"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/consolidate-memory/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for consolidate-memory

Your own site · 80×15
<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/consolidate-memory"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/consolidate-memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 131 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,474 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00131 $0.01474
Opus 5.5 $0.00052 $0.00590
Sonnet 5.5 $0.00026 $0.00295
Haiku 4.5 $0.00013 $0.00147

Measured 17d ago against content hash a6e17f4cfbcd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

consolidate-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 17d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/consolidate-memory/SKILL.md · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Consolidate Memory(WorkBuddy 适配版)

目标:让下一次会话能快速定位「用户是谁、在意什么、怎么做事」,不用重新问一遍。 原版假定 Claude Code 的单一 memory 目录 + MEMORY.md 索引文件;本版按 WorkBuddy 三层记忆重写,目录、红线、容量全部对齐平台规则。

0. 目录映射与边界(先做这一步)

层 位置 本 skill 的动作
云记忆 会话注入的 <memory> 与服务端 profile 只读,跳过。服务端自动学习,本地改动会被覆盖
用户级 ~/.workbuddy/user-*/MEMORY.md(用 ls -d 定位) 可整理:精简、去重、修时间、迁工作流。上限 4,000 字符
工作区长期 <workspace>/.workbuddy/memory/MEMORY.md 可整理:项目长期笔记。上限 3,000 字符
工作区日志 <workspace>/.workbuddy/memory/YYYY-MM-DD.md 只读 + 只追加,不改写、不删除、不重排
身份三件套 ~/.workbuddy/user-*/{SOUL,USER,IDENTITY}.md 只读,由用户手动维护

硬性红线:

  • 绝不删除 .workbuddy 目录;不改 SOUL / USER / IDENTITY;不写云记忆。
  • 日志 append-only:30 天以上日志的蒸馏由 WorkBuddy 内置机制负责,本 skill 只产出蒸馏候选清单,不执行移动或删除。
  • 不写入密钥、token、身份证 / 银行卡等敏感值;发现即提示用户移除,不复述内容。
  • 改动前先把目标文件备份到同目录 MEMORY.md.bak-YYYYMMDD-HHMMSS,并确认备份成功。
  • 逐条确认:先给完整清单,用户确认一项才改一项,禁止批量套用。
  • 用户级 MEMORY.md 是「分节规则清单」,不要套用 Claude 版 - [Title](file.md) — hook 索引格式,不凭空造主题文件。

1. 盘点

  • 定位并读取两层 MEMORY.md,用 wc -m 统计字符数,对照 4,000 / 3,000 上限。
  • 只读扫近期工作区日志,仅用于判断哪些长期条目已经过时。
  • 给每条打标签:重复 / 过期 / 相对时间 / 易重查 / 应迁到 skill / 保留。
  • 先汇报:条目数、字符数、超限多少、各类问题各几条。

2. 整理

按此优先级处理,逐条出示「原文 → 拟改」并等用户确认:

  1. 合并重复:同一规则在多处出现,保留最完整的一条,其余合并或删除。
  2. 清理过期:一次性项目、已过截止日的安排、已失效的账号状态,删掉或折成一句可复用结论。
  3. 绝对日期化:「上周」「本季度」「30 天内」改成 YYYY-MM-DD,过期判断据此得出。
  4. 去掉易重查的:能从日历、文档、git、已连接工具随时拉到的内容不存;保留偏好、决策背后的原因、找谁办什么事。
  5. 超限时先迁后删:可执行的多步工作流迁到 skill,MEMORY.md 只留一行指针;过程叙述一律删,只留结论。
  6. 矛盾项:两条冲突时保留较新且更明确的一条,另一条标注后交用户裁决,不静默覆盖。

3. 收尾

  • 复跑 wc -m,确认两层都在上限内;按主题分节、每节条目精简;仅扁平索引式 MEMORY.md 才限 10–20 条。
  • 确认日志文件未被改动(对比备份或 mtime)。
  • 输出汇总:动了几个文件、合并 / 删除 / 修改各几条、压缩前后字符数、剩余待办。
  • 若仍超限,说明差多少、建议迁移哪几节,不要自行大删。

Read the full file on GitHub · 72 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 17d ago First seen · 72 lines · 131 tokens per session scan A a6e17f4cfbcd

Subscribe to this mod's changes

consolidate-memory is a skill published in the GitHub repository Songhonglei/better-agent-skills (4 stars, last pushed 13d ago), licensed MIT. It adds 131 tokens to every session and 1,474 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-13.

Related

consolidate-memory compared with skills from other repositories

consolidate-memory next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
consolidate-memorySonghonglei/better-agent-skillsSkill413d agoMITA131Claude Code, Codex
memory-systembojieli/ai-agent-bookSkill60kyesterdayApache-2.0A95Claude Code, Codex
memory-recallzilliztech/memsearchSkill3.0k3d agoMITA152Claude Code
memanto-companionmoorcheh-ai/memantoSkill2.4k2d agoApache-2.0A72Claude Code
openloreaakarim/OpenLoreSkill2.0k9d agoApache-2.0A42Claude Code, Codex
Context Doctorletta-ai/letta-codeSkill3.9ktodayApache-2.0A66Claude Code, Codex
mnemonmnemon-dev/mnemonSkill7527d agoApache-2.0A25Claude Code, Codex