MCPcopy
hub / github.com/codeaashu/claude-code / getLocalAgentMemoryDir

Function getLocalAgentMemoryDir

src/tools/AgentTool/agentMemory.ts:29–44  ·  view source on GitHub ↗

* Returns the local agent memory directory, which is project-specific and not checked into VCS. * When CLAUDE_CODE_REMOTE_MEMORY_DIR is set, persists to the mount with project namespacing. * Otherwise, uses /.claude/agent-memory-local/ /.

(dirName: string)

Source from the content-addressed store, hash-verified

27 * Otherwise, uses <cwd>/.claude/agent-memory-local/<agentType>/.
28 */
29function getLocalAgentMemoryDir(dirName: string): string {
30 if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
31 return (
32 join(
33 process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR,
34 'projects',
35 sanitizePath(
36 findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot(),
37 ),
38 'agent-memory-local',
39 dirName,
40 ) + sep
41 )
42 }
43 return join(getCwd(), '.claude', 'agent-memory-local', dirName) + sep
44}
45
46/**
47 * Returns the agent memory directory for a given agent type and scope.

Callers 2

getAgentMemoryDirFunction · 0.85
getMemoryScopeDisplayFunction · 0.85

Calls 3

getProjectRootFunction · 0.85
getCwdFunction · 0.85
sanitizePathFunction · 0.50

Tested by

no test coverage detected