Diff display
Agents that write files without showing you what changed are scary agents. A minimal diff, even a line count, gives the user enough signal to trust or reject. You can log this at the dispatcher, without teaching the model anything new.
// A small addition inside runWriteFile before os.WriteFile:
old, _ := os.ReadFile(clean)
before := strings.Count(string(old), "\n")
after := strings.Count(in.Content, "\n")
fmt.Fprintf(os.Stderr, "[write] %s lines: %d -> %d bytes: %d -> %d\n",
clean, before, after, len(old), len(in.Content))
if err := os.WriteFile(clean, []byte(in.Content), 0o644); err != nil {
return "", fmt.Errorf("write_file: %w", err)
}This is the simplest useful signal. Lines and bytes before and after. You can swap in a real diff library later if you want side-by-side output in the REPL.
Stderr, because stdout carries the agent is final answer. If the REPL is used as a one-shot in a script, stdout is piped downstream. Keeping diagnostics on stderr means scripts see clean answers and humans still see the audit trail.
Validation checklist: Write tool checklist
Loading practice…
Checkpoint: File write checkpoint
Loading practice…