-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Closed as not planned
Copy link
Description
Bug Description
During normal Claude Code sessions, the claude-mem plugin creates 50-120+ empty CLAUDE.md files throughout the project structure. This happens in virtually every directory that is accessed via Read, Glob, or Grep tools.
Environment
- Claude-mem Version: Latest (installed via plugin)
- Claude Code Version: Latest
- Bun Version: 1.3.6
- Operating System: macOS Darwin 25.2.0 (arm64)
- Platform: darwin
Steps to Reproduce
- Start a Claude Code session with claude-mem plugin enabled
- Work normally - read files, search code, make edits
- After 30-60 minutes of work, run:
find . -name "CLAUDE.md" -type f | wc -l - Observe 50-120+ files created
Evidence from Real Session (2026-01-22)
# Files found after single session:
$ find . -name "CLAUDE.md" -type f ! -path "*/node_modules/*" | wc -l
56
# Locations affected:
oracle/server/api/**/*.md (15+ files)
oracle/server/db/CLAUDE.md
.claude/*/CLAUDE.md (10+ files)
docs/project/*/CLAUDE.md (6+ files)
cellm-core/*/CLAUDE.md (12+ files)
tests/*/CLAUDE.md (4+ files)
.github/workflows/CLAUDE.md
.git/CLAUDE.md # <- Critical: inside git internals!File Content (All Identical)
Every generated file contains only:
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
*No recent activity*
</claude-mem-context>Impact
| Issue | Severity |
|---|---|
| Git status polluted with untracked files | Medium |
| Risk of accidentally committing temp files | Medium |
Files created in .git/ directory break git operations |
High |
| Confusion between legitimate vs auto-generated files | Medium |
| Disk space (minor: ~24KB/session) | Low |
Current Workarounds
We've implemented these mitigations in our workflow:
1. .gitignore rules
**/CLAUDE.md
!/CLAUDE.md
!/cellm-core/templates/CLAUDE.md2. Pre-commit cleanup script
for f in $(find . -name "CLAUDE.md" -type f \
! -path "./CLAUDE.md" \
! -path "./cellm-core/templates/CLAUDE.md" \
! -path "*/node_modules/*" 2>/dev/null); do
if grep -q "claude-mem-context" "$f" 2>/dev/null; then
rm -f "$f"
fi
doneExpected Behavior
CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED=falseshould actually disable this feature.git/directory should NEVER have files created inside it- Option to specify allowlist/blocklist of directories
- Auto-cleanup of empty/inactive files at session end
Related Issues
- Claude-mem creates empty CLAUDE.md files in all folders #758 - Claude-mem creates empty CLAUDE.md files in all folders
- Bug: CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED setting is not checked - folder CLAUDE.md files always generated #760 - CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED setting is not checked
- Bug: CLAUDE.md files created inside .git directory causing git pull failures #734 - CLAUDE.md files created inside .git directory
- Feature request: Add setting to disable folder CLAUDE.md auto-generation #767 - Feature request: Add setting to disable folder CLAUDE.md auto-generation
- Bug: Observation system creates CLAUDE.md files in project subdirectories and duplicate nested directories #641 - Observation system creates CLAUDE.md files in project subdirectories
Suggested Fix
Per issue #760, the fix should be straightforward:
// At start of updateFolderClaudeMdFiles() or call site
const settings = SettingsDefaultsManager.loadFromFile(SETTINGS_PATH);
const enabled = settings.CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED === 'true';
if (!enabled) return;Additionally, add directory exclusion logic:
const EXCLUDED_DIRS = ['.git', 'node_modules', '.nuxt', '.output', 'dist', 'build'];
if (EXCLUDED_DIRS.some(dir => filePath.includes(`/${dir}/`))) return;Documentation
We've created detailed analysis of this issue:
- Root cause analysis
- Impact assessment
- Workarounds implemented
- Verification commands
Happy to share if helpful for debugging.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels