rem-sleep

Consolidates session logs into durable long-term memory files for AI agents.

3|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/firstsun-dev/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/skills/tree/main/plugins/health-wellness/skills/rem-sleep
Command: npx skills add https://github.com/firstsun-dev/skills --skill rem-sleep-firstsun-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? AI agent session logs accumulate over time but are expensive to re-read, causing important decisions, lessons, and commitments to get buried in noise or lost after context compaction and restarts. ## Core Features & Use Cases - Consolidate Mode: Searches recent session logs (JSONL) for decisions, lessons, facts, and TODOs, then distills them into a daily memory file and a durable MEMORY.md. - Defrag Mode: Reviews MEMORY.md to remove stale entries, merge duplicates, resolve inconsistencies, and compress verbose content. - Flexible Search Options: Works with plain grep/jq, Repo Prompt, or an agent's built-in memory_search tool, with no hard dependency on any single platform. - Use Case: After a busy week of agent sessions, run a full REM sleep cycle to extract key decisions from session logs and clean up MEMORY.md so the agent retains only relevant long-term knowledge. ## Quick Start Ask your agent to run REM sleep and consolidate the last few days of session logs into MEMORY.md.

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?▼

Run the consolidate workflow: search recent JSONL session logs for decisions, lessons, and TODOs using grep, jq, or memory_search, then distill the significant findings into a daily memory file and update MEMORY.md with durable knowledge.

How do I clean up and defragment an agent MEMORY.md file?▼

Use the defrag workflow: read MEMORY.md, categorize issues as stale, duplicate, inconsistent, or bloated entries, then remove outdated items, merge duplicates, resolve conflicts, and reorganize into logical sections.

Does this memory consolidation workflow work with Claude Code or OpenClaw?▼

Yes, it works with OpenClaw, Claude Code, or any agent that produces session logs and memory files. It adapts to available tooling, from plain grep and jq to Repo Prompt or built-in memory_search.

How often should memory consolidation and defragmentation run?▼

The recommended cadence is consolidation every few days or after busy periods, defrag weekly or bi-weekly, and a full cycle monthly. It can be triggered manually, via a heartbeat file, or through a scheduled cron job.

What are the limitations of log-based memory consolidation?▼

It depends on the quality of session logs and search heuristics, so significant events phrased without common keywords may be missed. It is a workflow rather than an automated binary, so results require agent judgment and adaptation to your setup.