Dive

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 stepWhat it does
exitEnds the plan early, with success or an error
routeTakes one branch of steps
filterKeeps the items in a list that pass a condition
mapRuns steps once per item, several at a time with concurrency
reduceFolds a list into one value
agentGives one task to an agent with its own prompt and tools
askAsks 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:

  • output returns a map of step results as JSON, with no model call.
  • solver has a model write the answer from the results.
  • silent returns 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 serve offers it to MCP clients as plan_<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 list adds a missing: column naming the first missing item. --json gives each plan a missing array, one entry per missing item with the path from the plan to it.
  • dive plan show adds the path to its note, for example can'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 tools dive mcp serve offers, and a plan__ call from another plan or agent all refuse it before its first step, with the same path.
  • The planner, search_tools and 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