Repository navigation
feat(skills): progressive discovery from centralized skills catalog - #973
Merged
Merged
Conversation
Adds SkillsDiscoveryConfig with Enabled/RegistryURL/Cleanup fields to AgentSkillsConfig. Adds SkillScopeCatalog scope and Discover/CleanupDynamic methods to SkillsService interface. Implements CatalogClient for fetching skill metadata from the registry index and downloading skill bodies on demand, reusing the existing Installer. Adds SKILLS DISCOVERY section to system prompt when discovery is enabled (omitted when disabled). Wires CleanupDynamic in container Shutdown. Updates docs/skills.md with full discovery order including catalog fallback.
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
edenreich
reviewed
Jul 30, 2026
Co-authored-by: Eden Reich <[email protected]>
edenreich
reviewed
Jul 30, 2026
Co-authored-by: Eden Reich <[email protected]>
edenreich
reviewed
Jul 30, 2026
…iter FakeSkillsService
inference-gateway-maintainer
Bot
force-pushed
the
fix/issue-972
branch
from
July 30, 2026 21:41
ef3eb96 to
cc5470a
Compare
edenreich
reviewed
Jul 30, 2026
…iter FakeSkillsService
edenreich
reviewed
Jul 30, 2026
Co-authored-by: Eden Reich <[email protected]>
…on path Skill discovery shipped config, an HTTP client and a prompt paragraph but no execution path: the catalog index was never listed and Discover had no production callers, so catalog skills never reached the / dropdown. - catalog: extract a cached Index() from Lookup, fix the default registry to catalog.json in inference-gateway/skills, and authenticate the index fetch with GITHUB_TOKEN/GH_TOKEN (only for GitHub hosts, so a custom registry_url never sees the token) - skills: merge catalog entries into Load as metadata-only skills with an empty Path; Discover fills that Path in place and resolves local skills before the discovery gate - agent: render catalog entries in AVAILABLE SKILLS without a path so the static system prompt stays byte-stable when a skill is installed mid-session; the concrete path rides in the per-request volatile tail - chat: prompt for approval before installing a catalog skill, remembering declines for the session; headless installs without approval - ui: color not-installed catalog skills distinctly in the dropdown and input
inference-gateway/skills was hardcoded in two places - the install shorthand constants and the catalog registry URL - so pointing registry_url at a private catalog still downloaded the skill bodies from the public repo. agent.skills.repository (INFER_AGENT_SKILLS_REPOSITORY) now drives all three: the `infer skills install <name>` shorthand, on-demand catalog downloads, and the catalog index base, which is derived from it when registry_url is unset. An explicit registry_url still wins for a catalog hosted outside the repo. A malformed value is rejected at config load rather than 404ing later.
…prompt The AVAILABLE SKILLS block applied max_chars inside its loop and then appended the name of every omitted skill, so a 1000-entry catalog produced ~20KB against a 4000-char budget. That string rides in the static system prompt, so the cost was paid on every request and sat in the KV-cache prefix. Skills with a local SKILL.md are now expanded first, since those are the ones the model can Read, and the tail is a count pointing at the new search command rather than a list of names. Catalog descriptions are truncated to the same limit local skills are validated against, and the index response is capped with an io.LimitReader. `infer skills search [term]` fuzzy-matches names and word-matches descriptions over the fetched index, since catalog.json is a static file with no server-side query. Descriptions are truncated to keep the table readable (--no-trunc for the full text) and the header shows the catalog release.
registry_url only redirected the catalog index; the skill bodies always resolved against agent.skills.repository. So a catalog hosted elsewhere could only ever list skills that live in that repo anyway, which makes it a knob promising something the code cannot deliver. agent.skills.repository already drives the index, the downloads, and the install shorthand together. Tests keep an unexported newCatalogClientWithBase seam for pointing at an httptest server. The key never shipped on main, so there is nothing to migrate.
The Installed column said yes or no. The path is what you want next once you know a skill is on disk, and it says the same thing by being present. Rendered relative to the working directory for a project skill and ~-prefixed for a user-global one - an absolute path is 80+ columns and wraps the table borders the description truncation was added to avoid. JSON output keeps installed as a bool and adds path.
6 tasks
Contributor
|
🎉 This PR is included in version 0.155.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
edenreich
added a commit
that referenced
this pull request
Sep 20, 2026
) ## The crash `infer chat` panics and tears down the TUI the moment `/` is typed: ``` strings: negative Repeat count strings.Repeat(...) tui/autocomplete.(*AutocompleteImpl).renderItems(..., 0x3, 0x1c, 0xb3) autocomplete.go:981 ``` ## Root cause — bytes used as display columns `formatting.TruncateText` cuts to **display columns** (`ansi.StringWidth` / `ansi.Truncate`), but `renderItems` padded the result with `len()` — **bytes**: ```go description := formatting.TruncateText(cmd.Description, descWidth) paddedDescription := description + strings.Repeat(" ", descWidth-len(description)) ``` One multibyte rune in a description long enough to be truncated pushes `len()` past the column budget and the count goes negative. Reproduced with the exact values from the trace: at a 214-column terminal `descWidth = 214 - 28 - 7 = 179` (the `0xb3`). The `motion-graphics` skill description truncated to 179 columns is **181 bytes** → `strings.Repeat(" ", -2)`. ## Why it surfaced now The code was correct until the contract changed under it: | when | what | | --- | --- | | 2026-06-27 | #667 flips `TruncateText` from `len(text) <= maxLength` (bytes) to `ansi.StringWidth` (columns) — this caller was not touched, and its padding silently became wrong | | 2026-07-31 | #973 wires the skills catalog into the autocomplete list, so skill descriptions reach this renderer | | 2026-09-16 | `inference-gateway/skills#132` adds `motion-graphics` — the only one of 25 catalog entries with a non-ASCII description (`—` U+2014, `→` U+2192) | Before #667 `len(truncated) <= maxLength` was guaranteed, so the subtraction could never go negative. Nothing in the CLI changed in September; the catalog data did. ## The fix One helper beside the function whose contract caused it, so truncation and padding always happen in the same unit: ```go func PadText(text string, width int) string { text = TruncateText(text, width) return text + strings.Repeat(" ", max(0, width-ansi.StringWidth(text))) } ``` - `autocomplete.go` — both columns route through `PadText`; `calculateMaxShortcutWidth` measures with `ansi.StringWidth` instead of `len`. - `task_management_view.go` — the two separators now use the `getSeparatorWidth()` guard that already existed for exactly this case (`strings.Repeat("─", t.width-4)` panics below 4 columns, and `t.width` is 0 until the first `WindowSizeMsg`). One copy had no guard; the other inlined a duplicate of it, now deleted. `lipgloss.NewStyle().Width(n)` was considered and rejected — it *wraps* overflow instead of truncating, which would turn one table row into several. ## Tests - `TestPadText` — table-driven, asserts `ansi.StringWidth(got) == width` and valid UTF-8 across narrow-multibyte, wide-rune and ASCII inputs. - `TestAutocomplete_RenderMultibyteDescription` — feeds the real failing shape at 214/60/20 columns and asserts the rows stay column-aligned. Verified the regression test earns its keep: reverting just the two pad lines makes it panic with the identical `strings: negative Repeat count`; restoring the fix passes. ## Checks - `task precommit:run` — 0 issues - `go test ./internal/presentation/... ./internal/platform/...` — green ## Notes No docs ticket: bug fix, no public surface change. No cross-repo impact — the trigger data lives in `inference-gateway/skills`, but nothing there needs changing. Found during the sweep, left for separate PRs: - `task_management_view.go:1116-1152` pads with `%-38s` (rune count) against a column budget — misalignment only, no panic. - `agent/infrastructure/formatter.go:258` still does a raw `text[:maxLength-3]` byte slice and emits invalid UTF-8 on multibyte input; its own test documents this at `formatter_units_test.go:86`.
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.
Resolves #972
Summary
Adds progressive skill discovery from the centralized skills catalog (
inference-gateway/skills). Whenagent.skills.discovery.enabledis true, the agent can discover and fetch skills at runtime from the registry when no local skill of that name exists. Local skills always take precedence. The feature is disabled by default and gated behind a config toggle.Changes
SkillsDiscoveryConfigstruct withEnabled,RegistryURL, andCleanupfields toAgentSkillsConfigSkillScopeCatalogscope andDiscover/CleanupDynamicmethods toSkillsServiceinterfaceCatalogClientfor fetching skill metadata from the registry index (index.json) and downloading skill bodies on demand, reusing the existingInstallerDiscover(progressive lookup + download) andCleanupDynamic(post-session cleanup) methods on theServicestructSKILLS DISCOVERYsection to the system prompt when discovery is enabled, explaining how to fetch skills from the registry; omitted when disabled (YAGNI - tokens saving)CleanupDynamiccall inShutdownfor post-session cleanup