agentleFS
SuShuhengSuShuheng/openclaw-memory-compact/skills/memory-compact/SKILL.md

memory-compact

Skill1 starsChanged 8 months agoMITView on GitHub

Restructure MEMORY.md into directory-based format to reduce token consumption. Split detailed memories into memory/details/, create directory index, generate Start_Memory.md, and update BOOTSTRAP.md/AGENTS.md. Provides examples in docs/ for manual execution.

5 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. anthony-chaudhary/fak★ 47same name
    2. whinc/super-skills★ 40same name
    3. dewil/ai-toolkit★ 9same name
    4. dewil/claude-toolkit★ 9same name
    5. GlassOnTin/claude-memory-skills★ 1same 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.

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. 0 are common, 14 are distinctive, and 12 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 14

    Distinctive

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always backup before modification.

    line 31
  2. Distinctive:

    Use relative paths for cross-references if needed

    line 48
  3. Very specific:

    Create directory index following docs/MEMORY.md format

    line 51
  4. Very specific:

    Use relative paths: ./details/{title}.md

    line 53
  5. Very specific:

    Create essential startup info following docs/Start_Memory.md format

    line 57
  6. Very specific:

    CRITICAL: Must include three mandatory sections (see docs/Start_Memory.md for details):

    line 58
  7. Very specific:

    Add conversation notice from docs/BOOTSTRAP_ADD.md

    line 65
  8. Distinctive:

    Place where Agent reads at startup

    line 66
  9. Distinctive:

    Document memory query flow and Memory_Search usage

    line 71
  10. Distinctive:

    Check directory structure is correct

    line 74
  11. Distinctive:

    Verify MEMORY.md format and links work

    line 75
  12. Distinctive:

    Ensure detail files are complete

    line 76
  13. Distinctive:

    Test Memory_Search can find and retrieve details

    line 77
  14. Very specific:

    When the workspace also uses a self-improvement / .learnings/ workflow:

    line 88
  15. Very specific:

    Treat .learnings/ as a staging area for raw corrections, failures, and feature requests

    line 90
  16. Very specific:

    Keep MEMORY.md index-only even when promoting learnings.

    line 92
  17. Very specific:

    Use memory/YYYY-MM-DD.md for daily capture first when information is still fresh or uncurated

    line 94
  18. Very specific:

    Preserve daily memories: Do not modify memory/YYYY-MM-DD.md files

    line 98
  19. Distinctive:

    Backup first: Always copy MEMORY.md before changes

    line 99
  20. Very specific:

    Relative paths: Use ./ paths for portability across workspaces

    line 101
  21. Distinctive:

    Complete migration: Ensure all important info is moved, nothing lost

    line 102
  22. Distinctive:

    Test thoroughly: Verify Memory_Search works with new structure

    line 103
  23. Very specific:

    Memory storage rule: All future memories MUST follow the details-based storage method - MEMORY.md stores only directory index (title + …

    line 104
  24. Distinctive:

    New conversation starts: Read BOOTSTRAP.md → Read Start_Memory.md → Greet user

    line 119
  25. Distinctive:

    User gives command: Use Memory_Search to find relevant memories

    line 120
  26. Distinctive:

    If found: Read detailed document at referenced path

    line 121

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Memory Compact

Optimize MEMORY.md into a directory-based structure to reduce token consumption in new conversations.

Why This Matters

New conversations load the entire MEMORY.md by default. By splitting into a lightweight index + detailed files, tokens are saved and queries become more efficient. Daily memories (YYYY-MM-DD.md) remain unchanged.

New Structure

{workspace}/
├── MEMORY.md                    # Directory index (lightweight, only links)
├── memory/
│   ├── details/                 # Detailed memory files (one per topic)
│   ├── _import/Start_Memory.md  # Essential startup info (must load first)
│   └── YYYY-MM-DD.md            # Daily memories (unchanged mechanism)

Execution Steps

  1. Backup original:
    cp {workspace}/MEMORY.md {workspace}/MEMORY.md.backup
    Always backup before modification.
  2. Create directories:
    mkdir -p {workspace}/memory/details
    mkdir -p {workspace}/memory/_import
  3. Parse and split MEMORY.md:
    • Read original MEMORY.md
    • Split by section headers (## level)
    • Group related content by theme
    • Generate short titles (≤10 characters, Chinese preferred)
  4. Generate detail files:
    • Save each section to memory/details/{title}.md
    • Preserve original content format
    • Use relative paths for cross-references if needed
  5. Generate new MEMORY.md:
    • Create directory index following docs/MEMORY.md format
    • Group memories by topic (environment, team, tools, etc.)
    • Use relative paths: ./details/{title}.md
    • Include reference to Start_Memory.md
  6. Generate Start_Memory.md:
    • Create essential startup info following docs/Start_Memory.md format
    • CRITICAL: Must include three mandatory sections (see docs/Start_Memory.md for details):
      1. 强制规则 - Memory_Search usage规范(先检索后读取)
      2. 重要约束:记忆存储结构规范 - MEMORY.md/details/Start_Memory/YYYY-MM-DD 的职责划分
      3. 记忆查询流程 - 新优化记忆结构下的查询流程
    • Save to memory/_import/Start_Memory.md
  7. Update BOOTSTRAP.md:
    • Add conversation notice from docs/BOOTSTRAP_ADD.md
    • Place where Agent reads at startup
    • Instruct to read Start_Memory.md on first conversation
  8. Update AGENTS.md:
    • Replace old Memory section with new structure description
    • Document memory query flow and Memory_Search usage
  9. Verify and test:
    • Check directory structure is correct
    • Verify MEMORY.md format and links work
    • Ensure detail files are complete
    • Test Memory_Search can find and retrieve details
    • Confirm Start_Memory.md is properly referenced
  10. Report results:
    • List created directories and files
    • Count migrated memory sections
    • Report validation status
    • Note any issues or warnings

Learnings Compatibility

When the workspace also uses a self-improvement / .learnings/ workflow:

  • Treat .learnings/ as a staging area for raw corrections, failures, and feature requests
  • Promote durable user preferences, environment facts, team rules, and other stable context into memory/details/*.md
  • Keep MEMORY.md index-only even when promoting learnings; do not paste detailed learnings directly into it
  • Continue to route behavioral patterns to SOUL.md, workflow rules to AGENTS.md, and tool gotchas to TOOLS.md
  • Use memory/YYYY-MM-DD.md for daily capture first when information is still fresh or uncurated

Key Rules

  • Preserve daily memories: Do not modify memory/YYYY-MM-DD.md files
  • Backup first: Always copy MEMORY.md before changes
  • Short titles: Detail file names ≤10 characters, clear and descriptive
  • Relative paths: Use ./ paths for portability across workspaces
  • Complete migration: Ensure all important info is moved, nothing lost
  • Test thoroughly: Verify Memory_Search works with new structure
  • Memory storage rule: All future memories MUST follow the details-based storage method - MEMORY.md stores only directory index (title + path), memory/details/ stores detailed content, memory/_import/Start_Memory.md stores essential startup info, memory/YYYY-MM-DD.md stores daily logs (unchanged)

Examples

Refer to docs/ directory for format templates:

  • docs/MEMORY.md - Directory index with topic groups and relative paths
  • docs/Start_Memory.md - Essential startup info with query flow and rules
    • NOTE: Simplified to remove redundancy. Must include three mandatory sections:
      1. 强制规则 (Memory_Search usage)
      2. 重要约束:记忆存储结构规范 (details storage method)
      3. 记忆查询流程 (query flow for optimized structure)
  • docs/BOOTSTRAP_ADD.md - Notice to add to BOOTSTRAP.md for first-time reading

Query Flow After Optimization

  1. New conversation starts: Read BOOTSTRAP.md → Read Start_Memory.md → Greet user
  2. User gives command: Use Memory_Search to find relevant memories
  3. If found: Read detailed document at referenced path
  4. If not found: Proceed normally without reading memory files

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.