This document describes the built-in and custom workflow patterns available in CoderClawβs multi-agent orchestration system.
Workflow patterns define how multiple agents coordinate to accomplish complex development tasks. Each pattern specifies:
Purpose: Implement a new feature with proper design, testing, and review.
Agent Flow:
Architecture Advisor β Code Creator β (Test Generator || Code Reviewer)
Execution:
Usage:
coderclaw agent --message "Create user authentication feature" --thinking high
Or via tool:
orchestrate workflow:feature description:"Add WebSocket support for real-time updates"
Example Output:
Workflow: Feature Development
ββ [β] Architecture Advisor: Design analysis complete
β ββ Proposed: JWT-based authentication with refresh tokens
ββ [β] Code Creator: Implementation complete
β ββ Files: auth.ts, auth.test.ts, middleware.ts
ββ [β] Test Generator: Tests created (parallel)
β ββ Coverage: 95% (47/50 lines)
ββ [β] Code Reviewer: Review complete (parallel)
ββ Issues: 0 critical, 1 minor (consider rate limiting)
Purpose: Systematically diagnose and fix bugs with validation.
Agent Flow:
Bug Analyzer β Code Creator β (Test Generator || Code Reviewer)
Execution:
Usage:
coderclaw agent --message "Fix the memory leak in the parser" --thinking high
Or via tool:
orchestrate workflow:bugfix description:"Fix race condition in cache invalidation"
Example Output:
Workflow: Bug Fix
ββ [β] Bug Analyzer: Root cause identified
β ββ Issue: Unclosed file handles in parser cleanup
ββ [β] Code Creator: Fix implemented
β ββ Changes: parser.ts (added finally block)
ββ [β] Test Generator: Regression tests added (parallel)
β ββ Tests: 3 new tests for cleanup scenarios
ββ [β] Code Reviewer: Fix validated (parallel)
ββ Confirmed: Memory leak resolved, no new issues
Purpose: Improve code structure while preserving behavior.
Agent Flow:
Code Reviewer β Refactor Agent β Test Generator
Execution:
Usage:
coderclaw agent --message "Refactor the authentication module" --thinking high
Or via tool:
orchestrate workflow:refactor description:"Improve modularity of API layer"
Example Output:
Workflow: Refactoring
ββ [β] Code Reviewer: Analysis complete
β ββ Found: High coupling, duplicated logic, complex functions
ββ [β] Refactor Agent: Refactoring complete
β ββ Improvements: Extracted 3 utilities, simplified 5 functions
ββ [β] Test Generator: Validation tests added
ββ Status: All tests pass, behavior preserved
Purpose: Comprehensive code review for quality, security, and performance.
Agent Flow:
Code Reviewer β (Documentation Agent || Test Generator)
Execution:
Usage:
coderclaw agent --message "Review the latest changes for security issues" --thinking high
Example Output:
Workflow: Code Review
ββ [β] Code Reviewer: Review complete
β ββ Security: 1 issue (SQL injection vulnerability)
β ββ Performance: 2 improvements suggested
β ββ Quality: 3 minor issues
ββ [β] Documentation Agent: Docs updated (parallel)
β ββ Updated: API documentation for new endpoints
ββ [β] Test Generator: Coverage improved (parallel)
ββ Added: 8 tests for edge cases
Purpose: Create comprehensive documentation for code or features.
Agent Flow:
Code Reviewer β Documentation Agent β Test Generator
Execution:
Usage:
coderclaw agent --message "Document the API endpoints" --thinking medium
Example Output:
Workflow: Documentation
ββ [β] Code Reviewer: Code analysis complete
β ββ Identified: 12 endpoints, 4 models, authentication flow
ββ [β] Documentation Agent: Documentation created
β ββ Created: api-reference.md with examples
ββ [β] Test Generator: Example tests added
ββ Created: examples.test.ts with usage patterns
Define custom workflows for project-specific needs.
type WorkflowStep = {
role: string; // Agent role name
task: string; // Task description
dependsOn?: string[]; // Dependencies (task descriptions)
};
type Workflow = {
id: string;
steps: WorkflowStep[];
};
const apiDevelopmentWorkflow: WorkflowStep[] = [
{
role: "architecture-advisor",
task: "Design API endpoints and data models",
dependsOn: [],
},
{
role: "code-creator",
task: "Implement API endpoints",
dependsOn: ["Design API endpoints and data models"],
},
{
role: "documentation-agent",
task: "Create OpenAPI/Swagger specification",
dependsOn: ["Implement API endpoints"],
},
{
role: "test-generator",
task: "Create integration tests for all endpoints",
dependsOn: ["Implement API endpoints"],
},
{
role: "code-reviewer",
task: "Review API implementation for security",
dependsOn: ["Implement API endpoints", "Create integration tests for all endpoints"],
},
];
Usage:
orchestrate workflow:custom description:"Build RESTful API" customSteps:[...]
const dbMigrationWorkflow: WorkflowStep[] = [
{
role: "architecture-advisor",
task: "Analyze impact of schema changes",
dependsOn: [],
},
{
role: "code-creator",
task: "Create migration scripts (up and down)",
dependsOn: ["Analyze impact of schema changes"],
},
{
role: "test-generator",
task: "Create migration test suite",
dependsOn: ["Create migration scripts (up and down)"],
},
{
role: "code-reviewer",
task: "Review migrations for data safety",
dependsOn: ["Create migration scripts (up and down)", "Create migration test suite"],
},
{
role: "documentation-agent",
task: "Document migration process and rollback procedure",
dependsOn: ["Review migrations for data safety"],
},
];
const performanceWorkflow: WorkflowStep[] = [
{
role: "bug-analyzer",
task: "Profile application and identify bottlenecks",
dependsOn: [],
},
{
role: "architecture-advisor",
task: "Propose optimization strategies",
dependsOn: ["Profile application and identify bottlenecks"],
},
{
role: "refactor-agent",
task: "Implement performance optimizations",
dependsOn: ["Propose optimization strategies"],
},
{
role: "test-generator",
task: "Create performance benchmarks",
dependsOn: ["Implement performance optimizations"],
},
{
role: "code-reviewer",
task: "Validate optimizations and measure improvements",
dependsOn: ["Create performance benchmarks"],
},
];
Each workflow task follows a state machine:
PENDING β PLANNING β RUNNING β COMPLETED
β
FAILED
β
(retry or cancel)
Monitor workflow progress:
# Get workflow status
coderclaw agent --message "What's the status of workflow abc-123?" --thinking low
# Via tool
workflow_status workflowId:abc-123-def
Results from all agents are aggregated into a structured summary:
{
"workflowId": "abc-123-def",
"status": "completed",
"totalTasks": 4,
"completedTasks": 4,
"results": {
"architecture-advisor": {
"status": "completed",
"summary": "Proposed JWT-based authentication",
"artifacts": ["design-doc.md"]
},
"code-creator": {
"status": "completed",
"summary": "Implemented authentication endpoints",
"artifacts": ["auth.ts", "middleware.ts"]
},
"test-generator": {
"status": "completed",
"summary": "Created 15 tests with 95% coverage",
"artifacts": ["auth.test.ts"]
},
"code-reviewer": {
"status": "completed",
"summary": "1 minor issue found (consider rate limiting)",
"artifacts": ["review-notes.md"]
}
}
}
Purpose: Produce a PRD, architecture specification, and ordered task list before writing any code. Use this at the start of any major feature or project so every agent downstream has a shared, written plan.
Agent Flow:
Architecture Advisor (PRD) β Architecture Advisor (Spec) β Architecture Advisor (Task Breakdown)
Execution:
Usage:
coderclaw agent --message "Plan a real-time collaboration feature" --thinking high
Or via tool:
orchestrate workflow:planning goal:"Add real-time collaboration to the editor"
Example Output:
Workflow: Planning
ββ [β] Architecture Advisor (PRD): Requirements documented
β ββ Artifacts: prd-realtime-collab.md
ββ [β] Architecture Advisor (Spec): Architecture defined
β ββ Artifacts: architecture-realtime-collab.md
ββ [β] Architecture Advisor (Tasks): Work items created
ββ 12 tasks across 4 milestones, all dependencies mapped
Purpose: Have one agent propose a design and a second agent critique it for gaps and blind spots, then synthesize the final version. No external tool required.
Agent Flow:
Architecture Advisor (Proposal) β Code Reviewer (Critique) β Architecture Advisor (Revised)
Execution:
Usage:
coderclaw agent --message "Adversarially review the API authentication design" --thinking high
Or via tool:
orchestrate workflow:adversarial-review subject:"API authentication design"
Example Output:
Workflow: Adversarial Review
ββ [β] Architecture Advisor: Initial proposal complete
β ββ Proposed: OAuth 2.0 + PKCE with short-lived JWTs
ββ [β] Code Reviewer: Critique complete
β ββ Found: No refresh-token rotation, missing rate limiting, unclear error codes
ββ [β] Architecture Advisor: Revised proposal complete
ββ All 3 gaps addressed, final spec saved to adversarial-review.md
CoderClaw stores session context in .coderClaw/sessions/ so any agent session can pick up exactly where the last one stopped β no need to replay history or re-explain the project.
At the end of a session, save a handoff:
coderclaw agent --message "Save a session handoff for what we accomplished today" --thinking low
The agent writes a YAML file to .coderClaw/sessions/<session-id>.yaml containing:
summary β one-paragraph description of what was donedecisions β key choices madenextSteps β concrete follow-on tasksopenQuestions β unresolved itemsartifacts β files or docs producedAt the start of the next session, the agent automatically loads the latest handoff:
coderclaw agent --message "Resume from the last session" --thinking low
CoderClaw reads .coderClaw/sessions/ and surfaces the most recent handoff as starting context.
Good:
"Implement JWT-based authentication with refresh tokens"
"Fix memory leak in parser cleanup logic"
"Refactor API layer to reduce coupling"
Bad:
"Add auth" (too vague)
"Fix bug" (no context)
"Make it better" (unclear goal)
Tasks without dependencies run in parallel:
[
{ role: "test-generator", task: "Create tests", dependsOn: ["implement"] },
{ role: "code-reviewer", task: "Review code", dependsOn: ["implement"] },
];
// Both run simultaneously after "implement" completes
Save successful custom workflows for reuse:
# .coderClaw/workflows/api-development.yaml
name: api-development
description: Complete API development workflow
steps:
- role: architecture-advisor
task: Design API
- role: code-creator
task: Implement API
dependsOn: [Design API]
# ... rest of steps
Define project-specific workflow patterns in .coderClaw/workflows/:
# .coderClaw/workflows/pr-review.yaml
name: pr-review
description: Automated PR review workflow
steps:
- role: code-reviewer
task: Review code for quality and security
- role: test-generator
task: Check test coverage and add missing tests
dependsOn: [Review code for quality and security]
- role: documentation-agent
task: Update documentation if needed
dependsOn: [Review code for quality and security]
Load and execute:
coderclaw agent --message "Run PR review workflow for the latest changes"
CoderClaw workflows can be integrated into CI/CD pipelines:
name: CoderClaw Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install CoderClaw
run: npm install -g coderclaw
- name: Run Review Workflow
run: |
coderclaw init
coderclaw agent --message "Review PR changes" > review.txt
- name: Comment on PR
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const review = fs.readFileSync('review.txt', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: review
});
Planned workflow features:
CoderClawβs workflow patterns enable:
Choose built-in patterns for common scenarios or define custom workflows for project-specific needs.