Does your AI agent really finish the job?
When an agent says “done,” the job may still be unfinished: files were never committed, branches were never merged, temporary files are still around, and what it learned is forgotten by next time. This post explains how I wrote “finished” down as a wrap-up chain, triggered by one word and stopping at the first failure, and ends with a prompt you can paste straight to an AI.
After working with agent-style AI (AI that reads files, edits files, and runs commands on its own) for a while, I noticed that its most common problem is not doing things wrong but not finishing. It politely reports “done,” but:
- Changed files were never committed, so once I close the window I can no longer tell which changes it made.
- It opened a new branch and never merged it back; two days later, another conversation picks up from an older version.
- Tests were not run, or they failed, and it did not mention that.
- Temporary files and background processes stay on the computer and keep piling up.
- Whatever pitfalls it hit and approaches it worked out this time are completely forgotten when a new conversation starts.
- Things it said it would “deal with later” are remembered by no one.
“Done” is a sentence; “finished” is a state: the moment it stops, what the computer, the commit history, and the to-do list each look like. What I did was write that state down and turn it into a fixed wrap-up chain.
The five questions “finished” has to answer
The bar I set for my AI’s “finished” is that it can answer all five of the questions below:
- Is the conclusion stated clearly? Lead with one sentence of conclusion, then the details; anything not verified must be said plainly as “not verified,” not blended into “done.”
- Did the work actually land? Changed files are committed, what should be merged is merged, what should be pushed is pushed, and it has been confirmed that they really are there.
- Were the promised items reconciled? Each thing it agreed to do in this conversation has either been done, or is stated explicitly as moved to later, with the reason.
- Was what was learned this time kept? Problems met and their fixes, plus approaches improvised on the spot, are written where the next session will read them (this part is covered separately in “Both the kid and the teacher: a few tricks for letting an AI agent grow up on its own”).
- Is the working environment cleaned up? Temporary folders and background processes opened by it this time are shut down; anything belonging to someone else is left alone.
What the five questions share is that each one can be checked, instead of asking the AI “Did you finish?” Ask that, and it will almost always say it’s done.
One word triggers the whole chain: “wrap up”
I require it to do the first three questions every time. But some actions, such as “push, merge, and clear temporary files,” affect things other people can see, and I do not want it deciding those on its own. So I set up one word: when I say “wrap up,” it runs the whole chain from start to finish, without stopping to ask me step by step.
My wrap-up chain runs roughly in this order:
- Run the tests and the build, and check the results.
- Push to the remote, merge, and confirm the branch and the automated checks are clean.
- Reread the merged main line once: other conversations may have merged things at the same time, so confirm the two did not overwrite each other.
- Write this session’s handoff record (what was done, which decisions I made, what problems came up, and the next step).
- Clear this session’s own temporary folder.
- Only at the very end, shut down its own background processes.
Three points in the design matter more than the steps themselves:
- The scope of authorization is narrow and clear. Only the word “wrap up” authorizes pushing; ordinarily it may save files on its own, but pushing to the remote waits for that word. One word stands for a whole bundle of authorization, so I do not have to act as its secretary and click “OK” at every step.
- If it breaks, stop and say so. When a test fails or a safety check blocks it, the whole chain stops right there, and it tells me which step it stopped at and why. It must not skip the failed step just to get to the end.
- Handing back a half-finished job counts as unfinished. “I’ve already pushed it, you merge the rest yourself” is not a wrap-up; it hands the work back to me.
Things to do even without waiting for “wrap up”
There are two things I have it do at any time, without waiting for me to say so:
- Save once each time something is finished. When a file is written, a feature is done, or a check passes, commit it, instead of waiting until the end of the day to commit once. That way, if something goes wrong, only a small step has to be rolled back, and an interrupted conversation does not throw away a whole day’s work.
- Reconcile before ending a round of conversation. Check whether what it said it would do has been done; anything not done must be stated.
Example: wrapping up a small project
Suppose you ask an AI to add an “article table of contents” feature to your blog. After it finishes the changes, it says “done.” Using the five questions above, here is what you should see at wrap-up:
- The first sentence of its report is the conclusion, for example, “The table of contents feature is added; I have not actually opened the mobile layout to look at it yet.”
- The commit history has one or two clear new entries, with messages that describe the content, such as “add article table of contents,” rather than “update.”
- The working folder is clean: there are no changed files left unsaved.
- It leaves a short handoff record, so when you open a new conversation, reading this one record is enough to pick up where things stopped.
A handoff record like this is enough:
## 2026-11-19 Article table of contents
- Done: added a table of contents to article pages, shown only when there are two or more heading levels; saved and merged.
- Decision: the table of contents goes on the right side, not above the article (decided by the user).
- Problem encountered: anchors generated from Chinese headings came out garbled → switched to sequence numbers as anchors.
- Workaround: manually compared the tables of contents of 5 long articles → one-off, keep as is.
- Not verified: the mobile version has not been opened and checked yet.
- Next step: confirm the mobile layout.Note the last two lines: what was not verified and the next step matter more than what was done. The next conversation (or your next self) needs exactly these two lines most.
Design lesson: build a wrap-up chain for your own agent
- Write the end state first, not the steps. “No unsaved changes in the working folder,” “this session’s record is on the main line,” “the temporary folder no longer exists”: these are sentences you can check. Once there is an end state, the steps have something to rest on.
- Order the steps: anything that affects others goes later, and cleanup goes last. Actions others can see, such as pushing and merging, go after the tests pass. Clear the temporary folder only after the handoff record is written; otherwise something that exists only in the temp area is gone with the cleanup.
- Pick one trigger word and write down exactly what it authorizes and what it does not. For example: “wrap up” = pushing and merging are allowed; deleting files still requires asking me.
- For each step, write down what to do if it fails. Most answers come down to “stop, and say so.”
- Check the end state with commands, not by asking the AI. For example, at the end of a wrap-up, run the commit history’s status command once to confirm it is clean, rather than asking “is everything saved?”
- Start with three steps. Save, handoff record, clear temporary files. Get these three stable first, then add to them slowly. If you write twenty steps at the start, it will skip steps, and you won’t notice.
Where does this wrap-up chain live? In the instruction file the AI reads at the start of every session: for example, CLAUDE.md in Claude Code, or AGENTS.md in Codex and other tools. The instruction file only needs the one line: when “wrap up” is said, follow a given file. The full steps live in that other file, so they do not take up the instruction file’s attention the rest of the time.
Prompt: have your AI help you design a wrap-up chain
Paste the text below to your agent, and replace the words in angle brackets < > with your own situation. It will ask you questions first, then give you a draft; once you have read it, you decide whether to write it into the instruction file.
I want to design a “wrap-up chain” for our collaboration: when I say “wrap up,” you take this session's work from start to finish, without stopping to ask me step by step in between.
My project is: <what the project does, whether it uses git, whether it has a remote or deployment>.
Please follow this order:
1. First ask me up to 5 questions to clarify: which actions affect others or external parties (pushing, deploying, sending messages), which ones I must confirm myself, and how the tests and build are run.
2. Write the end state of “finished”: 5–8 sentences that can be checked with commands (for example, “the working folder has no unsaved changes”), each with the command that checks it.
3. Then write the wrap-up steps, with these rules: actions that affect others go after the tests pass; cleaning up temporary files goes after the handoff record is written; for each step, state that on failure it “stops and tells me which step it stopped at and why,” and must not skip the failed step.
4. State clearly what “wrap up” authorizes and what it does not.
5. Give a format for a handoff record with fixed fields: what was done, decisions, problems encountered and their fixes, what was not verified, next step; 10 lines or fewer.
6. Also list two things that are done “without waiting for wrap-up, all the time.”
Give me a draft first, and do not change my instruction file directly. Keep the draft within one page; the first version has at most 6 steps.Related:Both the kid and the teacher: a few tricks for letting an AI agent grow up on its own, Claude Code makes my computer slow: processes that won't close and temp files that keep piling up, From a seed: my AI assistant Qizhe, and a starter seed kit for newcomers to agents
← Previous:AI Is Continuing the Conversation, Not Looking Things Up
Next:Both the kid and the teacher: a few tricks for letting an AI agent grow up on its own →
Email subscriptions will open later. For now, you can follow new articles and work with RSS.