Skip to content

Branches & Versioning

Every repo starts with a main branch. You can create additional branches for scenario testing — each branch is a full copy of the repo at a point in time.

The core use case for branches is running “what-if” scenarios side by side. The workflow has four steps:

Step 1 — Create a scenario branch

create_branch("optimistic", base_branch="main")

This preserves the base model exactly as-is on main.

Step 2 — Edit models on the scenario branch

Use patch_file for small targeted edits or update_file for larger rewrites with branch="optimistic" to change assumptions (e.g. raise the growth rate from 20% to 35%). All changes stay isolated on the scenario branch.

Step 3 — Compare outputs

compare_branches(scenario_branch="optimistic")

Both branches run concurrently against the same data snapshot and execute the full project entrypoint. The response includes a structured diff showing which metrics changed and by how much. If you only care about one top-level output, pass output_name to focus the returned diff without changing what gets executed. Changes of 10% or more are flagged as significant:

Main branch revenue: $1,200,000
Optimistic branch: $1,450,000
Delta: +$250,000 (+20.8%) ⚠️ significant

Step 4 — Adopt or discard the scenario

If the scenario wins, merge it into main:

  • Solo work (Owner): call merge_branch directly — no review step needed.
  • Team workflow: call create_pull_request, have a colleague review and approve, then call merge_pull_request.

If the scenario is not useful, leave the branch as-is or delete it with delete_branch.

Both merge_branch (direct) and merge_pull_request (PR-based) require Owner role. This protects main from unreviewed assumption changes.

RoleCreate branchesEdit models on a branchMerge
ViewerNoNoNo
EditorYesYesNo — must open a pull request
OwnerYesYesYes — direct merge or via PR

Editors submit their work for review by opening a pull request with create_pull_request. An Owner then approves and merges via merge_pull_request. See the team collaboration guide for the full PR-based workflow.

ToolRole requiredDescription
create_branchEditorCreate a new branch from a base (default: main)
list_branchesViewerList all branches in a project
compare_branchesViewerRun a project on two branches and diff the outputs
merge_branchOwnerMerge a scenario branch directly into a base branch
delete_branchOwnerDelete a branch (cannot delete main)

Every model change creates a Git commit. The version tools let you inspect and navigate this history.

ToolDescription
list_versionsShow commit history (optionally filtered to one model)
diffUnified diff between two commits
rollback_versionRestore a model to a previous version (new commit, no rewrite)

rollback_version creates a new commit with the content from the target SHA. It does not rewrite history — the rollback itself is a versioned change with a full audit trail.