Safe multi session deploy
Claude/agent skill: safe deploys when multiple agent sessions share one working tree (wrong-project guard, foreign-edit check, multi-session merge, live provenance verify).
npx -y skills add Madwr1d/safe-multi-session-deployAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use BEFORE committing or deploying any repo that multiple Claude/agent sessions may share (Vercel/Railway/Node web apps). Prevents the three failure modes of concurrent sessions on one working tree — clobbering another session's unsaved work, deploying to the WRONG linked project, and not knowing which session's build is actually live. Stamps a session-tagged build provenance marker and verifies it post-deploy.
SKILL.md
5.6 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it
Safe Multi-Session Deploy
When several agent sessions share one working directory (a real situation: 4 sessions once raced on the same repo), three things go wrong. This skill is the checklist that prevents each.
The three failure modes (all observed in production)
- Clobbering unsaved work — a deploy uploads the whole working tree, so another session's in-progress edits ship (or your edits get overwritten).
- Wrong-project deploy —
.vercel/project.jsonis linked to a stale or duplicate project, sovercel --prodbuilds successfully but to a project with no live domain; the real site never updates and you think you shipped. - Invisible provenance — after deploy you can't tell which session's code is actually live, or whether the alias even moved.
Identify your session
At the start, derive a stable short session code and remember it for the rest of the session:
SESSION=$(echo "${CLAUDE_SESSION_ID:-$$-$(date +%s)}" | sha1sum | cut -c1-6)
Use it in commit trailers and the build stamp.
Before you COMMIT
- Never
git add -A. Stage only the specific files you changed. - Add a session trailer so concurrent sessions are distinguishable in history:
git commit -m "<msg>" -m "Session: $SESSION" - If two sessions edit the same file, prefer one git worktree per session
(
git worktree add ../wt-$SESSION <branch>) — hard isolation beats coordination (the 2026 industry-standard pattern for parallel agents).
Before you DEPLOY — run the guard
Run scripts/deploy-guard.sh (see below) or do these checks by hand:
- Confirm the linked project is the intended one. Read
.vercel/project.jsonprojectNameand compare to the project that actually owns the target domain (vercel project ls→ match the Latest Production URL to your domain). If they differ, STOP — re-link withvercel link --project <correct> --yesfirst. (This is failure mode #2.) - Check for foreign unsaved work.
git status --porcelainmust show no uncommitted changes you didn't make; and no source file modified in the last ~15 min that isn't yours. If found, coordinate before deploying. (Mode #1.) - Build locally as the gate. Never deploy a tree that fails
build/tsc. - Stamp provenance. Write
public/version.json(or pass a build env) with{ session, sha, builtAt, project }so the live artifact reveals its origin. - Verify post-deploy. After deploy, fetch
https://<domain>/version.jsonand assertsession+shamatch what you just built. If it doesn't match, the alias didn't move or you hit the wrong project — investigate, don't declare success. (Modes #2 and #3.)
The script
scripts/deploy-guard.sh <domain> [vercel-project-name] runs all of the above
for a Vercel + Next.js/Vite repo. Read it before first use; adapt paths
(public/ for static, --build-env GIT_SHA= for SSR) to the project.
Showing provenance in-app (optional but recommended)
Render the stamp somewhere subtle (a footer chip, like the xXTrade floor game's
in-game version hash): fetch /version.json client-side and show
session·sha. Then anyone — you or another session — can read which build is
live at a glance.
Combining every session's work into one build (the "pre folder", done right)
The goal: when N sessions work in parallel, the deployed build contains ALL of their work, nothing is silently lost, and you can prove whose code is live.
Do NOT implement this as a shared folder that sessions copy into and "merge" — file-copy can't do a real merge, so same-file edits silently clobber each other. Git is the correct "pre folder": it does true 3-way merges and FLAGS conflicts.
The workflow (scripts/integrate-and-deploy.sh automates it):
- Every session commits to its own branch
session/<code>— committed, not left in the working tree. (Pre-req: the whole app must be git-tracked. If most files are untracked, fix THAT first —git addthe app — or no merge can include them.) - Integration branch
pre(orstaging): merge everysession/*branch into it withgit merge --no-ff. If git reports a conflict, STOP and have it resolved — that conflict is exactly the "two sessions changed the same thing" case a folder copy would have destroyed. - Build gate on the merged
pre. - Stamp
version.jsonwith ALL contributing sessions + shas so the live build proves it contains everyone's work. - Deploy from the committed
prebranch, never the mutable working tree. - Verify the live
version.jsonlists your session among the merged set. - Serialize deploys with a lock (a short-lived
pre-branch tag or a.deploy-lockfile) so two sessions don't deploy simultaneously.
This gives you exactly what the folder idea wanted — all sessions' work in one live build, always visible — but with conflict safety and provenance.
Red flags that mean STOP
- "The build succeeded so it must be live" — verify
/version.json, always. - "git status looks clean" but files were modified minutes ago by no one you know — another session is active; coordinate.
- The domain you expect isn't in the linked project's
vercel project lsrow.
What ships with it: 4 files
10.7 KB alongside SKILL.md, 2 of them executable
scripts/
- deploy-guard.shruns3.5 KB
- integrate-and-deploy.shruns4.0 KB
Gives 0 of the 12 instructions most context ai engineering skills give in ~1.3k tokens
Counted across 1,193 of the 1,976 authors here whose files we hold, read 2026-08-07
- Dispatch a fresh implementer subagent per taskin 48 of 1193, across 19 files
- Dispatch a final code reviewer after all tasksin 33 of 1193, across 8 files
- Provide full task text to the subagentin 30 of 1193, across 9 files
- Review spec compliance before code qualityin 27 of 1193, across 10 files
- Make the hook script executablein 26 of 1193, across 8 files
- Re-snapshot after navigation or DOM changesin 25 of 1193, across 19 files
- Read files before editing themin 22 of 1193, across 11 files
- Answer subagent questions before proceedingin 22 of 1193, across 7 files
- Mark task complete in TodoWrite after approvalin 22 of 1193, across 6 files
- Merge hook into existing settingsin 21 of 1193, across 3 files
- Ask if installation is global or projectin 20 of 1193, across 2 files
- Copy the hook script to target locationin 20 of 1193, across 2 files
Said here and by no other author read
- add a session trailer to git commits
- confirm linked project matches target domain
- abort deployment if untracked changes exist
- build locally before deploying
- write a session stamped version json file
- verify live version json matches local build
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.