defragmenting-memory

Decompose large memory blocks into hierarchical single-purpose components with YAML metadata.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/Kastalien-Research/kastalien-factory --skill defragmenting-memory
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defragmenting-memory
Source: https://github.com/Kastalien-Research/kastalien-factory/tree/main/letta-code/src/skills/builtin/defragmenting-memory
Command: npx skills add https://github.com/Kastalien-Research/kastalien-factory --skill defragmenting-memory

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Decomposes large, multi-topic or redundant memory blocks into focused, single-purpose components to improve clarity and retrieval.

Core Features & Use Cases

  • Decompose monolithic memory blocks into a hierarchical set of focused blocks (e.g., persona/identity, project/overview, human/preferences).
  • Enable safety backups and a guided workflow to edit memory blocks in-place with memfs sync.
  • Produce a structured, human-readable reorganization report detailing changes, rationale, and resulting block structure.

Quick Start

Spawn the memory defragmentation subagent to decompose and reorganize memory blocks on disk into a hierarchical, block-based structure.

Frequently Asked Questions about defragmenting-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I defragment agent memory blocks that have become too large or multi-topic?

You can defragment memory by decomposing monolithic blocks into a hierarchical set of focused components using YAML frontmatter metadata. The process applies hierarchical block naming and a change-report workflow that creates new blocks, deletes obsolete ones, and syncs with memfs.

What is memory block decomposition and when should I apply it?

Memory block decomposition is the process of breaking down redundant or outdated agent memory into single-purpose components. Apply it when large memory blocks contain multiple topics, and when clear boundaries between identity, projects, and human context are needed to improve recall and safety.

How do I reorganize agent memory to improve recall and safety?

Reorganize agent memory by applying hierarchical block naming and YAML frontmatter metadata to separate identity, projects, and human context. This structured decomposition creates clear boundaries that directly improve data retrieval recall and operational safety.

Does memory defragmentation work with memfs for in-place editing?

Yes, memory defragmentation supports a guided workflow to edit memory blocks in-place with memfs sync. This enables safety backups during the reorganization process while maintaining synchronization with the memory file system.

What is the best way to structure hierarchical memory blocks for an agent?

The best way to structure hierarchical memory blocks is to decompose monolithic data into focused categories like persona/identity, project/overview, and human/preferences. This single-purpose structure uses YAML frontmatter and produces a human-readable reorganization report detailing changes.

Why does my agent memory retrieval fail when blocks contain mixed topics?

Agent memory retrieval fails or degrades when blocks contain mixed topics because large, multi-topic data lacks clear boundaries. Decomposing these monolithic blocks into focused, single-purpose components with hierarchical naming applies clear boundaries that improve recall.