Skip to content

Tool calling when using opencode-skills plugin seem to loop and fail. #4158

Closed

Description

@DamianPereira

Description

Original issue: malhashemi/opencode-skills#27 (comment)

Hi! I've noticed that when using this plugin, tool calling seems to be broken, tool calling seems to keep calling the same tool over and over again after each response. Deep details are on the ticket I reported to the plugin, which was closed as not solve since it looks like a tool error.

But the clearest and most actionable example I have is using the brainstorming skill, with grok model like this: https://opencode.ai/s/gYW6TggF

Main problem:

The skill loaded again? This seems like a loop.
Evaluating Skill Behavior
The skill appears to be reloading, suggesting a potential loop in the process.

Other repros

  • I have also found similar problems when using minimax m2 (free) from openrouter: https://opencode.ai/s/1Xpf1G9F
  • Interestingly, big pickle handles this workflow perfectly, asking 1 quesiton at a time, and never reloading the skill: https://opencode.ai/s/tY09Wyyq, qwen3-coder from opencode zen seems to be handling it as well.

It looks like it's happening with smaller models, but also with minimax m2.

OpenCode version

1.0.46, latest available in brew.

Steps to reproduce

Install and enable https://www.npmjs.com/package/opencode-skills
Try to use https://github.com/obra/superpowers/blob/main/skills/brainstorming/SKILL.md to create a design doc

Operating System

Mac OS 15.6.1 (24G90)

Terminal

Iterm 2

Activity

  1. github-actions commented on Nov 10, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • [MiniMax M2] Agent stop at the middle of the work #4112: [MiniMax M2 via OpenRouter] Incorrect side panel title & agent stop at the middle of the work - This issue specifically mentions MiniMax M2 via OpenRouter having problems where the agent stops in the middle of work and requires manual "Please continue" responses, which sounds very similar to the looping/reloading behavior you're experiencing.
    • Tool calls abort, fail, syntax error #4042: Tool calls abort, fail, syntax error - While this is about JSON syntax errors rather than loops, it's another tool calling failure issue that might be related.

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Nov 10, 2025

    @rekram1-node
    Collaborator

    @DamianPereira is this an issue with opencode or with the skills plugin? We dont maintain the plugin so I don't think this is a bug on our end?

  3. self-assigned this
    on Nov 10, 2025
  4. rekram1-node commented on Nov 10, 2025

    @rekram1-node
    Collaborator

    Oh I see ur comment, so this is just a model calling the same tool multiple times?

    We do have some detection to try and prevent that but ultimately that is up to the model, better ones tend to not loop on the same call over and over

    Free models from openrouter commonly have issues like this

  5. DamianPereira commented on Nov 10, 2025

    @DamianPereira
    Author

    I thought it was a plugin level issue and reported there, but I got sent here since it was probably an opencode level issue.

    Is there a way to prevent tool calling to "pose" as the user? A lot of models seem to get confused when calling tools and understand the response as the user themselves. Or try to talk with the tool instead of with the user.

    The looping is not so bad, but the main issue is that with multi step process it tends to fast-forward like the minimax m2 logs I attached, (go through many steps of the main process just repeating the tool).

  6. rekram1-node commented on Nov 10, 2025

    @rekram1-node
    Collaborator

    wdym by this?

    Is there a way to prevent tool calling to "pose" as the user

  7. DamianPereira commented on Nov 10, 2025

    @DamianPereira
    Author

    Managed to reproduce something similar, it actually kept working through it: https://opencode.ai/s/ZFFNXrie

    You can see that after succesfully generating the right approach (ask the first question), instead of answering on the main chat, it runs another tool call to the same tool. It's like once it loads the tool it stays "inside" that tool.

    Maybe posing by the user is not the right explanation, it's more like "it starts talking with the skill instead of to me"

    skills_brainstorming
    description
    Understanding Tic Tac Toe Platform Scope
    prompt
    Ask this question to the user: What's the primary purpose and scope of your tic tac toe platform? A) Simple single-player game for casual play B) Multiplayer platform for competitive play with rankings C) Educational tool to teach programming/game theory D) Full-featured gaming platform with tournaments and social features Please choose one option and let me know if none perfectly match your vision, or if you want something different.

    It's like it's trying to use the tool in a way that it doesn't make sense. Every time you answer something, it will go back to the tool and keep trying to use it.

  8. rekram1-node commented on Nov 10, 2025

    @rekram1-node
    Collaborator

    @DamianPereira but that seems like a bug with the skills implementation right?

  9. DamianPereira commented on Nov 10, 2025

    @DamianPereira
    Author

    I thought so at first, but from the plugin maintainer (@malhashemi ):

    To clarify: the plugin only exposes a tool as described in SKILL.md. It cannot initiate or force tool calls, whether and how a tool is invoked is entirely up to the model. Given that, this looks like a model/integration issue and would be better tracked in the OpenCode repo.

  10. malhashemi commented on Nov 10, 2025

    @malhashemi
    Contributor

    Hi @rekram1-node to clarify this, it is as you suggested is probably a model issue. I referred him to track the issue here so we keep track of which models are performing poorly with tool use. Not sure if you can do anything about it though.

    As for @DamianPereira the behaviour of presenting skill as user message is by design as this is how you avoid tool call responses getting purged in longer context and how Claude Code does it, if you want to get the skill as a tool response feel free to pin the plugin to an older release, see the readme on the plugin repo for instructions.

  11. DamianPereira commented on Nov 10, 2025

    @DamianPereira
    Author

    Is there a chance that we can have a new kind of response type in opencode that works like "remember this and keep going" or rather than "this is that the user is saying" like current plugin does?

    Or maybe a way for tools to attach themselves so they get sent at the end of every prompt.

  12. rekram1-node commented on Nov 12, 2025

    @rekram1-node
    Collaborator

    that sounds kinda like system reminders

  13. taqtiqa-mark commented on Nov 22, 2025

    @taqtiqa-mark

    Also will help to document if this aims to be drop-in compatible with Claude plugins, or if they need to be ported to OC?

  14. DamianPereira commented on Feb 10, 2026

    @DamianPereira
    Author

    Forgot to circle back on this, but the same models that used to fail are much more consistent with the native opencode skills implementation. This is no longer a problem.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions