Most changes to this site are made together with Claude Code. To go faster, I often open three or four sessions at once: one for layout, one for the radar, one for tidying the to-do list. The catch is that they all work in the same folder, and that folder is the live site itself (the scripts/server.js the desktop's scheduler runs, and the CI deploy, both live here).
Normally each edits its own files and nothing seems wrong. On 11/26 and 11/27, the following things happened one after another.
1. A commit carried someone else's files
The staging area (index) that git add fills is one copy shared by the whole folder, no matter which session put things there. Session A runs git add for its files and has not committed yet; session B then runs git add its-files && git commit, and the commit takes everything in the staging area with it.
What actually happened:
| commit | message said | actual content also included |
|---|---|---|
8fc6a04 | remove duplicate "contact me" from the home footer | watchdog.ps1, radar health check, HeroSky.tsx, fake admin data... 10 files in all |
3915209 | widen admin by screen width | 4 files, all project pages and PortfolioSection.tsx |
Nothing was broken in the code itself, but the commit message does not match the content, so later when I ask "why was this line changed" I look in the wrong place. Worse, it can push someone else's unfinished work live.
What I can do right away: before every commit, look at git diff --cached --stat, and use git commit <files...> so that only my own paths are committed. That way, even if the staging area holds someone else's work, it is not taken along.
2. No new commit, yet the deploy build failed
The deploy script deploy.ps1 goes: git pull in the live folder, then next build into whichever of the two slots is not in use, then a health check, then swap. The hole is that next build reads the files in the folder, not the version in git.
logs/deploy.log shows two clear cases:
Both say "Already up to date": nothing new was pulled, and yet the build failed. The reason is that another session was in the middle of editing. The first time, a component on the radar project page was half edited (in the same minute tsc also reported a type error in RadarSnapshot.tsx), making a project page that should have been fully static read live data. The second was more direct: a string in route.ts was half typed when the build picked it up.
Nothing went wrong this time thanks to the two-slot deploy: the new slot failed to build, and the live slot kept serving, so the cost was one wasted run and one failure email. The reverse case is scarier: something half edited by someone else that happens to build goes straight live, and git has no such version, so when something breaks I do not even know what to roll back to.
The right approach is to build in a clean copy at deploy time: git worktree add a copy of origin/main, point its node_modules back to the existing one with a junction (creating a junction on Windows needs no administrator rights), and move the build output into the slot afterwards. That is still on my to-do list, not done yet.
3. Two writers on the database: clashing numbers
The to-do list lives in data/admin.db (SQLite) and is added to with a command-line script. While tidying the list, I was about to add an item as Q13, but in the meantime another session had already added Q13 to Q17.
The database itself was fine: it had long been in WAL mode with a busy_timeout set (the story is in SQLite WAL and backup), so simultaneous writes do not corrupt the data. What broke was the flow of "look up the highest number, remember it, write later": someone cut in between the lookup and the write. I changed it to compute the next free number right before writing (mine ended up as Q18), and it went in fine.
4. Also hit: Git Bash rewrites your arguments
This is not the multi-session's fault, but I hit it the same day, and it is sneaky. Claude Code's shell on Windows is Git Bash (MSYS2), which automatically converts arguments that look like Unix paths into Windows paths before passing them to Windows programs like node. I was adding a to-do whose title started with /now:
The title stored in the database became C:/Program Files/Git/now, .... To turn the conversion off, add MSYS_NO_PATHCONV=1:
But with it off, real paths are not converted either. In the same command I used a temp file path from cygpath -u, which is /tmp/..., and Node took it as the root of the current drive:
All seven additions failed. Convert paths to Windows form yourself first: cygpath -w gives C:\Users\...\Temp\..., which reads fine whether or not MSYS_NO_PATHCONV is on.
The rule in one sentence: if an argument has text starting with /, add MSYS_NO_PATHCONV=1, and use cygpath -w for any file path on the same line.
The real fix: one worktree per session
Problems 1 to 3 share one cause: several writers sharing one working area. Git already has the answer: git worktree gives one repo several folders, each with its own branch and its own staging area, sharing the same .git history:
The Claude Code desktop app lets you tick "use a worktree" when starting a session. The live folder is then left only for deploys, with nobody editing files in it.
Both of these (deploys building in a clean copy, one worktree per session) are still on my to-do list, waiting for me to decide. Until then, the manual guardrails are:
- Commit with
git commit <my files>, and look atgit diff --cached --statfirst - When adding anything numbered, look up the free number right before writing
- In Git Bash, add
MSYS_NO_PATHCONV=1for arguments starting with/, and usecygpath -wfor paths