MCPcopy
hub / github.com/aiming-lab/MetaClaw / load

Method load

metaclaw/memory/policy_store.py:43–50  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 self.history_path = self.path.with_suffix(self.path.suffix + ".history.jsonl")
42
43 def load(self) -> MemoryPolicyState:
44 if not self.path.exists():
45 return MemoryPolicyState()
46 try:
47 data = json.loads(self.path.read_text(encoding="utf-8"))
48 except Exception:
49 return MemoryPolicyState()
50 return _state_from_dict(data)
51
52 def save(self, state: MemoryPolicyState, reason: str = "update") -> None:
53 self.path.parent.mkdir(parents=True, exist_ok=True)

Callers 7

_promote_candidateMethod · 0.95
from_configMethod · 0.95
get_policy_stateMethod · 0.45
_refresh_policyMethod · 0.45

Calls 3

MemoryPolicyStateClass · 0.70
_state_from_dictFunction · 0.70
existsMethod · 0.45

Tested by 1