Developers can now spin up several coding-agent sessions at once without fearing overwritten state files or hidden file clashes. An advisory “share-nothing” pattern isolates each agent’s workspace and warns of potential conflicts. The approach swaps hard locks for a lightweight registry that flags overlapping work before it happens, keeping pipelines moving even when a session crashes.

Why parallel agents trip up

Running more than one automated coding assistant in a single repository speeds up code generation, testing, or refactoring. In practice two problems surface immediately.

  • State corruption – Two agents write to the same state file; the later write overwrites the earlier one, erasing progress.
  • File collision – Two agents edit the same source file unaware of each other. The conflict appears later, when a diff shows divergent changes.

Both issues waste developer time and can introduce hard-to-trace bugs.

The “share nothing” rule

The core idea is simple: each agent gets its own private scratchpad on disk and writes only to files belonging to that session. Only one deliberately shared file per branch is allowed, and it follows a “last-writer-wins” rule—whichever agent writes last determines the final content.

A presence layer tracks every active session:

  • Branch name
  • List of files being touched
  • Timestamp of last activity

When a new session starts, it consults the registry. If another session is already handling any of the same files, the developer receives a warning before any work begins.

Advisory vs. blocking locks

Traditional lock files act like a dead-end road: once a lock is taken, any other process waits until the lock is released. If the owning session crashes, the lock can linger indefinitely, forcing a manual hunt for stale lock files.

The advisory model is gentler. It issues a warning when a potential conflict is detected but does not stop the new session. If a registry entry is old—meaning the process that created it no longer exists—the system still only warns, letting the developer decide whether to proceed.

How to implement the pattern

  1. Partition state by writer – Give each agent its own directory for temporary files and state. Reserve shared files for truly global data and apply the last-writer-wins rule only there.
  2. Inject awareness at launch – Before an agent begins, read the presence registry and compare the requested file list with existing entries. Abort or warn if overlap is found.
  3. Verify liveness at read time – When consulting a registry entry, check whether the recorded process ID still runs on the OS. Discard entries belonging to dead processes.
  4. Prefer advisory over blocking – Let developers retain control. A warning lets them continue, pause, or cancel, avoiding deadlock.
  5. Track waiting states – When many agents are active, the developer’s attention becomes the bottleneck. Display which agents are waiting for human input so work can be reprioritized.

All of this can be built with a plain directory of JSON files; no external database or message bus is required. The simple storage format makes the system easy to audit and portable across environments.

Risks and counter-points

Some teams may argue that a hard lock guarantees safety: no two agents can ever write to the same file. The trade-off is reduced resilience—crashed sessions leave orphaned locks that stall the whole workflow.

What to watch for

If you’re juggling multiple AI-driven code assistants, the “share nothing” advisory pattern offers a pragmatic path to keep them from stepping on each other’s toes. By isolating state, exposing intent early, and letting humans decide when to proceed, the method balances safety with the flexibility modern development pipelines demand.