Repository navigation
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
The task and skill tool descriptions are statically inlined with the full list of all available agents/skills on every API call. This means every turn pays a fixed token cost proportional to the number of configured agents and skills, regardless of whether the user needs them.
How it works today
task.ts — on every init(), fetches all non-primary agents and concatenates their names + descriptions into the tool's description field:
const agents = await Agent.list().then(x => x.filter(a => a.mode !== "primary"))
const description = DESCRIPTION.replace("{agents}",
accessibleAgents.map(a => `- ${a.name}: ${a.description}`).join("\n")
)skill.ts — similarly inlines all skills as XML blocks into the tool description:
...accessibleSkills.flatMap((skill) => [
` <skill>`,
` <name>${skill.name}</name>`,
` <description>${skill.description}</description>`,
` <location>${pathToFileURL(skill.location).href}</location>`,
` </skill>`,
])Token cost
With 21 custom agents and 3 skills, this adds ~2,000 tokens per turn just in tool descriptions. For power users with 27+ agents and 7+ skills (common in multi-project setups), this can reach ~3,500 tokens per turn — entirely wasted when the user doesn't need to launch a subagent or load a skill in that particular turn.
Combined with MCP tools (see #7399) and other built-in tool descriptions (see #9858), the fixed overhead can consume 15-20% of the context window before any conversation even starts.
Proposed Solution
Make agent/skill lists dynamically loaded on demand instead of statically inlined.
Option A: Two-step tool call (recommended)
The task tool description becomes a fixed ~200 tokens:
Launch a new agent to handle complex, multistep tasks autonomously.
Call with action="list" to see available agent types, or provide a
subagent_type to launch an agent directly.
[usage notes...]
When the LLM needs to pick an agent, it calls task(action="list") → returns the full agent catalog as a tool result. This result lives in conversation history and is naturally available for subsequent turns without re-sending.
Same pattern for skill:
Load a specialized skill. Call with action="list" to see available
skills, or provide a skill name to load it.
Option B: Summary in description, detail on demand
Keep a one-line-per-agent summary in the description (just names, no descriptions), and add a task(action="describe", agent="foo") to get the full description when needed.
Benefits
- Saves ~2-3.5k tokens per turn for users with many agents/skills
- Scales gracefully — 100 agents costs the same as 3 until you actually need the list
- Consistent with how MCP tools themselves work (tools are registered, not described inline)
- The agent/skill list is typically only needed once per conversation (first time a subagent is spawned)
Related issues
- [FEATURE]: Filter which tools are loaded from MCP servers (includeTools/excludeTools) #7399 — MCP tool filtering (complementary, addresses a different axis of tool bloat)
- [FEATURE]: Token Consumption Analysis and Requirement for a Plugin Disable Feature for Agents #9858 — Token consumption analysis (documents the problem, this issue proposes a solution)
Activity
github-actions commentedon Feb 11, 2026
Thanks for the detailed feature request! This complements #8277 (lazy loading for MCP tools) nicely — while #8277 tackles context bloat from external MCP servers, this issue addresses the same problem for internal agents and skills.
Both follow similar patterns and could potentially share implementation approaches. Worth keeping an eye on the discussion in #8277 for any relevant insights.
eugenio commentedon Apr 2, 2026
Additional evidence: 1,500+ skills exhaust the entire context window
Adding data from my environment that shows this issue at scale.
Environment
opencode-skills-antigravityplugin (~1,330 skills) + LabClaw (~240 nested skills)Measurements from NadirClaw raw request logs
system_prompt_length<skill>XML blocksImpact
BadRequestError— even simple prompts like "hi" fail onautomodeWorkaround
Moved all skills from
~/.config/opencode/skills/to a separate directory and use@zenobius/opencode-skillfulplugin for lazy discovery. System prompt dropped from ~595KB to ~9KB.This confirms the same root cause identified in this issue — skill descriptions should not be statically inlined into the system prompt.
ref: #20647
malhashemi commentedon Apr 14, 2026
This was the way OpenCode worked for both skills and subagents some time ago, see #7042 and #7165. If it is no longer working as intended this seems like a regression. Not sure if it was intentional decision or an introduced bug.
HeyChriss commentedon Apr 22, 2026
I had the same problem installing the opencode-skills-antigravity plugin (~1,330 skills). The alert shows up, and the workaround of moving the skills to ~/.config/opencode/skills/ works; however, it is not ideal.
iatxako commentedon May 8, 2026
Real-world impact: 32K tokens just to start a session
Running OpenCode with:
~/.agents/skills/and~/.claude/skills/Breakdown
The problem
I want skills available on-demand but not paying for their descriptions every single session. The current design forces a trade-off:
There is no middle ground: no config to disable skills per-session, no lazy loading of the skill list, no way to have skills installed but turned off.
Request
Implement one of:
opencode.jsonallows marking skills as inactiveThis matters most for users with many skills who do not use all of them in every session.
github-actions commentedon Jul 9, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.