The document model

Kinogaki Core

The library, for C++ and Python, that defines what a Prism document is: the Document, its Elements, typed Values, properties and time, connections and the dataflow graph, and native serialization.

The library Prism tools build on

Kinogaki Core is the library, for C++ and Python, that defines what a Prism document is. The CLI, the Server, the Editor, and the UI and Platform libraries all build on it. Core depends only on the C++20 standard library; in Python it installs with pip install kinogaki.

That keeps it dependable: small enough to read in an afternoon, strict enough to trust with your data, and portable enough to embed in a command-line tool, a server, a plugin, a game engine, or a native app. It is what turns a Prism file from a blob into a typed object model that tools and agents can safely inspect and mutate.

What's in it

This manual covers Core in five parts:

The one-paragraph model

A Document is a set of Elements indexed by Path, each carrying typed Propertys; a Property is a Value, optionally varying over time. An Element is a node: a Path, a type token, and a map of typed Properties. A Value is a dtype plus a shape over a flat buffer. That is the entire model, and everything in this manual elaborates on it.

#prisma 4.0
def group "world" {
    def object "ball" {
        float3 position = (0, 1, 0)
        float  radius   = 1.5
        float3 albedo   = (1, 1, 1)
        connect albedo = </world/mat.out>
    }
}

A model, not a format

Two words run through this manual, so pin them down first. The format is the bytes on disk: the .prisma text and .prism binary files. The model is the typed object you hold in memory: a Document of Elements, each carrying typed Values. Core hands you the model. You open a file and get a Document to inspect and mutate, not a parse tree shaped like the file you happened to open.

One model takes every input. The codecs read Markdown, HTML, JSON, and SVG into the same Document, so a foreign file becomes a typed object with the same API as a native one. The set is extensible: a consumer adds a format by implementing the Codec seam.

One Document serves every use. The Elements you save to disk, the scene you edit, and the dataflow graph you evaluate are one set of Elements read for three purposes, not three structures kept in sync. The Document already is the model, so there is no compile step from "document" to "runtime model".

This lets a program, or an AI agent, reason over any Prism document with one API, one addressing scheme, and one set of guarantees. The same Document is a queryable and versioned store: filter and join its Elements, and diff, merge, or snapshot its history. Start with your first document to see it concretely, then read the model for the design.