Token导航 LogoToken导航

Agent Skill · 研究检索

defragmenting-memory(整理内存碎片)

defragmenting-memory 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

defragmenting-memory 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 50,054。

总安装 630周安装 26GitHub Stars 2,402下载 206核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:defragmenting-memory(整理内存碎片)
来源仓库:https://github.com/letta-ai/letta-code
仓库路径:skills/defragmenting-memory
安装命令:
npx skills add https://github.com/letta-ai/letta-code --skill defragmenting-memory
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/letta-ai/letta-code --skill defragmenting-memory

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于重组内存文件系统内的碎片化记忆块,提升信息组织效率。通过子代理分解大型记忆文件,实现原位优化与结构重整。专注于拆分复杂条目而非内容创作,保持原始语义完整性。需启用Memory Filesystem功能方可使用,否则无法操作内存文件。

defragmenting-memory 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/defragmenting-memory

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/letta-ai/letta-code --skill defragmenting-memo…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

defragmenting-memory 怎么安装?

在终端执行 npx skills add https://github.com/letta-ai/letta-code --skill defragmenting-memory。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

defragmenting-memory 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

defragmenting-memory 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/letta-ai/letta-code --skill defragmenting-memory 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

defragmenting-memory 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

defragmenting-memory 用的人多吗?

公开数据是累计安装 630 次,近一周安装 26 次,下载 206 次,GitHub 2,402 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

defragmenting-memory 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 来源仓库有 2,402 星,维护活跃度相对可查。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
defragmenting-memory

整理内存碎片 · 本页

6302,402执行命令未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Memory Defragmentation Skill

Requires Memory Filesystem (memfs) This skill works by directly editing memory files on disk. It requires the memory filesystem feature to be enabled. To check: Look for a memory_filesystem block in your system prompt. If it shows a tree structure starting with /memory/ including a system/ directory, memfs is enabled. To enable: Ask the user to run /memfs enable, then reload the CLI.

This skill helps you maintain clean, well-organized memory blocks by spawning a subagent to decompose and reorganize memory files in-place.

The focus is on decomposition—splitting large, multi-purpose blocks into focused, single-purpose components—rather than consolidation.

Memory files live at ~/.letta/agents/$LETTA_AGENT_ID/memory/ and are synced to API blocks automatically by memfs sync on CLI startup.

When to Use

  • Memory blocks have redundant information
  • Memory lacks structure (walls of text)
  • Memory contains contradictions
  • Memory has grown stale or outdated
  • After major project milestones
  • Every 50-100 conversation turns

Workflow

Step 1: Commit Current State (Safety Net)

The memory directory is a git repo. Commit the current state so you can rollback if needed:

cd ~/.letta/agents/$LETTA_AGENT_ID/memory
git add -A
git commit -m "chore: pre-defrag snapshot" || echo "No changes to commit"

⚠️ CRITICAL: You MUST commit before proceeding. This is your rollback point.

Step 2: Spawn Subagent to Edit Memory Files

The memory subagent works directly on the memfs system/ directory. After it finishes, memfs sync will propagate changes to the API on next CLI startup.

Task({
  subagent_type: "memory",
  run_in_background: true,
  description: "Decompose and reorganize memory files",
  prompt: `You are decomposing and reorganizing memory files in ~/.letta/agents/${LETTA_AGENT_ID}/memory/system/ to improve clarity and focus.

These files ARE the agent's memory — they sync directly to API memory blocks via memfs. Changes you make here will be picked up automatically.

## Directory Structure

~/.letta/agents/<agent-id>/memory/
├── system/       ← Attached blocks (always loaded in system prompt) — EDIT THESE
├── notes.md      ← Detached blocks at root level (on-demand) — can create here
├── archive/      ← Detached blocks can be nested too
└── .sync-state.json  ← DO NOT EDIT (internal sync tracking)

## Files to Skip (DO NOT edit)
- memory_filesystem.md (auto-generated tree view)
- .sync-state.json (internal)

## What to Edit
- persona.md → Consider splitting into: persona/identity.md, persona/values.md, persona/approach.md
- project.md → Consider splitting into: project/overview.md, project/architecture.md, project/conventions.md, etc.
- human.md → Consider splitting into: human/identity.md, human/preferences.md, etc.
- Any other non-system blocks present

## How Memfs File ↔ Block Mapping Works
- File path relative to memory root becomes the block label (system/ prefix for attached, root level for detached)
- Example: system/project/tooling/bun.md → block label "project/tooling/bun"
- New files you create will become new memory blocks on next sync
- Files you delete will cause the corresponding blocks to be deleted on next sync
- YAML frontmatter is supported for metadata (label, description, limit, read_only)

## Evaluation Criteria

1. **DECOMPOSITION** - Split large, multi-purpose blocks into focused, single-purpose components
   - Example: A "persona" block mixing identity, values, AND approach should become persona/identity.md, persona/values.md, persona/approach.md
   - Example: A "project" block with overview, architecture, conventions, and gotchas should split into project/overview.md, project/architecture.md, project/conventions.md, project/gotchas.md
   - Goal: Each block should have ONE clear purpose described by its filename
   - Use hierarchical / naming (e.g., project/tooling/bun.md, not project-tooling-bun.md)

2. **STRUCTURE** - Organize content with clear markdown formatting
   - Use headers (##, ###) for subsections
   - Use bullet points for lists
   - Make content scannable at a glance

3. **CONCISENESS** - Remove redundancy and unnecessary detail
   - Eliminate duplicate information across blocks
   - Remove speculation ("probably", "maybe", "I think")
   - Keep only what adds unique value

4. **CLARITY** - Resolve contradictions and improve readability
   - If blocks contradict, clarify or choose the better guidance
   - Use plain language, avoid jargon
   - Ensure each statement is concrete and actionable

5. **ORGANIZATION** - Group related information logically
   - Within each block, organize content from general to specific
   - Order sections by importance

## Workflow

1. **Analyze** - Read each file and identify its purpose(s)
   - If a block serves 2+ distinct purposes, it needs decomposition
   - Flag blocks where subtopics could be their own focused blocks

2. **Decompose** - Split multi-purpose blocks into specialized files
   - Create new files using hierarchical paths (e.g., project/tooling/bun.md)
   - Ensure each new block has ONE primary purpose

3. **Clean Up** - For remaining blocks (or new focused blocks):
   - Add markdown structure with headers and bullets
   - Remove redundancy
   - Resolve contradictions
   - Improve clarity

4. **Delete** - Remove files only when appropriate
   - After moving all content to new decomposed files
   - Never delete a focused, single-purpose block
   - Only delete if a block contains junk/irrelevant data with no value

## Success Indicators
- No block tries to cover 2+ distinct topics
- Each block title clearly describes its single purpose
- Content within each block is focused and relevant to its title
- Well-organized with markdown structure
- Clear reduction in confusion/overlap across blocks

Provide a detailed report including:
- Files created (new decomposed blocks)
- Files modified (what changed)
- Files deleted (if any, explain why)
- Before/after character counts
- Rationale for how decomposition improves the memory structure`
})

The subagent will:

  • Read files from ~/.letta/agents/<agent-id>/memory/system/ (and root level for detached)
  • Edit them to reorganize and decompose large blocks
  • Create new hierarchically-named files (e.g., project/overview.md)
  • Add clear structure with markdown formatting
  • Delete source files after decomposing their content into focused children
  • Provide a detailed report of changes

After the subagent finishes, memfs sync will automatically propagate changes to API blocks on the next CLI startup. No manual restore step is needed.

Step 3: Commit Changes

After the subagent finishes, commit the changes:

cd ~/.letta/agents/$LETTA_AGENT_ID/memory
git add -A
git commit -m "chore: defragment memory blocks"
git push

Example Complete Flow

// Step 1: Commit current state (MANDATORY)
Bash({
  command: "cd ~/.letta/agents/$LETTA_AGENT_ID/memory && git add -A && git commit -m 'chore: pre-defrag snapshot' || echo 'No changes'",
  description: "Commit current memory state as rollback point"
})

// Step 2: Spawn subagent to decompose and reorganize (runs async in background)
Task({
  subagent_type: "memory",
  run_in_background: true,
  description: "Decompose and reorganize memory files",
  prompt: "Decompose and reorganize memory files in ~/.letta/agents/$LETTA_AGENT_ID/memory/system/. These files sync directly to API blocks via memfs. Be aggressive about splitting large multi-section blocks into many smaller, single-purpose blocks using hierarchical / naming. Skip memory_filesystem.md and .sync-state.json. Structure with markdown headers and bullets. Remove redundancy and speculation. Resolve contradictions. Organize logically. Each block should have ONE clear purpose. Report files created, modified, deleted, before/after character counts, and rationale for changes."
})

// Step 3: After subagent completes, commit and push
// Check progress with /task <task_id>, restart CLI to sync when done

Rollback

If something goes wrong, use git to revert:

cd ~/.letta/agents/$LETTA_AGENT_ID/memory

# Option 1: Reset to last commit (discard all uncommitted changes)
git reset --hard HEAD~1

# Option 2: View history and reset to specific commit
git log --oneline -5
git reset --hard <commit-hash>

# Push the rollback
git push --force

On next CLI startup, memfs sync will detect the changes and update API blocks accordingly.

What the Subagent Does

The subagent focuses on decomposing and cleaning up files. It has full tool access (including Bash) and:

  • Discovers .md files in ~/.letta/agents/<agent-id>/memory/system/ (via Glob or Bash)
  • Reads and examines each file's content
  • Identifies multi-purpose blocks that serve 2+ distinct purposes
  • Splits large blocks into focused, single-purpose components with hierarchical naming
  • Modifies/creates.md files for decomposed blocks
  • Improves structure with headers and bullet points
  • Removes redundancy and speculation across blocks
  • Resolves contradictions with clear, concrete guidance
  • Organizes content logically (general to specific, by importance)
  • Provides detailed before/after reports including decomposition rationale
  • Does NOT run any git commands (parent agent handles that)

The focus is on decomposition—breaking apart large monolithic blocks into focused, specialized components rather than consolidating them together.

Tips

What to clean up:

  • Duplicate information (consolidate into one well-organized section)
  • Walls of text without structure (add headers and bullets)
  • Contradictions (resolve by clarifying or choosing the better guidance)
  • Speculation ("probably", "maybe" - make it concrete or remove)
  • Transient details that won't matter in a week

Decomposition Strategy:

  • Split blocks that serve 2+ distinct purposes into focused components
  • Use hierarchical / naming: project/tooling/bun.md, not project-bun.md
  • Create parent index files that reference children
  • Example: A "persona" mixing identity + values + approach → split into persona/identity.md, persona/values.md, persona/approach.md
  • Example: A "project" with overview + architecture + conventions → split into project/overview.md, project/architecture.md, project/conventions.md
  • Add clear headers and bullet points for scannability
  • Group similar information together within focused blocks

When to DELETE a file:

  • Only delete if file contains junk/irrelevant data with no project value
  • Delete source files after fully decomposing content into child files
  • Don't delete unique information just to reduce file count

What to preserve:

  • User preferences (sacred - never delete)
  • Project conventions discovered through experience
  • Important context for future sessions
  • Learnings from past mistakes
  • Any information that has unique value

Good memory structure:

  • Use markdown headers (##, ###)
  • Organize with bullet points
  • Keep related information together
  • Make it scannable at a glance
  • Use / hierarchy for discoverability

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

平台分布

Codex

39.97%
按下载量换算82

Claude

30.29%
按下载量换算62

Cursor

17.87%
按下载量换算37

Gemini CLI

9.26%
按下载量换算19

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/letta-ai/letta-code --skill defragmenting-memory 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills