返回顶部
a

agent-sleepAgent睡眠系统

Agent 睡眠系统 - 记忆整合、日志归档、工作区清理(支持 CortexGraph)

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
688
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

agent-sleep

Agent 睡眠系统 🛌

像人类一样,Agent 需要睡眠(离线维护)来防止记忆碎片化和上下文污染。

功能

  1. 1. 微休息 - 快速上下文修剪
  2. 深度睡眠 - 每日日志整合到长期记忆
  3. CortexGraph 同步 - 同步到 CortexGraph(带遗忘曲线)
  4. 梦境 - 后台模拟(可选)

工具

sleep_status

检查 agent 是否累了(基于运行时间或 token 使用) bash python3 scripts/sleep_status.py

runsleepcycle

触发睡眠周期
  • - 轻度: 压缩最近日志
  • 深度: 归档 + 文件清理
  • CortexGraph: 同步到 CortexGraph
bash python3 scripts/runsleepcycle.py --mode [light|deep|cortexgraph]

schedule

设置生物钟(cron 任务) bash python3 scripts/schedule.py --set 0 3 * # 凌晨 3 点睡眠

工作流程

深度睡眠模式

  1. 1. 触发 → Cron 在 3:00 AM 启动
  2. 读取 → memory/YYYY-MM-DD.md(昨天日志)
  3. 提取 → 高价值洞察
  4. 追加 → 到 MEMORY.md
  5. 归档 → 原始日志到 memory/archive/
  6. 清理 → 删除临时文件

CortexGraph 模式

  1. 1. 读取 → MEMORY.md + 每日日志
  2. 同步 → 到 CortexGraph
  3. 应用 → 遗忘曲线(自动衰减)
  4. 晋升 → 高价值记忆到 LTM

遗忘曲线

CortexGraph 使用艾宾浩斯遗忘曲线:

score = (use_count)^β × e^(-λ × Δt) × strength

  • - β = 0.6(使用频率权重)
  • λ = ln(2) / half_life(默认 3 天)
  • strength = 1.0-2.0(重要性)

使用

手动触发

bash

轻度睡眠

python3 scripts/runsleepcycle.py --mode light

深度睡眠

python3 scripts/runsleepcycle.py --mode deep

CortexGraph 同步

python3 scripts/runsleepcycle.py --mode cortexgraph

定时设置

bash

每天凌晨 3 点深度睡眠

python3 scripts/schedule.py --set 0 3 *

每 6 小时 CortexGraph 同步

python3 scripts/schedule.py --set 0 /6

目录结构

agent-sleep/
├── SKILL.md
├── AGENT.md
├── scripts/
│ ├── runsleepcycle.py
│ ├── sleep_status.py
│ └── schedule.py
└── memory/
├── archive/ # 归档的日志
└── consolidated/ # 整合的记忆

配置

环境变量

bash

CortexGraph 配置

export CORTEXGRAPHSTORAGEPATH=~/.config/cortexgraph/jsonl export CORTEXGRAPHDECAYMODEL=power_law export CORTEXGRAPHPLHALFLIFE_DAYS=3.0

ClawHub 配置

bash clawhub install agent-sleep

最佳实践

  1. 1. 每日深度睡眠 - 凌晨 3 点
  2. 每 6 小时 CortexGraph 同步 - 保持记忆新鲜
  3. 每周垃圾回收 - 清理低分记忆
  4. 每月晋升 - 高价值记忆升级到 LTM

与其他技能集成

技能集成方式
memory-sync-cn使用其脚本同步到 CortexGraph
agent-library
使用其压缩功能 | | cortexgraph | 直接调用 MCP 工具 |
版本: 1.1.0 更新: 添加 CortexGraph 支持

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 agent-sleep-1776419934 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 agent-sleep-1776419934 技能

通过命令行安装

skillhub install agent-sleep-1776419934

下载

⬇ 下载 agent-sleep v1.1.0(免费)

文件大小: 5.99 KB | 发布时间: 2026-4-17 19:13

v1.1.0 最新 2026-4-17 19:13
**CortexGraph support and workflow enhancements**

- Added support for CortexGraph memory synchronization, including forgetting curve models.
- Expanded sleep modes: now includes "light", "deep", and "cortexgraph" options.
- SKILL.md fully rewritten in Chinese, with detailed workflow, configuration, and best practices.
- Updated tools/scripts references and directory structure for easier integration.
- Introduced configuration options for CortexGraph decay model and scheduling.
- Added package.json for skill packaging.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部