bug(install): Claude Code install writes agents/*.compact.md under the same name as the canonical agents, so Claude Code loads only one of each pair by directory order
Pre-submission checklist
- I have searched existing issues and this bug has not already been reported
GSD Version
1.14.0 (also checked against next at e1f72cd)
Runtime
Claude Code
Operating System
Windows
Node.js Version
v24.21.0
Shell
PowerShell 7 / Git Bash (not shell-dependent)
Installation Method
Updated from a previous version
What happened?
Updating a global Claude Code install from 1.13.0 to 1.14.0 (/gsd-update, which runs npx -y --package=@opengsd/gsd-core@latest -- gsd-core --claude --global) installed 29 agents/gsd-*.compact.md files into ~/.claude/agents/, each next to its canonical agents/gsd-*.md. Every compact file declares the same frontmatter name as its canonical twin, so 29 agent names are now defined twice in one directory. For example:
| File | Frontmatter |
|---|---|
~/.claude/agents/gsd-code-reviewer.md |
name: gsd-code-reviewer |
~/.claude/agents/gsd-code-reviewer.compact.md |
name: gsd-code-reviewer |
Claude Code identifies a subagent only by its name. For two files in the same agents directory it "loads only one of them, chosen by filesystem read order rather than a documented precedence" (sub-agents docs, "Choose the subagent scope"), and /doctor reports same-name files as something to fix. So for these 29 agents, whether a dispatch of gsd-code-reviewer, gsd-code-fixer, gsd-roadmapper and so on runs on the full persona or on the compact one is decided by directory order, regardless of workflow.compact_content.
On the Claude runtime GSD itself never reads these files. The compact persona fallback in agent-skills is gated to non-claude runtimes (the block in src/init.cts commented "GATED to non-claude runtimes: Claude Code supports named subagent dispatch", from #2454 / #4407). On Claude the compact files have no consumer and can only shadow the canonical persona.
The install tree looks intentional: tests/fixtures/install-tree/claude.json on next (e1f72cd) lists all 29 agents/*.compact.md entries, and agents/ on next still holds 64 files, 29 of them compact.
What did you expect?
A Claude Code install should leave exactly one agent file per name under ~/.claude/agents/, so every gsd-* subagent resolves to its canonical persona. Any of these would do it:
- skip
agents/*.compact.mdwhen installing for runtimes that dispatch named subagents from that directory (Claude Code at least), since only the AGENTS-native fallback reads them; - install the compact personas outside the directory the runtime's agent loader scans, for example a sibling directory that the
agent-skillsfallback reads; - give the compact files a
namethat cannot collide with the canonical agent.
Steps to reproduce
npx -y --package=@opengsd/[email protected] -- gsd-core --claude --globalls ~/.claude/agents/*.compact.md | wc -lshows 29 files.grep -H '^name:' ~/.claude/agents/gsd-code-reviewer.md ~/.claude/agents/gsd-code-reviewer.compact.mdshowsname: gsd-code-reviewerfor both (same for the other 28 pairs).- Optionally run
/doctorin Claude Code, which flags the duplicate names.
Error output / logs
No response
GSD Configuration
No response
GSD State (if relevant)
No response
Runtime settings.json (if relevant)
No response
How often does this happen?
Every time (100% reproducible)
Impact
Moderate — Feature is broken but I have a workaround
Workaround (if any)
Delete ~/.claude/agents/*.compact.md after every install or update. On the Claude runtime GSD does not read them (see above), so nothing else changes. Each update puts them back, so the step has to be repeated.
Additional context
- Related: #4407 and #4553 (compact agent-persona payloads), epic #4139.
- Which of the two files Claude Code keeps depends on the filesystem's directory order, so the effect can differ between machines while the duplicate names are the same everywhere.
Privacy Checklist
- I have reviewed all pasted output for PII (usernames, paths, API keys) and redacted where necessary
Source: open-gsd/gsd-core