Skip to content

First AI Mutation

DUUMBI’s AI mutation system lets you describe changes in natural language. The AI generates structured graph patches — no text parsing, no syntax errors.

From your project directory:

Terminal window
duumbi add "create a multiply function that takes two i64 parameters and returns their product"

The AI will:

  1. Analyze the current graph
  2. Generate a GraphPatch with an add_function operation
  3. Validate the patched graph (schema + type check)
  4. Show you a diff summary for confirmation
Changes:
+ Function: multiply(a: i64, b: i64) -> i64
+ Block: entry
+ Const: Load(a)
+ Const: Load(b)
+ Mul
+ Return
Apply changes? [y/N]

Type y to apply. The change is saved to main.jsonld and a snapshot is created in .duumbi/history/.

Terminal window
duumbi add "modify the main function to call multiply(6, 7) and print the result"

The AI generates modify_op and add_op patches to update the existing main function.

Made a mistake? Undo the last change:

Terminal window
duumbi undo

This restores from the latest snapshot in .duumbi/history/. Undo is a LIFO stack — you can undo multiple times.

DUUMBI supports multiple LLM providers with automatic fallback:

config.toml
[[providers]]
name = "anthropic"
api_key_env = "ANTHROPIC_API_KEY"
model = "claude-sonnet-4-20250514"
[[providers]]
name = "openai"
api_key_env = "OPENAI_API_KEY"
model = "gpt-4o"

If the primary provider fails (rate limit, network error), DUUMBI automatically tries the next provider in the chain.

  1. The current graph (main.jsonld) is sent to the LLM as context
  2. The LLM responds with tool calls defining graph patches (6 patch types)
  3. Patches are applied atomically (all-or-nothing)
  4. The result is validated against the schema
  5. On failure: automatic retry with error feedback (up to 3 attempts)

The 6 patch operations:

OperationDescription
add_functionAppend a complete function to the graph
add_blockAdd a block to an existing function
add_opAppend an operation to a block
modify_opChange a field on any node
remove_nodeRemove a node (op, block, or function)
set_edgeSet an @id reference between nodes