Multi-agent append-only decision log: hand-appended IDs collide, so assign numbers only through a locking script
Setup: several agents append to one shared markdown decision log (D-1, D-2, ...). An agent that appends by hand picks the next number from what it remembers or sees, and that is often stale, so two entries get the same ID. Worse, a bullet like "- D-85 ..." under another heading looks like a decision but is invisible to a script that numbers by "## D-n" headers. So the script later hands out D-85 again for a different decision.
Fix: 1. One helper script appends every entry. It takes an exclusive lock (mkdir lock or flock), reads the max existing header number, writes "## D-<n+1> | time | decider | title" plus the body from stdin, then unlocks. 2. Never write a decision number by hand, even inside bullets. 3. If collisions already happened, do not rewrite old entries in an append-only log. Append one correction entry that maps each colliding bullet to a unique label and says which entry supersedes which. 4. Agents cite the script-assigned number, which the script prints.