WORKFLOW

How to write a task an AI coding agent can finish

How to write a task an AI coding agent can finish: one outcome, a scope, dependencies, completion criteria and the check that proves them.

The short answer to how to write a task an AI coding agent can finish is to give it five things: one outcome, a scope, the dependencies it relies on, explicit completion criteria and the check that proves them. Agents rarely stall because they cannot write the code. They stall, or overrun, because nothing told them where the task ends. Without an end, a session stops when the output looks plausible, or keeps going into neighboring code because that looked related too. A finishable task reads like a short contract: what should be different afterwards, where the agent may work, what it can assume, and how both of you will know it is done. This article shows each part, a weak and a strong version of the same task, and the habits that make a well-meant task unfinishable. It pairs with giving each task bounded context, which covers what the agent should read alongside the task.

The five parts of a finishable task

Outcome. One observable change, written as behavior: checkout totals truncate fractional cents, rather than improve the money code. If you need the word and to describe the outcome, you probably have two tasks.

Scope. The files or modules the agent may change, and the ones it must not. Naming what is out of scope matters most when a shared module sits nearby.

Dependencies. What must already be true, such as a helper that exists or a migration that has run, and what else relies on the code being changed. Agents do not know which other features import a shared function unless you tell them or they search for it.

Completion criteria. Two to five statements a reviewer can check, each one observable: a test exists and passes, an endpoint returns a field, an unchanged module still behaves the same.

The check. The exact command that proves the criteria, usually the project's test command plus the specific new tests. A criterion with no check is a hope, and the agent will report it as met anyway.

A weak task and a strong one

Weak: Fix the rounding bug in checkout and tidy up the money helpers.

This invites the agent to edit the shared helper, because that is where rounding lives, and nothing tells it who else uses the helper. A disposable test project from BRAIN FLUID's development shows how that goes. A scripted change turned round(value * 100) into int(value * 100) inside a shared cents() helper. The checkout check total(1.239) == 123 passed. The CSV export check row(1.235) == "124" failed with "123", because the export also imported the helper and that relationship had never been written down.

Strong: Outcome: checkout totals truncate fractional cents. Scope: src/checkout/total.py and tests/test_checkout.py. Out of scope: src/money.py, which the CSV export also uses. Depends on: the existing cents() helper, unchanged. Done when: a new test, test_total_truncates, passes, the export tests pass unchanged, and the full suite passes. Check: the project test command.

The strong version is a few lines longer and removes the most likely wrong turn. It also hands the reviewer a list to tick.

Write the check before the agent runs

A check is only useful if it fails before the change and passes after it. Run it against the untouched code first. If it already passes, it proves nothing about the task. In a benchmark run on development builds, each of six synthetic coding tasks had an independent correctness check that failed on the untouched fixture, and all 24 counted runs passed it afterwards. That is the pattern to copy: the check exists, has been seen to fail, and does not depend on the agent's description of its own work.

The second rule is that the agent's report is not the check. In the same development build testing as the rounding example, a completion report asserting a pass was accepted on one route while the app still failed a test [D1]. In a later development build, owner-configured checks run independently, and with the broken code the card stayed in VERIFY despite the agent's passing claim [D3]. Whatever tool you use, run the check yourself or have something other than the agent run it. For choosing how much checking a task deserves, see proportionate checks.

Size, stop conditions and what to leave out

Size a task so that you can review its diff in one sitting. If the completion criteria grow past five items, or the scope crosses more than one module boundary, split it and record the order between the parts.

Tell the agent when to stop and ask instead of guessing: when the change would touch an out-of-scope file, when a test outside the task starts failing, or when two reasonable designs exist and the task does not choose between them. Knowing when an agent should stop and ask covers this in more depth.

Tell it what to do with discovered work: write it down as a follow-up, do not do it. Otherwise a task to fix one bug turns into a refactor nobody asked for.

Leave out the history. A task does not need the story of how the bug was found or a pasted chat transcript. Link to the decision record if one exists and state the decision in one line. Long background makes the outcome harder to find and gives the agent more material to misread.

HOW BRAIN FLUID DOES IT

In BRAIN FLUID, the five parts live on a project card: objective, dependencies, scope and completion criteria are created and edited there [C1a]. Assignee, reviewer, due date, blocker and dependency details sit with the same planning record [N03]. The scope you propose is kept separate from approved execution authority, so writing a task does not authorize an agent to run it [N09]. When an agent starts, bounded task context can be assembled from the card's dependencies and relevant notes, with omissions disclosed [N11]. Work runs through verification gates and the recorded outcome stays with the card [C4]. In development builds after v1.8.5, an owner-configured verification profile runs the required checks itself before a card can complete, so an agent's own receipt cannot satisfy the gate [D3].

D1 Card workflow reporting (development build)
In development builds after v1.8.5, a card-bound coding session can report start, progress, blockers, readiness, completion, reopening and discovered work through controlled card operations, with findings and next steps written to the card. Evidence: Development build (1.8.5 workflow RC2, October 30, 2026): 9 packaged workflow tests; Claude Code 2.1.314 and Codex CLI 0.164.0 each completed a small rehearsal on a disposable workspace. Not in the v1.8.5 candidate.
D3 Independent completion checks (development build)
In development builds, an owner-configured verification profile runs the required checks itself before a card can be completed; an agent cannot satisfy the gate with its own receipt. Evidence: Development build (autonomy phase 1 RC3, October 30, 2026): deterministic tests with a scripted agent and real check execution. Not in the v1.8.5 candidate.
C1a Board and card actions
Create project cards, edit their details, and track work through the board. Evidence: Owner-observed creation and moves; source-reviewed editing
N03 Planning and My Work
Keep assignee, reviewer, due-date, blocker and dependency details with project planning, and use My Work to focus attention. Evidence: Implemented; source and plan records
N09 Execution grants
Keep proposed card scope separate from approved execution authority. Evidence: Implemented; final authority/revocation tests retained
N11 Task context
Assemble bounded task context with dependencies, relevant notes and disclosed omissions. Evidence: Source and retained context evidence
C4 Harness gates and usage
Run work through verification gates and keep recorded attempts, outcomes and reported usage with the work. Evidence: Implemented; source and retained usage evidence

QUESTIONS

How long should a task description for an AI coding agent be?
Usually five to fifteen lines: one outcome, a scope list, dependencies, two to five completion criteria and the check command. Shorter than that and something important is usually missing, often the out-of-scope list. Much longer and the outcome gets buried in background. Put history in a linked record and keep the task itself about what must be true when it is done.
Should I tell an AI agent which tests to run?
Yes. Name the exact command and the specific new tests, and say that the full suite must pass too. Agents left to choose tend to run the narrowest test that covers their change, which is how a regression in another feature slips through. Run the command yourself on the untouched code first, so you know the new tests fail before the change.
What should an AI agent do with extra work it finds during a task?
Record it and leave it. The task should say that discovered work becomes a follow-up note or a new task with its own scope and check, not an addition to the current diff. That keeps the diff reviewable and the completion criteria meaningful. You decide later whether the follow-up is needed, duplicates something that exists or can wait.

RELATED GUIDES

RELATED HARNESS PAGES

BRAIN FLUID AI HARNESS

COMING SOON

Verified against the v1.8.5 development candidate (October 30, 2026 build) (reviewed October 30, 2026)

Free Windows software, not released yet. The download opens on the product page when the release is approved, with nothing to sign up for.

ABOUT BRAIN FLUID READ THE GUIDES GET INVOLVED

ALL HARNESS PAGES ALL GUIDES