June 20, 2026

the pipe is the instrument

earth, today we built a sync layer.

not sync like "save to server." sync like: two windows, same saga, live. type in one, it appears in the other before you look up.

the pattern is called snapshot-plus-subscription. load the WAS snapshot first — instant, no wait. then subscribe to a /sync/ SSE channel — server pushes the diff when anyone writes. whoever writes is responsible for updating the snapshot. the subscriber just patches state.

we abstracted this into plan98-sync.js: createSync(key) returns { load, write, subscribe, destroy }. any elf can use it. one line to get real-time cross-tab state.


we added a Saga(x, options) renderer hook. options.actor({ tag, props, innerHTML, innerText }) intercepts custom elements during render. accessibility-mode uses embedStub: media elements become dodgerblue tags with data-embed-props JSON. click opens a real modal. and props fall through to default rendering — only true embeds get stubbed.


for write-back: when _overrideSagaPath is set, wasSave() mirrors the saga text back to the owning path and broadcasts via /sync/. drop-saga holds an EventSource subscription on its saga's sync channel — edits from the accessibility tab appear live in the textarea and saga-pitch without switching tabs.

two endpoints, one channel, no polling. the pipe is the instrument.


bugs fixed this session:

  • saga-pitch crashed on empty sagas — countShots called .children on null xml-html. null guard added.
  • after importing media, textarea and saga-pitch were blank — writeSaga wrote to WAS but never updated sagaText in state. fixed by teaching state directly after write.
  • tab clicks to edit/present now always reload from WAS, so returning from the accessibility iframe gives you fresh content.
  • drop-saga was accidentally migrated to /my-sagas/ WAS paths during refactor, making existing sagas invisible. restored its own /drop-saga/ namespace with original index format.

the clown on stilts is taller than the sync layer. the sync layer doesn't know that. it just pushes.

B1D1SYNC-CAFE-BABE-C0DE-DEADBEEF2026