ruvnet / ruvnet/ruflo

hive-mind memories are never recorded to memory.db

Open
#882 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
72.7k
Forks
8.6k
Avg merge
2d 23h
Merged PRs (30d)
83

Description

```
The latest commit on this repository is:

Commit: 25af48cd1c01cbcc4ac6d0dc4346e956db913845
Author: rUv ruv@ruv.net
Date: Thursday, November 13, 2025 at 11:32:02 AM (EST)
Message: Merge pull request #871 - 🚀 Release v2.7.34: MCP 2025-11 Compliance & Progressive Disclosure (Alpha)

This is a merge commit that brings in MCP 2025-11 specification compliance updates and progressive disclosure features in version 2.7.34.
```

> what triggers writting to hive-mind memory? I've been running hive-mind a lot and there are never any memories in it. They are all in swarm memory.

⏺ Let me investigate how hive-mind memory is initialized and when it should be used versus swarm memory.

⏺ Search(pattern: "new Memory\(|new CollectiveMemory\(|memory.*initialize|DatabaseManager")
⎿  Found 281 files (ctrl+o to expand)

⏺ Read(src/hive-mind/core/HiveMind.ts)
⎿  Read 542 lines

⏺ Read(src/cli/simple-commands/hive-mind.js)
⎿  Read 200 lines

⏺ Read(src/hive-mind/core/DatabaseManager.ts)
⎿  Read 150 lines

⏺ Search(pattern: "memory\.store|await.*store\(|this\.memory\.store", glob: "src/hive-mind/**/*.{ts,js}", output_mode: "content", head_limit: 30)
⎿  Found 7 lines (ctrl+o to expand)

⏺ Bash(ls -la .hive-mind/ 2>/dev/null || echo "No .hive-mind directory found")
⎿  .rw-r--r--@ 16k jimweller 17 Nov 06:46 memory.db

⏺ Bash(find . -name "*.db" -type f -not -path "./node_modules/*" -not -path "./dist-*/*" 2>/dev/null | head -20)
⎿  ./benchmark/.hive-mind/hive.db
./docker/docker-test/.swarm/memory.db
./docs/reasoningbank/models/domain-expert/memory.db
… +4 lines (ctrl+o to expand)

⏺ Bash(ls -la data/ 2>/dev/null || echo "No data directory")
⎿  No data directory

⏺ Bash(sqlite3 data/hive-mind.db "SELECT name FROM sqlite_master WHERE type='table';" 2>/dev/null || echo "Database doesn't exist or can't be read")
⎿  Database doesn't exist or can't be read

⏺ Perfect! I found the issue. Here's what's happening:

The Problem: Hive-Mind Memory Never Persists

Root Cause:
The hive-mind system expects to write to data/hive-mind.db, but the data/ directory doesn't exist in your project. This causes the DatabaseManager to fall back to in-memory storage (see
src/hive-mind/core/DatabaseManager.ts:75-94).

Evidence:
# Expected location (doesn't exist):
data/hive-mind.db ❌

# What exists instead:
.hive-mind/memory.db ✓ (16KB file, but not used by hive-mind core)
.swarm/memory.db ✓ (This is for swarm orchestrator, NOT hive-mind)

What's happening:
1. HiveMind TypeScript Core (src/hive-mind/core/DatabaseManager.ts:75):
this.dbPath = path.join(process.cwd(), 'data', 'hive-mind.db');
- Tries to create database at data/hive-mind.db
- Fails because data/ directory doesn't exist
- Falls back to in-memory storage (line 92-94)
- All memories are lost when process exits!
2. CLI Commands (src/cli/simple-commands/hive-mind.js:134):
const dbPath = path.join(hiveMindDir, 'hive.db'); // .hive-mind/hive.db
- Creates database at .hive-mind/hive.db
- But the core Memory class doesn't use this database!
3. Swarm Memory (src/swarm/memory.ts:1189):
persistencePath: './swarm-memory', // Defaults to ./swarm-memory or .swarm
- This is completely separate and works fine

The Fix:

Create the data/ directory so hive-mind can persist memories:

mkdir -p data

Then when you run hive-mind commands, the DatabaseManager will successfully create data/hive-mind.db and persist memories.

Verify it works:
# Create data directory
mkdir -p data

# Run a hive-mind command
npx claude-flow hive-mind init

# Check if database was created
ls -la data/hive-mind.db

# Verify tables exist
sqlite3 data/hive-mind.db "SELECT name FROM sqlite_master WHERE type='table';"

Why memories never appeared:
- The hive-mind system was using in-memory fallback storage
- All memories were stored in RAM and lost when the command finished
- The .hive-mind/memory.db file you see is either old/unused or created by a different process

Contributor guide

Open the contributing guide

Research direction

Start with src/hive-mind/core/DatabaseManager.ts and src/cli/simple-commands/hive-mind.js, then compare their database paths and fallback behavior. Run the documented hive-mind init flow and verify that memories persist in the intended database rather than only in memory or swarm storage.

Written by the indexing model from the issue text.

Assessment

Tech stack
sqlite, typescript
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.