mirror of
https://github.com/EveryInc/compound-engineering-plugin.git
synced 2026-06-19 15:41:46 +02:00
99284a64c6
When writing Codex custom agents, delete any same-basename sibling directory under agentsRoot if the retained agent declares zero sidecarDirs. Previously, cleanupRemovedAgents only swept the sibling directory when the TOML itself was being removed — a same-name agent that lost its sidecar between plugin versions left an orphan directory indefinitely. The new sweep is narrowly scoped: it only runs against base names of agents in the current install and only when the agent declares no sidecars, so unrelated directories under agentsRoot are untouched. Gated by isSafeManagedPath to match the existing cleanup safety pattern. Tests cover the three scenarios: orphan removed when agent has no sidecars, sidecar preserved when agent declares one, unrelated directory left alone. Per docs/plans/2026-04-21-001-refactor-flatten-agents-directory-plan.md Unit 4b. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>