AI coding agents do well on bounded tasks that follow a pattern the codebase already shows and give a quick pass or fail signal. They need a written spec when the task depends on a rule that lives in someone's head, a policy document or an older system and appears nowhere in the prompt or the code.
That line explains most of the mixed results teams report. This guide shows it on one small project in three trials: a task an agent handles well, the same agent on a task where it fills a gap with a guess and that task again with a spec and a test written first. It ends with five questions to ask before handing work to an agent and it is written for the architects, tech leads and engineering managers who choose and run these tools.
01A nine-second deletion and a rule that was already written
In April 2026 an AI coding agent deleted the production database of PocketOS, a software company serving car rental businesses, in one API call that took nine seconds. Euronews and Notebookcheck report that an agent built on one of the leading coding harnesses and a state-of-the-art model was handling a routine task in a staging environment when it hit a credential mismatch. It chose to fix the problem by deleting a storage volume on the hosting platform Railway, using an API token it found in an unrelated file. The token had been created to manage custom domains but its permissions covered destructive operations too. Notebookcheck lists three causes: the token scope, backups stored where the same deletion removed them and no confirmation step before an irreversible action. The outage ran for more than 30 hours over a weekend and founder Jer Crane said two days after the incident that the data had been recovered.
What makes the case useful is what came afterwards. PocketOS's project rules already said never to run destructive or irreversible commands unless the user explicitly asks. When Crane asked the agent to explain itself, it listed the rules it had broken and said it had guessed instead of verifying.
The rule was present and nothing enforced it. A rule written in prose reaches an agent as one more piece of text to weigh against the goal in front of it. The trials below cover rules an agent never receives and the section on why a spec changes the result shows how the same spec, test and gate also carry a rule like the one PocketOS had.
02What AI coding agents do well
Agents do their best work when the task is small enough to hold in view, resembles code already in the repository and ends in a check that returns pass or fail. Endpoints, form handlers and tests that copy an existing example fit that shape. So do renames, framework upgrades and file moves, where a build or a test run confirms the result in seconds.
The evidence agrees that output goes up. DORA's 2025 research found that AI adoption goes with higher delivery throughput and Faros AI's study of 10,000 developers found 98% more pull requests merged. The same sources show the cost. DORA also found lower delivery stability and Faros found 91% longer review times. Stack Overflow's 2025 survey reports that 66% of developers name AI output that is almost right but not quite as their top frustration and Veracode found security flaws in 45% of code samples from more than 100 models on 80 coding tasks. Almost right is what a missing rule looks like from the outside.
Fig 1 shows where the line falls. The two cards on the left carry their rules in the code and the build. The two on the right depend on rules that sit in a policy document or in someone's experience and a prompt rarely holds them.
03Trial 1: a task the agent handles well
The three trials run on Order Hub, the small sample project used across Orlian materials: a service with orders, payments, stock and a carrier handoff. The code below is written to show the pattern. It is an illustration that no agent produced.
The first request is the kind agents are built for:
Add a sort option to the order list endpoint so callers can ask for oldest or newest first.
Other list endpoints in the repository already take an ordering argument, so the agent has a pattern to copy. The change is small and a test run confirms it.
Nothing in this request depends on a rule outside the code. The agent can write the change, write a test for both directions and be right and a reviewer can read the whole diff in under a minute.
04Trial 2: the same agent, a task with a rule outside the code
The second request reads just as simply:
Add an endpoint to cancel an order and refund the customer.
The agent has no pattern to copy for the rules of cancellation, so it fills the gaps with the most common reading, which is to cancel whatever is asked and refund the full total. It writes a test for that reading and the test passes.
The diff is short, tidy and green. It also leaves out three behaviors the business depends on:
- An order already handed to the carrier is cancelled and refunded while the parcel is on its way.
- Stock reserved for the order stays reserved, so the item cannot be sold again.
- A customer who taps the button twice or a client that retries after a timeout, is refunded twice.
None of these is a coding error. Each is a rule that sits in the cancellation policy and in the experience of the people who run the warehouse and the request held none of them. This is the shape the Stack Overflow figure describes: output that is almost right and a reviewer who has to know the rules to see what is missing.
05Trial 3: the same task with a spec and a test first
The third run keeps the agent and changes the input. Before any code exists, the requirement is written as a short typed item with an ID, in the Given/When/Then form that Thoughtworks describes for spec-driven development.
Tests TC-ORD-014-1 to 4 are written from this item first and all four fail, because the endpoint does not exist yet. The agent's task is now to make them pass. It no longer has to guess the rules.
The diff is five lines longer and every added line traces to a clause, so a reviewer checks it against three short statements and does not need to recall a policy. Thoughtworks also cautions that over-formalized specs can slow change, which is why the item above stays at the level of behavior and runs to eleven lines.
Fig 2 sets the two endpoints side by side. The refund method was already right in the first version. The difference lies in the rules the request never stated.
06Why a spec changes the result
The agent in Trial 3 is no more capable than the one in Trial 2. Three things about its input changed:
- One written rule. The requirement lives in one place as a typed item with an ID that people, tests and code all cite.
- A test that exists first. The agent is graded against the policy as written. Orlian goes a step further and has the tests written by an agent that never sees the code.
- A person where the stakes are high. A named engineer approves the change after a separate reviewer has checked it.
Fig 3 shows the path. A failing test sends the change back to the agent and the requirement ID travels with the work from the first step to the approval record.
The same path carries a rule like the one PocketOS wrote in prose. "No destructive or irreversible command without explicit approval" becomes a requirement with its own ID. A test can confirm that the agent's credentials cannot reach a delete operation and the approval gate holds any change that asks for wider access. The rule then no longer depends on the agent choosing to follow it, because the credential scope and the gate enforce it.
Anthropic's engineering post The components of agent memory (Lance Martin, 6 November 2026) offers a useful comparison. It argues that the context injected into an agent must stay small, with detail held in notes and wikis that the agent searches when it needs them. A spec has the same shape. REQ-ORD-014 is eleven lines the agent reads on every task and the cancellation policy, the carrier contract and the warehouse process behind it stay in their source documents. The post also reports that giving a model one page per contract raised graded facts captured from 41 of 57 to 57 of 57. That study measures agent memory on non-coding tasks, so read the parallel as an analogy.
07Five questions to ask before handing a task to an AI coding agent
- Does the task follow a pattern already in the codebase? If it does, a clear prompt is usually enough, as in Trial 1.
- Does it depend on a rule that sits in a policy, a contract or someone's experience? Write that rule as a requirement with an ID before the agent starts, as in Trial 3.
- Can a test check the result and does the test exist before the code? A test written afterwards checks the agent's reading of the request, so write it first.
- What can the agent reach and what would a wrong guess cost? Give it the narrowest credentials that do the job. The PocketOS token was created for domains and could also delete a volume.
- Who signs off? Name a person for every change that touches money, permissions or data deletion and keep that approval on record.
Settling these five questions first is worth the effort because DORA's 2025 research describes AI as an amplifier of whatever a team already does well or badly.
08Where Orlian fits
Orlian builds the path in Fig 3 into the platform. Its test-first AI coding agents write failing tests from each typed requirement before the Build wing writes any code, a separate reviewer checks each change and a named engineer signs the gate. The requirements come from the Plan wing, which turns a document such as the one described in What is a business requirements document (BRD)? into typed items with IDs. Every artifact carries the same ID, which Orlian calls the red thread, so a reviewer can follow REQ-ORD-014 to its tests, its code and its approval.
The PocketOS case shows why the controls sit where they do. In Orlian the Stage wing references secrets from a vault and writes none of them into files, so a token has no unrelated file to sit in. The Operate wing is read-only and the agents stop at five signed human gates before work moves on. Each of those limits what a wrong guess can do and each leaves a signed, timestamped record.
Teams weighing a coding assistant against a full lifecycle can read the comparison in agentic SDLC vs AI coding assistants. The wider picture is in What is an agentic SDLC? and the view stage by stage is in AI in software development, stage by stage. To see Order Hub run through the Build wing, ask us for a walkthrough.


