Token导航 LogoToken导航TokenDH.com
研究检索敏感数据clawhub未标认证来源可访问clear审计提醒

sleep-consolidation睡眠巩固

Agent Skill

sleep-consolidation 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 OpenClaw 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,885

周安装

119

GitHub Stars

公开资料未说明

下载量

942
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sleep-consolidation(睡眠巩固)
来源仓库:https://github.com/cshiaa/sleep-consolidation
安装命令:
openclaw skills install sleep-consolidation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install sleep-consolidation

简介

sleep-consolidation 用于将 AI Agent 经验固化到长期记忆,模仿人类睡眠记忆机制。

  • 适合在 OpenClaw 中持续积累错误修正、最佳实践与能力缺口。
  • 通过 clawhub 安装,需定期触发以更新日志与知识库。
  • 安装前应确认存储路径权限与数据加密措施。
  • 不主动干预任务执行,仅作为后台学习辅助模块。

SKILL.md

name
sleep-consolidation
description
>

Agent Sleep Consolidation — v2

Biologically-grounded memory consolidation for AI agents, based on:

  • Eichenlaub et al. 2020 (Cell Reports): Neural replay in human motor cortex — waking rest consolidates too; NREM1 shows compressed (fast) AND dilated (slow) dual-track replay; replay prioritizes weakly-learned items
  • Walker, "Why We Sleep": NREM hippocampus→cortex transfer, synaptic pruning (~20%), REM creative synthesis
  • OpenClaw memory architecture: Markdown-as-truth, two-layer files, pre-compaction flush, hybrid BM25+vector recall

See references/workspace_layout.md for full file format examples. See references/memory_schema.md for Markdown conventions and type system.


Memory workspace layout

~/.agent_workspace/
├── MEMORY.md                  ← long-term: durable facts, preferences, decisions
├── memory/
│   └── YYYY-MM-DD.md          ← daily log (append-only; load today + yesterday)
└── bank/
    ├── entities/              ← per-person or per-project pages
    └── concepts/              ← per-topic deep-dives

Core rule: The agent only "remembers" what gets written to disk. Never keep important things in RAM.


Three consolidation modes

ModeBiological analogWhen to useScript
micro-restWaking neural replay (Eichenlaub 2020)Mid-session, after any significant exchangescripts/micro_rest.py
nremNREM deep sleep, hippocampus→cortexEnd of session, context nearing limitscripts/sleep_cycle.py --phase nrem
remREM dream synthesisAfter NREM, or standalone for insightscripts/sleep_cycle.py --phase rem
bothFull overnight cycleEnd of day / long sessionscripts/sleep_cycle.py --phase both

Mode 1 — Micro-rest (waking replay)

Quick append to today's daily log. No LLM call — pure write. Based on the paper's finding that waking replay occurs during rest blocks immediately after learning.

python scripts/micro_rest.py \
  --note "User prefers TypeScript; rejected Python suggestion" \
  --type O \
  --workspace ~/.agent_workspace
# Pre-compaction flush: extract worth-retaining from raw context
python scripts/micro_rest.py \
  --flush \
  --context-dump "$(cat session_log.txt)" \
  --workspace ~/.agent_workspace

Memory type prefixes (W/B/O/S system from OpenClaw research):

PrefixMeaningExample
WWorld fact (objective)W: Redis default port is 6379
BBiographical/experienceB: Fixed the auth bug by wrapping in try/catch
O(c=N)Opinion/preference + confidence 0–1O(c=0.9): User prefers concise replies under 200 words
SSummary/synthesis (generated)S: Three sessions used streaming; all had lower latency

Each entry is appended to memory/YYYY-MM-DD.md under a ## Retain section.


Mode 2 — NREM consolidation

Two-track processing based on the paper's temporal replay findings:

  • Fast track (compressed replay, ~0.1x duration): high-confidence facts → MEMORY.md
  • Slow track (dilated replay, 1.5–2x duration): weakly-learned or uncertain items the paper shows replay *prioritizes* these → bank/ for deeper storage
python scripts/sleep_cycle.py --workspace ~/.agent_workspace --phase nrem

The script reads today's daily log + current MEMORY.md, then calls Claude:

NREM system prompt

You simulate NREM deep-sleep memory consolidation for an AI agent.

Two-track processing:

FAST TRACK (compressed replay — high-confidence, clear facts):
  - Distill into single-sentence durable memories for MEMORY.md
  - Prune ~20% as redundant (synaptic homeostasis: sleep removes weak connections)
  - Use prefixes: W (world fact), B (experience), O(c=N) (opinion + confidence), S (summary)

SLOW TRACK (dilated replay — weakly-learned, uncertain, needing reinforcement):
  - Expand on low-confidence or partial-knowledge items
  - Write to bank/ as entity or concept pages
  - These are what human NREM prioritizes (Schapiro et al. 2018)

Respond ONLY with valid JSON:
{
  "memory_md_updates": [
    {
      "action": "add|update|remove",
      "type": "W|B|O|S",
      "confidence": 0.0,
      "text": "single sentence",
      "replaces": "old text if action=update"
    }
  ],
  "bank_updates": [
    {
      "slug": "topic-slug",
      "kind": "entity|concept",
      "section": "## Section heading",
      "content": "markdown block"
    }
  ],
  "pruned_count": 0,
  "weakly_learned": ["items for slow-track attention"],
  "open_questions": ["gaps for next session"]
}

Mode 3 — REM synthesis

Creative cross-domain connections. The dreaming brain ignores conventional logic.

python scripts/sleep_cycle.py --workspace ~/.agent_workspace --phase rem

REM system prompt

You simulate REM dream-sleep creative synthesis for an AI agent.
Find non-obvious connections. Update beliefs where evidence shifted.

Tasks:
1. Cross-domain links between today's memories and MEMORY.md
2. Update O(c=N) confidence values where evidence has shifted
3. Generate concrete next-session actions
4. Propose new bank/ pages if a topic recurred 3+ times this session

Respond ONLY with valid JSON:
{
  "aha_moments": ["string"],
  "creative_connections": [{"link": "A ↔ B", "why": "string"}],
  "confidence_updates": [
    {"item": "text excerpt", "old_c": 0.0, "new_c": 0.0, "reason": "string"}
  ],
  "new_bank_suggestions": [
    {"slug": "string", "kind": "entity|concept", "seed_content": "markdown"}
  ],
  "next_session_actions": ["string"]
}

Pre-compaction flush

Mirrors OpenClaw's memoryFlush mechanism. Triggered when context approaches token limit. Runs silently (no user output).

Configure the threshold (equivalent to OpenClaw's softThresholdTokens):

# When session token estimate > (context_window - 20000 - 4000):
python scripts/micro_rest.py --flush --context-dump "..." --workspace ~/.agent_workspace

The --flush flag calls Claude to extract durable memories from the raw context dump, then writes them to the daily log. One flush per compaction cycle.


Loading memory at session start

from scripts.load_memory import get_context

system_addendum = get_context(
    workspace="~/.agent_workspace",
    max_memory_chars=3000,   # MEMORY.md snippet (fits ~2k tokens)
    load_yesterday=True      # also load yesterday's daily log
)
# Inject system_addendum into system prompt

Loaded content:

  1. Full MEMORY.md (trimmed to max_memory_chars)
  2. Today's daily log (if exists)
  3. Yesterday's daily log (if load_yesterday=True)

Full session workflow

# Session start: inject memory into system prompt (in Python)

# During session: micro-rest after significant exchanges
python scripts/micro_rest.py --note "..." --type W --workspace ~/.agent_workspace

# If context > 80% full: flush before compaction
python scripts/micro_rest.py --flush --context-dump "..." --workspace ~/.agent_workspace

# Session end: full sleep cycle
python scripts/sleep_cycle.py --phase both --workspace ~/.agent_workspace

Troubleshooting

ProblemSolution
MEMORY.md growing too largeRun with --prune-memory flag — NREM removes redundant entries
Bank file staleDelete it; NREM regenerates next session
REM generating hallucinationsAdd "Be strictly grounded. No invention." to REM prompt
Micro-rest called too oftenAdd 5-min cooldown check in calling code
Flush extracting too littleLower the softThresholdTokens equivalent; flush earlier
Replay not strengthening weak itemsCheck that NREM prompt slow-track section explicitly lists weakly_learned items

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

77.06%
按下载量换算726

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills