One Thing at a Time: The Feature List and git Discipline
Today opens on a reversal. The hand-built Coding Agent course ruled explicitly that the agent must never commit to git, while in this course a git commit is the authoritative record of progress. Both rulings are right, because the premises differ. Get that distinction and the rest follows: list-driven task selection, and rolling back to the last verified commit.
Today's Goals
- Can explain why an interactive agent must not touch the user's git history while an unattended agent's commits are its authoritative progress, and point at the premise that separates the two cases
- Can explain why the one-feature-at-a-time rule works better as code than as a line in the prompt, and name the two failures that appear once you relax it
- Can state what a verified commit is, and when to roll back to the last one versus when to push forward
Today starts with a conflict that is supposed to confuse you for a moment. When you finish, scroll back up and tick off the three goals.
Plain-Language Walkthrough
A reversal: the same question, two courses, opposite answers
If you took Build Your Own Coding Agent in 21 Days, you will remember an explicit ruling there: never use git to commit, because the user's repository history is not yours to pollute. Snapshots were taken by content hash instead.
This course concludes the opposite: a git commit is the authoritative record of progress, and the agent makes those commits itself.
Both are correct. One sentence separates them: whose repository is this.
| Interactive Coding Agent | Unattended harness | |
|---|---|---|
| Whose repository it operates on | The user's repository | The agent's own workspace |
| Who reads that history | The user, their colleagues, their code review | Only the harness, and you when you check the work in the morning |
| What a new commit in it means | Overreach. The user's git log belongs to the user | Bookkeeping. Those commits are the progress itself |
| Cost of not committing | None. Hash snapshots roll back just as well | No landing point to return to, so an incident means redoing the whole stretch |
The reversal is worth remembering for more than today's design. It demonstrates a way of reading advice: when two sources you trust reach opposite conclusions, do not start by deciding which one is wrong. Go find the premise each of them is standing on. Most conflicting best practices are conflicting premises.
Interview questions
When may an agent run git commit on its own, and when must it never?什么情况下 Agent 可以自己执行 git commit,什么情况下绝对不行?
Common in ChinaCommon overseasIntermediate#git#state-management#boundaries🔒 Unlock this chapter to see the answer keys.
How do you force an agent to do one thing at a time? Is putting it in the prompt enough?怎么强制一个 Agent 一次只做一件事?写在提示词里够吗?
Common in ChinaCommon overseasIntermediate#feature-list#constraints#harness-design🔒 Unlock this chapter to see the answer keys.
An agent botches one feature - do you roll back or let it keep fixing? On what basis?Agent 做坏了一条 feature,你会让它回滚还是继续修?依据是什么?
Common in ChinaCommon overseasDeep dive#rollback#green-point#risk-exposure🔒 Unlock this chapter to see the answer keys.
What can go wrong when an agent drives git, and how do you prevent it in code?让 Agent 操作 git 有哪些具体的危险?你会怎么在代码层面防住?
Common in ChinaCommon overseasDeep dive#git#safety-invariants#assertions🔒 Unlock this chapter to see the answer keys.
