-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Problem
Agents are creating duplicate .claude-flow
and .swarm
folders in subdirectories instead of using the main workspace root folders. This causes:
- Fragmented memory storage across multiple locations
- Agents not sharing state properly
- Increased disk usage with redundant folders
- Confusion about which folder contains the actual data
Root Cause
The code was using process.cwd()
to determine folder paths, which returns the current working directory. When agents operate in subdirectories, they create local folders instead of using the project root folders.
Locations Affected
Multiple duplicate folders were found:
./docker/docker-test/.swarm
./examples/litellm/.claude-flow
./benchmark/.claude-flow
./docs/.claude-flow
./claude-flow-wiki/.claude-flow
- And several others...
Solution Implemented
Created a project root detection utility that:
- Searches upward from any directory to find the main project root
- Prioritizes the main claude-flow package root over subdirectory markers
- Always returns paths relative to the true project root
- Ensures all agents use the same
.claude-flow
and.swarm
folders
Files Modified
- Created:
src/utils/project-root.js
- New utility for project root detection - Updated:
src/memory/sqlite-store.js
- Use project root instead of process.cwd() - Updated:
src/memory/migration.js
- Use project root for paths - Updated:
src/memory/shared-memory.js
- Use project root for database paths - Updated:
src/memory/unified-memory-manager.js
- Use project root for config paths
Testing
Verified that from any subdirectory, the utility correctly identifies the project root and returns the main workspace folders.
Impact
- All agents will now use the same centralized folders
- Memory and state will be properly shared
- No more duplicate folder creation in subdirectories
- Consistent behavior regardless of where agents operate
Fixes #763