From the round-1 review of #216 (issue #174).
Where: .claude/skills/update-xmech-page/SKILL.md:56-57 and step 11 (rm -rf "${SNAP:?}").
The skill's only definition of SNAP is "Put the snapshot and logs in the session scratchpad, here $SNAP". Read literally, that names the scratchpad itself, and no step assigns SNAP or creates a directory for it. The :? guard catches an unset variable, but not SNAP set to the scratchpad root.
Failure scenario: a later refresh sets SNAP to the scratchpad. Step 11 then deletes the whole scratchpad. In this session that would have included the git worktrees of five open PRs (wt-148, wt-149, wt-173, wt-174, and wt-150 before it merged), taking any uncommitted changes with them, plus about 200 unrelated working files.
Fix:
- In step 1, create a dedicated directory,
SNAP=<scratchpad>/xmech-refresh-<date>, and refuse if it already exists.
- In step 11, remove only a directory that is recognizably the snapshot:
revisions.json and mechs/ present.
From the round-1 review of #216 (issue #174).
Where:
.claude/skills/update-xmech-page/SKILL.md:56-57and step 11 (rm -rf "${SNAP:?}").The skill's only definition of
SNAPis "Put the snapshot and logs in the session scratchpad, here$SNAP". Read literally, that names the scratchpad itself, and no step assignsSNAPor creates a directory for it. The:?guard catches an unset variable, but notSNAPset to the scratchpad root.Failure scenario: a later refresh sets
SNAPto the scratchpad. Step 11 then deletes the whole scratchpad. In this session that would have included the git worktrees of five open PRs (wt-148, wt-149, wt-173, wt-174, and wt-150 before it merged), taking any uncommitted changes with them, plus about 200 unrelated working files.Fix:
SNAP=<scratchpad>/xmech-refresh-<date>, and refuse if it already exists.revisions.jsonandmechs/present.