State-machine-driven agentic workflow for automated software development.
OpenClaw DevEngine orchestrates multiple AI agents to handle the complete software development lifecycle: Analysis, Planning, Implementation, Verification, and Documentation.
- ποΈ Architect Agent β Breaks down goals into atomic file-level tasks
- π· Builder Agent β Generates complete, production-ready code
- π Auditor Agent β Creates comprehensive tests and verifies code
- π§ Fixer Agent β Self-heals code based on test failures
- π Scribe Agent β Generates documentation
- β‘ Parallel Execution β Tasks run concurrently when dependencies allow
- πΎ Checkpointing β Resume from failures without losing progress
- π― Error Classification β Smart error categorization for targeted fixes
- π Event System β Real-time progress tracking and monitoring
npm install openclaw-dev-engineOr install globally for CLI access:
npm install -g openclaw-dev-engine# Set your API key
export OPENAI_API_KEY=your-api-key
# Create a new project
dev-engine "Create a REST API with Express and TypeScript"
# Extend existing project
dev-engine "Add user authentication" ./my-project
# Resume from checkpoint
dev-engine "Create a todo app" --resume
# Verbose mode with detailed logging
dev-engine "Build a CLI tool" --verbose
# Specify concurrency and model
dev-engine "Create a React app" --concurrency 5 --model gpt-4| Option | Short | Description |
|---|---|---|
--help |
-h |
Show help message |
--version |
-v |
Show version number |
--verbose |
-V |
Enable verbose output |
--resume |
-r |
Resume from last checkpoint |
--concurrency <n> |
-c |
Max parallel tasks (default: 3) |
--model <name> |
-m |
LLM model to use |
import { DevEngine } from 'openclaw-dev-engine';
import { OpenClawAdapter } from 'openclaw-dev-engine/adapters';
const adapter = new OpenClawAdapter(process.env.OPENAI_API_KEY);
const engine = new DevEngine(adapter, {
maxConcurrency: 3,
verbose: true,
enableCheckpoints: true
});
// Subscribe to events
engine.events.on('task:complete', async (e) => {
console.log(`Completed: ${e.data.taskId}`);
});
// Track progress
engine.progress.onProgress((p) => {
console.log(`${p.percentage}% complete`);
});
// Execute
const result = await engine.run('Create a REST API');
console.log(result);import { DevEngine } from 'openclaw-dev-engine';
import { SkillContext } from 'openclaw-dev-engine/interfaces';
const engine = new DevEngine(openclawAdapter);
const result = await engine.execute({
adapter: openclawAdapter,
parameters: {
goal: 'Create a React component library',
resume: false
},
workingDirectory: process.cwd()
});
if (result.success) {
console.log('Generated files:', result.artifacts);
} else {
console.error('Failed:', result.error);
}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DevEngine (ISkill) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Architect ββ β Builder ββ β Auditor ββ β Scribe β β
β β (Planning) β β (Code) β β (Test) β β (Docs) β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ βββββββββββββββ β
β β β β
β ββββββββββββββββββββββββββββββββ β
β β Fixer β β
β β (Self-Healing Loop) β β
β ββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β TaskScheduler β β
β β β’ DAG-based execution β’ Concurrency control (Semaphore) β β
β β β’ Dependency resolution β’ Retry with backoff β β
β β β’ Priority scheduling β’ Circular dependency detection β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββ β
β β StateManager β β InterfaceExtractβ β ErrorClassifier β β
β β (Checkpointing) β β (AST-based) β β (10 Categories) β β
β ββββββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β EngineEventEmitter β β
β β β’ Typed events β’ Progress tracking β β
β β β’ Event history β’ Filtered streams β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IEnvironmentAdapter β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββββββ β
β β ILLMProviderβ β IFileSystem β βIShellAdapterβ β IImageAdapterβ β
β β (streaming) β β (enhanced) β β(test runner)β β (optional) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Option | Type | Default | Description |
|---|---|---|---|
maxConcurrency |
number | 3 | Maximum parallel tasks |
maxRetries |
number | 3 | Retry attempts per task |
enableCheckpoints |
boolean | true | Enable state persistence |
checkpointDir |
string | .openclaw/state |
Checkpoint directory |
verbose |
boolean | false | Enable verbose logging |
testTimeout |
number | 60000 | Test execution timeout (ms) |
| Option | Type | Default | Description |
|---|---|---|---|
model |
string | gpt-4-turbo-preview |
LLM model to use |
baseUrl |
string | OpenAI API | LLM API endpoint |
basePath |
string | process.cwd() |
Working directory |
logPrefix |
string | OpenClaw |
Log message prefix |
The engine emits typed events for monitoring:
// Phase lifecycle
engine.events.on('phase:start', async (e) => {
console.log(`Phase: ${e.data.phase}`);
});
// Task lifecycle
engine.events.on('task:start', async (e) => {
console.log(`Starting: ${e.data.taskId}`);
});
engine.events.on('task:complete', async (e) => {
console.log(`Done: ${e.data.taskId} in ${e.data.duration}ms`);
});
engine.events.on('task:failed', async (e) => {
console.error(`Failed: ${e.data.taskId} - ${e.data.error}`);
});
// Checkpoints
engine.events.on('checkpoint:saved', async (e) => {
console.log(`Saved: ${e.data.planId}`);
});
// LLM calls
engine.events.on('llm:request', async (e) => {
console.log(`LLM call: ${e.data.tokens} tokens`);
});Implement custom adapters for different environments:
import {
IEnvironmentAdapter,
IFileSystem,
IShellAdapter,
ILLMProvider,
ILogger
} from 'openclaw-dev-engine/interfaces';
class MyCustomAdapter implements IEnvironmentAdapter {
fs: IFileSystem = new MyFileSystem();
shell: IShellAdapter = new MyShell();
llm: ILLMProvider = new MyLLMProvider();
logger: ILogger = new MyLogger();
log(message: string, level = 'info') {
this.logger.log(level, message);
}
}
const engine = new DevEngine(new MyCustomAdapter());The engine automatically classifies errors and applies targeted fix strategies:
| Category | Examples | Fix Strategy |
|---|---|---|
syntax |
Missing brackets, invalid tokens | Check syntax structure |
type |
Type mismatches, missing types | Fix type annotations |
import |
Module not found, wrong path | Correct import paths |
runtime |
Null access, undefined vars | Add defensive checks |
assertion |
Test failures | Fix implementation or test |
timeout |
Hanging tests | Add async handling |
permission |
Access denied | Check file permissions |
resource |
File not found | Verify paths exist |
network |
Connection refused | Mock network calls |
# Run all tests
npm test
# Run unit tests only (mocked services)
npm run test:unit
# Run integration tests (mocked services)
npm run test:integration
# Run with coverage
npm run test:coverage
# Watch mode
npm run test:watchBenchmarks test against real services and require API keys:
# Dry run (no API calls)
npm run benchmark:dry
# Run all benchmarks (costs $$$)
npm run benchmark
# Speed benchmarks only
npm run benchmark:speed
# Quality benchmarks only
npm run benchmark:qualitySee benchmarks/README.md for details.
# Clone repository
git clone https://github.com/openclaw/dev-engine
# Install dependencies
npm install
# Build
npm run build
# Type check
npm run typecheck
# Lint
npm run lintsrc/
βββ index.ts # Main exports
βββ cli.ts # CLI entry point
βββ interfaces/ # TypeScript interfaces
βββ core/ # Core engine components
β βββ DevEngine.ts # Main orchestrator
β βββ TaskScheduler.ts # DAG execution
β βββ StateManager.ts # Checkpointing
β βββ InterfaceExtractor.ts # AST extraction
β βββ ErrorClassifier.ts # Error categorization
β βββ EventEmitter.ts # Event system
βββ adapters/ # Environment adapters
βββ skills/ # Prompt templates
tests/
βββ mocks/ # Mock adapters
βββ unit/ # Unit tests
βββ integration/ # Integration tests
benchmarks/
βββ suites/ # Benchmark implementations
βββ results/ # Benchmark outputs
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
Yes* | OpenAI API key |
OPENCLAW_KEY |
Yes* | Alternative key name |
*One of these is required.
MIT
Contributions welcome! Please read our contributing guidelines before submitting PRs.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request