← All needs

Folder CLAUDE.md is never written when the project path has a doubled folder name (~/code/app/app)

## Before submitting - [x] I searched [existing issues](https://github.com/thedotmack/claude-mem/issues) and confirmed this is not a duplicate ### Bug Description With `CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED=true`, no folder `CLAUDE.md` is ever written for a project whose own path has two equal folder names in a row. Examples: `~/code/app/app`, `~/go/src/github.com/foo/foo`, or a repo cloned into a folder with the same name. Nothing is logged above debug, so the feature just looks dead for that project. ### Cause `isValidPathForClaudeMd` in `src/utils/claude-md-utils.ts` runs `hasConsecutiveDuplicateSegments` on the full absolute path: ```ts const resolved = path.isAbsolute(filePath) ? filePath : path.resolve(projectRoot, filePath); ... if (hasConsecutiveDuplicateSegments(resolved)) { return false; } ``` The check exists for #814, where the observer prefixed a path with the project folder name and produced `frontend/frontend/src`. But the absolute path also contains every folder above the project. When the project root itself ends in `app/app`, every file path in the project is rejected. This is the same shape as #4888, which fixed the unsafe directory check to look only below the project root. ### Steps to Reproduce 1. Set `CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED` to `true`. 2. Work in a project at a path like `/tmp/app/app` and edit `src/index.ts`. 3. No `src/CLAUDE.md` is written. The same project at `/tmp/other/app` gets one. Minimal repro against `updateFolderClaudeMdFiles(['src/utils/file.ts'], 'p', 37777, root)` with a mocked worker: - root ` /other/app`: 1 worker request, `CLAUDE.md` written - root ` /app/app`: 0 worker requests ### Expected Behavior The duplicate segment check covers the project folder name and what is below it, so `frontend/frontend/src` is still rejected and a project at `~/code/app/app` gets its folder `CLAUDE.md` files. ### Environment - **Claude-mem version**: main at 70aa40042 (15.7.0) - **OS**: macOS (the path logic is the same on every OS)