Skip to content

fix: keep the subagent list visible in the task tool description - #21

Open
karimodm wants to merge 1 commit into
openchamber:mainfrom
karimodm:fix/task-agent-list-truncation
Open

karimodm wants to merge 1 commit into
openchamber:mainfrom
karimodm:fix/task-agent-list-truncation

Conversation

@karimodm

Copy link
Copy Markdown

Claude Code cuts MCP tool descriptions at 2048 characters. OpenCode's task tool description is about 2300 characters of guidance, and the "Available agent types…" list comes after it. So the list is always cut off. On claude-code/* models, Claude doesn't know which subagent_type values exist. It guesses, or it avoids custom subagents entirely.

This PR adds fitToolDescription() in src/tool-description.ts. When a description is over the limit and contains OpenCode's agent-list marker, the list is moved to the front and the full guidance follows it. Nothing is removed on our side; the cut now falls on the end of the generic guidance. Other tools and short descriptions are unchanged.

Test: test/tool-description-regression.ts checks that every agent is inside the first 2048 chars after the reorder (none are before it), that the full guidance and list are both kept, and that short or list-less descriptions pass through unchanged. bun test/smoke.ts and tsc --noEmit pass.

For context, we run a condensed version of the guidance locally (about 1850 chars in total) so the most useful rules also fit. I left that out because it hard-codes OpenCode's wording. Happy to add it if you prefer.

Claude Code cuts MCP tool descriptions at 2048 chars. OpenCode appends
the available subagents after ~2300 chars of guidance, so Claude never
saw valid subagent_type values. Move the list to the front of long
descriptions; the cut then falls on the tail of the guidance.
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