Memory List Displays "null" Instead of Content
Bug Report: Memory List Displays "null" Instead of Content
Summary
When using npx agentic-flow reasoningbank list or npx claude-flow@alpha agent memory list, stored memory content displays as "null" instead of showing the actual stored value.
Environment
- Package:
agentic-flow(vianpx) - Related:
claude-flow@alpha - Database: SQLite (
.swarm/memory.db) - Node.js version: [user's version]
- OS: macOS (Darwin 24.6.0)
Expected Behavior
When listing memories, the output should display the actual content that was stored:
1. api_pattern
Confidence: 0.80 | Usage: 0 | Created: 2025-11-20 18:57:54
Domain: default
All endpoints return { success: boolean, data?: any, error?: string }
Actual Behavior
The content is displayed as "null":
1. api_pattern
Confidence: 0.80 | Usage: 0 | Created: 2025-11-20 18:57:54
Domain: default
null
Reproduction Steps
- Store a memory using the memory store command:
npx claude-flow@alpha memory store api_pattern "All endpoints return { success: boolean, data?: any, error?: string }"
Actual output:
$ npx claude-flow@alpha memory store "api_pattern" "All endpoints return { success: boolean, data?: any, error?: string }"
âšī¸ đ§ Using ReasoningBank mode...
[ReasoningBank] Initializing...
[ReasoningBank] Enabled: true (initializing...)
[ReasoningBank] Database: .swarm/memory.db
[ReasoningBank] Embeddings: local
[ReasoningBank] Retrieval k: 3
[INFO] Database migrations completed { path: '.swarm/memory.db' }
[ReasoningBank] Database migrated successfully
[INFO] Connected to ReasoningBank database { path: '.swarm/memory.db' }
[ReasoningBank] Database OK: 3 tables found
[ReasoningBank] Initialization complete
[ReasoningBank] Node.js backend initialized successfully
[INFO] Upserted reasoning memory { id: '1a80302c-854f-4955-b73f-7a18290f4d6a', title: 'api_pattern' }
[Embeddings] NPX environment detected - using hash-based embeddings
[Embeddings] For semantic search, install globally: npm install -g claude-flow
â
â
Stored successfully in ReasoningBank
đ Key: api_pattern
đ§ Memory ID: 1a80302c-854f-4955-b73f-7a18290f4d6a
đĻ Namespace: default
đž Size: 69 bytes
đ Semantic search: enabled
[INFO] Closed ReasoningBank database connection
[ReasoningBank] Database connection closed
2. List memories:
```bash
npx claude-flow@alpha agent memory list
- Observe that content displays as "null" instead of the stored value
$ npx claude-flow@alpha agent memory list
â
đ§ Listing ReasoningBank memories (limit: 10)
[INFO] Connected to ReasoningBank database { path:
'.swarm/memory.db' }
đ Memory Bank Contents
ââââââââââââââââââââââââââââââââââââââââââââââââââ
Showing top 10 memories (sorted by created_at)
1. api_pattern
Confidence: 0.80 | Usage: 0 | Created: 2025-11-20 18:57:54
Domain: default
null
Expected output confirms storage:
â
Stored successfully in ReasoningBank
đ Key: api_pattern
đ§ Memory ID: 1a80302c-854f-4955-b73f-7a18290f4d6a
đĻ Namespace: default
đž Size: 69 bytes
- Verify data is actually stored in database:
sqlite3 .swarm/memory.db "SELECT id, type, pattern_data FROM patterns WHERE type = 'reasoning_memory' ORDER BY created_at DESC LIMIT 1"
Output shows content IS stored:
{
"title":"api_pattern",
"content":"All endpoints return { success: boolean, data?: any, error?: string }",
"domain":"default",
"agent":"memory-agent",
"task_type":"fact",
"original_key":"api_pattern",
"original_value":"All endpoints return { success: boolean, data?: any, error?: string }",
"namespace":"default"
}
Root Cause
File: dist/utils/reasoningbankCommands.js
Function: listMemories()
Line 136 - Incorrect field name in SQL query:
const memories = dbInstance.prepare(`
SELECT
id,
json_extract(pattern_data, '$.title') as title,
json_extract(pattern_data, '$.description') as description, // â WRONG FIELD
json_extract(pattern_data, '$.domain') as domain,
confidence,
usage_count,
created_at
FROM patterns
WHERE type = 'reasoning_memory'
ORDER BY ${orderBy}
LIMIT ?
`).all(limit);
Line 155 - Displays the null value:
console.log(` ${mem.description}`);
The JSON structure stores the field as content, not description. The query extracts a non-existent field, resulting in null.
Suggested Fix
Change line 136 from:
json_extract(pattern_data, '$.description') as description,
To:
json_extract(pattern_data, '$.content') as description,
Alternatively, for consistency with the JSON structure:
json_extract(pattern_data, '$.content') as content,
And update line 155:
console.log(` ${mem.content}`);
Additional Notes
- The data is correctly stored in the database with the
contentfield - Only the display/rendering logic has the bug
- The same issue affects both:
npx agentic-flow reasoningbank listnpx claude-flow@alpha agent memory list(which delegates to agentic-flow)
Verification Query
To confirm the actual stored structure:
sqlite3 .swarm/memory.db "SELECT json_extract(pattern_data, '$.title'), json_extract(pattern_data, '$.content'), json_extract(pattern_data, '$.domain') FROM patterns WHERE type = 'reasoning_memory' ORDER BY created_at DESC LIMIT 3"
Pattern note: SQL schema â code mismatches
We've been hitting a similar class of bug while building on AgentDB v3.0.0-alpha.10. The root cause here (querying $.description when the data stores $.content) matches a broader pattern we're seeing:
- #127:
status.jsqueriesreflexion_episodesbut the actual table isepisodes - This issue:
listMemories()queries$.descriptionbut the data uses$.content - storeEpisode: SQL schema has
episodes+episode_embeddingstables, butstoreEpisode()never INSERTs into them (filed separately) - causalGraph:
addCausalEdge()expects integer FKfrom_memory_idbut the API accepts string cause/effect names
Seems like the SQL schema and the controller code may have diverged during the v1âv2âv3 refactoring. A pass through the controllers to reconcile the actual table schemas with the query/insert statements would probably fix several open issues at once.
Just flagging the pattern in case it helps prioritize â not urgent for us since we have workarounds, but other users hitting these may not realize they need to go to the SQL level.