Each agent gets its own git worktree: a separate folder with its own branch, sharing the same repository. One agent's half-saved file can't break another's test run, and an edit can't quietly overwrite another. They only meet at merge time.
Agents on one folder do not see each other coming. One saves a file the other read a minute ago, and the first agent's work is gone with no error. Two worktrees turn that silent loss into a merge conflict you can see.
Say it to your agent
“Do this in its own git worktree on a new branch, not in this folder. Run the tests there. Use a separate test database and port, and tell me which you chose.”