← 返回
AI智能

Memory Defrag

Defragment and reorganize agent memory files: split bloated files, merge duplicates, remove stale information, and restructure the memory hierarchy. Use when...
对智能体记忆文件进行碎片整理与重组:拆分臃肿文件,合并重复项,清除过期信息,重构记忆层级。适用于...
phernandez
AI智能 clawhub v0.1.0 1 版本 99811.7 Key: 无需
★ 0
Stars
📥 530
下载
💾 9
安装
1
版本
#latest

概述

Memory Defrag

Reorganize memory files for clarity, efficiency, and relevance. Like filesystem defragmentation but for knowledge.

When to Run

  • Periodic: Weekly or biweekly via cron (recommended)
  • On demand: User asks to clean up, reorganize, or defrag memory
  • Threshold: When MEMORY.md exceeds ~500 lines or daily notes accumulate without consolidation

Process

1. Audit Current State

Inventory all memory files:

MEMORY.md           — long-term memory
memory/             — daily notes, tasks, topical files
memory/tasks/       — active and completed tasks

For each file, note: line count, last modified, topic coverage, staleness.

2. Identify Problems

Look for these common issues:

ProblemSignalFix
----------------------
Bloated file>300 lines, covers many topicsSplit into focused files
Duplicate infoSame fact in multiple placesConsolidate to one location
Stale entriesReferences to completed work, old dates, resolved issuesRemove or archive
Orphan filesFiles in memory/ never referenced or updatedReview, merge, or remove
InconsistenciesContradictory information across filesResolve to ground truth
Poor organizationRelated info scattered across filesRestructure by topic
Recursive nestingmemory/memory/memory/... directoriesDelete nested dirs (indexer bug artifact)

3. Plan Changes

Before making edits, write a brief plan:

## Defrag Plan
- [ ] Split MEMORY.md "Key People" section → memory/people.md
- [ ] Remove completed tasks older than 30 days from memory/tasks/
- [ ] Merge memory/bm-marketing-ideas.md into memory/competitive/
- [ ] Update stale project status entries in MEMORY.md

4. Execute

Apply changes one at a time:

  • Split: Extract sections from large files into focused topical files
  • Merge: Combine related small files into coherent documents
  • Prune: Remove information that is no longer relevant or accurate
  • Restructure: Move files to appropriate directories, rename for clarity
  • Update: Fix outdated facts, dates, statuses

5. Verify & Log

After changes:

  • Verify no information was lost (compare before/after)
  • Update any cross-references between files
  • Log what was done in today's daily note:
## Memory Defrag (HH:MM)
- Files reviewed: N
- Split: [list]
- Merged: [list]
- Pruned: [list]
- Net result: X files, Y total lines (was Z lines)

Guidelines

  • Preserve raw daily notes. Don't delete or modify memory/YYYY-MM-DD.md files — they're the audit trail.
  • Target 15-25 focused files. Too few means bloated files; too many means fragmentation. Aim for the sweet spot.
  • File names should be scannable. Use descriptive names: people.md, project-status.md, competitive-landscape.md — not notes-2.md.
  • Don't over-organize. One level of directories is usually enough. memory/tasks/ and memory/competitive/ are fine; memory/work/projects/active/basic-memory/notes/ is not.
  • Completed tasks: Tasks with status: done older than 14 days can be removed. Their insights should already be in MEMORY.md via reflection.
  • Ask before destructive changes. If uncertain whether information is still relevant, keep it with a (review needed) tag rather than deleting.

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-19 12:21 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 711 📥 243,717
productivity

Memory Notes

phernandez
如何编写结构良好的 Basic Memory 笔记:frontmatter、使用语义分类的观察、使用 wiki‑links 的关联,以及构建的最佳实践...
★ 0 📥 791
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,356 📥 318,069