DEV Community

Cover image for Two AI Agents, One Repo, Zero Collisions: My DeepSeek Harness + Git Worktree Field Test
boluo
boluo

Posted on

Two AI Agents, One Repo, Zero Collisions: My DeepSeek Harness + Git Worktree Field Test

Here's the workflow problem I kept running into with DeepSeek Harness (DSH): one session means one module at a time, and two sessions means two agents fighting over the same working directory — git status turns into soup, and untangling who changed what is manual labor before every merge.

The 0.2.2 pre-release ships two experimental plugins that map onto the two halves of that problem: AgentTeam for splitting work, Change Requests & Worktrees for isolating it. I pinned my install at 0.2.2-rc.1, built a throwaway repo with three independent modules, and pointed two sub-agents at two of them in parallel. This is the field report. (Disclosure, since DEV asks: this write-up was drafted with AI assistance — the run, the hashes, and the screenshots are mine, from the session on 2026-11-17.)

TL;DR

  • The combination works: two agents, two worktrees, two branches, main repo untouched the whole time.
  • It is not turnkey — worktree creation only happened because I put it in the task prompt.
  • Commits are not guaranteed: one agent committed on its own, the other stalled at staged. You close the loop.
  • Windows users: the default "workspace edits" access mode failed its sandbox ACL request and the task sat at 3% for ten-plus minutes. "Full access" fixed it.
  • Verdict: worth running for multi-module parallel refactors; wait for the stable release for anything production-facing.

Why two agents on one checkout collide

Not an AI problem — a git problem. One checkout directory holds one working tree and one index. Two processes writing files in the same directory produce a git status that blends both; touch the same file and the first save gets silently overwritten. Two agents sharing one checkout is two engineers elbowing each other on the same machine.

git worktree exists precisely for this: one repository, multiple checkout directories, each on its own branch with its own index. Collision becomes physically impossible. The AgentTeams docs even say it out loud — members may share a checkout, so independent worktrees still matter.

What each plugin covers

  • AgentTeam — the who does what. The session becomes a lead: splits the goal into named tasks, spins up teammates, tracks them on a shared board, lets them message each other, then reports back.
  • Change Requests & Worktrees — the where. The sidebar tracks associated PRs and local changes, and isolates each task in its own worktree.

Distribution and isolation. Missing either one, the setup limps.

Setup, three steps

My machine was already on 0.2.2-rc.1, so no upgrade to redo — the version sits at the bottom of the settings page. One thing worth knowing: the startup update check already offers 0.2.2-rc.3. The pre-release channel moves fast; treat any single RC as disposable. There's no dev-channel toggle in settings — the installer you run is the channel.

Settings page showing version 0.2.2-rc.1

Step one: enable both plugins. They're under the experimental plugins section, off by default.

Both experimental plugins enabled

Step two: create a session, pick a model. I routed through the Crazyrouter gateway with deepseek-v4-flash. Provider Base URL, one value:

https://api.crazyrouter.com/v1
Enter fullscreen mode Exit fullscreen mode

Verify before you trust it: /v1/models came back HTTP 200 with 173 models listed, deepseek-v4-flash among them. To check availability yourself, see the model catalog; skim the gateway catalog and billing terms before you commit to a setup — access conditions and model IDs follow that catalog.

Step three: set the access mode. This is where the run nearly died. The default "workspace edits" mode failed to get write permission (ACL) on my Windows machine — the session sat at 3% for over ten minutes until the model itself diagnosed it as a known Windows sandbox issue. I ruled out the file system first (C: and D: are both NTFS, so ACL support isn't the problem); the stall was in the sandbox authorization step. Switching to "full access" and confirming the dialog fixed everything. Trade-off: sensitive operations lose their confirmation step, so keep that mode for tasks you trust. Honesty note: the task prompts were in Chinese; the repo, code, and tests are language-neutral.

Sandbox ACL failure with the default access mode

What actually happened

The repo: three independent modules — textutil, mathutil, datefmt — with a baseline of 8 failing tests. Task covered two modules, rules pinned up front: teammate A takes textutil on feature/textutil, teammate B takes mathutil on feature/mathutil, each spins up its own worktree, edits only its own file, no merging, no push.

The lead confirmed repo state, created shared tasks, and brought both teammates up in parallel. The session header ticked its sub-agent count to two, and the sidebar board started counting.

Two sub-agents running in parallel

The worktrees were real: git worktree list grew wt-textutil and wt-mathutil, each on its own feature branch, main repo clean the entire run. I checked the directories by hand rather than trust the report — each showed exactly one modified source file (src/textutil.js and src/mathutil.js respectively), zero crossover. Both passed node --test: 3 passing, 0 failing, each. One caveat worth repeating: the worktrees only existed because the prompt demanded them. The plugin doesn't force that pattern, so leave it out and you're back to the shared-checkout risk.

Commits exposed the boundary. The textutil teammate committed under its own identity (textutil-dev, short hash f650772), with a tidy message I didn't have to touch. The mathutil teammate finished, passed tests, staged the file — and stopped. The lead was busy waiting for reports; two messages I queued never got through while that turn hung. I killed the stuck turn and committed wt-mathutil myself. Nothing in the AgentTeam protocol requires work to land as a git commit, so "done" from a teammate can mean committed, staged, or merely edited. How far a teammate gets is up to the teammate; whether the branch is clean is your verification job, which in practice means git log per branch before you believe any status line.

Review was the cheap part, and this is where the layout pays off: one branch, one commit, one file, so git show --stat per change is all it takes — no fishing one person's edits out of a blended diff. I filed one real comment: the clamp function left the reversed-range case (min > max) undefined, silently returning garbage instead of a normalized bound. I added a fix in wt-mathutil, re-ran the tests — still 3/0 — and it landed as a second commit on feature/mathutil. Two commits, two clear responsibilities, so a rollback touches only what it should. That cheapness is a property of the one-branch-one-file shape, not a feature the plugin enforces; let an agent sprawl across files and it's gone.

Cleanup: git worktree remove on both directories, the list shrank back to the main repo, branches and commits untouched. Main's 8 tests stayed red — exactly the goal. Nothing leaked into main; merge timing stays mine.

The parts you still own

  • Committing. One teammate committed, one stalled at staged. Close the loop yourself.
  • Turning review into code. My comment, my fix commit, my test re-run.
  • Cleanup. Worktree directories don't disappear on their own; git worktree remove is yours.
  • Worktree creation itself. Semi-automatic at best — it only happened because the prompt demanded it.

What ran on its own: task splitting, teammate creation, the progress board, and running tests to green inside each worktree.

Time check, honestly: just over ten minutes from task to both modules passing; twenty-plus for the whole session including the stuck lead turn — slower than doing it sequentially myself. Parallelism buys not watching, not wall-clock time. More modules, and the gap opens in your favor.

Questions I keep getting

Will teammates mess up my main repo? No — git status stayed clean, main stayed at the initial commit, 8 tests stayed red. Condition: spell out "no merge, no push" in the prompt.

Do teammates commit on their own? They can, under named local identities (textutil-dev), but it's not guaranteed — the mathutil one stalled at staged.

Will upgrading lose config? Untested — I didn't upgrade. Observed: update check offers rc.3, plugin docs warn APIs may change between RCs. Screenshot your plugin config first.

Stuck at 3%? Check the access mode. The ACL failure under "workspace edits" looks exactly like a long 0–3% stall; "full access" recovers immediately. Then confirm your drives are NTFS.

Reproduction: the repo is public at zhouxiaoying416-sketch/dsh-agentteam-worktree-demo — clone it and the baseline is 8 failing tests. Model: deepseek-v4-flash through the gateway on /v1/chat/completions; model IDs follow the gateway catalog.

Wrap-up

I'll keep this combination around for exactly one scenario: parallel multi-module refactors. Single file, single module? A plain session is faster and cheaper.

If you want to taste multi-agent without risking files, there's a middle ground: enable only AgentTeam, leave worktrees off, and give it tasks that don't write to the repo — research, summaries, doc drafts. You get the dispatch and the board without the part where an unclosed commit or a shared checkout burns an evening. One honest limit on my run, too: I tested two teammates, not ten, so how the lead copes with five or six queued reports is a separate check I haven't done.

Both plugins are labeled experimental and their APIs may change between RCs — for production repos, wait for the stable release.

Top comments (0)