How to write a ticket an AI coding agent can finish
How to write tickets for AI coding agents: the outcome, the edge cases you already know, acceptance criteria someone can test, and what the change must not touch.
How to write tickets for AI coding agents starts on the card, before anyone opens a pull request. The agent has zero tribal knowledge. A one-line ticket that only made sense to the person who wrote it is a bad pull request waiting to happen.
The ticket is the part small teams skip
Every week someone tells me they built an AI software factory over the weekend and don't need developers anymore.
Before that thing opens a single pull request on code your customers rely on, make sure you've got:
> self-contained tickets with explicit I/O contracts and edge cases, because the agent has zero tribal knowledge
> a gate that bounces vague tickets back to a human before the agent starts guessing
> testable acceptance criteria on every ticket
> a short list of ticket types the factory is allowed to touch, and a much longer list of the ones it can't
> a trigger that won't kick off the same ticket twice if someone drags it to "AI: Ready" and back
> webhook signature verification, so nobody outside your org can trigger a run on your repo
> a fallback poller for the day the webhook silently drops
> a written spec before any code gets written, approved by a real person
> a way to route open questions to a human instead of letting the model wing it
> a build plan laying out the architecture, data changes, and contracts upfront
> a sanity check confirming the spec, plan, and task list actually agree with each other
> big tickets broken down into chunks an agent can finish in a single run
> acceptance criteria that stay attached to the ticket all the way through code review
> documented architecture decisions, so the agent stops trying to relitigate them every run
> a repo that builds cleanly from a fresh checkout, since the agent doesn't have your laptop's local state
> setup steps an agent can execute without pinging someone on Slack
> a queryable code map, so it actually knows what calls the function it's about to change
> your domain rules written down somewhere the agent can read them
> only the slice of the repo the ticket needs, instead of stuffing the whole codebase into every prompt
> a fresh sandbox for every task that gets nuked the second it finishes
> preloaded dependencies, so runs don't burn ten minutes on npm install every time
> parallel sandboxes that don't trample over a single shared test database
> seeded test data in every sandbox, with zero production data copied over
> zero long-lived credentials sitting inside the sandbox
> an outbound network allowlist, so the agent can't install some random package it read about in a GitHub comment
> write access locked to one working branch, with no way to push to main
> zero merge permissions anywhere in the factory
> a retry cap, so a stuck ticket goes back to the board instead of looping all night
> a cap on CI runs per ticket, because CI minutes aren't free
> a hard timeout for the run that decides your entire billing module needs a rewrite
> hard spend caps per run and per day (the review agent we built for a US healthcare data company cuts off at $20 a day)
> a kill switch that halts every active run immediately
> a dry-run mode that does all the work and posts nothing until you give the green light
> a single gateway for all model calls, treating any direct vendor call as a bug
> provider API keys that never leave that gateway
> separate keys per team, service, and agent, each with its own budget
> rate limits so one noisy repo doesn't starve everyone else
> model names living in config, so swapping models doesn't require a code deploy
> a fallback provider for the afternoon your primary one goes down
> a migration plan for when your model gets deprecated
> spend alerts that fire the same day, well before the monthly invoice lands
> cost tracked per merged PR, not just raw token counts
> customer and patient data stripped out of any ticket or comment the agent reads
> a signed BAA with your model provider before any ticket touching patient data goes near it
> code and data staying inside your own cloud if your customer contracts require it
> secrets scrubbed from prompts, traces, and PR comments
> code-level blocks preventing the agent from even opening secret files
> a secrets scan running on every single diff
> prompt injection defenses on every ticket, comment, and README, so a malicious README can't tell the agent to drop a table
> a check verifying that every new package actually exists and isn't a typosquat
> dependency scanning on every pull request
> a guard against deleted tests, because an agent that can't fix a failing test will sometimes just delete it
> protected files that require human sign-off: CI config, auth, migrations, and the factory's own settings
> least-privilege tokens for your issue tracker, repo, and CI
> strict tenant isolation, so one client's code never leaks into another client's context
> a full audit trail of what the agent read, what it changed, and who signed off
> a real answer for customer security questionnaires asking exactly what the AI can access
> an incident plan for the day a tracker token leaks
> linting, type-checking, and tests running as plain code before any model reviews a line
> CI acting as the judge, never trusting the agent's own claim that "all tests pass"
> tests written from the acceptance criteria, not generated from the agent's own code, so it isn't grading its own homework
> a review agent forced to quote the exact line it's flagging, or the comment gets dropped
> deterministic rules around the model written as unit-testable code
> a cap of five review comments, security first and style last, because nobody is reading forty
> memory of past dismissals, so a finding an engineer already rejected doesn't pop right back up on the next PR
> pull requests small enough for a human to review before lunch
> draft pull requests by default
> autonomy earned repo by repo based on your own metrics, where a single revert knocks it back down a tier
> first-pass CI rate, merged-unchanged rate, and revert rate tracked for every repo
> prompts stored in git and reviewed like production code
> a golden set of tickets with known answers, rerun whenever you tweak a model, prompt, or tool
> an eval suite that blocks the change if even one case fails
> evals specifically testing the ugly stuff: patient data in logs, committed .env files, delete-only diffs, prompt injections
> evals written by your own engineers, rather than a vendor's cherry-picked demo set
> a prompt version stamped on every run, so you can trace which one opened the bad PR
> a playbook for the Thursday your model provider ships a silent update and your eval scores tank
> full traces of every model call: prompt, output, tokens, latency, and cost
> self-hosted traces, because those prompts contain your source code
> one unbroken chain linking session, branch, commit, PR, ticket, and epic
> logs that never capture secrets, tokens, or patient data
> run history stored in a real database, not inside an agent's memory
> checkpoints so a crashed run picks up where it left off instead of starting over and billing you twice
> alerts when the queue backs up, before product asks why nothing shipped
> cycle time pulled straight from that chain, not from developer surveys
> reporting rolled up by team and feature, with zero individual developer leaderboards
> config-driven adapters for your tracker, git host, and CI
> a plan for when your issue tracker changes its API
> review comments posted right in the PR tool your engineers already live in, instead of some separate dashboard nobody opens
> a way to kill a run directly from the ticket
> your existing CI/CD handling deploys, keeping your release rules intact
> a clear policy for the Claude Code, Cursor, and Codex seats your engineers are already using
> seat telemetry that tracks usage without ever logging prompts or code
> device management on every laptop that has agent access to your repos
> the entire factory running on infrastructure you actually own
> a straight answer to "does this keep working if we stop paying the vendor tomorrow?"
> the factory's own infrastructure managed as code
> separate dev, staging, and prod environments for the factory itself
> unit tests for the factory that run without a model or a database
> contract tests covering every adapter
> a deploy pipeline for the factory with the exact same gates as your core product
> prompt rollbacks that are just as fast as code rollbacks
> an on-call rotation for the factory, with someone who actually answers the page
> runbooks for the morning the factory opens 40 pull requests overnight
> postmortems that fix the factory itself, not just the broken code it shipped
> a changelog for the factory so engineers know why it started behaving differently on Tuesday
> real documentation your team can read before they're asked to trust it
> a reviewer rotation so the same two senior engineers don't burn out reading every agent PR
> a weekly tally of how many hours your senior engineers are spending on reviews
> a human approving every single merge, every time
> a clear owner who holds the budget and actually reads the bill
> every key, repo, and account under the company's name, not tied to whoever hacked together the weekend prototype
> a bus factor higher than one
Oh, and on top of keeping all of that alive every day, forever, your weekend software factory is still going to need people who actually know what they're doing:
> writing the spec the agent builds from (a product owner who knows the domain)
> signing off on the plan before a line of code exists (a senior engineer)
> reading every pull request before it merges (a senior engineer, again)
> deciding which tickets the factory is never allowed to touch (a tech lead)
> keeping the architecture from turning into spaghetti while agents keep adding to it (an architect)
> writing the test cases the factory gets graded on (QA)
> running the gateway, sandboxes, and cloud bill (a platform engineer)
> rerunning evals every time a model changes (an AI engineer)
> walking an auditor through what the agent read and what it changed (security and compliance)
> explaining to the CFO why the token bill doubled in March (an engineering manager)
> answering the 3 a.m. page when an agent-written change breaks checkout (whoever's on call)
> debugging the code when the agent that wrote it gets stuck (a senior engineer)
> remembering why the factory was built this way a year from now (someone who was actually there)
Wishing them the best 馃
Mark Ajzenstadt posted that on November 24.
Every week someone tells me they built an AI software factory over the weekend and don't need developers anymore.
Before that thing opens a single pull request on code your customers rely on, make sure you've got:
Most of the list after that is platform plumbing. Sandboxes, gateways, keys, evals. Fair. I am not walking through it. The first items are about the ticket, and that is where a small team actually fails.
self-contained tickets with explicit I/O contracts and edge cases, because the agent has zero tribal knowledge
Yup. Zero tribal knowledge. If it is not written on the work, the agent does not have it.
a gate that bounces vague tickets back to a human before the agent starts guessing
testable acceptance criteria on every ticket
@mardehaym That gate bouncing vague tickets back to a human is the most underrated item here. Most bad agent PRs start as a one-line ticket that only made sense to the person who wrote it.
Manish replied the next morning.
That gate bouncing vague tickets back to a human is the most underrated item here. Most bad agent PRs start as a one-line ticket that only made sense to the person who wrote it.
Yup.
Joey Nelson the same morning: "Your first bullet is a construction scope of work. Hand a sub a vague scope and you get a change order every week. An agent with a vague ticket is that same sub with no phone."
The human version of that hole is not an agent team.
i manage a small ops/reporting team and one of my senior people just resigned. He's been here for 8 years and basically owns a bunch of messy processes around monthly reporting, billing exceptions, and CRM stuff that nobody else really touches.
We have about 6 weeks of overlap before his last day. The routine day-to-day stuff is mostly covered in checklists already, so I'm not too worried about that. What i am worried about are those potential weird one-off edge cases that only pop up once a year where if you do the standard thing it breaks downstream numbers.
ive experienced some bad cases where critical ex employees were actually depended on years after they had left that job
I'm also a bit skeptical that making him write a massive doc or record a bunch of screen shares is going to help, because in my experience nobody actually reads or watches that stuff once the person is gone.
Any pointers/dos/donts for a situation like this
u/Consistent_Page_3598 posted that on November 24. An ops team. A senior person leaving.
He's been here for 8 years and basically owns a bunch of messy processes around monthly reporting, billing exceptions, and CRM stuff that nobody else really touches.
I'm also a bit skeptical that making him write a massive doc or record a bunch of screen shares is going to help, because in my experience nobody actually reads or watches that stuff once the person is gone.
Yup on the doc. Nobody reads it once the person is gone. u/GregG997's practical bit is the one I would keep: "make an exception log, not a doc. every time one of the odd cases comes up, whoever handles it writes one line: what the input looked like, what the normal step would have broken, what they did instead."
Whatever was not written down left with him. An agent never had the 8 years. A giant doc aint the fix. The odd case belongs on the card for that case, one line, where the next run will actually look.
How to write tickets for AI coding agents
An AI-ready ticket is short and specific. The outcome in one or two sentences. The inputs and outputs. The edge cases you already know. Acceptance criteria someone can test. What the change must not touch. That is the card. Domain rules do not go on it.
Write the outcome as what is true when the card is done, for a person who can look. Not "fix receipts". "A customer who paid in the last 14 days sees the refund window on the receipt page. Anyone else does not."
Then the inputs and the outputs, and the edge cases you already know. Missing paid-at means hide the window, if that is the rule. A partial refund means show what is left, if that is the rule. The agent will not remember the time you decided it. If you do not know the rule yet, do not leave it as a vibe on a card that touches customer money. Decide it, or split it onto its own card so the run is not guessing.
Bohdan Korzh wrote that "acceptance criteria rarely cover what a new user actually sees". Yup. Write the criteria as something a person can check on the page. Paid 13 days ago, the window is there. Paid 15 days ago, it is not. No paid-at, the page still loads, and the window is not there. "Works correctly" is not a criterion. Acceptance criteria for an AI agent are the same checks you would hand a person who was not in the room.
Say what it must not touch. The email copy. How a refund is issued. Billing. A card with no fence comes back with a drive-by refactor, and then you are reading a novel.
Domain rules live in the repo, not on the ticket. CLAUDE.md is where Claude Code reads them, because the run starts inside the repo. WORKFLOW.md on the default branch can replace the code-job prompt and name the checks. The card is this job. The repo file is how this codebase works. Copying the style guide onto every card is how the card gets long and the rules go stale. A ticket template for Claude Code is still this card. The template does not replace the repo file, and the repo file does not know this job.
Split a big ticket into chunks one run can finish. That is the agent-ready backlog. One outcome, one pull request. A card that asks for the week comes back as a diff nobody wants to hold. If the second chunk depends on the first, it waits until a person has merged the first. Mark's line for that is "big tickets broken down into chunks an agent can finish in a single run". And "acceptance criteria that stay attached to the ticket all the way through code review". And "your domain rules written down somewhere the agent can read them".
Keep those criteria on the card through review. The reviewer checks the card, then the diff. That pass is AI code review vs verification: check the card, then the diff. It only works if the criteria are still the description when the pull request shows up, not a comment from three days ago that the description never absorbed.
Edit the description when the decision changes. Comments are the conversation. On r/jira, u/garageFou wrote "Comments cannot be deleted or modified, but acceptance criteria and description can." u/jschum2s said "Honestly, either a comment or a change in the description is fine. The item has a history, so you can always go back to see what鈥檚 changed." I edit the description. The comment is where we argued. The card is what the run is supposed to hit.
Bounce a vague ticket back before it starts. A person does that. Do not hand over a sentence and hope. If the only person who understands it is the person who typed it, it is not ready.

Here is the same sample, written out so you can copy the shape. Not a real card. Not a customer.
Title: Show the refund window on the receipt
Outcome. A customer who paid in the last 14 days sees the refund window on the receipt page. Anyone else does not.
Inputs. The order id on the receipt, and the paid-at time already stored on the order.
Edge cases.
- Paid-at is missing: hide the window. Do not guess a date.
- A partial refund already exists: show the amount still refundable, not the original total.
- 14 days means calendar days in the store timezone.
Acceptance criteria.
- Paid 13 days ago: the window is there, with the amount still refundable.
- Paid 15 days ago: no window.
- No paid-at: the page loads, and there is no window.
Out of scope. Do not change the email copy. Do not change how a refund is issued. Do not touch billing.

What Kahoona does with the card
I built Kahoona, so weigh this part.
You assign the card to Agent, or you drop it in the Agent column. Before a computer starts, triage reads the title, the description, the last 12 comments on the thread, and the comment that mentioned the agent when the run came from @agent. It also knows whether you assigned the card or mentioned it. It picks a code job or a review, posts a one-line plan, and does not ask you what the job is.
The run is Claude Code, headless, started inside the cloned repo, so the repo's CLAUDE.md applies. A WORKFLOW.md on the default branch replaces Kahoona's standard instructions for a code job, and it can set the checks. A review does not use that file. Sections in it that would change how agents run are refused.
The card text goes over as untrusted data, not as instructions. The run gets the title, the description, the last 20 comments, and, when someone mentioned the agent, that comment. In that hand-off the title is cut at 300 characters, the description at 8,000, and each comment at 1,000. Triage's own prompt cuts the description at 4,000 and uses the last 10 of those 12 comments, each cut at 600. Neither number is a limit on the card. Put the outcome at the top anyway. The prompt tells the agent not to follow directions written inside the card.
There is no gate that bounces a vague ticket. If you assign a card and the description is under 60 characters, the card shows "Add what done looks like. The agent does much better with a clear spec." while it is queued, and again if it is about to start over. The run still starts. Bouncing it is your job.
While it works, the agent can post a question with kahoona-note --ask. That lands in the team's notifications and puts "Question for you" on the card. It does not stop the run. The instruction says to ask, then carry on with the best assumption and say which one it made. If you needed a decision before any code, write it on the card, or do not start the card.
a way to route open questions to a human instead of letting the model wing it
The question gets to a person. The model is still told to keep going. That is not the gate in his list.
It can try a failing check twice. If the checks still fail, the pull request opens as a draft, the card says Needs you, and it comes back. The comment says the checks still fail after 2 fixes, and it names the draft. A run past 45 minutes is stopped. The line is "The agent ran out of time (45 minutes). The card is back with you." If the checks pass, or none are configured, the pull request opens ready for review. It is linked on the card. The body names the card and ends with Fixes and the card key, such as Fixes WEB-18 on the sample above.
draft pull requests by default
zero merge permissions anywhere in the factory
A failed check is a draft. A passed check is not left as a draft. Agents never merge, and they never deploy. A person merges.
On a board with the Agent review column, a pull request that got through the checks does not come straight back. A second agent reviews it first. The card stays with the agent until that review is posted, then it moves to In review and back to the person who asked. Without that column, the card goes to In review and back when the pull request is ready. A draft from failed checks comes back right away, and so does a run that failed or ran out of time. The card goes back to whoever asked, if they are still in the workspace and the card is still assigned to Agent. If they have left, it is unassigned. A card someone already gave to another person is left alone. An @agent mention does not take the card.
Dragging the card out of the Agent or Agent review column assigns it to the person who dragged it and stops the run. Moving it on to In review or Done does not.
Who that person is, before the run starts, is in Name a human owner before the agents open pull requests. What the agent should decide, and what it should ask, is in What coding agents should decide, and what they should ask you. Rules in the repo and the job on the card is also the split in A markdown backlog for AI coding agents. Claude Code on your own machine can open the same card over MCP. The install is in Let Claude Code and Codex pick up tickets from your board with MCP. The ticket still has to be written. MCP does not write it.
If your tickets live in Jira or Linear today, the comparisons are one page each: Kahoona vs Jira and Kahoona vs Linear.

Kahoona is free for one person. On a team the first chair stays free and each extra chair is $5 a month, so five people pay $20 and ten pay $45. It is a web app.
Write the card like the agent was not in the room when you decided. Then hand it over.