OpenProgram Docs

Layout specification

Position = (lane start + tier, row). The rules are in DAG rendering; these scenes are what they produce.

LetterNode
RROOT
UYour message
AAgent reply
FFunction call or Program run
MMerge

Letters stand in for the icons on the real round chips. Lane 0 is filled, other lanes outlined. The narrow view lists each node as column,row.

Conversation

One messageRROOTUHelloAReplyTwo turnsRROOTUHelloAReply 1UWeatherAReply 2Manual function, openRROOTUHelloAReplyFgui_agentFgui_stepFconclusion
  1. One messageROOT 0,0 · Hello 1,1 · Reply 2,2
  2. Two turnsROOT 0,0 · Hello 1,1 · Reply 1 2,2 · Weather 1,3 · Reply 2 2,4
  3. Manual function, openROOT 0,0 · Hello 1,1 · Reply 2,2 · gui_agent 1,3 · gui_step 2,4 · conclusion 2,5
  • Every turn and every manual Program hangs off ROOT, not off the previous reply.
  • Calls inside a function are one flat, time-ordered column, however deep they nest.

Retry

RetryRROOTUHelloAReply 1UEditedAReply 1′Three versions of one turnRROOTUv1Ar1Uv2Ar2Uv3Ar3
  1. RetryROOT 0,0 · Hello 1,1 · Reply 1 2,2 · Edited 5,1 · Reply 1′ 6,2
  2. Three versions of one turnROOT 0,0 · v1 1,1 · r1 2,2 · v2 5,1 · r2 6,2 · v3 10,1 · r3 11,2
ColumnUse
3Gap: the branch is a parallel version
4The fork lane's empty spine, where the dashed bridge lands
5, 6The fork's turn and reply

Call threads

FoldedRROOTUWeatherA3ReplyOpenRROOTUWeatherAReplyFbashFweb_fetchFopen_meteoFolded: the defaultRROOTUQuestionA1ReplyUEditedAA′UFollow-upAReply 2Open: rows insert, columns stayRROOTUQuestionAReplyUEditedAA′UFollow-upAReply 2Fweb_search
  1. FoldedROOT 0,0 · Weather 1,1 · Reply 2,2
  2. OpenROOT 0,0 · Weather 1,1 · Reply 2,2 · bash 3,3 · web_fetch 3,4 · open_meteo 3,5
  3. Folded: the defaultROOT 0,0 · Question 1,1 · Reply 2,2 · Edited 5,1 · A′ 6,2 · Follow-up 1,3 · Reply 2 2,4
  4. Open: rows insert, columns stayROOT 0,0 · Question 1,1 · Reply 2,2 · Edited 5,1 · A′ 6,2 · Follow-up 1,4 · Reply 2 2,5 · web_search 3,3

Thread items reserve no lane width. Closing a thread gives back its rows.

Branches talking

MergeRROOTUQuestionAReply AUEditedABMmergesend_messageRROOTUQuestionAAFsendUBranch BABUAUFrom BAA answersAgent spawned on a thread, both openResearcherRROOTUQuestionAAFreadFAFbashFwrite
  1. MergeROOT 0,0 · Question 1,1 · Reply A 2,2 · Edited 5,1 · B 6,2 · merge 2,3
  2. send_messageROOT 0,0 · Question 1,1 · A 2,2 · send 3,3 · Branch B 5,1 · B 6,2 · U 5,3 · A 6,4 · From B 1,5 · A answers 2,6
  3. Agent spawned on a thread, both openROOT 0,0 · Question 1,1 · A 2,2 · read 3,3 · F 3,4 · A 4,5 · bash 4,6 · write 3,7
SceneRule
MergeOne node with several parents, in the base lane. Each peer tip feeds it with a thick line in the peer's colour.
send_messageReturns at once; neither branch blocks. The message lands at the end of the target branch. The answer comes back as a new user-tier turn labelled with the sender's name. Dotted lines appear only on hover.
SpawnA square on its caller's thread, at the moment it happened, with a name tag. Its own thread is one column further right and pushes later items down. No return line: the follow-up reply merges into the same anchor.

Node states and marks

StateDrawn as
RunningThe chip's own icon animates, and beads ride the belt leading to it. No placeholder node.
ErrorA red ! on the chip's upper-right edge; the rest of the turn is unchanged.
CancelledThe whole node fades, shape kept.
CountDigits on the upper-right shoulder: how many events are folded. Not a node.
↗Cross-session spawn, on both sides: the source node and the target branch root.

Branch-name badges

Beside the deepest visible nodeHelloRROOTUQuestionA1Follows an open threadHelloRROOTUQuestionAFCollision: the later name slides down a rowWeather in Shanghai tomorrowBRROOTUQuestionAUEditedA
  1. Beside the deepest visible nodeROOT 0,0 · Question 1,1 · A 2,2
  2. Follows an open threadROOT 0,0 · Question 1,1 · A 2,2 · F 3,3
  3. Collision: the later name slides down a rowROOT 0,0 · Question 1,1 · A 2,2 · Edited 5,1 · A 6,2
  • Collisions use measured pixel boxes, and every visible node counts as an obstacle.
  • Badges come only from active list_branches rows. A merged branch loses its badge; its name moves to the merge node's tooltip.

What counts as a branch tip

SessionStore.list_branches() in openprogram/state/store/session/session_store/branches.py returns only true leaves of the conversation predecessor graph, plus the head.

Continues the conversationDoes not
User and reply nodes; top-level Programs (empty or ROOT caller); runtime-scheduled user rowsInternal execution children, other runtime rows, structural and root rows, attach, context/*

Sequential top-level Programs leave one tip, the last. Parallel siblings each stay a tip.

Retry and lanes

Top-level Programs under ROOT stay on the ROOT lane in time order. Only a persisted metadata.retry_of opens a fork lane. The Retry entry point writes it; build_session_graph() exposes it to layout.

Frontend modules

Under apps/web/lib/runtime-bridge/dag/:

FolderHolds
passes/Data projection
layout/Geometry
render/Drawing
interaction/Interaction and camera
RootPublic entry points, types, paint gate, pipeline

Tooltip content is separate from its DOM lifecycle, graph preparation from SVG commit, node classification from ownership. A file stays within about 500 lines. Splitting one must not change public entry points, DOM classes, SVG structure, test-visible state or camera behaviour.

Try the layout algorithm on sample data

Last updated · 2026-11-25