MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / initMemory

Function initMemory

tools/claw-launcher-ui/memory.mjs:34–44  ·  view source on GitHub ↗
(workspaceDir)

Source from the content-addressed store, hash-verified

32 * Ensure memory directory structure exists.
33 */
34export async function initMemory(workspaceDir) {
35 if (!workspaceDir) return
36 const memDir = memoryDir(workspaceDir)
37 await mkdir(join(memDir, TOPICS_DIR), { recursive: true })
38 await mkdir(join(memDir, LOGS_DIR), { recursive: true })
39
40 const indexPath = join(memDir, MEMORY_INDEX)
41 if (!existsSync(indexPath)) {
42 await writeFile(indexPath, '# Memory Index\n\n(暂无记忆)\n', 'utf8')
43 }
44}
45
46/**
47 * Load the MEMORY.md index, capped at MAX_INDEX_LINES / MAX_INDEX_BYTES.

Callers 1

mainFunction · 0.90

Calls 2

memoryDirFunction · 0.85
writeFileFunction · 0.85

Tested by

no test coverage detected