Skip to main content

Module: scratch

A minimal notes panel — and the reference example for the windowing system. It exists so the workspace has a non-singleton panel to open multiple of, split, tab, and float, until richer modules (editor, terminal) land.

Contributions to the layout shell

  • Panels: scratch.note (a textarea, defaultPlacement: center, non-singleton — every open creates a new window). It declares collab: { room: 'shared', key: 'scratch:shared' }, marking it a network-aware pane (see below).
  • Commands: scratch.open (Scratch: New note).

Collaborative sharing (reference consumer)

Scratch is the reference example of a network-aware pane. It declares a collab room in its manifest and drives the useCollab host hook from the network module — toggling Share joins a well-known collab room so the note syncs live with other users on connected nodes (rev-checked last-writer-wins), and the header shows a live count of editors currently in the room. The pane does no channel plumbing of its own: useCollab owns the join/leave, revision tracking, rebase-on-reject, and presence. See Module: network and the CollabDecl contract in the plugin SDK.

Backend surface

None of its own. Local content is persisted client-side to localStorage under horrible.scratch; while shared, the collab room is the source of truth.

Browser vs desktop

Identical in both layouts.

Known limitation

All scratch.note instances currently share one localStorage key, so multiple windows show the same text. Per-instance content arrives with real buffer identity (the editor module) — see editor.md.