Back to Skills

memory-hygiene

Maintains memory cleanliness with deduplication, validation, and expiration

2starsUpdated 3/19/2026

Security Assessment

Safe(100/100)
Security Score100/100

About memory-hygiene

The memory-hygiene skill is designed to maintain the cleanliness, consistency, and efficiency of memory storage within an AI system. It addresses common issues such as memory bloat, duplicate entries, stale data, and schema inconsistencies, ensuring that memory remains queryable, compact, and reliable. By automating critical hygiene operations, this skill prevents performance degradation and supports high-quality data management, reducing the risk of errors or inefficiencies in memory-dependent processes.

The skill provides several key capabilities to uphold memory integrity. It can compact memory files by deduplicating identical or highly similar entries, bucket entries by topic for faster retrieval, and generate detailed compression reports. It validates memory entries against a defined schema to ensure proper structure, data types, and confidence scores. The skill also expires stale entries based on TTL values, archiving them if needed, and supports merging duplicates while preserving metadata and retaining the highest confidence versions. Safety measures include automated backups, logging, dry-run previews, atomic operations with rollback, and full provenance tracking.

Memory-hygiene is particularly useful for AI system developers, data engineers, and memory-intensive applications that require reliable and maintainable memory storage. It is ideal before bulk memory operations, during periodic maintenance, or after detecting inconsistencies and duplicates. Use cases include managing large datasets, ensuring data quality in long-running AI systems, performing schema validation, and automating memory housekeeping tasks to reduce manual intervention and maintain system performance over time.

FAQ

When should I use the memory-hygiene skill?

It is recommended to use memory-hygiene before bulk imports or migrations, when memory files exceed 5MB or 1000 patterns, periodically as a daily or weekly maintenance task, after detecting duplicates or stale entries, and whenever schema validation fails.

Which scripts are included for memory hygiene operations?

The skill includes scripts for each operation: compact_memory.py for compaction, validate_schema.py for schema validation, expire_stale.py for expiring stale entries, and merge_duplicates.py for deduplication.

Does memory-hygiene support automatic backups?

Yes, all hygiene operations create backups before modification in the /memories/.backups/ directory to ensure recoverability in case of errors.

What data formats and constraints must memory entries follow?

All memory entries must conform to a schema including fields for topic, scope, value, source, confidence, optional TTL, and metadata with created/updated timestamps. Confidence must be between 0.0 and 1.0, and TTL must follow ISO8601 format.

Can this skill be integrated into automated workflows?

Yes, it supports integration before write operations, periodic maintenance via cron jobs, and post-bulk import tasks, allowing automated validation, compaction, expiration, and deduplication.

Install memory-hygiene

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill