flow

/flow-plan

Phase: 2 — Plan

Usage: /flow-plan, /flow-plan --auto, /flow-plan --manual, or /flow-plan --continue-step

Invokes the decompose plugin for DAG-based task decomposition, explores the codebase, validates the DAG against reality, and produces an ordered implementation plan with a dependency graph.


What It Does

  1. Reads the feature description from the prompt field in the state file (the full text passed to /flow-start)
  2. Fetches referenced GitHub issues (#N patterns in the prompt) and checks for the “decomposed” label
  3. If a referenced issue has the “decomposed” label, skips decompose and uses the issue body as a head start (see Pre-Decomposed Issues below). Otherwise, invokes /decompose:decompose for structured DAG decomposition (configurable via dag mode — see below), then self-invokes with --continue-step to ensure continuation after the turn boundary
  4. Explores the codebase to validate the DAG against reality
  5. Verifies script behavior assertions from issue bodies by reading the relevant source code — catches false assumptions before they become bugs in the plan
  6. Validates that file targets are inside the repo working tree — notes out-of-repo paths in the Risks section, defaulting to repo-local equivalents when the prompt contains repo-related keywords
  7. Writes the plan file with a Dependency Graph section and ordered tasks
  8. Renders the full plan content inline in the conversation for review
  9. Stores the plan file path in state and transitions to Code

DAG Decomposition

The Plan phase optionally invokes the decompose plugin to decompose the feature into a Directed Acyclic Graph with explicit dependencies, node types, and topological ordering. The DAG output is stored to .flow-states/<branch>-dag.md and used to inform the plan file’s Dependency Graph and task ordering.

DAG Capture

Before invoking decompose, the skill sets _continue_pending and _continue_context so the stop-continue hook forces continuation after the plugin returns. After the decompose plugin returns, the complete output — XML DAG plan, node executions with quality scores, and synthesis block — is captured verbatim to .flow-states/<branch>-dag.md with a markdown heading. The path is stored in files.dag in the state file. The skill then self-invokes with --continue-step to dispatch to the plan writing step via the Resume Check.

DAG Mode

Configurable via .flow.json under skills.flow-plan.dag:

Pre-Decomposed Issues

When a referenced issue has the “decomposed” label (applied by /create-issue), the Plan phase skips the decompose plugin invocation entirely. The issue body — which contains verified file paths, acceptance criteria, scope boundaries, and architectural context from a prior decompose run — is written to .flow-states/<branch>-dag.md as a pre-existing analysis and used as a head start for plan writing. This applies regardless of the configured DAG mode.

No self-invocation or continuation flags are needed when skipping decompose — execution proceeds directly to codebase exploration and plan writing in the same turn.


Plan File Structure

The plan file lives at .flow-states/<branch>-plan.md and includes:


Resuming

The Resume Check handles both session restarts and mid-session self-invocation (after decompose returns). It checks the state file:


Mode

Mode is configurable via .flow.json (default: manual) under skills.flow-plan.continue. In auto mode, the phase transition advances to Code without asking. Flags --auto and --manual override the configured mode.


Gates


See Also