Skip to content

[Feature] Agent-scoped skill loading: only load skills declared by the active agent #19343

Closed

Description

@jdiegosierra

Problem

When launching OpenCode with a specific agent, all skills are loaded into context, even those unrelated to the agent's purpose. There's no way for an agent to declare which skills it needs.

This matters because:

  • Context budget is finite. Loading irrelevant skill descriptions wastes tokens.
  • Auto-invocation noise: The model may consider skills that are irrelevant to the agent's domain.
  • Plugin authors building multi-domain plugins (SRE + backend + frontend) can't scope skills per agent.

Current state

OpenCode supports per-agent tool permissions (allow/deny/ask with wildcards), which is great for controlling tool access. However, this doesn't extend to skill loading — all discovered skills are loaded into context regardless of which agent is active.

Proposed solution

Allow agents to declare which skills they need via a skills field in their frontmatter. When an agent is active, only those skills' descriptions are loaded into context.

Agent declares its skills

# .opencode/agents/sre.md
---
description: "SRE agent for incident response and infrastructure tasks"
skills: ["sre-runbook", "kubernetes", "incident-response"]
---

You are an SRE agent...
# .opencode/agents/backend-developer.md
---
description: "Backend development agent"
skills: ["api-scaffold", "db-migration", "code-review"]
---

You are a backend development agent...

Behavior

  • Agent with skills: [...] → only loads descriptions for those skills
  • Agent without skills field → current behavior, loads all skill descriptions
  • Skills not in the list are not loaded into context and cannot be invoked

Alternative: skill tags

If a skills array feels too rigid, agents could declare tags instead:

# .opencode/agents/sre.md
---
description: "SRE agent"
skill-tags: ["sre", "infra"]
---
# .opencode/skills/sre-runbook/SKILL.md
---
name: sre-runbook
tags: ["sre"]
---

Skills matching any of the agent's skill-tags would be loaded.

Use case

Multi-domain engineering plugins with agents and skills for different domains (SRE, backend, frontend). When an SRE agent is active, backend scaffolding skills shouldn't consume context budget. Today there's no way to scope this — all skills load regardless of which agent is active.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 26, 2026
  2. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Feature requests must use the feature request template, which requires checking the verification box confirming the feature hasn't been suggested before.
    • The issue title should start with [FEATURE]: (all caps) to match the required format.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)needs:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions