TevinClaw
18 hours ago 949bac4c4c9fda71ab129b7fc1067cde28de1463
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""
检查MEMORY.md文件大小
"""
 
import sys
from pathlib import Path
 
 
def main():
    workspace = Path.home() / ".openclaw" / "workspace"
    memory_file = workspace / "MEMORY.md"
    
    if not memory_file.exists():
        print("❌ MEMORY.md 不存在")
        return 1
    
    size = memory_file.stat().st_size
    kb = size / 1024
    
    print(f"📊 MEMORY.md (L0层) 大小检查")
    print(f"   当前: {kb:.1f}KB / 4KB")
    
    if size > 4096:
        print("   🚨 状态: 超过红线!需要立即归档")
        return 2
    elif size > 3500:
        print("   ⚠️  状态: 接近限制,建议准备归档")
        return 1
    else:
        print("   ✅ 状态: 正常")
        return 0
 
 
if __name__ == "__main__":
    sys.exit(main())