Forge Fate
AI

Using AI Coding Agents Well: Design the Delegation Before Comparing Tools

4 min read

Choosing an agent involves development environments, workflows, and cost. But after choosing, a request such as “improve login” remains ambiguous. It could mean error messages, session refresh, or a redesigned screen. All concern login without necessarily meeting the intended outcome.

First make one task reviewable. This example adds a re-login notice after session expiration.

System behavior, paths, error codes, and prompts below are illustrative assumptions, not a real service or observed agent output. No code execution, tool benchmark, or productivity measurement was performed.

1. Narrow login improvement to a visible user change

Assume an authenticated user calls a protected API; an expired session returns 401 with application code SESSION_EXPIRED; the client currently shows a generic error; /login already exists; automatic session refresh is absent.

The task is to identify expiration, explain it, and let the user navigate to the existing login screen. It does not add refresh or replace that screen.

HTTP 401 means valid authentication credentials are missing, not specifically that a session expired. 403 separately indicates refusal to fulfill the request. RFC 9110 status definitions

SESSION_EXPIRED is this example's application contract; inspect the actual service before assuming it. UI notification also differs from enforcing server-side expiration, which OWASP requires on the server. This task communicates existing expiration handling. OWASP session expiration

2. Complete the specification delivered to the agent

Specify triggers and exceptions, not just “add a notice.” auth/session is an illustrative module name.

text
Task: Add a re-login notice for an expired session.Purpose:Help users understand expiration and reach the existing login screen.Current contract:Expiration returns HTTP 401 plus SESSION_EXPIRED.The client currently shows a generic error.Login is /login; automatic refresh is not used.If actual code differs, describe the difference first and do notarbitrarily settle implementation decisions that depend on it.Changed behavior:When both 401 and SESSION_EXPIRED are present, show:"Your session has expired. Please log in again."Provide a "Log in" button linking to the existing /login.Do not navigate automatically merely because the notice appears.Do not stack duplicate notices when multiple requests expire in one login state.Reset notice state after successful login so a later expiration can show it again.Preserved behavior:Other 401 causes, 403, server errors, and network errors retain existing handling.Normal responses and existing login behavior remain.Showing the notice must not reset a form the user is editing.Do not automatically retry the failed business request in this feature.Scope:Client auth/session handling, necessary notice UI, and related tests.No public API, database schema, or server expiration/refresh-policy changes.Proceed with implementation and checks within scope. If another area mustchange, explain why and propose the smallest change.Deployment is excluded.Deliverables:Changed files and reasons; verification method and observed result foreach acceptance condition; checks not run and open issues;differences between assumed and actual behavior.

This leaves implementation details such as state management and component reuse open while exposing consequential choices: automatic navigation, duplication, other errors, and request retries.

If a real system refreshes sessions automatically, rewrite the contract to distinguish recoverable intermediate responses from final authentication failure before applying this specification.

3. Map acceptance conditions to inputs and observations

“Pass related tests” does not define behavior. This table is a verification plan with expected outcomes, not executed results.

ConditionExpected observation
Receive 401 plus SESSION_EXPIREDSpecified notice and login button
Repeated/concurrent expiration responses in one login stateNo stacked notices
Notice appears without button clickStay on current screen; preserve form inputs
Click login buttonNavigate to existing /login
Login succeeds, then a new session expiresNotice appears again
Another-code or code-less 401Existing handling, no presumed expiration
403, server error, or network errorNot converted to this expiration notice
Normal responseExisting success handling
Business request fails from expirationNo automatic retry by this feature

Checking only the first row does not check duplicate popups. Testing an error-classification function does not establish that a real UI button is wired. Connect function, component, and screen checks to what each uniquely establishes instead of repeating every condition at every layer.

4. Ask for evidence in the completion report

“Added expiration handling and passed tests” is hard to compare with acceptance criteria.

EvidenceReview question
Changed files/diffAny out-of-scope changes?
Error classificationDoes it incorrectly classify every 401 as expiration?
Notice stateDeduplication and reset after login?
Test inputs/assertionsDo they exercise the specified conditions?
Commands/resultsWhat ran against which changed state?
Screen evidenceHow much of text, button, and navigation was checked?
Unverified itemsWhat remains and how does it affect acceptance?
text
Changes: files/reasons and integration points.For each acceptance condition: method, target, observed result, evidence.Remaining items: unrun checks and reasons, differences from assumptions,and decisions still required.

Every field need not say success. Connecting a button in code differs from clicking it in a browser. Do not substitute expected output or unrelated passing checks for actual evidence.

5. Name the missing condition in follow-up requests

Instead of “check more carefully,” identify the gap.

Classification is too broad

text
The change treats every 401 as expiration; the specification requiresboth 401 and SESSION_EXPIRED. Correct the condition and check thatother-code and code-less 401 responses retain their existing path.

Deduplication exists but reset is unverified

text
Check expiration notice → successful login → new session expiration.Confirm the notice appears again and identify its integration withexisting login-success handling.

Tests exist without execution evidence

text
Distinguish added tests from tests actually run. Provide commands,targets, and results; if not run, state the required conditions.

Linking feedback to the original specification distinguishes a missing implementation/check from a new requirement. “Return to the original screen after login” would be a new requirement needing return-route and state-preservation decisions, not an omission from this task.

6. Compare tools using the same task and deliverables

Start from the same repository state, supply the same specification and evidence, align environments/permissions where possible, use common acceptance criteria, and record model/version/settings and added instructions.

ComparisonObservation
RequirementsWhich acceptance conditions were satisfied?
ScopeAny unrequested policy/API changes?
VerificationExecuted evidence matches claimed scope?
Follow-up burdenExtra explanations and corrections required?
Time/costAgent time, human review/correction, observable usage cost

Even then, one task does not rank entire products. It can establish the result and review burden for this task in this repository. No such comparison ran here; these are future criteria.

Product features and policies still matter. Defining actual work makes relevant capabilities concrete: reading authentication flow, changing and checking related code, and presenting reviewable changes/results.

7. Connection matters more than specification length

The example is long because “login” hides multiple decisions. Its goal is a re-login notice; input is the defined expiration response; output is text and a button; other errors and server policies remain; evidence maps to each condition.

A simple task may need only a few sentences, provided the chain remains:

text
Current behavior → changed behavior → invariants/exceptions→ acceptance conditions → reviewable deliverables

Continue with deciding delegation scope and judging code you did not write.

Report an error or share feedback

Open a draft with this article’s title and URL. Review the message and recipient before sending.

To: [email protected]

Open email draft

If no email app opens, copy these details into your usual email service.

Contact information