Skip to content

Concepts

Diagrams of how clabe's parts relate. Terms are defined in the glossary.

How it fits together

flowchart LR
  wf["Workflow"] -- "clabe run" --> launcher["Launcher"] --> run["Run"]
  run --> records[("Records<br/>events, outputs, run.json")]
  run <-->|"prompts, answers"| clients["Clients<br/>TUI, web UI, agents"]
  run --- server["Run server (HTTP)"]
  daemon["Daemon (rig PC)"] -- "starts, proxies" --> server
  hub["Hub (optional)"] -- "follows" --> daemon

Steps and runs

flowchart LR
  run["Run"] -- executes --> wf["Workflow"] -- "a list of" --> step["Step"]
  step -- "each execution:<br/>an attempt" --> output["Output"]
  output -. "input of later steps,<br/>by name" .-> step
  • A step's name is the name of its output.
  • A step's parameters name the outputs it needs.
  • Any step can also take the built-ins launcher and run.

A step's states:

stateDiagram-v2
  direction LR
  [*] --> pending
  pending --> running
  running --> done
  pending --> skipped: condition false
  running --> skipped: optional, declined
  running --> failed: raised
  failed --> running: Retry
  done --> pending: go back
  done --> locked: a later barrier ran

Going back to rig re-runs only what depends on it (highlighted):

flowchart LR
  session --> store --> trainer_state --> review
  rig --> review --> register
  session --> register
  rig --> register
  classDef rerun fill:#cceb05,stroke:#141d28,color:#000
  class rig,review,register rerun

Prompts and clients

Every client sees every prompt. The run validates each answer and accepts the first valid one.

sequenceDiagram
  participant S as Step
  participant R as Run
  participant T as TUI (rig)
  participant W as Web UI
  participant A as Agent
  S->>R: ui.number("Trials")
  R-->>T: prompt
  R-->>W: prompt
  R-->>A: prompt
  A->>R: "abc"
  R-->>A: rejected: not a number
  W->>R: 300
  R->>S: 300
  R-->>T: closed (answered from the web UI)

Records

flowchart TB
  run["Run"] --> events["events.jsonl<br/>what happened"] & outputs["outputs.jsonl<br/>outputs + lineage"] & artifacts["artifacts/"] & manifest["run.json<br/>code, env, machine"]
  events --> replay["clabe replay"]

Machines

flowchart TB
  browser["Browser"] & agent["Agent (clabe mcp)"] --> hub["Hub"]
  hub --> a & b
  subgraph pcA["Rig PC A"]
    a["Daemon (host)"] -- "/run/" --> run["Run server"]
  end
  subgraph pcB["Rig PC B"]
    b["Daemon (worker)"] --> ephys["Open Ephys"]
  end
  run -- "lease, jobs" --> b
  • Connections go from the observer to the rig. The rig does not connect to observers.
  • A worker serves one run at a time. That run holds the worker's lease.