* 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)
| 27 | * Otherwise, uses <cwd>/.claude/agent-memory-local/<agentType>/. |
| 28 | */ |
| 29 | function 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. |
no test coverage detected