autonomous-dev — A Development Harness for Claude Code

A harness that wraps Claude Code with enforcement, specialist agents, and alignment gates to deliver consistent, production-grade software engineering outcomes.
A harness is the software and structure that wraps an AI model to keep it on track — the prompts, tools, feedback loops, constraints, and validation that turn a capable but undisciplined model into a reliable system. Without a harness, the model is a wild horse with raw power but no direction. With one, that power is controlled, directed, and accountable.
What Is This?
The problem: Claude Code is brilliant at execution but unreliable at process. It skips tests, declares "good enough" on failing code, bypasses security reviews, and drifts from your project's intent. Not out of malice — it's trained to complete tasks, not follow engineering discipline. Prompt-level instructions ("please run tests") get ignored under context pressure.
The solution: autonomous-dev is a harness that enforces the full software development lifecycle:
- You define your project in a file called PROJECT.md - your goals, what's in/out of scope, constraints, architecture
- You track work in GitHub Issues - each feature or bug is an issue
- You run one command -
/implement "#72"
- Claude executes a full development pipeline - research, planning, acceptance tests, implementation, code review, security scan, documentation
- Claude stays aligned - if a feature doesn't fit your PROJECT.md scope, it's blocked before any code is written
In short: You define the rules once. The harness enforces them for every feature.
What Does It Actually Do?
When you type /implement "#72", Claude coordinates specialist agents through a 15-step pipeline (the default full mode). The step numbers below are the real STEP N/15 ids you'll see in the run output and logs:
| Step | Stage | What It Does |
|---|
| 1–2 | pre-flight + alignment | Blocks pre-staged files; a two-stage gate checks the feature against PROJECT.md — a deterministic pre-check, then the alignment-classifier agent (Haiku) classifies and cites the governing PROJECT.md clause (verified verbatim). Out of scope or ambiguous → blocked/escalated before any code, not decided by the coordinator itself. |
| 3–4 | researcher (×2, parallel) | researcher-local (Haiku, codebase) + researcher (Sonnet, web) find patterns, best practices, existing solutions |
| 5 | planner (Opus) | Designs the architecture and a file-by-file implementation plan |
| 5.5 | plan-critic (Sonnet) | Adversarial single-pass review across 4 axes (assumption audit, existing-solution search, minimalism, operational-integration test). Verdict PROCEED / REVISE / BLOCKED; REVISE re-invokes the planner. Plus structural validation of the plan. |
| 6 | acceptance tests | Writes acceptance tests that define what "done" means (acceptance-first default) |
| 8 | implementer (Opus) + test gate | Writes code + unit tests. HARD GATES: 0 test failures, no stubs, bug-fix regression test required, planned-vs-implemented file alignment (blocks >50% divergence) |
| 8.5 | spec-validator (Opus) | Spec-blind behavioral validation — writes tests from acceptance criteria without seeing the implementation, then validates against it |
| 9–9.5 | registration + agent-count gates | Verifies new hooks are registered; blocks if required pipeline agents haven't run |
| 10 | reviewer + security-auditor + doc-master | Run in parallel for low-risk changes; sequential (reviewer → security) on security-sensitive paths. Review across 6 dimensions; OWASP scan; doc-drift check |
| 11 | remediation gate | Blocking findings loop back to the implementer, max 2 cycles, then block-and-file |
| 12.5 | continuous-improvement-analyst | Examines the session for drift, bypasses, gaming — dispatched before commit (#1211) |
| 13–15 | git + doc-congruence + cleanup | Commit (blocked until agents complete), push, close issue; documentation-congruence HARD GATE; state cleanup |
One command. Full software development lifecycle. Aligned to your project.
Why Use This?
Without a harness:
- You ask Claude to build a feature
- Claude makes assumptions about your architecture
- It skips tests when context gets long (context anxiety)
- It approves its own work as "good enough" (poor self-evaluation)
- You review the code, find issues, ask for fixes
- Repeat until it's acceptable
- Hope you didn't introduce security issues
With autonomous-dev:
- You define your project once (PROJECT.md)
- You create a GitHub issue for each feature
- You run
/implement "#X"
- The harness enforces every step — research, planning, testing, implementation, adversarial review, security audit, documentation
- You review a complete, tested, documented, security-scanned result
The difference: Claude stops guessing. The harness keeps it honest.
Four-Layer Harness Architecture
autonomous-dev enforces process through four layers, each addressing a different failure mode — enforce now, add intelligence, learn from the session, then evolve:
-
1. Hooks (deterministic enforcement) — Run on every tool call, commit, and prompt. Hard gates that can't be argued with: tests must pass with 0 failures before code review starts, no stubs or placeholders allowed, security scan is mandatory, documentation must stay in sync. Functional infrastructure (agents/, hooks/, lib/, commands/) is write-protected outside the pipeline, and a dispatch sentinel keeps the coordinator from directly editing those paths mid-pipeline — it must re-dispatch the implementer agent (#1296). These are the harness equivalent of guardrails — if the model tries to skip a step, it's physically blocked.
-
2. Agents (adversarial evaluation) — Each pipeline step is handled by a specialist agent with a specific job and constrained tools. The implementer never reviews its own work — a separate reviewer agent with a skeptical mandate evaluates it (generator/evaluator pattern). Skills power this layer: instead of stuffing every rule into context upfront, domain knowledge is injected progressively — testing standards load during test writing, security patterns during security review — keeping each agent focused within its current step.
-
3. Continuous Improvement (post-session, self-correcting) — Every session logs JSONL to .claude/logs/activity/. The continuous-improvement-analyst evaluates those logs against PROJECT.md + CLAUDE.md and emits structured finding records; /improve --auto-file promotes recurring findings into GitHub issues labeled auto-improvement. Runs asynchronously, never blocks active work. (This is the layer that, earlier today, caught this very session's gate mis-scopes and filed #1385/#1387/#1388.)
-
4. Autonomous Self-Improvement (closed-loop, evidence-driven) — /triage clusters the improvement queue by root cause → /drain-queue (and the scheduled cloud-drain) works it through /implement --issues behind safety guardrails → benchmarks gate whether a change is kept or reverted. Effectiveness benchmarks measure reviewer/agent accuracy; HIGH-confidence diagnoses are applied autonomously, the rest filed as issues.
The result: Every feature goes through every step — not because Claude remembers to, but because the harness won't let it skip — and the harness itself gets better every week from its own runtime data.
Recent Improvements
Substantial enforcement hardening shipped recently. Current focus areas:
- Mode- and intent-aware enforcement — hooks respect the active pipeline mode (
full / light / fix / tdd-first) so a --light run isn't held to the full agent set, and an intent/session-mode classifier scopes the SDLC gates to actual software-development edits (not scratch/exploration/meta-work). The gate also short-circuits message-only git commit --amend — context-aware gating, not surface-signal gating
- Default-ON global enforcement — the SDLC gates fire in every repo by default, opt out per-repo with
.claude/.bypass (Phase 1 polarity flip, #1142+/#1361)
- Autonomous operations loop —
/triage clusters the open improvement queue by root cause, /drain-queue drains it through /implement --issues behind safety guardrails, and a scheduled cloud-drain runs the same loop unattended. Cross-machine issue claiming (a GitHub in-progress label + marker-comment mutex) stops a local run and the cloud drainer from racing the same cluster. /goa is a standing infra-health observer
- Planning workflow — 7-step
/plan + adversarial plan-critic review (1-5 Likert, composite ≥3.0 → PROCEED)
- Session analytics — every conversation archived to
~/.claude/archive/ with a 17-column SQLite index
- Closed-loop self-improvement — benchmark → modify → re-benchmark → commit-or-revert (see EVALUATION.md)
See CHANGELOG.md for complete release-over-release details with issue references.
The 12 Elements of Harness Engineering
The core insight of harness engineering: reliability in multi-step AI workflows is difficult because failures compound. A 10-step process with 90% accuracy per step fails over 60% of the time. "Agent skills" that are just prompts or markdown files — where you hope the AI follows instructions — lack the dependability required for production work.
The solution is deterministic rails: a software layer that gates and validates every stage. autonomous-dev implements all 12 elements of this framework:
| # | Element | How autonomous-dev implements it |
|---|
| 1 | State Machine | pipeline_state.py — 13-phase state machine with Step enum, advance()/complete_step() API, JSON-persisted state |
| 2 | Validation Loops | STEP 8 HARD GATE — runs pytest, loops until 0 failures/0 errors. Anti-stubbing gate blocks raise NotImplementedError() shortcuts |
| 3 | Isolated Sub-Agents | Specialist agents, each spawned with fresh context and constrained tools. Model selection per agent (Haiku/Sonnet/Opus) |
| 4 | Virtual File System | Git worktree isolation for batch mode. checkpoint.py + artifacts.py persist outputs to .claude/artifacts/ per phase |
| 5 | Human-in-the-Loop | Plan mode (STEP 5) requires user approval before implementation. pause_controller.py for explicit gates |
| 6 | Hook Enforcement | 26 hooks with JSON {"decision": "block"} hard gates — not prompt-level nudges. Research-confirmed: nudges produce unreliable compliance. Includes plan_gate.py (blocks complex Write/Edit without validated plan) and Layer 6 prompt quality gate (blocks anti-pattern prompts to agents/*.md and commands/*.md) |
| 7 | State Persistence | CheckpointManager for resume after failure. batch_state_manager.py for multi-feature recovery. /implement --resume |
| 8 | Context Management | Progressive skill injection loads domain knowledge per-step. /clear between features. Agent isolation prevents context rot |
| 9 | Deterministic Ordering | agent_ordering_gate.py enforces pipeline sequence. "You MUST NOT run STEP 10 before STEP 8 test gate passes" |
| 10 | Output Validation | Parallel reviewer + security-auditor in STEP 10. genai_validate.py for LLM-as-judge tests. completion_verifier.py |
| 11 | Observability | session_activity_logger.py, conversation_archiver.py, pipeline_timing_analyzer.py. Structured JSONL + SQLite for long-term analytics |
| 12 | Error Recovery | failure_analyzer.py, batch_retry_manager.py, stuck_detector.py, qa_self_healer.py. Automatic retry with consent |
What's PROJECT.md?
A simple markdown file that defines your project. Example: