Skip to main content
koharu-scene owns what a project means and how it is stored. For the layer tree, text blocks, undo, and the project file as a user sees them, see pages, layers, and history. This page covers what code that reads or changes a project relies on.

Apply an edit

Every writer edits a project the same way: the editor, a pipeline run, the agent, and an MCP client. An edit carries an undo label and its changes and applies whole or not at all; an edit that changes nothing adds no step. Each edit, undo, and redo names the pages and layers it touched and the ones it made, so a view redraws only those. A layer patch is a JSON Merge Patch (RFC 7396) read back into the layer’s types, so a misspelled property or a value of the wrong shape fails and leaves the layer as it was. A patch can’t name a layer’s id, children, kind, or attributes. A text’s wording changes only through the text edits, a block’s translation included; a block’s source takes its wording from a patch, as OCR writes it.
The last writer of any value wins, model or user. A rerun replaces your changes, and undo is the way back. The workflow decides which fields a run writes; the scene enforces none of it.

Attributes

Each layer has attributes: a namespace, then keys and values, for data only a tool reads, such as a detector’s confidence or a C2PA record of what a model did. The renderer never reads them, so two projects that differ only in attributes draw the same. A namespace’s owner reads its values into its own types; a namespace no reader knows is kept as it is.

Open and version

Opening fails closed: a value of the wrong shape, a misspelled property, an unknown kind, missing pixels, or a file that isn’t a project fails to open and is left as it was. The tree’s rules, which kind holds which, are kept by the edits and not checked again. The project’s version is a SemVer version that changes only with the core schema:
  • A new layer kind or core property raises the minor version. A reader opens any version up to its own with the same major version, since an addition needs no decoder.
  • Writing to an older file raises its version, so an older build refuses what it can’t read as too new.
  • Removing or redefining core data raises the major version, and once a release has written a version, the change ships an upgrade from it.
  • The patch number stays 0: stored data has no bug fixes.
A newer version, a pre-release, or unknown core data fails to open; unknown attributes never do.

Keep application ownership separate

The desktop owns the projects folder and project names. The renderer, pipeline, and agent read the open session and submit edits; they never write the file directly. Design and sources: the koharu-scene README.