#5161·gsd-core

bug(install): every install/update silently deletes user-created skills/gsd-* dirs, including one the same run's baseline migration resolved to "keep"

Author: 0xdhxCreated Oct 1, 2026Updated Oct 1, 2026
Labelsneeds-triage

Pre-submission checklist

  • I have searched existing issues and this bug has not already been reported

GSD Version

1.15.0 (source re-read at next 404482b7a36f6bc3f450948141fa28382808bd85; the three cited source files are byte-identical at tag v1.15.0)

Runtime

Claude Code

Operating System

WSL

Node.js Version

v24.14.1

Shell

bash 5.2

Installation Method

Updated from a previous version

What happened?

Every install or update deletes any user-created <configDir>/skills/gsd-<name>/ dir that the manifest does not own, and prints nothing about it. On a first install, the same run's first-time baseline migration has already logged that exact path as → keep before the prune removes it.

What this issue is not arguing: that gsd-core must stop treating the gsd- prefix as its namespace. #1325 describes the install prune as intentionally prefix-selective, and that is a defensible design. The narrow claims are these:

  1. Two parts of the same installer give opposite answers about one path in one run. The baseline migration resolves it to keep, and the prune then deletes it.
  2. The deletion is silent. Nothing in the install log names the removed dir.
  3. The sibling prune in surface already gates deletion on manifest membership, and the install prune does not.

Mechanism. _removeGsdEntries removes every entry whose name starts with kind.prefix. It makes no manifest check:

https://github.com/open-gsd/gsd-core/blob/404482b7a36f6bc3f450948141fa28382808bd85/src/install-engine.cts#L864-L867

typescript
  for (const entry of installFs().readdirSync(destDir, { withFileTypes: true })) {
    if (!entry.name.startsWith(kind.prefix)) continue;
    installFs().rmSync(path.join(destDir, entry.name), { recursive: true, force: true });
  }

The skills call site snapshots and restores only a one-entry hard-coded allowlist. The opencode-family writer repeats the same allowlist at L1565.

https://github.com/open-gsd/gsd-core/blob/404482b7a36f6bc3f450948141fa28382808bd85/src/install-engine.cts#L1386-L1399

typescript
            const USER_OWNED_SKILL_DIRS = ['gsd-dev-preferences'];

By contrast, surface's pruneSkillDirs already treats a prefix match as necessary but not sufficient. It deletes a gsd-* dir only when the manifest names it, and it preserves an unknown one with a warning:

https://github.com/open-gsd/gsd-core/blob/404482b7a36f6bc3f450948141fa28382808bd85/src/surface.cts#L591-L616

typescript
      // Finding 1 fix: prefix match is necessary but NOT sufficient.
      // The dir must also be in the manifest to be considered GSD-owned.
      // A user-created gsd-* dir that isn't in the manifest is preserved with a warning.

The first-time baseline classifies the same path as stale-gsd-looking and offers choices: ['keep', 'remove']. Under a non-TTY run it auto-resolves to keep, but the prune that runs afterwards never consults that decision:

https://github.com/open-gsd/gsd-core/blob/404482b7a36f6bc3f450948141fa28382808bd85/src/installer-migrations/000-first-time-baseline.cts#L228-L239

What did you expect?

A user-owned gsd-* skill dir that the previous gsd-file-manifest.json does not name would survive, as it does under surface. At minimum, the install log would name each dir it removes. In any case, a baseline keep should not be followed by a deletion in the same run.

Steps to reproduce

The run is offline (unshare -rn) with a throwaway HOME and --config-dir, using the published 1.15.0 package's bin/install.js. That file is the package's gsd-core bin, so npx -y @opengsd/[email protected] … enters the same code.

bash
T=$(mktemp -d)
mkdir -p $T/home/.claude/skills/{gsd-mine,gsd-dev-preferences,xr-mine}
for d in gsd-mine gsd-dev-preferences xr-mine; do
  printf -- '---\nname: %s\n---\nx\n' $d > $T/home/.claude/skills/$d/SKILL.md
done
INST="$(npm root -g)/@opengsd/gsd-core/bin/install.js"   # @opengsd/[email protected]

# Run 1: fresh config dir (first-time baseline runs)
unshare -rn env -u CLAUDE_CONFIG_DIR HOME=$T/home node "$INST" --claude --global --config-dir $T/home/.claude </dev/null
ls $T/home/.claude/skills/gsd-mine

# Run 2: re-seed, install again (update path, no baseline)
mkdir -p $T/home/.claude/skills/gsd-mine && printf -- '---\nname: gsd-mine\n---\nx\n' > $T/home/.claude/skills/gsd-mine/SKILL.md
unshare -rn env -u CLAUDE_CONFIG_DIR HOME=$T/home node "$INST" --claude --global --config-dir $T/home/.claude </dev/null
ls $T/home/.claude/skills/gsd-mine

Error output / logs

Observed, not predicted. Run 1 exits 0. The installer log says:

  ↪ installer-migration auto-resolved: skills/gsd-mine/SKILL.md → keep (category=user-facing-skill, source=non-tty-default)
  ✓ Installer migrations
     preserved 3 user baseline files — first-time baseline scan
  ✓ Installed workflow assets
  ✓ Installed 73 skills to skills/

and then:

$ ls $T/home/.claude/skills/gsd-mine
ls: cannot access '.../home/.claude/skills/gsd-mine': No such file or directory

gsd-dev-preferences/, which is on the allowlist, and xr-mine/, which has a non-gsd- name, both survive unchanged.

Run 2 also exits 0. It deletes the re-seeded gsd-mine/ again, and nothing in its log mentions gsd-mine or any removal. grep -nE 'gsd-mine|keep|remov|prun' over the log finds no match.

How often does this happen?

Every time (100% reproducible)

Impact

Moderate — Feature is broken but I have a workaround

Workaround (if any)

Name user skills outside the gsd- prefix, or re-provision them after every install or update.

Additional context

How it showed up in practice. A routine 1.14.0 → 1.15.0 update (--claude --global) deleted a user-provisioned ~/.claude/skills/gsd-<name>/. Several projects referenced it as agent_skills: ["global:gsd-<name>"], and after the update buildAgentSkillsBlock rendered an empty block for each of them (WARNING: Global skill not found … skipping). Nothing in the update output pointed at the deletion.

The docs give users no reason to avoid the prefix. docs/CONFIGURATION.md defines global:<name> as ~/.claude/skills/<name>/SKILL.md and states no naming rule:

https://github.com/open-gsd/gsd-core/blob/404482b7a36f6bc3f450948141fa28382808bd85/docs/CONFIGURATION.md#L901-L906

The only documented gsd- reservation covers overlay-capability ids:

https://github.com/open-gsd/gsd-core/blob/404482b7a36f6bc3f450948141fa28382808bd85/docs/CONFIGURATION.md#L1204

Suggested fix (either option closes it):

  1. Manifest-gate the install prune, the way surface's pruneSkillDirs already does. Delete a gsd-* skill dir only when the previous gsd-file-manifest.json names it, and preserve anything else with the same warning surface prints. This also makes the baseline's keep binding, and USER_OWNED_SKILL_DIRS becomes a special case rather than the only escape.
  2. If the gsd- namespace is meant to be reserved, keep the prune as it is, but print each non-manifest gsd-* path it removes, stage it the way legacy commands/gsd artifacts are staged (user-artifact-staging), and document the reservation next to global:<name> in docs/CONFIGURATION.md.

A regression test for either option: seed a non-manifest skills/gsd-<x>/ and run the install twice, fresh and then update. Under option 1, assert the dir survives both runs. Under option 2, assert a staged copy plus a log line naming the path. Add a non-vacuity control that a manifest-owned gsd-* dir is still replaced.

I'm happy to open the fix PR once the direction is triaged.

Privacy Checklist

  • I have reviewed all pasted output for PII (usernames, paths, API keys) and redacted where necessary