Workflow File Location
Workflow files live intemplates/workflows/ and use the .workflow.js extension:
my-workflow-codemachine
templates
workflows
my-workflow.workflow.js
Basic Structure
Every workflow exports a default object with a name and steps:templates/workflows/my-workflow.workflow.js
Name
Names should be short and descriptive. They define the objective of your workflow and help users understand what it accomplishes.Code Review PipelineAPI GeneratorDocumentation WriterBug Fixer
Steps
Steps are agents set in sequence. TheresolveStep() function loads an agent from your config/main.agents.js.
Arrangement matters. Each step receives context from previous steps, so the order determines how information flows through your workflow.
Workflow Modes
Choose how your workflow runs:
Set the mode using
autonomousMode:
Adding Separators
Useseparator() to add visual dividers between workflow phases:
templates/workflows/code-review.workflow.js
Interactive vs Non-Interactive Steps
By default, steps are interactive - the workflow waits for user input. Setinteractive: false to auto-advance:
A common pattern is making the first step interactive for gathering requirements, then running subsequent steps non-interactively.
Complete Simple Example
Here’s a complete workflow for a basic code generation pipeline:templates/workflows/code-generator.workflow.js
Running Your Workflow
Once your workflow is complete, run it with:Keyboard Shortcuts
Validation Checklist
Before running your workflow, verify:1
Agent IDs Match
Every agent ID in
resolveStep() exists in config/main.agents.js2
Prompt Files Exist
All
promptPath references in agent configs point to existing files3
Placeholders Registered
All placeholders used in prompts are registered in
config/placeholders.jsNext Steps
Ready for more? Learn about tracks, conditions, modules, controllers, and sub-agents.Advanced Workflows
Tracks, conditions, modules, and controllers
Workflow Examples
Complete real-world examples