Repository navigation
Description
Basic Memory MCP Server - Dot Folder Exclusion Feature Request
Problem Description
The basic-memory MCP server currently attempts to sync ALL files in a project directory, including hidden folders (folders starting with a dot). This causes several critical issues:
Current Issues:
-
File Name Length Errors: When syncing
.taskmaster/folders that contain CLI output in filenames, the sync fails with:[Errno 63] File name too long: b"[INFO] Initialized Perplexity client... -
Unnecessary Processing: The server attempts to process tool-specific configuration and cache directories that are not relevant to project memory/knowledge management:
.taskmaster/- TaskMaster task management files.git/- Git repository metadata.vscode/- VS Code configurationtarget/(Rust) - Build artifactsnode_modules/- Node dependencies.next/- Next.js build cache- And many other tool-specific directories
-
Performance Impact: Syncing thousands of build artifacts and dependency files unnecessarily slows down the sync process and inflates the database size.
-
MCP Server Conflicts: Different MCP servers may use dot folders for their own purposes, causing interference between tools.
Proposed Solution
Add an option to automatically exclude all dot folders (folders starting with .) from file syncing and watching. This should be the default behavior, with an option to override if needed.
Implementation Suggestions:
- Default Exclusion Pattern: Add
.*to the default exclude patterns - Configuration Option: Add a setting like
include_dot_folders: false(default) - Respect .gitignore: Consider also respecting
.gitignorepatterns by default
Example Configuration:
{
"exclude_patterns": [".*", "node_modules", "target", "dist", "build"],
"include_dot_folders": false,
"respect_gitignore": true
}Benefits
- Prevents Sync Errors: Eliminates file name length errors from tool outputs
- Improves Performance: Reduces unnecessary file processing
- Better Tool Interoperability: Prevents conflicts between different MCP servers
- Follows Best Practices: Aligns with common practice of ignoring dot folders in many tools
- Cleaner Database: Only tracks actual project source files, not tool artifacts
Current Workaround
Currently, users must manually delete and recreate projects when sync errors occur, which is disruptive to workflow.
Additional Context
Many development tools follow the convention of using dot folders for configuration and cache:
- Version control systems (
.git,.svn,.hg) - IDEs and editors (
.vscode,.idea,.sublime) - Language/framework tools (
.cargo,.npm,.yarn) - Project management tools (
.taskmaster,.github)
These folders typically contain:
- Machine-generated files
- Frequently changing cache files
- Large binary artifacts
- Tool-specific metadata
None of these are relevant to the semantic knowledge that basic-memory is designed to track.
Expected Behavior
When include_dot_folders is false (default):
- The file watcher should skip all directories starting with
. - The sync process should not attempt to process files in dot folders
- The database should only contain actual project source files
Priority
High - This issue causes basic-memory to fail with errors and significantly impacts usability when used alongside other MCP servers or development tools.
Activity
FellowTraveler commentedon Sep 3, 2025
#286
I think this issue is fixed with this PR. Was causing conflicts with .taskmaster
phernandez commentedon Sep 26, 2025
@claude we added an
src/basic_memory/ignore_utils.py. Can we integrate this into the sync so it skips .gitignored files?claude commentedon Sep 26, 2025
Claude finished @phernandez's task —— View job •
claude/issue-287-20250926-1439• Create PR ➔✅ Completed integration of ignore_utils.py into sync process
I've successfully integrated the existing
src/basic_memory/ignore_utils.pyinto the sync process to skip .gitignored files.Changes Made:
Updated
src/basic_memory/sync/sync_service.py:load_gitignore_patternsandshould_ignore_pathfromignore_utilsscan_directorymethod to load gitignore patterns and filter files/directoriesUpdated
src/basic_memory/sync/watch_service.py:_watch_projects_cycleto filter out changes for ignored filesHow It Works:
.gitignorepatterns plus default ignore patterns (e.g.,.git,node_modules,__pycache__, etc.)ignore_utils.pymodule which was already in the codebase with comprehensive testsResult:
This fixes issue #287 by preventing the sync of:
.git,.vscode,.taskmaster, etc.).gitignoreBranch: claude/issue-287-20250926-1439
feat: integrate ignore_utils to skip .gitignored files in sync process