Plans
Plans
A plan is a YAML file of steps that runs the same way every time, with a model call only where you put one.
A plan is a list of steps that run in order, the same way every time. Each step calls a tool, and the plan makes a model call only where a step asks for one. Agents call plans as tools, so work an agent repeats can run without a model choosing each call.
version: 2
identifier: unreleased_changes
name: Unreleased changes
description: The commits since the latest release, each with a one-line release note.
steps:
- id: release
tool_name: github__tool__gh_release
input: {}
- id: commits
tool_name: github__tool__git_log
input:
base: '{{release.tag}}'
head: HEAD
- id: notes
tool_name: map
input:
over: '{{commits.commits}}'
concurrency: 4
do:
- id: files
tool_name: github__tool__git_changed_files
input:
base: '{{item.sha}}~1'
head: '{{item.sha}}'
prefix: ''
- id: note
tool_name: builtin__infer
input:
instruction: |-
Write one release-note line for this commit.
Subject: {{item.subject}}
Files changed: {{files.files}}
finish:
output:
since: '{{release.tag}}'
notes: '{{notes.results}}'Plan files
A plan is a YAML file in ./.dive/plans/ or ~/.config/dive/plans/. It has an identifier, a description that tells agents when to call it, its steps, and a finish that says what it returns. Steps read the plan's inputs as {{input.<field>}} and earlier results as {{<id>.<field>}}, in the template language. See Plan file for every field.
Steps
A step calls one of:
- A catalog tool:
builtin__*,user__*, or an MCP server's<server>__* - Another plan, as
plan__<identifier> - A named agent, as
agent__<name> - A control step, which the plan runs itself
| Control step | What it does |
|---|---|
exit | Ends the plan early, with success or an error |
route | Takes one branch of steps |
filter | Keeps the items in a list that pass a condition |
map | Runs steps once per item, several at a time with concurrency |
reduce | Folds a list into one value |
agent | Gives one task to an agent with its own prompt and tools |
ask | Asks a person a question mid-run |
Model calls happen only in agent steps, model-backed tools such as builtin__infer, infer and decide conditions, and a solver finish.
How a plan ends
finish decides what a plan returns:
outputreturns a map of step results as JSON, with no model call.solverhas a model write the answer from the results.silentreturns nothing, for plans that only act.
Running plans
dive plan run <identifier>runs a plan from the terminal or a script.- Agents and other plans call it as
plan__<identifier>. dive mcp serveoffers it to MCP clients asplan_<identifier>.
A failing step fails the run. Dive doesn't rewrite a plan you wrote to work around it.
Where plans live
Dive reads ./.dive/plans/ before ~/.config/dive/plans/, and the first plan with an identifier wins, so a project plan replaces one in your home directory. A plan with a built-in plan's identifier replaces the built-in. dive plan rm <identifier> deletes the plan's file, and whatever it was shadowing takes over. Commit ./.dive/plans/ to give your whole team the same plans.
Lists show each plan's scope: project for ./.dive/plans/, global for ~/.config/dive/plans/ and other shared directories, the pack's name for a pack plan, and built-in.
Plans that can't run here
A plan can run only when everything it reaches resolves in the current project: every tool, plan and agent its steps call (control-step bodies included, at any depth), the tools and subagents of those agents, and every MCP server in requires_servers. A global plan can reach a tool that exists in only one project, so it can run in one project and not in another.
When something is missing, the plan is still listed, marked with what it's missing:
dive plan listadds amissing:column naming the first missing item.--jsongives each plan amissingarray, one entry per missing item with the path from the plan to it.dive plan showadds the path to its note, for examplecan't run here: researcher (subagent) → read_sources (tool) → user__crawl4ai_markdown (step sources/page) is not in this project's catalog.dive plan run, the plan toolsdive mcp serveoffers, and aplan__call from another plan or agent all refuse it before its first step, with the same path.- The planner,
search_toolsand agents never offer it to a model.
Everything that reaches a plan that can't run can't run either. Adding the missing item to the project or to ~/.config/dive, or removing the reference, makes it runnable again.
Guides
Draft a plan in the workbench
Turn a goal into a working, saved plan.
Run a plan
Run a plan with inputs and use its result.
Debug a plan
Step through a run in the workbench.
Stop early with exit gates
End a plan when a condition holds.
Branch with route
Take different steps depending on the data.
Select items with filter
Keep only the items that matter.
Iterate with map and reduce
Run steps per item, or fold a list into one value.
Rank and cut lists
Join, dedupe and rank a list against a question with no LLM.
Delegate a step to an agent
Hand a fuzzy task to an agent and get typed output back.
Ask for input mid-run
Pause a plan to ask a person a question.
Compose plans
Split a large plan into plans that call each other.
Handle failures
Tell why a run failed and choose how to respond.