From a94650a5be629e5f4f0788228a02fff0c74afbc8 Mon Sep 17 00:00:00 2001
From: TevinClaw <510129976@qq.com>
Date: Sat, 14 Mar 2026 12:26:27 +0800
Subject: [PATCH] 添加次 agent lifehelper 基本配置

---
 workspace/skills/memory-management/scripts/daily_check.py |   83 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/workspace/skills/memory-management/scripts/daily_check.py b/workspace/skills/memory-management/scripts/daily_check.py
new file mode 100755
index 0000000..52fc94a
--- /dev/null
+++ b/workspace/skills/memory-management/scripts/daily_check.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python3
+"""
+每日记忆检查脚本
+在晚上10点后触发,检查今日是否已写入L2
+"""
+
+import os
+import sys
+from datetime import datetime
+from pathlib import Path
+
+
+def get_workspace_path() -> Path:
+    """获取workspace路径。"""
+    return Path.home() / ".openclaw" / "workspace"
+
+
+def check_today_journal() -> bool:
+    """检查今日是否已有L2记录。"""
+    workspace = get_workspace_path()
+    today = datetime.now().strftime("%Y-%m-%d")
+    journal_file = workspace / "memory" / "journal" / f"{today}.md"
+    return journal_file.exists()
+
+
+def get_l0_size() -> int:
+    """获取MEMORY.md文件大小(字节)。"""
+    workspace = get_workspace_path()
+    memory_file = workspace / "MEMORY.md"
+    if memory_file.exists():
+        return memory_file.stat().st_size
+    return 0
+
+
+def format_size(size_bytes: int) -> str:
+    """格式化文件大小显示。"""
+    kb = size_bytes / 1024
+    return f"{kb:.1f}KB"
+
+
+def main():
+    """主函数。"""
+    today_str = datetime.now().strftime("%Y-%m-%d")
+    print(f"📅 日期检查: {today_str}")
+    print("=" * 50)
+    
+    # 检查今日L2
+    has_today_journal = check_today_journal()
+    print(f"\n📝 L2记录检查:")
+    if has_today_journal:
+        print("  ✅ 今日已有journal记录")
+    else:
+        print("  ⚠️  今日尚未创建journal记录")
+        print("  💡 建议:如有重要决策或事件,写入L2详情层")
+    
+    # 检查L0大小
+    l0_size = get_l0_size()
+    print(f"\n📊 L0 (MEMORY.md) 大小检查:")
+    print(f"  当前: {format_size(l0_size)} / 4KB")
+    
+    if l0_size > 4096:
+        print("  🚨 警告:超过4KB红线!需要立即归档到L1")
+    elif l0_size > 3500:
+        print("  ⚠️  提醒:接近4KB限制,建议准备归档")
+    else:
+        print("  ✅ 大小正常")
+    
+    print("\n" + "=" * 50)
+    print("📋 每日维护清单:")
+    if not has_today_journal:
+        print("  [ ] 如有重要事件,写入今日L2")
+    else:
+        print("  [x] L2记录已存在")
+    print("  [ ] 检查MEMORY.md最近活动摘要")
+    if l0_size > 3500:
+        print("  [ ] L0接近限制,考虑归档到L1")
+    print("  [ ] 确认L0层引用链接有效")
+    
+    return 0 if has_today_journal else 1
+
+
+if __name__ == "__main__":
+    sys.exit(main())

--
Gitblit v1.9.1