Skip to content

Search results truncate note content at 4000 characters with no indicator #1455

Closed

Description

@phernandez

What happens

search_notes / bm grep return each hit's content cut at CONTENT_DISPLAY_LIMIT = 4000 (repository/search_index_row.py) with no marker, no truncated flag, and no total length. A note of 4425 bytes comes back as exactly 4000 characters ending mid-token.

Repro on the Moby Dick project (206 notes):

bm grep -F "features [[" --page-size 200 --project moby-dick --json

results[] for "Chapter 135 - The Chase - Third Day" has len(content) == 4000, ending - follows [[C. The file is 4425 bytes. Same for "Stubb".

Why it matters

An agent that parses relations or observations out of grep results (the skill's recommended one-call replacement for 136 reads) silently loses the tail of every long note: here the follows/precedes relations of the final chapter. Exit 0, plausible output, no signal. This is the same "silent truncation" class the literary-analysis skill already warns about for paging.

Expected

Either a content_truncated: true field (and ideally content_length) on the row, or a visible suffix marker, so the caller knows to cat the note. The cap itself is fine.

Found during the #1398 Moby Dick qualitative run.

🤖 Generated with Claude Code

https://claude.ai/code/session_014pmKq6bqCi6Zp6BTHuZjrp

Activity

  1. added
    bug
    on Sep 3, 2026
  2. claude commented on Sep 3, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 41s —— View job


    Triage

    Type: Bug — SearchIndexRow.content (src/basic_memory/repository/search_index_row.py:87-92) silently slices content_snippet at CONTENT_DISPLAY_LIMIT (4000 chars) with no marker or metadata indicating truncation occurred, and no content_length/content_truncated field is surfaced through search_notes / bm grep --json.

    Component: MCP search tools (search_notes) and the bm grep CLI, both backed by repository/search_index_row.py. Not cloud-specific.

    Priority: Medium — output is well-formed and exits 0, so callers (including agents parsing relations/observations out of grep results, per the skill's guidance) get a plausible-looking but silently incomplete result. Not data loss or a full breakage, but a correctness trap with no signal.

    Complexity: Simple — the cap logic and its single call site are already isolated in SearchIndexRow.content. Adding a content_truncated: bool (and optionally content_length: int) field to the row/serialization, or an explicit suffix marker, is a small, localized change plus test updates (tests/repository/test_search_index_row.py already covers this property).

    Duplicate check: No open duplicates found. Related but distinct closed issues: #609 (richer content context for content-hit scoring) and #599 (return matched chunk text instead of truncated header) — neither addresses signaling truncation itself.

    Labels applied: bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions