Build Log
Concurrent Sessions Get Real Isolation
July 31, 2026
Fixed gate-evidence collisions, then rejected a homegrown session-lock scheme mid-build in favor of Claude Code's native git-worktree isolation — proven with a real two-worktree end-to-end test, including a genuine merge conflict correctly surfaced.
Timeline
What shipped
sessionKey() in .claude/hooks/lib/marker.mjs — derives a per-session key from the hook payload's session_id (falling back to transcript_path)
markerPath()/transcriptPath() take a sessKey parameter, defaulting to 'unscoped' for backward compatibility
gate-dispatch.mjs and gate-transcript-capture.mjs compute and thread the real session key through checkMarker/checkTranscript/appendTranscript
checkPushGate fixed to use --git-common-dir instead of --show-toplevel + '.git/hooks' — the same worktree-awareness fix already applied to checkCommitGate, never reapplied to this sibling function; found live by the two-worktree proof itself
.claude/settings.json: worktree.baseRef set to 'head' (repo is 200+ commits ahead of origin; the 'fresh' default would silently branch from a stale remote)
.worktreeinclude at repo root — copies required .env files into every new EnterWorktree-created worktree
.claude/rules/concurrency.md — the full operating rule, what worktrees do/don't isolate, the merge-back procedure, and 2 real tool-behavior findings from the proof
9-point two-worktree end-to-end proof, actually executed (not asserted): local-HEAD basing, independent uncommitted changes, independent staging index, independent commits, retro dirty-tree isolation, hook/gate-evidence resolution, env file availability, and real conflict detection on merge
session-start.mjs / session-finish.mjs — built, then fully reverted before ever being committed, once Claude Code's native EnterWorktree/ExitWorktree tools were found mid-session
“I don't understand, reason through it with the crucible please”