diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..6f7d132
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+update.bat -text
diff --git a/update.bat b/update.bat
index ff88d66..8b6a45b 100644
--- a/update.bat
+++ b/update.bat
@@ -1,35 +1,64 @@
-@echo off
-rem fullstack-agent: give your AI a full stack — memory, voice, face, hands.
-rem Copyright (C) 2026 Jared Rhodenizer
-rem
-rem This program is free software: you can redistribute it and/or modify
-rem it under the terms of the GNU Affero General Public License as published
-rem by the Free Software Foundation, either version 3 of the License, or
-rem (at your option) any later version.
-rem
-rem This program is distributed in the hope that it will be useful,
-rem but WITHOUT ANY WARRANTY; without even the implied warranty of
-rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-rem GNU Affero General Public License for more details.
-rem
-rem You should have received a copy of the GNU Affero General Public License
-rem along with this program. If not, see .
-rem
-rem SPDX-License-Identifier: AGPL-3.0-or-later
-
-rem Pulls the newest version of every installed piece, and of this repo.
-rem Your files live outside the repos, so updates never touch them. If git
-rem reports a conflict on a config you edited, your edit wins.
-
-cd /d "%~dp0.."
-for %%r in (fullstack-agent ai-memory-vault backtalk barehands ai-visualizer) do (
- if exist "%%r\.git\" (
- echo == %%r
- rem show what is arriving BEFORE applying it
- git -C "%%r" fetch -q origin 2>nul
- git -C "%%r" log --oneline "..@{u}" 2>nul
- git -C "%%r" pull --ff-only
- )
-)
-echo update complete.
-if not exist "%USERPROFILE%\Desktop\Update *" echo Tip: want a desktop Update icon that does this on a double-click? Open your agent and ask for one.
+@echo off
+rem fullstack-agent: give your AI a full stack. memory, voice, face, hands.
+rem Copyright (C) 2026 Jared Rhodenizer
+rem
+rem This program is free software: you can redistribute it and/or modify
+rem it under the terms of the GNU Affero General Public License as published
+rem by the Free Software Foundation, either version 3 of the License, or
+rem (at your option) any later version.
+rem
+rem This program is distributed in the hope that it will be useful,
+rem but WITHOUT ANY WARRANTY; without even the implied warranty of
+rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+rem GNU Affero General Public License for more details.
+rem
+rem You should have received a copy of the GNU Affero General Public License
+rem along with this program. If not, see .
+rem
+rem SPDX-License-Identifier: AGPL-3.0-or-later
+
+rem Pulls the newest version of every installed piece, and of this repo.
+rem Your files live outside the repos, so updates never touch them. If git
+rem reports a conflict on a config you edited, your edit wins.
+
+rem Run from a temp copy: cmd reads .bat files by byte offset, so a script
+rem that updates itself mid-run gets garbled. The copy is immune.
+if "%~1"=="__run__" goto run
+copy /y "%~f0" "%TEMP%\fsa-update.bat" >nul
+call "%TEMP%\fsa-update.bat" __run__ "%~dp0"
+exit /b %errorlevel%
+
+:run
+setlocal
+cd /d "%~2.."
+for %%r in (fullstack-agent ai-memory-vault backtalk barehands ai-visualizer) do (
+ if exist "%%r\.git\" call :one "%%r"
+)
+echo update complete.
+if not exist "%USERPROFILE%\Desktop\Update *" echo Tip: want a desktop Update icon that does this on a double-click? Open your agent and ask for one.
+exit /b 0
+
+:one
+echo == %~1
+rem show what is arriving BEFORE applying it
+git -C "%~1" fetch -q origin 2>nul
+git -C "%~1" log --oneline "..@{u}" 2>nul
+rem one-time migration (2026-08): the per-piece configs moved out of git
+rem tracking so an update can never collide with personal settings. If
+rem this clone still tracks one, lift it aside, pull, put it back as-is.
+set CFG=
+if "%~1"=="backtalk" set CFG=backtalk.json
+if "%~1"=="barehands" set CFG=barehands.json
+if "%~1"=="ai-visualizer" set CFG=ai-visualizer.json
+set MIGRATE=0
+if not defined CFG goto pull
+if not exist "%~1\%CFG%" goto pull
+git -C "%~1" ls-files --error-unmatch "%CFG%" >nul 2>nul
+if errorlevel 1 goto pull
+copy /y "%~1\%CFG%" "%~1\%CFG%.mine" >nul
+git -C "%~1" checkout -- "%CFG%"
+set MIGRATE=1
+:pull
+git -C "%~1" pull --ff-only
+if "%MIGRATE%"=="1" if exist "%~1\%CFG%.mine" move /y "%~1\%CFG%.mine" "%~1\%CFG%" >nul
+exit /b 0
diff --git a/update.sh b/update.sh
index 9231676..4ba2b23 100755
--- a/update.sh
+++ b/update.sh
@@ -25,18 +25,40 @@
HERE="$(cd "$(dirname "$0")" && pwd)"
HOME_DIR="$(dirname "$HERE")"
-for repo in fullstack-agent ai-memory-vault backtalk barehands ai-visualizer; do
- if [ -d "$HOME_DIR/$repo/.git" ]; then
+# Everything runs from main() so the whole script is parsed before any of
+# it executes; updating this very file mid-run can then never garble it.
+main() {
+ for repo in fullstack-agent ai-memory-vault backtalk barehands ai-visualizer; do
+ [ -d "$HOME_DIR/$repo/.git" ] || continue
echo "== $repo"
# show what is arriving BEFORE applying it, so "what changed?"
# answers itself on every update
git -C "$HOME_DIR/$repo" fetch -q origin 2>/dev/null
git -C "$HOME_DIR/$repo" log --oneline "..@{u}" 2>/dev/null | sed "s/^/ new: /"
+ # one-time migration (2026-08): the per-piece configs moved out of git
+ # tracking so an update can never collide with personal settings. If
+ # this clone still tracks one, lift it aside, pull, put it back as-is.
+ CFG=""
+ case "$repo" in
+ backtalk) CFG="backtalk.json" ;;
+ barehands) CFG="barehands.json" ;;
+ ai-visualizer) CFG="ai-visualizer.json" ;;
+ esac
+ MIGRATE=0
+ if [ -n "$CFG" ] && [ -f "$HOME_DIR/$repo/$CFG" ] && \
+ git -C "$HOME_DIR/$repo" ls-files --error-unmatch "$CFG" >/dev/null 2>&1; then
+ cp "$HOME_DIR/$repo/$CFG" "$HOME_DIR/$repo/$CFG.mine" && \
+ git -C "$HOME_DIR/$repo" checkout -q -- "$CFG" && MIGRATE=1
+ fi
git -C "$HOME_DIR/$repo" pull --ff-only || \
echo " (couldn't fast-forward; your local edits win. See the note at the top of this script.)"
+ if [ "$MIGRATE" = 1 ] && [ -f "$HOME_DIR/$repo/$CFG.mine" ]; then
+ mv "$HOME_DIR/$repo/$CFG.mine" "$HOME_DIR/$repo/$CFG"
+ fi
+ done
+ echo "update complete."
+ if ! ls "$HOME/Desktop/Update "*.command >/dev/null 2>&1; then
+ echo "Tip: want a desktop Update icon that does this on a double-click? Open your agent and ask for one."
fi
-done
-echo "update complete."
-if ! ls "$HOME/Desktop/Update "*.command >/dev/null 2>&1; then
- echo "Tip: want a desktop Update icon that does this on a double-click? Open your agent and ask for one."
-fi
+}
+main "$@"