Repository navigation
fix(skills): load installed skills via sandbox carve-out and deterministic activation - #571
Merged
Merged
Conversation
Closed
5 tasks
…istic activation Installed skills were unusable when the agent ran outside the project directory (e.g. the @infer CI bot installs to ~/.infer/skills): the Read sandbox blocked the only path to a skill's SKILL.md, and activation was left entirely to the model. - Sandbox: allow read access to ~/.infer/skills and ./.infer/skills when agent.skills.enabled, mirroring the existing ~/.claude carve-out. This unblocks the model's on-demand Read of SKILL.md (and references/*.md). - Deterministic activation: on explicit invocation ("/<name>" or "use the <name> skill") inject the invoked skill's metadata (description + path) as an ACTIVE SKILL pointer, so the agent reliably knows to read and apply it regardless of mode (chat, agent, channels, heartbeat). The SKILL.md body stays progressive-disclosure, read on demand via the Read tool. - Chat: route "/<known-skill>" input to the agent instead of dead-ending as "Unknown shortcut". Closes #569
edenreich
force-pushed
the
fix/skills-loading-569
branch
from
June 1, 2026 18:18
6bf4706 to
3bd0c5d
Compare
Use the global one for skills - this could be overwehlming a lot of files.
edenreich
commented
Jun 1, 2026
edenreich
commented
Jun 1, 2026
edenreich
commented
Jun 1, 2026
edenreich
commented
Jun 1, 2026
edenreich
commented
Jun 1, 2026
edenreich
commented
Jun 1, 2026
edenreich
commented
Jun 1, 2026
Co-authored-by: Eden Reich <[email protected]>
3 tasks done
edenreich
added a commit
that referenced
this pull request
Jun 1, 2026
Resolve conflict in internal/agent/agent_utils.go: keep both this branch's GitHub gh-CLI guidance (buildGitHubGuidanceInfo) and main's deterministic skill activation (buildActiveSkillInfo, #571) in buildContextInfo. Thread messages through buildSystemPromptText so BuildSystemPrompt() passes nil for a fresh session (no active skill yet).
inference-gateway-releaser Bot
pushed a commit
that referenced
this pull request
Jun 1, 2026
## [0.117.0](v0.116.0...v0.117.0) (2026-06-01) ### 🚀 Features * add GitHub issue references autocomplete and inline expansion ([#574](#574)) ([5056c9d](5056c9d)), closes [#N](https://github.com/inference-gateway/cli/issues/N) [#573](#573) ### 🐛 Bug Fixes * **skills:** load installed skills via sandbox carve-out and deterministic activation ([#571](#571)) ([18a9287](18a9287)), closes [#569](#569) ### ♻️ Code Refactoring * **system-prompt:** add available tools info to system prompt ([a913728](a913728)) * remove built-in Github tool in favor of the gh CLI ([#572](#572)) ([4c74997](4c74997)) * **config:** remove inline redundant comment ([c389929](c389929)) * system prompt - reduce tokens ([0be4b3a](0be4b3a)) ### 👷 CI/CD * centralize infer.yml + bump infer CLI and sync .infer config ([#567](#567)) ([c0369de](c0369de))
Contributor
|
🎉 This PR is included in version 0.117.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
edenreich
added a commit
that referenced
this pull request
Jun 2, 2026
…ditionally (#578) Resolves #577 ## Summary Follow-up to #569 / #571 (shipped in v0.117.0). The sandbox carve-out for `~/.infer/skills` and `./.infer/skills` was conditional on `c.Agent.Skills.Enabled` being true at `ValidatePathInSandbox` time. When that flag is not set — running with default config, before `infer config agent skills enable` has run, or when the `INFER_AGENT_SKILLS_ENABLED` override has not reached the validator — the carve-out silently did not fire and reads of `SKILL.md` were denied with `outside configured sandbox directories`. Skills directories are a well-known, read-only allowlist under `~/.infer/`. Gating their **sandbox visibility** on a runtime feature flag re-introduces the failure mode #569 was meant to remove. ## Changes 1. **DefaultConfig()**: Include `./.infer/skills` and `~/.infer/skills` in `Sandbox.Directories` unconditionally (no flag gating). 2. **ValidatePathInSandbox()**: Remove the `c.Agent.Skills.Enabled`-gated `isWithinSkillsDir` branch from the `carveOut` expression. The `tmp/plans` carve-out is preserved as it is orthogonal. 3. **checkProtectedPaths()**: Add `isWithinSkillsDir()` short-circuit at the top so that the broader `.infer/` protected-path pattern does not deny readable skills files. Skills dirs are fully trusted. 4. **Tests**: Rewrite `TestValidatePathInSandbox_SkillsCarveOut` to verify that skills reads succeed with `DefaultConfig()` and `Skills.Enabled=false`, that `~/.infer/config.yaml` and `conversations.db` remain protected, and that `skills-evil` sibling dirs are still rejected. ## Why this is better - One source of truth for *what is readable*: `Sandbox.Directories`. No second runtime predicate to keep in sync. - `agent.skills.enabled` goes back to meaning exactly "load skill metadata into the prompt and offer them to the agent" — purely about discovery/loading, no sandbox semantics. - No env-var plumbing required from `infer-action` or any other consumer. - Behavior is identical across `chat`, `infer agent`, channels, and heartbeat — no per-mode flag drift. ## Follow-up Once this lands and a new CLI is cut: - `inference-gateway/infer-action` — bump `inputs.version.default` in `action.yml` to the new CLI release. - `inference-gateway/.github` — bump `cli-version` default in the centralized infer workflow. --------- Co-authored-by: {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/users/users#get-the-authenticated-user","status":"403"} <{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/users/users#get-the-authenticated-user","status":"403"}+{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/users/users#get-the-authenticated-user","status":"403"}@users.noreply.github.com> Co-authored-by: Eden Reich <[email protected]>
inference-gateway-releaser Bot
pushed a commit
that referenced
this pull request
Jun 2, 2026
## [0.117.1](v0.117.0...v0.117.1) (2026-06-02) ### 🐛 Bug Fixes * **sandbox:** move skills dirs into default Sandbox.Directories unconditionally ([#578](#578)) ([e67222e](e67222e)), closes [#577](#577) [#569](#569) [#571](#571) [#569](#569) ### 👷 CI/CD * **infer:** centralize infer.yml + bump infer CLI and sync .infer config ([#575](#575)) ([bcf7ca4](bcf7ca4))
Closed
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
Fixes #569 — installed skills were unusable when the agent ran outside the project directory (notably the
@inferCI bot, which installs to~/.infer/skills/). Two compounding defects, both addressed:buildSkillsInfo()tells the model toReadeach SKILL.md, but~/.infer/skills/is outside the default Read sandbox, so the Read was denied.Changes
config/config.go):ValidatePathInSandboxnow allows read access to~/.infer/skillsand./.infer/skillswhenagent.skills.enabled, mirroring the existing~/.claudecarve-out. This unblocks the model's on-demandReadofSKILL.mdandreferences/*.md.checkProtectedPathsstill runs first, so protected files under the skills dir remain denied.internal/agent/agent_utils.go): a newbuildActiveSkillInfo()scans user messages for an explicit invocation (/<name>or "use the<name>skill") and injects the invoked skill's metadata (description + path) into the system prompt as anACTIVE SKILLpointer instructing the agent to read and follow it. This works in every mode (chat,infer agent, channels, heartbeat) since all funnel throughaddSystemPrompt. The SKILL.md body stays progressive-disclosure — read on demand via the Read tool (now reachable thanks to the carve-out), not inlined.internal/handlers/chat_message_processor.go):/<known-skill>input is routed to the agent (which then flags the skill active) instead of dead-ending as "Unknown shortcut".Get(name)lookup was added todomain.SkillsService(used by both the agent matcher and the chat router).Design note
Activation detection is centralized in the agent rather than duplicated across entry points, because
addSystemPromptis the single funnel for all run modes. Per maintainer review, the full body is not injected — only a deterministic pointer + metadata; the body remains progressive-disclosure via Read.Tests
config: carve-out allows both scopes when enabled, rejects when disabled, rejects lookalike sibling dirs, and protected paths still block.skills:Gethit/miss + scope precedence.agent: trigger matrix — slash, phrase (case-insensitive), adjacent/foo /bar, two-skill plural header, dedupe across messages, unknown token ignored, assistant-message ignored, nil service.handlers:/skillroutes as a message; non-skill/xyzstill hits the shortcut path.task test+task lintgreen.Follow-up
[DOCS]ticket forinference-gateway/docs(skills activation + sandbox behavior) should accompany this PR.