Ingest disk edits to a file open in the editor #50

Closed
opened 2026-09-21 18:04:31 +01:00 by cruelacid · 1 comment
Owner

Part of #37. The cheapest strategic win in the programme.

What Relay does

Their headline 0.8.12 feature: edits made to vault files on disk by external
tools — explicitly naming AI agents like Claude Code, scripts and text
editors — are picked up and merged. They ship a companion relay-skills repo for
Claude Code and Codex.

Worth knowing this path is also where their current bugs live: #135 (a disk
edit deleting text at two or more places in one file is merged at the wrong
offsets, corrupting the file and propagating the corruption) and #137 (a
freshly shared folder left a file 0 bytes on both devices while showing "Synced").
Both open, both reproduced by their maintainer, both opened this month.

What we do today

We already do this, and have for some time. content-sync.ts:749 onLocalModify reads the file, compares against the Y.Text, and applies a
minimal prefix/suffix diff (applyMinimalDiff) rather than a destructive
delete-all-insert-all — precisely so concurrent changes from other clients
survive. It also guards the empty-placeholder case that once blanked a note in
both vaults.

External edits to closed files already ingest correctly.

The gap: one line

content-sync.ts:762:

if (state.editorActive) return;

A disk write to a note the user currently has open is silently dropped — which is
exactly the Claude-Code-edits-an-open-note case.

What changes

Ingest while the editor is bound, routing the diff through the same yCollab
binding rather than around it. Plus a finer diff than prefix/suffix, since #135
is the failure mode of a coarse one.

Then a skills repo, and the marketing story we do not currently tell.

Risk

risk:none.

Verification

The case their #135 describes: a disk edit deleting text at two separate places
in one file, applied while the file is open, with a second vault connected.
Neither vault may end up with a wrong file. Invert and confirm the test fails.

Part of #37. **The cheapest strategic win in the programme.** ## What Relay does Their headline 0.8.12 feature: edits made to vault files on disk by external tools — explicitly naming **AI agents like Claude Code**, scripts and text editors — are picked up and merged. They ship a companion `relay-skills` repo for Claude Code and Codex. Worth knowing this path is also where their current bugs live: **#135** (a disk edit deleting text at two or more places in one file is merged at the wrong offsets, corrupting the file and propagating the corruption) and **#137** (a freshly shared folder left a file 0 bytes on both devices while showing "Synced"). Both open, both reproduced by their maintainer, both opened this month. ## What we do today **We already do this, and have for some time.** `content-sync.ts:749 onLocalModify` reads the file, compares against the `Y.Text`, and applies a **minimal prefix/suffix diff** (`applyMinimalDiff`) rather than a destructive delete-all-insert-all — precisely so concurrent changes from other clients survive. It also guards the empty-placeholder case that once blanked a note in both vaults. External edits to **closed** files already ingest correctly. ## The gap: one line `content-sync.ts:762`: ```js if (state.editorActive) return; ``` A disk write to a note the user currently has open is silently dropped — which is exactly the Claude-Code-edits-an-open-note case. ## What changes Ingest while the editor is bound, routing the diff through the same yCollab binding rather than around it. Plus a finer diff than prefix/suffix, since #135 is the failure mode of a coarse one. Then a skills repo, and the marketing story we do not currently tell. ## Risk `risk:none`. ## Verification The case their #135 describes: a disk edit deleting text at two separate places in one file, applied while the file is open, with a second vault connected. Neither vault may end up with a wrong file. Invert and confirm the test fails.
Author
Owner

Moved to the Vikunja board as NEC-27: https://projectron.nerchure.com/tasks/27

Moved to the Vikunja board as **NEC-27**: https://projectron.nerchure.com/tasks/27
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Nectenda/nectenda#50
No description provided.