You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bm_read omits checksum on full reads of binary files #2150
A full bm_read of a non-Markdown binary file (a PDF or an image) returns the file content without a checksum field. Markdown notes and text files include it. A customer's backup job checks each file against Basic Memory's stored checksum. Because of this, it reads the PDF's checksum as empty (length 0), and the check fails on every run, even though the file is intact.
The checksum does exist. bm_read(..., include_content=false) returns it for any file type, and the entity row has it.
Where
src/basic_memory/mcp/tools/read.py, in the # --- Files that are not Markdown notes --- branch:
_present_file(...) returns image content or document.to_resource_content(...) for binaries, with no metadata attached.
The text-file path returns a dict through target.paths.note(...), and the metadata-only path includes "checksum": entity.db_checksum.
The JSON output of bm tool read --json for a binary therefore has no checksum to report.
Second issue: what the checksum means
In Cloud, db_checksum is the storage ETag: 32 hex characters, which for single-part uploads is the MD5 of the bytes. Locally it is SHA-256 (64 hex characters). Projects can even mix both (one production workspace has 32- and 64-character values side by side). Callers have no way to tell which algorithm a value uses, so comparing it with a local SHA-256 fails even when the file is intact.
Proposed
Include checksum (and content_type, file_path) in the JSON result of a full binary read, matching text files and notes.
Document what the checksum is, or return it with its algorithm (for example checksum_algorithm: "md5-etag" | "sha256"), so backup and verification tools can compare correctly.
Done when
bm tool read --cloud --json on a PDF returns a non-empty checksum.
The docs (or the response itself) say which hash the checksum is.
There is a test for a full binary read in JSON output that asserts the checksum is present.
Component: MCP tools (read.py, non-Markdown branch) and CLI JSON output. The checksum semantics concern Cloud, since the storage ETag is MD5 there and SHA-256 locally.
Priority: Medium-High. A customer's backup verification fails on every run, but the data is intact and there is a workaround: include_content=false returns the checksum.
Complexity: Simple to Medium.
Part 1: add checksum, content_type and file_path to the binary read result. This is a small change plus a test.
Part 2: either document the algorithm or return a checksum_algorithm field. This needs a design decision, because Cloud can mix 32-character MD5 ETags and 64-character SHA-256 values in the same project. Inferring the algorithm from the checksum length is fragile, so it would be better to record the algorithm at write time.
Duplicates: I searched for existing issues on checksums in binary reads and found none.
Notes: The issue is clear and includes a location, a proposal and acceptance criteria. I did not investigate further or implement anything, because this was triage only.
Activity
claude commentedon Nov 25, 2026
Claude finished @phernandez's task in 13s —— View job
Triage
bug,cloud)read.py, non-Markdown branch) and CLI JSON output. The checksum semantics concern Cloud, since the storage ETag is MD5 there and SHA-256 locally.include_content=falsereturns the checksum.checksum,content_typeandfile_pathto the binary read result. This is a small change plus a test.checksum_algorithmfield. This needs a design decision, because Cloud can mix 32-character MD5 ETags and 64-character SHA-256 values in the same project. Inferring the algorithm from the checksum length is fragile, so it would be better to record the algorithm at write time.Duplicates: I searched for existing issues on checksums in binary reads and found none.
Notes: The issue is clear and includes a location, a proposal and acceptance criteria. I did not investigate further or implement anything, because this was triage only.