rem-sleep

Consolidate session logs into MEMORY.md and defragment memory files.

1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/firstsun-dev/yao-agent-skills --skill rem-sleep-firstsun-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rem-sleep
Source: https://github.com/firstsun-dev/yao-agent-skills/tree/main/external/health/rem-sleep
Command: npx skills add https://github.com/firstsun-dev/yao-agent-skills --skill rem-sleep-firstsun-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Memory consolidation for AI agents: turning raw session logs into durable long-term memory to prevent forgetting and drift after restarts.

Core Features & Use Cases

  • Consolidation: scan recent sessions, extract decisions, facts, and lessons, and update MEMORY.md.
  • Defrag: prune stale entries, merge duplicates, and compress memory files for efficiency.
  • Heartbeat maintenance: run periodic memory maintenance to keep long-term knowledge fresh for ongoing tasks.
  • Use Case: Apply REM Sleep during end-of-session wrap-ups or regular heartbeats to maintain a coherent and actionable memory.

Quick Start

Consolidate recent sessions into MEMORY.md and perform a defrag pass to keep memory coherent.

Frequently Asked Questions about rem-sleep

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

FAQPage Schema
How do I consolidate AI agent session logs into long-term memory?

To consolidate AI agent session logs into long-term memory, you scan recent sessions to extract decisions, facts, and lessons, then update MEMORY.md. This prevents forgetting and drift by turning raw session logs into durable knowledge during end-of-session wrap-ups.

What is the best way to defragment memory files for an AI agent?

The best way to defragment memory files for an AI agent is to prune stale entries, merge duplicates, and compress the files for efficiency. This defragmentation process keeps long-term knowledge fresh and actionable during heartbeat maintenance.

Why does my AI agent forget previous decisions after a restart?

Your AI agent forgets previous decisions after a restart because raw session logs are not consolidated into long-term memory. Applying end-of-session memory consolidation extracts decisions and updates MEMORY.md to prevent drift and knowledge loss.

Can I run memory consolidation periodically using a heartbeat for AI agents?

You can run memory consolidation periodically using a heartbeat for AI agents to maintain long-term knowledge. Heartbeat maintenance scans recent sessions, extracts lessons, updates MEMORY.md, and performs defragmentation with safe fallbacks.

Does memory consolidation work without existing session logs?

Memory consolidation does not work without existing session logs because it requires raw session data to search and extract decisions, facts, and lessons. The workflow depends on session logs to update MEMORY.md and perform defragmentation.