Markdown Converter
Agent skill for markdown-converter
Memory consolidation and defragmentation for long-term memory maintenance. Use when asked to consolidate memories, defrag memory, run REM sleep, clean up memory files, or process session logs into durable memory. Also use periodically during heartbeats for memory maintenance.
Sign in to like and favorite skills
Like biological REM sleep, this skill processes raw experience (session logs) into consolidated long-term memory.
Works with: OpenClaw, Claude Code, or any agent with session logs and memory files.
Periodic "sleep cycles" that:
Process recent session logs → extract significant events → update MEMORY.md
Review MEMORY.md → remove stale/outdated entries → merge duplicates → compress
Run both consolidate then defrag.
Option A: Using grep/jq (no extra software)
# OpenClaw session logs location SESSIONS_DIR="$HOME/.openclaw/agents/main/sessions" # Search for patterns in recent sessions grep -r "decision\|learned\|important\|remember\|TODO" "$SESSIONS_DIR" --include="*.jsonl" | head -100 # Parse JSONL and search content find "$SESSIONS_DIR" -name "*.jsonl" -mtime -3 -exec cat {} \; | \ jq -r 'select(.content) | .content' 2>/dev/null | \ grep -i "decision\|learned\|important"
Option B: Using Repo Prompt (if installed)
# More powerful semantic search rp -e 'search "decision" --context-lines 2' rp -e 'search "learned" --context-lines 2' rp -e 'search "important" --context-lines 2'
Option C: Using memory_search (OpenClaw built-in)
If your agent has the
memory_search tool, use it to semantically search memory files:
memory_search("decisions made this week") memory_search("lessons learned")
From search results, look for:
Two-tier system:
memory/YYYY-MM-DD.md): Raw events, specific detailsConsolidation prompt:
Review these session excerpts. Extract significant information that should be remembered long-term. Focus on: decisions, facts about people/projects, lessons learned, and preferences. Format as bullet points suitable for MEMORY.md.
Read MEMORY.md and identify:
STALE: [entry] — reason it's outdated DUPLICATE: [entry A] ≈ [entry B] INCONSISTENT: [entry A] vs [entry B] BLOAT: [verbose entry] → [compressed version]
Ensure MEMORY.md has logical sections:
Recommended cadence:
Trigger options:
# Native search (no dependencies) grep -r "pattern" ~/.openclaw/agents/main/sessions --include="*.jsonl" # With Repo Prompt rp -e 'search "PATTERN" --context-lines 2' # Helper script (if using Repo Prompt) ./scripts/gather-sessions.sh [days_back]
rem-sleep/ ├── SKILL.md # This file ├── README.md # GitHub readme └── scripts/ └── gather-sessions.sh # Helper script (requires Repo Prompt)
PRs welcome! Ideas for improvement: