Add sdd init orphan cleanup of installed legacy skills - #7
Merged
Conversation
SkillStatus walked bundle entries only, so a file left behind by a removed bundle source was invisible to the whole install pipeline (s-tac-zaz). It now also walks the install directory and reports what has no embedded counterpart, and init sweeps those for every rendered agent after the install pass. The stamp is the ownership marker: a file with no sdd-content-hash is a skill of the user's own sharing the directory, so it is neither removed nor reported. A stamped orphan still matching its stamp is removed; an edited one is preserved and named, and goes only under --force — the same rule pruneAgentSkills already applies to a dropped agent's render. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The orphan sweep arrived as a near-copy of pruneAgentSkills. Both now feed removePrunable, which owns the shared rule — unmodified files go, edited ones are preserved and named, --force takes those too, emptied directories are cleaned up. Each caller keeps only what differs: which files it offers, and that a dropped agent also takes its parent skills dir. SkillStampIsAhead stops an older binary pruning what a newer one installed: absence from the running bundle is not evidence a later sdd never shipped it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…se bundle source is ... SDD-Mutation: entry-20260905-112554-s-tac-3ja
SDD-Mutation: summary-20260905-112554-s-tac-3ja-416463235f34b340
The sweep read every Markdown file under the install directory to decide ownership, so one it could not read — a foreign file closed by permissions, a directory it may not enter — failed SkillStatus and took the whole init down, including the install pass that calls it first. Ownership is what the read establishes, and establishing it is the only thing that leads to deletion, so a path that cannot be read is passed over: never deletes more, at worst leaves an orphan for a later run. Files already known to be sdd's are read by the bundle-entry loop, where a failure still stops everything. Reported by Greptile on #7. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greptile Summary
This PR extends
sdd initto discover and remove SDD-stamped installed skill files that are no longer present in the embedded bundle.Confidence Score: 4/5
The PR should not merge until orphan discovery no longer aborts initialization because of unreadable files that SDD does not own.
The recursive scan introduces a concrete initialization failure path by reading all foreign Markdown files before ownership classification; the remaining cleanup, downgrade protection, and refactoring behavior appears sound.
Files Needing Attention: internal/finders/skill.go
Important Files Changed
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "sdd: summarize 20260905-112554-s-tac-3ja..." | Re-trigger Greptile