OpenProgram Docs

Conversation and call edges

EdgeAnswersValuesRead by
predecessorWho I follow in chat orderOne inbound per node. "ROOT" on the session's first node and explicit root forks; None on spawn branch roots.linear_history, get_branch, _annotate_spawn_origin, turn_groups, rewind
callerWho invoked me to execute"ROOT" or empty on chain-level turns. A node inside an Agent method's execution subtree names another call._rebuild_runtime_cards, aggregate_tool_messages, turn_groups

Schema: openprogram/state/store/session/nodes.py. Time order is seq, never an edge. reads is a third edge: the nodes whose content shaped an LLM prompt.

Branch walk

get_branch follows predecessor only, with no caller or seq guesses. A node with no predecessor must be a legal end, or the data is broken and the walk raises.

Legal ends
Spawn branch root, the ROOT node, a code node opening a run branch, the session's first node, a compaction summary covering the session start
Chat display
active_branch_chain filters the tool-aggregated rows to the ids get_branch returned; a stale or empty head falls back to a predecessor walk or all rows
Attach pointers
Hang off a message by predecessor without joining the chain and are written with advance_head=False, so they never move the head; splice_attach_pointers inserts them inline

Node and chat message

DAG nodeChat message
ServesRuntime: render_contextDisplay: message list, tool-call cards
Tool callsOne node per toolFolded into the assistant's tool_calls[]
ThinkingIn the extra fieldExtracted into blocks[]
Shape{role, name, input, output, predecessor, caller, seq}{role, content, tool_calls, blocks, predecessor, caller}
BuiltAt writeAt load, by aggregate_tool_messages

_msg_adapter.py takes predecessor from the top-level Call field only, so a stray metadata copy cannot override it.

Code
FileHolds
openprogram/state/store/session/_msg_adapter.pyNode to message
openprogram/state/store/session/session_store/branches.pyget_branch
openprogram/runtime/context/git/dag.pylinear_history, active_branch_chain
openprogram/interfaces/server/persistence.pyaggregate_tool_messages
openprogram/interfaces/server/transcript/turn_index.pyturn_groups, splice_attach_pointers, the branch view
openprogram/interfaces/server/ws_actions/session/load.pyhandle_load_session
openprogram/interfaces/server/ws_actions/session/transcript.py_rebuild_runtime_cards, _annotate_spawn_origin

Implementation status

Implemented. Session nodes carry no parent_id or called_by; a parent_id elsewhere in the code belongs to other records, such as run control and channels.

Last updated · 2026-11-25