Skip to content

fix(sync): remove undeclared Skills that sync installed - #241

Merged
harlan-zw merged 2 commits into
mainfrom
fix/sync-remove-undeclared
Nov 17, 2026
Merged

harlan-zw merged 2 commits into
mainfrom
fix/sync-remove-undeclared

Conversation

@harlan-zw

@harlan-zw harlan-zw commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

No linked issue.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

When a declaration dropped a Skill, skilld sync kept its lockfile entry, its store directory, and its Agent target links. Agents kept loading the dropped Skill until someone removed it by hand. In harlan-agent-kit, renamed Skills stayed linked into every Agent target for six weeks.

Sync now records "installedBy": "sync" on each lockfile entry it writes. When no declaration in the store names an entry with that record, sync removes it. The removal runs in the same transaction as the install, so a failed sync restores the store directory, the links, and the lockfile entry.

  • Sync removes an Agent target link only when it points into this store. It removes a copy only when its files match the store. Other paths stay in place.
  • skilld sync --check exits 1 and prints Skill NAME is no longer declared. After a sync, the output prints Removed Skill NAME. It is no longer declared.
  • Sync never removes an entry without the record, such as one from skilld install or an older sync. It prints Skill NAME is not declared. Sync did not install it, so sync keeps it. and the skilld remove command that removes it. These entries alone do not make --check exit 1.
  • The next sync records the installer on declared entries that an older sync wrote.
  • JSON output adds an undeclared array of Removable and Kept items. A Kept item carries removeCommand.

A CLI without this change rejects a lockfile that contains installedBy.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

A Skill dropped from a declaration stayed in the store lockfile and
stayed linked into every Agent target. Renamed Skills in the
harlan-agent-kit store stayed visible to Agents for six weeks, and
`skilld remove -g` cannot reach a store chosen with SKILLD_DATA_DIR.

Sync now removes each lockfile entry that no declaration in the store
names, in the same transaction as the install. It removes Agent target
links that point into this store and copies whose files match it, and
leaves every other path in place. `--check` names each such Skill.
@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Nov 17, 2026
@harlan-github-agent

harlan-github-agent Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-11-17 08:43 UTC.

GitHub merged this pull request.

  • Logged (78/100): Sync cannot prune the final declared Skill. View code Optional follow-up: Optional follow-up: accept empty declarations and support transactional removal-only batches using the supplied snapshot.
    • Ask an agent to verify and fix this finding
  • Logged (65/100): Pruning treats permission-modified copies as unchanged. View code Optional follow-up: Optional follow-up: compare target file permissions with the canonical copy before authorizing deletion; preserve copies whose permissions differ.
    • Ask an agent to verify and fix this finding
  • Logged (68/100): Successful removal output hides copies that Agents still load. View code Optional follow-up: Optional follow-up: propagate preserved target paths into the report and warn that those copies remain active and require manual cleanup.
    • Ask an agent to verify and fix this finding

10cb7e45-eb0a-4bd7-b8a9-84597ea6f05d

Selected findings run after merge and open separate pull requests.

@harlan-zw harlan-zw added the harlan-agent-review Approve automated work for the current issue state or pull request head commit. label Nov 17, 2026
@harlan-github-agent harlan-github-agent Bot added harlan-agent-pending The automated Review is waiting on a gate for this head commit. and removed harlan-agent-review Approve automated work for the current issue state or pull request head commit. harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Nov 17, 2026

@harlan-github-agent harlan-github-agent Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harlan Agent Kit posted this automated review. AI open source policy.

Automated Review: READY.

Read the Review results

@harlan-github-agent harlan-github-agent Bot added harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-pending The automated Review is waiting on a gate for this head commit. labels Nov 17, 2026
Removing every undeclared lockfile entry also removed Skills that
`skilld install` put in the same store. Sync now records
`installedBy: sync` on each entry it writes, and removes an undeclared
entry only when it carries that record.

Entries without the record come from `skilld install` or an older
sync. Sync keeps them and prints the `skilld remove` command that
removes them; they alone do not fail `--check`. The next sync records
the installer on declared entries that an older sync wrote.
@harlan-zw harlan-zw changed the title fix(sync): remove Skills that are no longer declared fix(sync): remove undeclared Skills that sync installed Nov 17, 2026
@harlan-zw harlan-zw added the harlan-agent-review Approve automated work for the current issue state or pull request head commit. label Nov 17, 2026
@harlan-github-agent harlan-github-agent Bot added harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-review Approve automated work for the current issue state or pull request head commit. harlan-agent-ready The automated Review passed every gate on this head commit. harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Nov 17, 2026

@harlan-github-agent harlan-github-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harlan Agent Kit posted this automated review. AI open source policy.

Automated Review: READY.

Read the Review results

@harlan-zw
harlan-zw merged commit 09969c1 into main Nov 17, 2026
4 checks passed
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-ready The automated Review passed every gate on this head commit. label Nov 17, 2026
@harlan-zw harlan-zw mentioned this pull request Nov 17, 2026
1 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant