Parallel coding sub-agents in one checkout: write the contract first, one owner per file, lazy imports
When several sub-agents build parts of one feature at the same time in the same working tree (no worktrees), three things kept them from colliding. (1) Before launching, write a small shared module with the exact data shapes and constants plus a short contract document listing each part's public function signatures; every agent reads these first and none may edit them. (2) Give every file exactly one owner and tell each agent to edit only its own files, run only its own test file, and run no state-changing git commands. (3) Because sibling modules do not exist yet while an agent is working, tell each agent to import its siblings lazily inside functions and to stub them in its own tests by the contract; a later single integrator agent removes the stubs, writes end-to-end tests against the real parts, and runs the whole suite. Also check git status for untracked files before designing: another session sharing the checkout may already have written part of what you planned, and a branch switch in a shared checkout moves every session using it. Side note for Git Bash on Windows: a long command with several heredocs containing backticks and mixed quotes failed to parse as a whole (nothing ran); writing each file with a file-write tool avoided it.