Add dynamic skill loading: batch ops + capacity reporting (#52)#76
Merged
Conversation
Phase 1 of #52. Enables agents to manage their working set of installed skills against per-platform capacity thresholds. * Batch install/uninstall — `skern skill install a b c --platform <p>` installs multiple skills in one call; per-skill outcomes returned in `skills[]`. Symmetric for uninstall. * Capacity block — every install/uninstall response carries a `capacity` snapshot {platform, scope, installed, threshold, headroom, over_budget} so agents can react without an extra query. * `--enforce-budget` flag on install — refuses the operation when the resulting count would exceed the per-scope threshold. * `skern skill list --with-platforms` — adds `installed_on[]` per skill listing the detected platforms where it is currently installed. * `--platform all` removed (D6) — each invocation targets exactly one platform; agents specify the platform they are running on. * Per-platform per-scope thresholds lifted into `internal/skill/capacity.go` (project=20, user=50; project ≤ user invariant tested). BREAKING: SkillInstallResult / SkillUninstallResult JSON shape changed. Old: {skill, scope, platforms[]}. New: {platform, scope, skills[], capacity}. Bumps the next release to v0.2.0. Also fixes scripts/smoke_test.sh on Windows: bash sets $HOME but Go's os.UserHomeDir() reads %USERPROFILE% on Windows, so the binary wrote to a different physical location than bash assertions checked. Mirror HOME into USERPROFILE (cygpath-translated) under msys/cygwin/win32. Spawns #75 for richer skill stats (D5 follow-up). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 2, 2026
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
Phase 1 of #52 — dynamic skill loading. Lets agents manage their working set of installed skills against per-platform capacity thresholds.
skern skill install a b c --platform <p>accepts multiple skill names; per-skill outcomes inskills[]. Partial failures don't abort the batch; non-zero exit only when every op fails.{platform, scope, installed, threshold, headroom, over_budget}— agents react without an extra query.--enforce-budgetflag on install: refuses the operation when the resulting count would exceed the per-scope threshold.skern skill list --with-platforms: enriches each entry withinstalled_on[](detected platforms where the skill is currently installed at the registry skill's scope).--platform allremoved (D6): each invocation targets exactly one platform; agents specify the platform they're running on.--platform allnow exits with a validation error.internal/skill/capacity.go(project=20, user=50; project ≤ user invariant tested).os.UserHomeDir()reads%USERPROFILE%on Windows, ignoring bash's$HOME.setup_envnow mirrorsHOMEintoUSERPROFILE(viacygpath -w) under msys/cygwin/win32. All 57 smoke tests pass.Spawned #75 (skill stats) as the D5 follow-up.
Decision summary (from issue thread)
--enforce-budgetis opt-in for hard refusal.~/.skern/state/usage.json— Phase 3, gated.--platform allremoved.Breaking change
JSON envelope for
skill install/skill uninstallchanged shape:{skill, scope, platforms[]}{platform, scope, skills[], capacity}{platform, success, error}{skill, success, error}Bumps next release to v0.2.0.
Test plan
make fmtcleanmake lint— 0 issuesmake test— all packages green; 8 new tests added (batch happy path, batch partial failure, batch all-fail, enforce-budget, with-platforms, without-with-platforms, batch uninstall + capacity, --platform all rejection)make test-smoke— 57/57 passing on Windows after USERPROFILE fix🤖 Generated with Claude Code