Skip to content
OpenNodeFlow.DocsOpen beta ↗
Agent guide ↗
Docs/Agents & API

Patch a graph safely

Preview and save targeted operations while preserving unrelated pins, literals and metadata.

23 Oct 2026 · 2 min read
Markdown ↗

Use onf_patch_graph to edit an existing workflow. It applies an ordered operation list to a cloned draft, validates the result and saves under the workflow's revision guard. This reduces accidental replacement of unrelated content compared with reconstructing a graph from summaries or redacted readbacks.

Read the target first#

Call onf_get_workflow or onf_get_graph for the saved graph/revision. Read exact pinned definitions for nodes being changed. Discover actual node, edge and socket IDs; labels are not identities. Read relevant context notes before changing a branch's meaning.

The tool takes workflowId, expectedRevision, operations, optional dryRun and optional allowInvalid. An operation list has 1–1,000 entries:

OperationTarget
add_nodeComplete pinned node instance
update_nodeSelected node fields
remove_nodeOne actual node ID
connectComplete edge with exact socket IDs
disconnectOne actual edge ID
upgrade_nodeExplicit version of that node's definition
set_framesComplete intended frame array

Preview a small change#

Replace these placeholders and revision with a current read:

json
{
  "workflowId": "FLOW_ID",
  "expectedRevision": 7,
  "dryRun": true,
  "operations": [
    {"op":"update_node","nodeId":"NODE_ID","patch":{"label":"Validate order"}}
  ]
}

Dry run checks the revision and returns a draft without saving or executing. Review issues and the resulting graph, then apply the intended operations with dryRun:false against a still-current revision. If another editor saves meanwhile, reread and reconcile; do not blindly substitute a higher number.

Replacement remains literal#

Although update_node targets one node, supplied config and inputs objects are deliberate replacements rather than arbitrary deep merges. Preserve their full intended fields. set_frames similarly replaces the collection. Inspect the wiring and documentation consequences of removing a node.

Visibility arrays contain socket IDs and change presentation only. Hiding a socket does not remove its value, validation or execution behavior. A variable binding contains exact variable/workspace/type identity and needs deliberate rebinding if that variable disappears.

allowInvalid:true can preserve an incomplete draft; enabled nonmanual automation still requires a valid graph. Finish with validation and a readback of the saved revision. Keep concise context notes current when purpose or wiring changes. For helper-originated changes, follow the separate reviewed proposal workflow.

Source provenance

Reviewed against maintained source and topic documentation on 23 October 2026. This is a source snapshot; installed versions and provider access may differ.

  • docs/MCP.md
  • server/mcp-graph.ts
  • server/mcp-tools.ts
Type to search the documentation.
↑ ↓ to navigate · Enter to openAgent map ↗