Show HN: Stop parallel AI coding sessions clobbering each other's handoffs A developer released a tool that prevents parallel AI coding sessions from overwriting each other's handoff files. The solution uses a PreToolUse hook that enforces ownership markers on handoff files, blocking writes from sessions that don't match the file's session ID. The tool addresses a gap in existing handoff systems, which focus on preserving context across sessions but fail to prevent concurrent overwrites that silently destroy needed context. Hook-enforced ownership for AI coding session handoffs. Most "handoff" tools solve amnesia : capture state to a markdown file, restore it after compaction or a new session. That problem is well covered. This one solves the problem nobody enforces: concurrent clobber . When two sessions work the same repo, or you resume on a second machine, or a background agent runs alongside an interactive one, they overwrite each other's handoff notes and you do not find out until the context you needed is gone. The fix here is not a better template. It is a PreToolUse hook that makes a cross-session overwrite structurally blocked, not merely discouraged. Every handoff file's first line is an ownership marker: php < -- claude-session: 9e0d3802-... -- There is no sidecar .lock file. Ownership travels with the artifact through git, across devices, through a mv . A PreToolUse hook reads the calling session's id and compares it to the marker in the content being written and the marker already on disk. Mismatch blocks the write. To write a handoff that says who wrote it, the session needs to know its own id. It does not. The model has no native access to its session id . So the first write of a fresh handoff is designed to fail . The block reason carries the id: Handoff write missing or wrong ownership marker. Your session id: 9e0d3802-4f... . Prepend exactly this as line 1: < -- claude-session: 9e0d3802-4f... -- Then retry. The model copies the id from the failure and retries. One block per fresh handoff, and the file is now self-identifying for every future session. The missing capability becomes a one-time handshake. A model that is blocked on Write will route around you. So the guard covers every way a file can be mutated: Write validates the marker in the new content. Edit validates the marker on disk and blocks edits to legacy marker-less files until you take ownership with a Write . Bash matches shell redirects to handoff paths , , tee , sed -i and blocks unowned writes that try to sneak past the file tools. It also accepts both the Claude Code tool schema Write / Edit / Bash and the Gemini CLI schema write file / replace / run shell command in one hook, because gating on one silently disables the guard for the other client. hooks/handoff-write-guard.mjs PreToolUse: the ownership guard hooks/handoff-session-start.mjs SessionStart: surface existing handoffs + slug overlaps hooks/handoff-stop-gate.mjs Stop: once-per-session "you have no handoff" nudge hooks/pre-commit-staged-marker-check.mjs git pre-commit: block commits mixing two sessions' handoffs hooks/test/handoff-write-guard.test.mjs node --test suite 8 cases scripts/handoff-migrate-archive.mjs archive stale, marker-less legacy handoffs scripts/install-git-hooks.sh per-device installer for the pre-commit hook skills/handoff/SKILL.md the /handoff slash command rules/session-handoff.md the convention the hooks enforce settings.example.json hook wiring to merge into ~/.claude/settings.json Handoffs are expected under the standard Claude Code memory layout: ~/.claude/projects/