baneeishaque/ljt-520_openclaw-backup / skills/0range-x/triple-layer-memory
triple-layer-memory
Verified| File | Kind | Size |
|---|---|---|
| README.md | markdown | 2.1 KB |
| SKILL.md | skill md | 7.3 KB |
| _meta.json | config | 299 B |
| docs/github-upload-guide.md | markdown | 3.1 KB |
| docs/mem0-channel-isolation.md | markdown | 2.2 KB |
| package.json | manifest | 598 B |
| scripts/auto_memory_write.py | script | 4.2 KB |
| scripts/channel_memory.py | script | 5.0 KB |
| scripts/init.sh | script | 4.0 KB |
| scripts/memory_consistency.py | script | 1.9 KB |
| scripts/memory_decay.py | script | 8.9 KB |
| scripts/memory_meta.py | script | 3.0 KB |
| scripts/session_compress.py | script | 3.0 KB |
| templates/MEMORY_ARCHITECTURE.md | markdown | 9.8 KB |
| upload-to-github.sh | script | 2.7 KB |
scripts/memory_consistency.py
View on GitHub"""
memory_consistency.py
跨层一致性校验(阶段3)
- 校验 MEMORY.md 中记录的 Discord 频道ID 是否与 ~/.openclaw/openclaw.json bindings 一致
- 生成报告: memory/consistency-report.json
"""
import json
import re
from pathlib import Path
from datetime import datetime
WORKSPACE = Path(__file__).resolve().parent.parent
MEMORY_MD = WORKSPACE / "MEMORY.md"
REPORT = WORKSPACE / "memory" / "consistency-report.json"
CONFIG = Path.home() / ".openclaw" / "openclaw.json"
def extract_channel_ids_from_memory() -> set[str]:
text = MEMORY_MD.read_text(encoding="utf-8") if MEMORY_MD.exists() else ""
# 抓 16~20 位纯数字(Discord snowflake)
ids = set(re.findall(r"\b\d{16,20}\b", text))
return ids
def extract_channel_ids_from_config() -> set[str]:
if not CONFIG.exists():
return set()
obj = json.loads(CONFIG.read_text(encoding="utf-8"))
out = set()
for b in obj.get("bindings", []):
pid = (((b.get("match") or {}).get("peer") or {}).get("id"))
if isinstance(pid, str) and pid.isdigit():
out.add(pid)
return out
def run() -> dict:
mem_ids = extract_channel_ids_from_memory()
cfg_ids = extract_channel_ids_from_config()
only_in_memory = sorted(mem_ids - cfg_ids)
only_in_config = sorted(cfg_ids - mem_ids)
overlap = sorted(mem_ids & cfg_ids)
report = {
"generatedAt": datetime.now().isoformat(),
"memoryCount": len(mem_ids),
"configCount": len(cfg_ids),
"overlapCount": len(overlap),
"onlyInMemory": only_in_memory,
"onlyInConfig": only_in_config,
"status": "ok" if not only_in_memory else "warn",
}
REPORT.parent.mkdir(parents=True, exist_ok=True)
REPORT.write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
return report
if __name__ == "__main__":
r = run()
print(json.dumps(r, ensure_ascii=False, indent=2))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |