new-agent.sh's walk-up checked for a .git directory before checking whether it had reached $HOME, so a dotfiles-managed home directory (e.g. `~/.git` from yadm or a bare-repo checkout) made `new-agent.sh <name> ~` silently resolve to project scope instead of user scope, writing .github/agents/ instead of ~/.copilot/agents/. Check the $HOME boundary before the .git check so it can no longer be shadowed. Found via post-implementation review of issue #89.
scripts/
new-agent.sh
Scaffolds agent definition file(s) from a single root directory input.
Usage: new-agent.sh <agent-name> <root>
Resolves scope by walking up from <root>: a type:-bearing apm.yml found at or above <root> → plugin/APM scope (single file at <package-root>/.apm/agents/<name>.agent.md; an apm.yml without type: is a marketplace-only manifest and is skipped); <root> exactly ~ → user scope (~/.claude/agents/ + ~/.copilot/agents/); otherwise project scope (<root>/.claude/agents/ + <root>/.github/agents/). Each file is a no-op if it already exists. See --help for full usage.
Tests: tests/new-agent.bats (requires bats-support and bats-assert).