Skip to content

AgentDB status command shows 0 records — wrong table names in status.js #127

@PogeystickJoe

Description

@PogeystickJoe

Bug Summary

npx agentdb status reports Total Records: 0 and Episodes: N/A even when the database contains 1,530+ episodes with embeddings. The status command queries non-existent table names.

Root Cause

In dist/src/cli/commands/status.js (line 52-58), the status command looks for these tables:

const tables = [
    { name: 'reflexion_episodes', label: 'Episodes' },
    { name: 'skill_library', label: 'Skills' },
    { name: 'causal_nodes', label: 'Causal Nodes' },
    { name: 'causal_edges', label: 'Causal Edges' },
    { name: 'reasoning_patterns', label: 'Patterns' }
];

But the actual tables created by AgentDB v2 with the ruvector backend are:

Expected (status.js) Actual (in DB)
reflexion_episodes episodes
skill_library skills
causal_nodes Does not exist
reasoning_patterns Does not exist

The catch block silently swallows the "table not found" error and adds 0, so the total is always 0.

Reproduction

# Store some episodes
npx agentdb reflexion store "test-session" "test task" 0.8 true "critique" "input" "output"

# Status shows 0
npx agentdb status --verbose
# Episodes: N/A
# Total Records: 0

# But retrieve finds them
npx agentdb reflexion retrieve "test" --k 1
# Shows the episode

Actual Table Schema

Querying sqlite_master on a working AgentDB v2 database:

episodes: 1,530 rows
episode_embeddings: 1,530 rows
skills: 0 rows
skill_links: 0 rows
skill_embeddings: 0 rows
facts: 0 rows
notes: 0 rows
note_embeddings: 0 rows
events: 0 rows
consolidated_memories: 0 rows
causal_edges: 0 rows
causal_experiments: 0 rows
causal_observations: 0 rows
agentdb_config: 4 rows

Suggested Fix

Update the table names array to match the actual schema. Include both current and legacy names for backwards compatibility:

const tables = [
    { name: 'episodes', label: 'Episodes' },
    { name: 'reflexion_episodes', label: 'Episodes (legacy)' },
    { name: 'skills', label: 'Skills' },
    { name: 'skill_library', label: 'Skills (legacy)' },
    { name: 'causal_edges', label: 'Causal Edges' },
    { name: 'episode_embeddings', label: 'Embeddings' },
    { name: 'notes', label: 'Notes' },
    { name: 'facts', label: 'Facts' },
    { name: 'events', label: 'Events' },
    { name: 'consolidated_memories', label: 'Memories' }
];

Alternatively, dynamically query sqlite_master to enumerate all tables and count rows.

Environment

  • AgentDB: 3.0.0-alpha.10
  • Backend: ruvector
  • Platform: win32-x64 (WASM mode)
  • Database: agentdb.db (3.64 MB, 1,530 episodes verified)

Impact

This bug makes it impossible to verify whether data is actually being stored in AgentDB without using reflexion retrieve. Users (and AI agents) rely on status to confirm the system is working, and it falsely reports an empty database. This caused real-world confusion in a production SEO intelligence pipeline where the system appeared non-functional despite containing real data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions