agent-sleepAgent 睡眠系统 - 记忆整合、日志归档、工作区清理(支持 CortexGraph)
Install via ClawdBot CLI:
clawdbot install guohongbin-git/agent-sleep像人类一样,Agent 需要"睡眠"(离线维护)来防止记忆碎片化和上下文污染。
检查 agent 是否"累了"(基于运行时间或 token 使用)
python3 scripts/sleep_status.py
触发睡眠周期
python3 scripts/run_sleep_cycle.py --mode [light|deep|cortexgraph]
设置生物钟(cron jobs)
python3 scripts/schedule.py --set "0 3 * * *" # 3 AM 睡眠
1. 触发 → Cron 在 3:00 AM 启动
2. 读取 → memory/YYYY-MM-DD.md(昨天日志)
3. 提取 → 高价值洞察
4. 追加 → 到 MEMORY.md
5. 归档 → 原始日志到 memory/archive/
6. 清理 → 删除临时文件
1. 读取 → MEMORY.md + daily logs
2. 同步 → 到 CortexGraph
3. 应用 → 遗忘曲线(自动衰减)
4. 晋升 → 高价值记忆到 LTM
CortexGraph 使用 Ebbinghaus 遗忘曲线:
score = (use_count)^β × e^(-λ × Δt) × strength
# 轻量睡眠
python3 scripts/run_sleep_cycle.py --mode light
# 深度睡眠
python3 scripts/run_sleep_cycle.py --mode deep
# CortexGraph 同步
python3 scripts/run_sleep_cycle.py --mode cortexgraph
# 每天凌晨 3 点深度睡眠
python3 scripts/schedule.py --set "0 3 * * *"
# 每 6 小时 CortexGraph 同步
python3 scripts/schedule.py --set "0 */6 * * *"
agent-sleep/
├── SKILL.md
├── AGENT.md
├── scripts/
│ ├── run_sleep_cycle.py
│ ├── sleep_status.py
│ └── schedule.py
└── memory/
├── archive/ # 归档的日志
└── consolidated/ # 整合的记忆
# CortexGraph 配置
export CORTEXGRAPH_STORAGE_PATH=~/.config/cortexgraph/jsonl
export CORTEXGRAPH_DECAY_MODEL=power_law
export CORTEXGRAPH_PL_HALFLIFE_DAYS=3.0
clawhub install agent-sleep
| Skill | 集成方式 |
|-------|----------|
| memory-sync-cn | 使用其脚本同步到 CortexGraph |
| agent-library | 使用其压缩功能 |
| cortexgraph | 直接调用 MCP 工具 |
版本: 1.1.0
更新: 添加 CortexGraph 支持
Generated Mar 1, 2026
An AI agent handling customer inquiries 24/7 benefits from scheduled deep sleep cycles to consolidate daily interactions into long-term memory, preventing context overload and improving response accuracy over time. This ensures the agent maintains high performance by archiving logs and applying forgetting curves to prioritize relevant information.
In academic settings, an AI agent assisting with literature review and data analysis uses sleep cycles to integrate daily findings into a structured memory system, reducing fragmentation and enabling better knowledge retention. CortexGraph synchronization helps decay less relevant data while promoting key insights for long-term use.
An AI agent in healthcare analyzes patient data and medical records, requiring regular sleep to clean temporary files and sync critical insights to long-term memory, ensuring compliance and accuracy. This prevents memory pollution and supports decision-making by maintaining a consolidated, up-to-date knowledge base.
A trading bot processing market data uses light sleep modes to prune context and deep sleep to archive logs, optimizing memory usage and preventing performance degradation. Scheduled CortexGraph syncs apply decay models to prioritize recent trends, enhancing trading strategy adaptability.
An AI agent generating marketing content benefits from sleep cycles to consolidate daily creative outputs and clean workspaces, reducing clutter and improving idea coherence. This helps maintain brand consistency by archiving past campaigns and promoting high-value concepts to long-term memory.
Offer the Agent Sleep skill as part of a monthly subscription for AI platforms, providing regular updates, support, and integration features. Revenue is generated through tiered pricing based on usage levels and advanced functionalities like CortexGraph synchronization.
Provide basic sleep functionalities for free, with premium features such as advanced CortexGraph decay models, priority scheduling, and integration with other skills available for a one-time purchase or annual license. This attracts users to upgrade for enhanced performance.
Sell customized versions of the Agent Sleep skill to large organizations, including tailored sleep cycles, dedicated support, and integration with proprietary systems. Revenue comes from high-value contracts and ongoing maintenance fees for specialized deployments.
💬 Integration Tip
Integrate with existing memory systems by using the provided scripts and environment variables, ensuring compatibility with tools like CortexGraph for optimized memory management.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection