Back to Ruflo

Fix for agentic-flow "Enabled: false" Log Message

v2/docs/AGENTIC_FLOW_ENABLED_LOG_FIX.md

3.6.305.2 KB
Original Source

Fix for agentic-flow "Enabled: false" Log Message

Problem

When using npx claude-flow@alpha memory store, the log shows:

[ReasoningBank] Enabled: false

Even though ReasoningBank is working correctly. This is misleading to users.

Root Cause

File: agentic-flow/src/reasoningbank/index.ts (or .js) Line: ~41

typescript
console.log(`[ReasoningBank] Enabled: ${!!process.env.REASONINGBANK_ENABLED}`);

This checks for an environment variable that is never set, so it always shows false.

Solution

Change line 41 from:

typescript
console.log(`[ReasoningBank] Enabled: ${!!process.env.REASONINGBANK_ENABLED}`);

To:

typescript
console.log('[ReasoningBank] Enabled: true (initializing...)');

Steps to Fix in agentic-flow Repository

1. Navigate to agentic-flow Repository

bash
cd /path/to/agentic-flow
git checkout updates-oct-25  # Or your working branch

2. Edit the Source File

File: src/reasoningbank/index.ts (or src/reasoningbank/index.js)

Find line 41 (approximately):

typescript
export async function initialize() {
    const config = loadConfig();
    console.log('[ReasoningBank] Initializing...');
    console.log(`[ReasoningBank] Enabled: ${!!process.env.REASONINGBANK_ENABLED}`);  // ← FIX THIS LINE
    console.log(`[ReasoningBank] Database: ${process.env.CLAUDE_FLOW_DB_PATH || '.swarm/memory.db'}`);
    // ... rest of function
}

Replace with:

typescript
export async function initialize() {
    const config = loadConfig();
    console.log('[ReasoningBank] Initializing...');
    console.log('[ReasoningBank] Enabled: true (initializing...)');  // ← FIXED!
    console.log(`[ReasoningBank] Database: ${process.env.CLAUDE_FLOW_DB_PATH || '.swarm/memory.db'}`);
    // ... rest of function
}

3. Build the Package

bash
# If using TypeScript
npm run build

# Or if building with swc
npm run build:esm

4. Verify the Dist File

Check that dist/reasoningbank/index.js line 41 now shows:

javascript
console.log('[ReasoningBank] Enabled: true (initializing...)');

5. Update Version

Edit package.json:

json
{
  "version": "1.8.5"
}

6. Commit and Publish

bash
git add .
git commit -m "fix: Show accurate 'Enabled: true' during ReasoningBank initialization

- Changed misleading env variable check to hardcoded true
- Users were confused by 'Enabled: false' when ReasoningBank was working
- Affects npx users who see this message during initialization"

git push origin updates-oct-25

# Publish to npm
npm publish

Expected Output After Fix

Before ([email protected]):

[ReasoningBank] Initializing...
[ReasoningBank] Enabled: false  ← MISLEADING!
[ReasoningBank] Database: .swarm/memory.db

After ([email protected]):

[ReasoningBank] Initializing...
[ReasoningBank] Enabled: true (initializing...)  ← ACCURATE!
[ReasoningBank] Database: .swarm/memory.db

Update claude-flow After Publishing

Once [email protected] is published, update claude-flow:

1. Update Dependency

bash
cd /workspaces/claude-code-flow
npm install [email protected] --legacy-peer-deps

2. Update package.json

Already set to use ^1.8.4, which will automatically pick up 1.8.5:

json
{
  "dependencies": {
    "agentic-flow": "^1.8.4"  // Will match 1.8.5
  }
}

3. Remove Unnecessary Patch Script

The postinstall patch is no longer needed. Edit package.json:

Before:

json
{
  "postinstall": "node scripts/install-arm64.js || true && bash scripts/fix-agentdb-imports.sh || true && bash scripts/fix-agentic-flow-sqlite.sh || true && bash scripts/fix-agentic-flow-enabled-log.sh || true"
}

After:

json
{
  "postinstall": "node scripts/install-arm64.js || true && bash scripts/fix-agentdb-imports.sh || true"
}

4. Publish [email protected]

bash
# Update version
npm version patch  # Changes to 2.7.23

# Build
npm run build:esm

# Commit
git add .
git commit -m "chore: v2.7.23 - Use [email protected] with fixed log message"

# Publish
npm publish --tag alpha

Testing

Test with npx (no local installation):

bash
npx claude-flow@alpha memory store "test" "value"

Expected output:

[ReasoningBank] Initializing...
[ReasoningBank] Enabled: true (initializing...)  ✅
[ReasoningBank] Database: .swarm/memory.db
[INFO] Database migrations completed
✅ Stored successfully in ReasoningBank

Why Patch Scripts Don't Work for npx

The issue: Postinstall hooks don't run when using npx because:

  1. npx installs to a temporary directory
  2. npx skips postinstall scripts for security reasons
  3. The package is downloaded fresh from npm registry

The solution: Fix must be in the source code of agentic-flow, not a runtime patch.

Timeline

  • v1.8.3: Had const BetterSqlite3 = null; bug
  • v1.8.4: Fixed better-sqlite3 import
  • v1.8.5: Fix misleading "Enabled: false" log message (this fix)

Summary: The "Enabled: false" message needs to be fixed in agentic-flow's source code and published as v1.8.5, just like the better-sqlite3 fix was published in v1.8.4.