From 1a1fd847dd3bbefa1c2a83d3bffdc39f8ed8b2b9 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 6 Aug 2026 02:12:20 +0000 Subject: [PATCH] docs(agents): os-dev isolates scratchpad temp files in a per-issue subdir (#5614) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parallel os-dev agents dispatched in one batch share a single container scratchpad directory. Nothing separates their temp files, so the natural filenames — `pr-body.md`, `notes.md`, `diff.txt` — collide: whoever writes last wins, both writers get a success receipt, and the loser reads the other agent's content back under its own name. Measured once already (#5614): the #5483 agent's PR body draft came back as the #5176 agent's, discovered only on read-back. Fixed structurally rather than by convention, one level down from the worktree-first rule it mirrors: the agent creates an `issue-/` subdir under the scratchpad as a first step and writes every temp file only there, so isolation does not depend on each agent remembering to decorate filenames. Added as a sub-bullet of the worktree-first rule (same shape, adjacent location) instead of a new numbered item, which would renumber items 2-6 and break the `(rule 6)` cross-reference further down the file. --- .claude/agents/os-dev.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.claude/agents/os-dev.md b/.claude/agents/os-dev.md index f33af4e36b..308e2a51ea 100644 --- a/.claude/agents/os-dev.md +++ b/.claude/agents/os-dev.md @@ -21,6 +21,16 @@ rules that most often get missed: then `cd` there and `pnpm install`. Never edit the shared checkout — a PreToolUse hook blocks it. One worktree **per repo** if the fix spans siblings (`objectui`, `cloud`). + - **Scratchpad-per-issue — the same shape, one level down.** First step + too: create an `issue-/` subdir under your scratchpad dir and write + every temp file inside it only (PR body draft, report draft, + intermediate measurements, probe output). One batch's agents share + **one** scratchpad dir, so the natural names (`pr-body.md`, `notes.md`, + `diff.txt`) are silently overwritten by whoever writes next — both + sides get a success receipt, and the victim reads someone else's + content back under its own name (#5614: #5483's PR body draft came back + as #5176's; the bigger the batch, the likelier the collision). Isolate + by structure, not by memory. 2. **The issue is already claimed by the PM** (your shared GitHub identity). Do not change assignees. If you discover the issue duplicates or conflicts with someone else's in-flight work, stop and report `blocked`.