Summary
Expose Core's existing optimistic-concurrency capability through the MCP edit_note tool and document the contract.
This is separate from #1536, which is a Basic Memory Cloud bug: Cloud already exposes expected_checksum but currently ignores a stale supplied value on ordinary notes. Core's MCP tool does not currently accept a checksum argument at all.
Current state
- Core MCP
edit_note exposes edit-operation controls such as expected_replacements, but no revision checksum precondition.
- Core's
NoteContentMutationService.edit_note(..., base_checksum=...) already supports an optional accepted-content checksum and rejects stale values through the canonical accepted-note mutation transaction.
- The Core v2 PUT route exposes this as the
x-bm-cloud-note-base-checksum header.
- The ordinary Core MCP edit path does not carry the precondition into that service.
expected_replacements is not a substitute: it verifies the number of textual matches, not that the note revision is the one the caller read.
Proposed MCP contract
Add an optional expected_checksum argument to Core edit_note:
- omitted: preserve current blind-edit behavior against the latest accepted note;
- supplied and current: apply the edit;
- supplied and stale: return a recognizable conflict and do not mutate the note;
- the checksum refers to the accepted canonical Markdown revision (
db_checksum), not the materialized file checksum or a derived search projection.
The precondition must reach the existing transactional base_checksum enforcement. Do not implement it as only a read-before-write comparison, and do not add locks, retries, or a second concurrency mechanism.
Read contract
Ensure callers can obtain the correct checksum from the corresponding machine-readable Core read result. Use consistent naming or document the mapping clearly if the read response uses db_checksum while the edit input uses expected_checksum.
Documentation
Document:
- read → conditionally edit workflow;
- omitted versus supplied behavior;
- conflict response and required caller action;
- distinction from
expected_replacements;
- distinction between accepted-content, file, and projection checksums;
- clients should re-read and deliberately rebase after conflict, not blindly retry a potentially destructive edit.
Update the MCP tool reference and generated schema/man-page coverage as appropriate.
Acceptance criteria
Out of scope
Summary
Expose Core's existing optimistic-concurrency capability through the MCP
edit_notetool and document the contract.This is separate from #1536, which is a Basic Memory Cloud bug: Cloud already exposes
expected_checksumbut currently ignores a stale supplied value on ordinary notes. Core's MCP tool does not currently accept a checksum argument at all.Current state
edit_noteexposes edit-operation controls such asexpected_replacements, but no revision checksum precondition.NoteContentMutationService.edit_note(..., base_checksum=...)already supports an optional accepted-content checksum and rejects stale values through the canonical accepted-note mutation transaction.x-bm-cloud-note-base-checksumheader.expected_replacementsis not a substitute: it verifies the number of textual matches, not that the note revision is the one the caller read.Proposed MCP contract
Add an optional
expected_checksumargument to Coreedit_note:db_checksum), not the materialized file checksum or a derived search projection.The precondition must reach the existing transactional
base_checksumenforcement. Do not implement it as only a read-before-write comparison, and do not add locks, retries, or a second concurrency mechanism.Read contract
Ensure callers can obtain the correct checksum from the corresponding machine-readable Core read result. Use consistent naming or document the mapping clearly if the read response uses
db_checksumwhile the edit input usesexpected_checksum.Documentation
Document:
expected_replacements;Update the MCP tool reference and generated schema/man-page coverage as appropriate.
Acceptance criteria
edit_noteaccepts optionalexpected_checksum.Out of scope