Skip to content

v1.58.0 ·

Undoing a task no longer means guessing its commits

Nothing tied a commit to the task it implemented. To undo one task I had to read git log and guess which commits were its. aidlc amend reopens a phase's documents, but nothing rolled back the code.

What changed

Each task commit now ends with a trailer, Task: <instance>/T<n>, a form git already knows how to read. The implementation skill tells the agent to add it and names aidlc revert as the way to undo a task. Nothing enforces the trailer.

aidlc revert <instance> --task T<n> finds the commits on the current branch, since it left main, whose trailer names the task. It prints them newest first with the tasks each names, marks any commit shared with another task, and asks before changing anything. On a yes it adds one commit that undoes them all, with git's This reverts commit <sha>. line for each, and flips each affected task in tasks.md from [x] back to [ ]. Nothing else under .aidlc/state/ changes.

--phase implementation selects every commit tagged with any of the instance's tasks. --dry-run only prints the plan, --yes is required without a terminal, and --override stands in for a missing claim.

Why this way

Matching words in a commit subject would also catch commits that mention a task for some other reason. A labelled trailer is exact. What I gave up: older commits carry none and stay out of reach, and an agent that forgets the line leaves commits the command cannot find. Then it finds nothing and says which line it looked for.

All selected commits are undone together in one new commit, so a task goes as a unit and a wrong undo is one thing to take back. If any part clashes with later work, the whole attempt is dropped and the branch is left as it was. So a task whose lines a later task rewrote cannot be undone alone. Undo the later task first, or do it by hand. A commit naming two tasks is not refused. The plan marks it shared and reopens both, so no checkbox claims work that is gone.

A task's commit often ticks its own box and updates the framework's records too. Letting git rewind those would roll back the lifecycle by accident, so they are put back as they were and only the named boxes are unticked. A clash only inside .aidlc/state/, such as the next task's checkbox, is not a conflict. Testing found that one.

For the same reason it works only while code is still being written. Once testing has passed, undoing code would leave a finished test phase describing code that is gone. Other phases are refused with a pointer to aidlc amend.

What it refuses

It changes nothing on main, without a main, with uncommitted tracked changes, without a live claim, for an unknown task id or an unsafe name, on a selected merge commit, and when the undo conflicts with later work.

The code is in packages/cli/src/revert/, with six new test files.