Skip to content

Add dynamic skill loading: batch ops + capacity reporting (#52)#76

Merged
devrimcavusoglu merged 1 commit into
mainfrom
feature/m6-dynamic-loading-batch
May 2, 2026
Merged

Add dynamic skill loading: batch ops + capacity reporting (#52)#76
devrimcavusoglu merged 1 commit into
mainfrom
feature/m6-dynamic-loading-batch

Conversation

@devrimcavusoglu
Copy link
Copy Markdown
Owner

Summary

Phase 1 of #52 — dynamic skill loading. Lets agents manage their working set of installed skills against per-platform capacity thresholds.

  • Batch install/uninstall: skern skill install a b c --platform <p> accepts multiple skill names; per-skill outcomes in skills[]. Partial failures don't abort the batch; non-zero exit only when every op fails.
  • Capacity block in every install/uninstall JSON response: {platform, scope, installed, threshold, headroom, over_budget} — agents 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: enriches each entry with installed_on[] (detected platforms where the skill is currently installed at the registry skill's scope).
  • --platform all removed (D6): each invocation targets exactly one platform; agents specify the platform they're running on. --platform all now exits with a validation error.
  • Per-platform per-scope thresholds lifted into internal/skill/capacity.go (project=20, user=50; project ≤ user invariant tested).
  • Smoke tests fixed on Windows: os.UserHomeDir() reads %USERPROFILE% on Windows, ignoring bash's $HOME. setup_env now mirrors HOME into USERPROFILE (via cygpath -w) under msys/cygwin/win32. All 57 smoke tests pass.

Spawned #75 (skill stats) as the D5 follow-up.

Decision summary (from issue thread)

ID Decision
D1 Capacity is advisory; --enforce-budget is opt-in for hard refusal.
D2 LRU state at ~/.skern/state/usage.json — Phase 3, gated.
D3 Batch is the primitive; #48 sync sits on top.
D4 Per-platform AND per-scope (project vs user counted separately).
D5 Skill count is the budget metric. Stats follow-up tracked in #75.
D6 One platform per invocation; --platform all removed.

Breaking change

JSON envelope for skill install / skill uninstall changed shape:

Before After
Top level {skill, scope, platforms[]} {platform, scope, skills[], capacity}
Per-entry {platform, success, error} {skill, success, error}

Bumps next release to v0.2.0.

Test plan

  • make fmt clean
  • make lint — 0 issues
  • make 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
  • Capacity invariant tested (project ≤ user threshold)
  • Docs updated: AGENTS.md, commands.md, quick-start.md, agent-setup.md, platform-adapters.md, platforms/index.md

🤖 Generated with Claude Code

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>
@devrimcavusoglu devrimcavusoglu merged commit 1017c64 into main May 2, 2026
4 checks passed
@devrimcavusoglu devrimcavusoglu deleted the feature/m6-dynamic-loading-batch branch May 2, 2026 21:38
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