Featured image of post Agentic Harness Workflow: Taming AI Coding with an Engineered Workflow

Agentic Harness Workflow: Taming AI Coding with an Engineered Workflow

A phased, human-AI collaborative AI coding workflow framework that solves long-context drift through sub-agent division of labor and state persistence.

Agentic Harness Workflow: Taming AI Coding with an Engineered Process

Core Event: Agentic Harness Workflow is an engineering framework developed by the author that breaks down AI coding tasks into a linear pipeline of 12 stages. Each stage is handled by a dedicated sub-agent, while the main agent (Manager) oversees scheduling and state management. Human confirmation gates are retained at key checkpoints, and process state is persisted to a workflow-state.json file.

Key Facts:

  • Release Status: Self-developed open-source framework (no specific version number or pricing information)
  • Availability: The framework is provided as a directory template and supports direct deployment
  • Core Capabilities: State persistence, staged sub-agent division of labor, human-in-the-loop gate mechanism
  • Agent Topology: 1 main Manager + 10 independent sub-agents (init/specify/plan/tasks/test-plan/plan-review/implement/code-quality/e2e-run/commit-push)

Why Do We Need an Engineered Harness?

Why Do We Need an Engineered Harness?
Why Do We Need an Engineered Harness? | News Screenshot

The traditional single-agent approach has four major pain points:

  • Context bloat and result drift: Requirements, plans, code, and test logs all pile into the same context, making it easy for the agent to forget earlier agreements and deviate from the goal
  • Skipping engineering steps: Agents often jump straight into coding, skipping requirements clarification, design review, or test design
  • Unrecoverable process: After session compression, restart, or tool switching, it becomes difficult to determine current progress and pending tasks
  • Lack of human gates: A wrong direction may run all the way to completion, resulting in extremely high rework costs

The framework’s answer is not to build a smarter agent, but to give AI coding the same structure as software engineering itself: clearly defined processes, explicit handoff points, and mandatory approval steps.

Architecture Core Analysis

Architecture Core Analysis
Architecture Core Analysis | News Screenshot

12-Stage Lifecycle

Requirements proceed strictly in the following order:

1
init → specify → plan → tasks → test-plan → plan-review → implement → code-quality → e2e-run → human-acceptance → commit-push → archive

Among these, implement → code-quality → e2e-run forms the automated execution zone, supporting iterative fixes (e.g., returning to coding after a test failure). All other stages pause and wait for human confirmation before proceeding.

Manager: Single Source of State

The main session agent (Manager) wears three hats:

  • Scheduler: Determines the next-stage sub-agent based on state-graph.json
  • State steward: Exclusively writes to workflow-state.json, managing the project’s movement between active/process/archived directories
  • Translator: Converts the user’s natural language into structured instructions for sub-agents, and vice versa

Key design principle: The Manager never reads the body of any artifact (requirements documents, design plans, source code, test reports). It only reads the status (ok/needs_input/fail) and output.next_state fields in protocol responses. This ensures its context remains lightweight and stable even after a dozen or more stage cycles.

Sub-Agent Specialization

Each sub-agent has its responsibilities bounded by an independent Agent.md. A “referee and player separation” mechanism is specifically designed—technical design and review are handled by two different sub-agents, with the latter required to challenge the former’s assumptions rather than just confirming whether the process can run. This draws on the idea of adversarial testing.

General protocol response structure:

1
2
3
4
5
6
7
8
{
  "status": "ok | needs_input | fail",
  "output": {
    "conclusion": "accept | revise | request_human",
    "next_state": "optional rollback target stage",
    ...
  }
}

State Persistence and Recovery

The process does not rely on chat memory but writes to workflow-state.json. Key fields include:

  • current_state: Name of the current stage
  • pending: Pending items (forward/cleanup/rollback/acceptance keys)
  • states: Stage history, status, and artifact paths
  • review_findings: Issues found at gates and suggested rollback stages

This design supports tool switching (e.g., from Claude Code to Codex) and session restarts—a new agent can simply read the persisted state to resume execution.

Human-in-the-Loop Gate Points

Nine nodes explicitly require human confirmation:

  • specify: Requirements clarification confirmation
  • plan-review: Design plan review
  • human-acceptance: Acceptance before code commit
  • commit-push: Code review confirmation
  • init/tasks/test-plan/e2e-run: Pause for confirmation after completion

The purpose of each gate and its downstream target stage are recorded in workflow-state.json.

Practical Details and Isolation Mechanisms

Practical Details and Isolation Mechanisms
Practical Details and Isolation Mechanisms | News Screenshot

Directory Structure Specification

The workspace follows a clear organization:

1
2
3
4
5
6
7
8
<working directory>/
├── CLAUDE.md          # Framework entry point + project knowledge base index
├── .harness/
│   ├── rules/         # Rules: protocol/state schema/flow graph templates
│   ├── agents/        # 10 independent stage Agent.md files
│   └── active/        # Currently active requirements directory
├── .claude/skills/    # Pluggable capabilities (DB connections/card creation tools)
└── <business repo A>, <business repo B> # Independent git repositories

Each requirement has its own independent directory containing a dedicated workflow-state.json and git worktree, ensuring complete isolation when multiple requirements run in parallel.

Bounded Loop Engineering

When automated tests fail, the framework supports iterative fixes (e2e-run failure → return to implement), but loops are capped. Once the threshold is reached, the agent stops and offers three choices: continue fixing / pass through directly / request an explanation from the sub-agent.

Rollback Logic

All rollbacks follow a unified rule: the target must be a stage in state-graph.json that is already completed and upstream in position. The rollback reason is injected into the target sub-agent’s input, clarifying what it needs to supplement.

Who Should Use This

Who Should Use This
Who Should Use This | News Screenshot

  • Multi-tool collaborative teams: For example, teams mixing Claude Code and Codex—state persistence solves cross-session drift
  • Projects with formal review processes: Design reviews, test plan approvals, and code reviews naturally align with the framework’s checkpoints
  • Matching requirement granularity: Suitable for medium-to-large feature development, not recommended for tiny changes like single-line bug fixes
  • Start cautiously: Individuals or teams with loose processes can start with a subset of stages and simplify usage, then expand to the full process once familiar

Final Thoughts

Agentic Harness proves that the value of a structured process far exceeds that of a standalone agent’s capabilities. By enforcing handoffs, isolating state, and defining explicit human decision points, it transforms AI agents from solo performers into team members fighting in coordination, providing a practical reference paradigm for engineering AI coding.