MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / save_contract

Method save_contract

src/memory/context.py:829–847  ·  view source on GitHub ↗

Save the contract for a memory system

(self, memory_names: Optional[List[str]] = None)

Source from the content-addressed store, hash-verified

827 return str(file_path)
828
829 async def save_contract(self, memory_names: Optional[List[str]] = None):
830 """Save the contract for a memory system"""
831 contract = []
832 if memory_names is not None:
833 for index, memory_name in enumerate(memory_names):
834 memory_info = await self.get_info(memory_name)
835 if memory_info:
836 text = f"Name: {memory_info.name}\nDescription: {memory_info.description}\nRequire Grad: {memory_info.require_grad}"
837 contract.append(f"{index + 1:04d}\n{text}\n")
838 else:
839 for index, memory_name in enumerate(self._memory_configs.keys()):
840 memory_info = await self.get_info(memory_name)
841 if memory_info:
842 text = f"Name: {memory_info.name}\nDescription: {memory_info.description}\nRequire Grad: {memory_info.require_grad}"
843 contract.append(f"{index + 1:04d}\n{text}\n")
844 contract_text = "---\n".join(contract)
845 with open(self.contract_path, "w", encoding="utf-8") as f:
846 f.write(contract_text)
847 logger.info(f"| 📝 Saved {len(contract)} memory systems contract to {self.contract_path}")
848
849 async def load_contract(self) -> str:
850 """Load the contract for memory systems

Callers 5

initializeMethod · 0.95
registerMethod · 0.95
updateMethod · 0.95
copyMethod · 0.95
unregisterMethod · 0.95

Calls 6

get_infoMethod · 0.95
joinMethod · 0.80
appendMethod · 0.45
keysMethod · 0.45
writeMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected