Workflows
Workflows orchestrate teams of agents through defined phases with automatic knowledge fusion. The WorkflowOrchestrator manages execution, state transitions, and result aggregation — all persisted in Cortex.
Workflow lifecycle
mermaidstateDiagram-v2 [*] --> Pending : startWorkflow() Pending --> Running : executeNextPhase() Running --> Running : next phase Running --> Merging : all phases done Merging --> Completed : results merged Running --> Failed : error or timeout
Built-in workflows
code-review
Single parallel phase with 4 specialized review agents:
| Agent | Role | Focus |
|---|---|---|
security-reviewer | security | OWASP vulnerabilities, input validation |
test-reviewer | tests | Test coverage, edge cases |
type-reviewer | types | Type safety, interface consistency |
simplification-reviewer | simplification | Code clarity, dead code |
Strategy: additive — all findings are combined.
feature-dev
Four sequential phases building on each other:
- Explore —
exploreragent maps the codebase structure - Design —
architectagent creates the implementation plan - Review — parallel
security-reviewer+quality-reviewer(strategy:conflict-flag) - Implement —
implementeragent writes the code
security-review
Single parallel phase with 2 security agents:
- static-scanner: OWASP Top 10, hardcoded credentials, insecure dependencies
- semantic-scanner: data flow analysis, authorization boundaries, privilege escalation
Strategy: additive.
Custom workflows
Register custom workflow definitions at runtime:
typescriptimport { registerWorkflow } from "./workflows/registry.js"; registerWorkflow({ name: "my-workflow", description: "Custom review process", defaultStrategy: "additive", phases: [ { name: "analyze", description: "Analyze the target", parallel: true, strategy: "additive", agents: [ { agentId: "analyzer-1", role: "analyzer", task: "Analyze ${path}" }, { agentId: "analyzer-2", role: "analyzer", task: "Analyze ${path}" }, ], }, ], });
The ${path} placeholder in task descriptions is interpolated with the target path at runtime.
Git worktree integration
When worktree.enabled is true, each agent in a workflow phase gets an isolated git worktree via the GitWorktreeManager. This prevents agents from interfering with each other's file changes.
Worktrees are created under .mayros/worktrees/ with branches prefixed mayros/worktree/.
Configuration
json5{ teams: { maxTeamSize: 8, defaultStrategy: "additive", workflowTimeout: 600, }, worktree: { enabled: false, basePath: ".mayros/worktrees", }, }
Related
- Teams — team management
- workflow CLI — command reference
- Background Tasks — task tracking
- Team Dashboard — aggregate status