Repository navigation
feat(config): add preserveUnownedSkills to keep unmanaged skills under --delete - #4018
Merged
Merged
Conversation
…r --delete With `delete` on and `preserveUnownedSkills: true`, the orphan sweep no longer removes whole skill directories (or a flattening target's skill files) that this run did not generate, while the in-directory sweep still removes stale files inside the skill directories the run generates, and `generate --check` still reports them. Retiring `skills` with the option on removes only the skills the current sources generate for the retired tool. Rulesync keeps no record of skills generated by earlier runs, so a skill removed from `.rulesync/skills/` is left behind as well; the docs say so. Off by default and config-file only, like `preserveUnownedHooks`. Closes #4015 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…ile filter List the skills the sources own for a retired tool on a processor with a silent logger, so its conversion warnings are not printed again, and add a Takt retirement test for the flat-file ownership filter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
This was referenced Nov 29, 2026
Merged
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.
Summary
Adds an opt-in
preserveUnownedSkillsoption (parallel topreserveUnownedHooks) sogenerate --deletecan prune stale files inside the skill directories it generates without removing skills Rulesync does not manage — the common situation in global mode, where~/.claude/skills/and~/.agents/skills/are shared with other installers.What changed
src/config/config.ts,src/config/config-resolver.ts: newpreserveUnownedSkillskey (defaultfalse, config-file only — no CLI flag, same aspreserveUnownedHooks). The JSON schema is derived from the Zod schema, so it picks the key up automatically.src/lib/generate.ts: withdeleteand the new key on, the skills sweep skipsremoveOrphanAiDirs(whole skill directories) andremoveOrphanFlatFiles(Takt's flat skill files), and still runsremoveOrphanFilesInAiDirson the directories this run generates.generate --checktherefore still reports a stale in-directory file, exactly as--checkreports what--deletewould remove.src/lib/retire-targets.ts: retiringskillswith the key on removes only the skill directories/files the current.rulesync/skills/sources generate for the retired tool, so--retire-targetsdoes not wipe unmanaged skills either.docs/guide/configuration.md(option reference),docs/guide/global-mode.md(deleteand shared user-scope directories),docs/reference/cli-commands.md(--deleteskill-sweep note and retirement notes);src/generated/docs-content.tsregenerated.old.txtremoved, unmanagedmanual/kept,--checkfails while the stale file exists and passes afterwards). The e2e tests were confirmed to fail with the option off.Design decision (made autonomously)
The issue offered two options. Option 2 (opt-in key) was chosen; option 1 (running the in-directory sweep with
deleteoff) was not, because it would delete files whiledeleteis off, changing behavior for every existing user.Ownership record: Rulesync has no record of the skill outputs earlier runs generated (the only output lock is
.rulesync-hooks-lock.jsonfor hooks;rulesync.lockand friends track source installs, not generated outputs). So with the key on, a skill removed from.rulesync/skills/cannot be told apart from an unmanaged one and is left behind too. This trade-off is documented; the user removes such a directory by hand. Adding a skills output lock could close that gap later but would be a larger change.For retirement, the current sources are the only ownership evidence available, so retirement with the key on removes exactly the skills the sources would generate for the retired tool.
Skipped
preserveUnownedHookshas none either (it is a property of the output root, not of a run).Closes #4015
🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4