(path: Path)
| 230 | dict so callers can also re-render MEMORY.md / USER.md. |
| 231 | """ |
| 232 | def _load(path: Path) -> dict[str, list[dict[str, Any]]]: |
| 233 | if not path.exists(): |
| 234 | return {"user": [], "global": []} |
| 235 | try: |
| 236 | data = load_json(path) |
| 237 | except Exception: # noqa: BLE001 — corrupt files contribute nothing |
| 238 | return {"user": [], "global": []} |
| 239 | return { |
| 240 | "user": data.get("user", []) or [] if isinstance(data, dict) else [], |
| 241 | "global": data.get("global", []) or [] if isinstance(data, dict) else [], |
| 242 | } |
| 243 | |
| 244 | source_memory = source_path / "memory" / "memory.json" |
| 245 | target_memory = target_path / "memory" / "memory.json" |
no test coverage detected