Skip to content

[BUG] Smart-extractor skips [cases] category due to misleading BigInt prompt guidance #640

@jlin53882

Description

@jlin53882

Issue: LanceDB BigInt Error Causes Smart-Extractor to Skip [cases] Category

Problem Description

The smart-extractor is skipping all [cases] category memories with the error message:

memory-pro: smart-extractor: skipped [cases] LanceDB BigInt error -> Use Number() coercion before arithmetic

This triggers a fallback to regex capture, which finds 0 capturable texts.

Root Cause Analysis

The issue originates from extraction-prompts.ts, which includes guidance for the LLM about BigInt handling:

// extraction-prompts.ts:103-110
## cases
```json
{
  "category": "cases",
  "abstract": "LanceDB BigInt error -> Use Number() coercion before arithmetic",
  "overview": "## Problem\\nLanceDB 0.26+ returns BigInt for numeric columns\\n\\n## Solution\\nCoerce values with Number(...) before arithmetic",
  "content": "When LanceDB returns BigInt values, wrap them with Number() before doing arithmetic operations."
}

When the LLM processes existing memories in the [cases] category, it interprets this guidance as a reason to skip them, resulting in:

  • stats.created = 0
  • stats.merged = 0
  • stats.skipped > 0
  • Triggers "falling back to regex capture"

Evidence

Log excerpt:

00:36:47 [plugins] memory-pro: smart-extractor: skipped [cases] LanceDB BigInt error -> Use Number() coercion before arithme
00:37:50 [plugins] memory-lancedb-pro: smart extraction produced no persisted memories for agent dc-channel--1476866394556465252 (created=0, merged=0, skipped=4); falling back to regex capture
00:37:50 [plugins] memory-lancedb-pro: regex fallback found 0 capturable texts for agent dc-channel--1476866394556465252

Code Fix Status

The store.ts already has Number() coercion in multiple locations (lines 553-554, 607-608, 675-686, 749-750, 887-888, 1019-1020, 1230-1231):

// store.ts:685-686
importance: Number(row.importance),
timestamp: Number(row.timestamp),
// store.ts:675
const rawScore = row._score != null ? Number(row._score) : 0;

All accesses to row.importance, row.timestamp, and row._score are properly wrapped with Number().

Solution

The prompt in extraction-prompts.ts is misleading the LLM. The fix should either:

  1. Remove the misleading guidance from the cases category prompt, OR
  2. Clarify that this is guidance for CODE WRITING, not for evaluating existing memories

Recommended fix: Update the cases category prompt to clarify its purpose.

Test Case

Create a unit test to verify:

  1. LanceDB returns BigInt for numeric columns
  2. Memory operations work correctly with Number() coercion
  3. [cases] category memories are not incorrectly skipped

Related Issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions