Git hygiene for agentic development

Visual storyboard and complete narration. Timing estimates await a voice take.

GIT HYGIENE / AGENTIC DEVELOPMENT
01 / 09

Finished tasks can slow down the next one

AFTER TASKS MERGEBranches + historyLeftover checkoutsState outlives the task
LATER RUNSMore state to inspectLess free diskSetup and cleanup can take longer

More finished tasks · more state to inspect

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

As agentic software development becomes more common, it puts new pressure on familiar tools like Git. Agents leave branches, checkouts and intermediate history behind. Without regular retirement, that state can consume disk and make cleanup compete with the next task for machine time.

GIT HYGIENE / AGENTIC DEVELOPMENT
02 / 09

Cleanup itself can become the bottleneck

8–12 minutes

of CPU-consuming cleanup per sweep

5 overlapping sweeps~657 worktrees in one shared checkout

Repeated history reads + concurrent cleanup
delayed allocation of new work.

Five overlapping sweeps · 8–12 minutes each

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Reported incident · assay#1037

In one reported Assay incident, five cleanup sweeps each consumed CPU for eight to twelve minutes. They ran at once against about six hundred and fifty-seven worktrees. Repeated history reads and overlapping sweeps delayed new work. Those timings describe that incident.

GIT HYGIENE / AGENTIC DEVELOPMENT
03 / 09

A merge finishes the change, not its cleanup

Ashared baseBS← mainCDEtask branchreview HEAD

Main has the fix · task history is still retained

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

Here is how finished work stays around. An agent fixes a CSV export with commits C, D and E. A review worktree, another checkout sharing the history, points to E. Squashing puts the accepted change into S on main. The task branch and review checkout still retain the original commits.

GIT HYGIENE / AGENTIC DEVELOPMENT
04 / 09

Deleting the branch removes one holder

Ashared baseBS← mainCDEtask branchreview HEAD

Branch removed · review still holds E

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

Now remove the finished task branch. Its name disappears. The review checkout still points to E, so Git must keep the history it needs. Deleting a branch name does not mean deleting the commits behind it.

GIT HYGIENE / AGENTIC DEVELOPMENT
05 / 09

Removing the checkout can leave recovery records

Ashared baseBS← mainCDEreview HEADrecovery record

Checkout removed · recovery remains

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

After the review evidence is saved and the session has ended, the checkout may be retired. But a reflog, Git’s local record of earlier positions, can keep those commits recoverable. That recovery window is useful when cleanup was a mistake.

GIT HYGIENE / AGENTIC DEVELOPMENT
06 / 09

Storage stays occupied until retention ends

Ashared baseBS← mainCDErecovery record

Finished work can still occupy storage

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

Removing both visible holders does not immediately free the stored history. When no other retention source needs it, and normal expiry permits it, garbage collection can reclaim unneeded commits and file contents. Main’s accepted change stays.

GIT HYGIENE / AGENTIC DEVELOPMENT
07 / 09

Retire finished work and maintain its shared store

Retire safelyOwner + saved evidence
Keep active work
Coordinate upkeepOne shared Git store
One maintenance owner
Fix repeated readsProfile cleanup tools
Packing alone is insufficient

Safe retirement · coordinated maintenance · efficient readers

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

Retire finished branches and checkouts once their work and evidence are safe. Then maintain the shared Git store, with one owner for the job. Packing organizes storage, but tools that repeatedly read the same history also need their own fixes.

GIT HYGIENE / AGENTIC DEVELOPMENT
08 / 09

Assay makes ownership and retirement explicit

Allocatedeskdispatch
Claim + worktree
Inspectdeskwt
Plan + held reasons
ExtendCleanup work in progress
Check installed version

Assign an owner · inspect the retirement plan

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

Assay’s desk tools allocate tasks, prepare worktrees and report cleanup candidates with reasons for keeping them. They put ownership and retirement into the workflow. Check your installed version: merged fixes and work under review are not automatically available there.

GIT HYGIENE / AGENTIC DEVELOPMENT
09 / 09

Measure what completed work costs your next task

Measure the costSetup + cleanup time
Branches, worktrees, objects
Trace one taskWhat still retains it?
Who owns its retirement?
Check the resultInspect the cleanup plan
Retire safely + measure again

Measure → inspect one task → retire safely → measure again

FINISH THE TASK   /   RETIRE ITS REFERENCES   /   RECLAIM STORAGE
Illustrative workflow

Time repository setup and cleanup, and count branches, worktrees and stored objects. Follow one merged task to find what still retains it. Assign an owner and retirement condition, then inspect the cleanup plan. Measure again to see whether old work is still delaying new tasks.