Custom Workflows

Prodara workflows orchestrate how the AI agent interacts with the compiler. The default workflow covers the full specify → clarify → plan → implement → review cycle, but you can customize it or define entirely new workflows.

Default Workflow

When you run prodara build, the engine executes these phases in order:

1

Specify

Parse the full specification and build the product graph.

2

Clarify

Identify ambiguities and produce structured questions.

3

Plan

Diff against the previous build and generate an incremental plan.

4

Tasks

Break the plan into ordered, actionable tasks.

5

Analyze

Run consistency and metrics analysis across tasks.

6

Implement

Generate implementation instructions for each task.

7

Review

Run the reviewer pipeline with configured reviewers.

Phase Kinds

Each workflow step maps to a PhaseKind. The engine exports individual runner functions for each kind:

KindRunnerOutput Type
specifyrunSpecifyPhase()SpecifyOutput
clarifyrunClarifyPhase()ClarifyOutput
planrunPlanPhase()PlanOutput
tasksrunTasksPhase()TasksOutput
analyzerunAnalyzePhase()AnalyzeOutput
implementrunImplementPhase()ImplementOutput

Defining Custom Workflows

Define a custom workflow in your prodara.config.json using the WorkflowSchema structure. Each step specifies a phase kind and optional configuration.

prodara.config.json
{
  "workflows": {
    "quick-check": {
      "steps": [
        { "phase": "specify" },
        { "phase": "clarify", "autoResolve": true }
      ]
    },
    "full-review": {
      "steps": [
        { "phase": "specify" },
        { "phase": "clarify" },
        { "phase": "plan" },
        { "phase": "tasks" },
        { "phase": "analyze" },
        { "phase": "implement" },
        { "phase": "review", "reviewers": ["architecture", "security", "quality"] }
      ]
    }
  }
}
💡
Use the --workflow CLI flag to select a named workflow: prodara build --workflow quick-check

Review Gates

Review gates are special workflow steps that run the reviewer pipeline. You can configure which reviewers run and how many fix attempts are allowed.

prodara.config.json (workflow section)
{
  "review": {
    "maxFixAttempts": 3,
    "reviewers": ["architecture", "quality", "security"],
    "fixLoop": {
      "severity": "error",
      "autoFix": true
    }
  }
}

Clarify Phase

The clarify phase identifies ambiguities in the specification and produces structured questions. Auto-resolution can answer common questions automatically.

clarify config
{
  "clarify": {
    "maxQuestions": 10,
    "priority": "high",
    "ambiguityThreshold": "medium",
    "autoResolve": true
  }
}

Programmatic API

Run workflows programmatically using the runWorkflow() function or execute individual phases:

import {
  runWorkflow,
  runSpecifyPhase,
  runClarifyPhase,
  runPlanPhase,
} from '@prodara/compiler';

// Run the full workflow
const result = await runWorkflow({ rootDir: './project' });

// Or run individual phases
const specResult = await runSpecifyPhase(config);
const clarifyResult = await runClarifyPhase(specResult, config);
const planResult = await runPlanPhase(specResult, config);

Next Steps

See the Interactive Workflows tutorial to build a custom workflow from scratch. Read about interactive modes like Explore, Help, and Party.