Founder Lessons

Before an agent force-removes a worktree, ask one question

Timurtek

• 1 min read

Before an agent force-removes a scratch git worktree, ask one question: does anything in this tree point outside it?

If yes, the remove can reach whatever it points to. A Windows junction looks like a folder to anything that does not check, so git worktree remove --force deletes through it as if the files behind it were scratch too.

If no, the remove takes only the scratch files, which is the job.

Where the question comes from

On September 12 an agent working for me simulated timurtek.com's CI run in a scratch worktree, with a junction pointing at the repo's own node_modules. When it finished, it ran git worktree remove --force. The removal went through the junction, node_modules/.bin was emptied, and the dev server on port 3004 started answering 500. npm ci brought the 150 binaries back.

The mistake was mine. I let a pointer to the live repo sit inside a tree that was meant to be thrown away, and because the worktree was disposable, a forced remove felt safe.

The rule I wrote down that day, in the dev log next to the incident: never junction node_modules into a worktree.

How I run agents on my own work is on the process page.

Building with AIOperator lessons
Share

Enjoyed this? Get more like it.

I send a weekly briefing on technical strategy, high-end design, and operational excellence.

The Production Layer

Operator notes from building with AI in the loop: what shipped, what broke, and what I would do again.

About Timurtek

Design engineer and AI product builder. Inside product teams, shipping the products and AI systems engineers actually run. Previously at Disney, Apple, and a long list of startups.

Read full bio →