* True when an absolute, normalized path points into the Claude Code native * auto-memory directory: /.claude/projects/ /memory/ where * is a single path segment. The memory directory itself also matches. * Comparison is case-insensitive on win32. * CITADEL_HOME_OVERRIDE replac
(normalizedPath)
| 281 | * Comparison is case-insensitive on win32. |
| 282 | * CITADEL_HOME_OVERRIDE replaces the home directory only when CITADEL_TEST=1 |
| 283 | * so tests can exercise this path without touching the real home. |
| 284 | * |
| 285 | * @param {string} normalizedPath - Result of path.normalize(path.resolve(...)) |
| 286 | * @returns {boolean} |
| 287 | */ |
| 288 | function isNativeMemoryPath(normalizedPath) { |
| 289 | const home = (process.env.CITADEL_TEST === '1' && process.env.CITADEL_HOME_OVERRIDE) |
| 290 | ? process.env.CITADEL_HOME_OVERRIDE |
| 291 | : os.homedir(); |
| 292 | const projectsRoot = path.normalize(health.canonicalizePath( |
| 293 | path.resolve(home, '.claude', 'projects') |
| 294 | )); |
| 295 | const fold = (p) => (process.platform === 'win32' ? p.toLowerCase() : p); |
| 296 | const target = fold(normalizedPath); |
| 297 | const root = fold(projectsRoot); |