basic-memory icon indicating copy to clipboard operation
basic-memory copied to clipboard

[FEATURE] `edit_note` on a reviewed note needs a checksum that changes on every web-app comment, and the only way to fetch it is `read_note`, which returns the whole document

Open calebpickerconsulting opened this issue 2 months ago • 2 comments

Title: edit_note on a reviewed note needs a checksum that changes on every web-app comment, and the only way to fetch it is read_note, which returns the whole document

Concept. Two collaborators on one note: a human commenting in the web app, an agent appending and editing through MCP. Every comment the human adds bumps revision_checksum. Every MCP edit on a reviewed note requires expected_checksum to equal the current revision. So each comment silently voids the agent's next write, and the agent's only recovery path is a full read_note(review_mode="structured") — 120–240K characters returned just to obtain a 64-character token. The result is a document that cannot be worked on by two parties at the same time without one of them stopping.

Caleb's thought: This may also cost a lot of tokens for each and every check. Goal is to smooth, frictionless way to collaborate in realtime.

What happened.

  1. Agent appended chunk N with the checksum from its last successful write.
  2. Human added a comment in the web app between the agent's read and its write.
  3. edit_note → "This note contains review threads. Call read_note(review_mode='structured') and retry edit_note with its current revision_checksum."
  4. Agent called read_note → 117K-character payload → extracted the checksum with jq → retried. Repeated four times in forty minutes as comments kept arriving. Each failed retry re-sent a 38K-character append payload. Why it matters. The checksum is doing two jobs: protecting prose from conflicting prose edits (good) and protecting the review layer (comments/suggestions) from being clobbered. A comment is not a prose change; it should not fence an append to the end of the document.

Proposal from Fable 5.1 (any one of these would fix the workflow; the first two together would be ideal).

  • Split the checksum: a content_checksum over prose only and a review_checksum over the review layer. edit_note checks content_checksum; review_note checks review_checksum. Comments stop invalidating prose edits.
  • Add a lightweight get_revision(identifier) (or a head/stat tool) returning {revision_checksum, content_checksum, review_summary, total_lines, size} without the body. Even without the split, this turns a 240K-character read into a 300-byte one.
  • Scope the intersection check to the span being edited: an append cannot intersect any anchor, so it should never be refused on review-layer grounds; find_replace should be refused only when the matched span overlaps an open anchor.
  • Optional: accept a section/line-range checksum (checksum of the target section) so concurrent edits in different sections do not conflict at all.

Drafted by Fable 5.1

calebpickerconsulting avatar Sep 22 '26 01:09 calebpickerconsulting

@calebpickerconsulting I’m researching human review during agent writing while building GFT Map. Since this report, have you found a way to keep commenting while the agent writes, or do you still have to take turns / reread the whole note? Your current workaround would help me understand the remaining collaboration work.

CoralLips avatar Oct 05 '26 03:10 CoralLips

Fixed in basicmachines-co/basic-memory-cloud#2415 (merged), building on core #1712. Hosted edit_note now works like write_note: expected_checksum is optional, a stale checksum returns the structured NOTE_REVISION_CONFLICT with currentChecksum, and read_note(include_content=False) returns the checksum without the document body. Edits that touch review markup are still refused.

phernandez avatar Oct 10 '26 18:10 phernandez