Skip to content

Minimal Protocol

The minimal public example creates a source tube, creates a target tube, and transfers 5uL from source to target.

Source file:

text
examples/minimal/public_minimal.culs

Full Source

text
protocol PublicMinimal {
    let source = tube(
        label = "Source",
        capacity = 100uL,
        load = [buffer(code = "BUF01", type = "water"):10uL]
    );
    let target = tube(label = "Target", capacity = 100uL);
    target << [source:5uL];
}

Protocol Declaration

text
protocol PublicMinimal {
    ...
}

A protocol is the executable unit. The CLI takes a source file, resolves its protocol declarations, and runs the entry protocol through the pipeline.

Container Binding

text
let source = tube(...);
let target = tube(...);

let binds names inside the protocol. Here, source and target are logical container references.

Source Tube

text
let source = tube(
    label = "Source",
    capacity = 100uL,
    load = [buffer(code = "BUF01", type = "water"):10uL]
);

This constructs a tube with:

  • a display label: "Source"
  • capacity: 100uL
  • initial material load: 10uL of a buffer content record

The buffer(...) expression identifies the material content. The load=[content:amount] entry puts that content into the tube.

Target Tube

text
let target = tube(label = "Target", capacity = 100uL);

The target tube starts empty but has a declared capacity.

Transfer

text
target << [source:5uL];

The << operator mutates container material state. In this example:

  • target is the destination container.
  • source is the source container.
  • 5uL is the transferred volume.

After execution, the runtime state reflects the transfer:

  • source loses 5uL from its tracked buffer content.
  • target gains 5uL of the same tracked buffer content.

Run It

bash
culsma run --input examples/minimal/public_minimal.culs --artifacts-dir tmp/run

The generated plan.json shows the execution plan, and run.json contains the runtime state and events.

Released under the Apache-2.0 license.