You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED is set to true, claude-mem creates CLAUDE.md files in every directory it touches — even when there are zero observations for that directory. These files contain 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>
This is different from issues requesting the ability to disable the feature entirely (#609, #767, #941). The feature itself is valuable — directory-scoped observation history helps Claude understand landmines in specific areas of the codebase. The problem is that it creates files with no useful content.
In my project, 84 CLAUDE.md files were generated, and the majority were empty. Each one gets loaded into Claude Code's context window when working in that directory, burning tokens for zero informational value. This is especially costly for subagent (explore agent) spawns, where context space is already tight.
Suggested Fix
In src/utils/claude-md-utils.ts, add a guard before writeClaudeMdToFolder(): if the observation query returns zero rows for a directory, skip file creation entirely. If an existing file has only the empty template (no observation rows), delete it.
Pseudocode:
constobservations=getObservationsForFolder(folderPath,project);if(observations.length===0){// If an empty file already exists, clean it upif(existsSync(claudeMdPath)&&hasOnlyEmptyTemplate(claudeMdPath)){unlinkSync(claudeMdPath);}return;// Don't create a new empty file}// Proceed with normal file generationwriteClaudeMdToFolder(folderPath,observations, ...);
This preserves the feature for directories with real activity while eliminating the empty file spam.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
When
CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLEDis set totrue, claude-mem creates CLAUDE.md files in every directory it touches — even when there are zero observations for that directory. These files contain only:This is different from issues requesting the ability to disable the feature entirely (#609, #767, #941). The feature itself is valuable — directory-scoped observation history helps Claude understand landmines in specific areas of the codebase. The problem is that it creates files with no useful content.
In my project, 84 CLAUDE.md files were generated, and the majority were empty. Each one gets loaded into Claude Code's context window when working in that directory, burning tokens for zero informational value. This is especially costly for subagent (explore agent) spawns, where context space is already tight.
Suggested Fix
In
src/utils/claude-md-utils.ts, add a guard beforewriteClaudeMdToFolder(): if the observation query returns zero rows for a directory, skip file creation entirely. If an existing file has only the empty template (no observation rows), delete it.Pseudocode:
This preserves the feature for directories with real activity while eliminating the empty file spam.
Related Issues
writeClaudeMdToFolder()Environment
Beta Was this translation helpful? Give feedback.
All reactions