A fault-tolerant workflow system for AI agent orchestration in software development. CLAWS coordinates multiple AI agents under human supervision to build software with high quality standards.
- Overview
- Architecture
- Quick Start
- Workflow
- CLI Reference
- Specialist Roles
- Gate System
- Session Management
- Directory Structure
- Core Principles
CLAWS enforces engineering discipline through structure and behavioral norms rather than hoping agents "do the right thing." The system provides:
- Orchestrator-Worker Architecture: A central orchestrator (Claude) dispatches tasks to isolated specialist workers
- Phase-Gated Workflows: Tasks must pass automated and manual gates before advancing
- Fault Tolerance: Every state is inspectable; violations are logged for pattern analysis
- Worktree Isolation: Each task gets its own git worktree for parallel development
- Review Requirements: Multi-pass reviews for scope, design, and code
- Session Continuity: Handoff system for maintaining context across sessions
Human User
β
β (scope approval, design collaboration, rare review)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ORCHESTRATOR (Claude) β
β β
β - Interprets human intent β
β - Decomposes specs into tasks (via Planning Agent) β
β - Assigns specialists to tasks β
β - Enforces phase gates β
β - Coordinates merges β
β - Triggers batch jobs (E2E, docs) β
β - Escalates blockers to human β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β (dispatch 1-6 concurrent task agents)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WORKER AGENTS β
β β
β - Specialized by domain (implementer, reviewer, etc.) β
β - Isolated in worktrees (cannot see each other's work) β
β - Cannot communicate with each other β
β - Report back only on completion β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
.claude/bin/claws-initCreates the SQLite database at .claude/claws.db with all required tables and default gate definitions.
.claude/bin/claws-statusShows system health, tasks by phase, counters, and any violations.
# Create a task
.claude/bin/claws-task create TASK-001 "Implement user authentication"
# Create a worktree for it
.claude/bin/claws-worktree create TASK-001All tasks follow a unified workflow:
SCOPE β DESIGN β CODE β REVIEW β TEST β MERGE β VERIFY β DONE
| Phase | What Happens | Gate Requirements |
|---|---|---|
| SCOPE | Define what to build or fix | 2 scope reviews |
| DESIGN | Technical proposal | Proposal exists, 2 design reviews |
| CODE | Implementation | Tests pass, linter clean, types clean, code exists |
| REVIEW | Peer review | 2 code reviews |
| TEST | Full test suite | All tests pass |
| MERGE | Integrate to main | Changelog entry exists |
| VERIFY | Final verification on main | Manual verification |
| DONE | Complete | - |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WORKFLOW β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Create Task Create Worktree
β β
βΌ βΌ
βββββββββββββββ 2Γ review βββββββββββββββ proposal + βββββββββββββββ
β SCOPE βββββββββββββββΆβ DESIGN βββ2Γ reviewββββΆβ CODE β
β β β β β β
β Define what β β Technical β β Implement β
β to build β β proposal β β + tests β
βββββββββββββββ βββββββββββββββ ββββββββ¬βββββββ
β
tests, linter, types pass
β
βΌ
βββββββββββββββ all tests βββββββββββββββ 2Γ review βββββββββββββββ
β TEST ββββββββββββββββ REVIEW βββββββββββββββββ (ready) β
β β pass β β β β
β Full suite β β Peer review β β β
ββββββββ¬βββββββ βββββββββββββββ βββββββββββββββ
β
β changelog exists
βΌ
βββββββββββββββ merge to βββββββββββββββ verified βββββββββββββββ
β MERGE βββββmainββββββΆβ VERIFY ββββββββββββββββΆβ DONE β
β β β β β β
β Worktree β β On main β β Complete β
β cleaned up β β branch β β β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
# Create task
.claude/bin/claws-task create <id> <title> [--spec <spec_id>]
# List tasks
.claude/bin/claws-task list [--phase <phase>] [--spec <spec_id>]
# Show task details
.claude/bin/claws-task show <id>
# Update task
.claude/bin/claws-task update <id> --specialist <role>
.claude/bin/claws-task update <id> --blocked-by <task_id>
# Transition to next phase (runs gate checks automatically)
.claude/bin/claws-task transition <id> <to_phase>
# Delete task
.claude/bin/claws-task delete <id># Create isolated worktree
.claude/bin/claws-worktree create <task_id>
# List all worktrees
.claude/bin/claws-worktree list
# Merge to main and cleanup
.claude/bin/claws-worktree merge <task_id>
# Remove without merging
.claude/bin/claws-worktree remove <task_id># List all gates
.claude/bin/claws-gate list
# Run gate check for a transition
.claude/bin/claws-gate check <task_id> <transition>
# Example: .claude/bin/claws-gate check TASK-001 CODE-REVIEW# Record a review
.claude/bin/claws-review record <task_id> <artifact_type> <result> [--issues "..."]
# artifact_type: scope, design, code
# result: approved, changes_requested
# Check review status
.claude/bin/claws-review check <task_id> <artifact_type>
# List reviews for a task
.claude/bin/claws-review list <task_id>
# Clear reviews (restart cycle)
.claude/bin/claws-review clear <task_id> [<artifact_type>]# Get role prompt
.claude/bin/claws-worker prompt <role>
# Get full context (role + task info)
.claude/bin/claws-worker context <task_id> <role>
# List available roles
.claude/bin/claws-worker roles.claude/bin/claws-status # Full overview
.claude/bin/claws-status health # Health check
.claude/bin/claws-status tasks # Tasks by phase
.claude/bin/claws-status gates # Gate definitions
.claude/bin/claws-status counters # System counters
.claude/bin/claws-status violations # Recent violations.claude/bin/claws-counter list
.claude/bin/claws-counter get <name>
.claude/bin/claws-counter set <name> <value>
.claude/bin/claws-counter reset <name>.claude/bin/claws-backup create [name]
.claude/bin/claws-backup auto # Rotating backup
.claude/bin/claws-backup list
.claude/bin/claws-backup restore <name>CLAWS uses 7 parameterized specialist roles:
| Role | Description |
|---|---|
planning |
Decompose specs into sized tasks |
architect |
Design and technical proposals |
implementer |
All implementation (backend, frontend, infra, ai-dl) |
reviewer |
All reviews (scope, design, code) |
bug-investigator |
Root cause analysis with differential diagnosis |
validator |
QA, E2E testing, documentation, verification |
Each role has a detailed prompt in .claude/roles/. All roles inherit behavioral norms from .claude/roles/_base.md.
Gates are automated checks defined in the database. Each transition has specific requirements:
| Transition | Gates |
|---|---|
| SCOPE β DESIGN | 2 scope reviews |
| DESIGN β CODE | Proposal exists, 2 design reviews |
| CODE β REVIEW | Tests pass, linter clean, types clean, code exists |
| REVIEW β TEST | 2 code reviews |
| TEST β MERGE | Full test suite passes |
| MERGE β VERIFY | Changelog entry exists |
| VERIFY β DONE | Manual verification |
Gates are stored in the gates table and can be customized per project:
SELECT transition, gate_type, gate_value, description FROM gates;| Type | Description |
|---|---|
script |
Run a shell script (e.g., check_tests.sh) |
reviews |
Require N approved reviews (format: artifact:count) |
file_exists |
Check file exists (supports globs) |
code_exists |
Check for code changes in src/tests |
manual |
Manual verification required |
Use the /wrapup command:
/wrapup # Archive session
/wrapup continue # Handoff for next session
# Save session handoff (archived, no continuation)
cat <<'EOF' | .claude/bin/claws-session wrapup
# Session Handoff
...
EOF
# Save with continuation flag
cat <<'EOF' | .claude/bin/claws-session wrapup --continue
# Session Handoff
...
EOF
# Check for pending handoff
.claude/bin/claws-session pending
# Mark handoff as resumed
.claude/bin/claws-session resumeRun .claude/bin/claws-status to:
- Check for pending handoffs
- Display handoff content
- Show current system state
.claude/
βββ bin/ # CLI scripts
β βββ claws-init
β βββ claws-status
β βββ claws-task
β βββ claws-worktree
β βββ claws-gate
β βββ claws-worker
β βββ claws-review
β βββ claws-counter
β βββ claws-backup
β βββ claws-session
β βββ claws-common.sh
βββ gates/ # Gate check scripts
β βββ check_tests.sh # Python + Node.js
β βββ check_linter.sh
β βββ check_types.sh
β βββ check_todos.sh
β βββ check_orphans.sh
βββ roles/ # Worker role definitions
β βββ _base.md # Shared behavioral norms
β βββ planning.md
β βββ architect.md
β βββ implementer.md
β βββ reviewer.md
β βββ bug-investigator.md
β βββ validator.md
βββ templates/
β βββ bug-report.md
βββ commands/
β βββ wrapup.md
βββ backups/
βββ claws.db
βββ CLAWS_DESIGN.md
- Every state is inspectable (database, worktrees, artifacts)
- Phase gates are the enforcement mechanism
- Violations are logged for pattern analysis
- If main is broken, no new merges until fixed
- Merge lock activates when E2E fails
- If a gate fails, the worker fixes it
- No passing broken work to the next phase
HEALTHY DEGRADED
β β
β E2E fails β E2E passes
β β
βΌ βΌ
βββββββββββ ββββββββββββ
β Normal βββββββββββββββΆβ Merge β
β flow β β locked β
βββββββββββ ββββββββββββ
When E2E fails:
merge_lockcounter set to 1- New merges blocked
- Bug investigation triggered
- Once fixed, counter reset
- Design Document:
.claude/CLAWS_DESIGN.md - Role Definitions:
.claude/roles/*.md - Gate Scripts:
.claude/gates/*.sh