OpenProgram Docs

Branch naming

A branch name follows its current conversation endpoint; an explicit fork uses another endpoint. Rewind preserves the current branch identity and name, even when its endpoint temporarily rests on a shared ancestor of an existing sibling. The trunk has no synthesized main name and follows the same rules.

Who wins

TierSourceLocksAutomatic naming may overwrite
HighestUser rename (rename_branch, Branches panel, /branch <name>) or user-requested LLM name (auto_name_branch, /branch, TUI /branch rename)Sets name_lockedNo
SpawnLabel of a spawned task, recorded at admission on the reply the run will write (<job>_user_reply), so the agent list and Activity name the branch while it runs; written again at the end only if the branch has no nameNoOnly if the write-back passes its checks
AutomaticBackground LLM label at thresholdsNoYes
FallbackFirst 8 hex digits of head_msg_idNoReplaced by any stored name

Whether a name is protected depends on whether the user asked for it, not on whether an LLM wrote it.

One turn on a branch

  1. finalize_turnSkipped for background turns; their branches are hidden when they end.
  2. carry_branch_entryA recorded branch's entry has already moved with each message the turn wrote (follow_line for the selected branch, carry_branch for another), merged with any entry written at the new tip, so a rename mid-turn keeps the counter. For a line without a branch record, this moves the entry from the tip this turn extended to the new head, so name, lock and counter follow the branch. An ordinary fork point stays put; the fork starts fresh. Continuing after Rewind carries the current entry even when a sibling exists, preserving its name, lock and counter.
  3. maybe_auto_name_branchStops if archived. Otherwise turns + 1, locked or not; a locked branch gets no automatic label.
  4. turns in 1, 6, 16, 40Background thread: last 6 messages, at most 2000 characters, 2 to 6 words, capped at 40 characters.
  5. Write backRereads the entry and discards the label if it is now locked or archived (the lock is checked again on the record inside the write lock); otherwise stores it and refreshes branches_list.

State

branches: {
  <head_msg_id>: {
    name, created_at, updated_at,
    auto_named: bool,
    name_locked: bool,
    name_gen_count: int,
    turns: int,
  }
}

In session meta.json, written by set_branch_name, which merges so a name-only write keeps the lock and counters. Every writer merges on disk under the session write lock (branch records). A write addressed to a tip the branch has since moved past (the previous reply, or this turn's own message) goes to the branch's record at its tip now.

DisplayShows
Branches panelName, else the short id (graph/branches.py)
DAG badgeName, else the text the user asked on that branch, else the short id (dag/render/labels/badges.ts)

The transcript goes inside <branch> tags with an instruction to treat it as data, so a message cannot rename the branch.

Compared with session titles
SessionBranch
PlaceholderFirst line, 50 characters (_title_from_text)Short id: a branch is another possibility at the same position
Prompt_TITLE_SYSTEM_PROMPT, 3 to 7 wordsbuild_branch_name_prompt, 2 to 6 words; separate semantics, so separate prompts
Thresholds_RETITLE_AT_TURNSSame constant
Turn countAssistant messages across the whole sessionThe branch's own turns: unaffected by other branches, no walk to the fork point
Lock_user_titled, top level of meta.jsonname_locked, in the branch entry
Broadcastsession_updatedbranches_list refresh
Background thread_bg() in titles.pyOwn thread; write-back targets differ, so nothing is shared
Where it lives
ConcernSource
Entry, carry, counteropenprogram/state/store/session/session_store/branches.py
Thresholds, prompt, background namingopenprogram/runtime/conversation/turn_runtime/titles.py
Turn-end triggeropenprogram/runtime/conversation/turn_runtime/finalize.py
Rename and on-demand actionsopenprogram/interfaces/server/ws_actions/branch.py. Both default to the session's head_id. On-demand naming is synchronous and uses the chat runtime.
Composer commandapps/web/components/chat/composer/slash/slash-commands.ts

Boundaries

  • Labels remain in session metadata and branch references; no separate naming registry.
  • Branch naming changes neither the session title nor the DAG parent edges.

Implementation status

Implemented. Worth testing when this changes: manual rename against a concurrent automatic result, unnamed trunk, fork progression, and the WebSocket update after background naming.

Last updated · 2026-11-25