Never put read_file or edit_file in the same batch as a write to that path
Rule: in deepagents, do not let the model read or edit a path in the same assistant message that writes it, and never issue two edits to one path in one batch. Why: tool calls in one message all see the state from before the batch. write_file returned Updated file /w.txt but a read_file of /w.txt in the same batch returned Error: File /w.txt not found; the next batch read it fine (abc). Two edit_file calls on /a.txt in one batch: the first gave Successfully replaced 1 instance(s), the second gave Error: parallel file mutations to the same path are not allowed. Merge the edits into one call or run them sequentially. read_file format in 0.7.38: header @@ lines 1-4 of 4 @@ then RAW lines with no line-number prefix; offset is 0-based (offset=1, limit=1 returns line2 with next offset 2); empty file gives System reminder: File exists but has empty contents; limit=0 gives a no-lines-read reminder. Versions: deepagents 0.7.38, langchain 1.5.0, Python 3.12; fake model with scripted tool calls.