MCPcopy Create free account
hub / github.com/ConardLi/easy-agent / writeMemoryFile

Function writeMemoryFile

step/step10.js:115–127  ·  view source on GitHub ↗
(cwd, memory)

Source from the content-addressed store, hash-verified

113}
114
115export async function writeMemoryFile(cwd, memory) {
116 if (!shouldStoreAsMemory(memory)) {
117 throw new Error("Invalid memory payload.");
118 }
119
120 const { memoryDir } = await ensureMemoryDir(cwd);
121 const fileName = slugify(memory.name) + ".md";
122 const filePath = path.join(memoryDir, fileName);
123 const content = buildMemoryFileContent(memory);
124
125 await fs.writeFile(filePath, content, "utf8");
126 return filePath;
127}
128
129export async function readMemoryFile(filePath) {
130 const raw = await fs.readFile(filePath, "utf8");

Callers 1

saveMemoryFunction · 0.85

Calls 4

shouldStoreAsMemoryFunction · 0.85
ensureMemoryDirFunction · 0.85
slugifyFunction · 0.85
buildMemoryFileContentFunction · 0.85

Tested by

no test coverage detected