garrytan / garrytan/gstack

OpenCode: slash commands route to non-existent 'plan' subagent

Open
#2,629 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
133k
Forks
19.9k
Avg merge
18h 46m
Merged PRs (30d)
26

Description

## Problem

When running gstack skills in OpenCode via slash commands (e.g., `/review`), the command fails immediately with "Task cancelled." The TUI spinner runs briefly, then nothing happens.

## Root cause

`./setup --host opencode` (setup:1186-1194) wires up skills correctly — it creates the symlinks in `~/.config/opencode/skills/gstack-*/` so the `skill` tool can find them. But it never writes anything to `~/.config/opencode/commands/`.

When a user types `/review` in the OpenCode TUI, OpenCode auto-generates a command config from the skill's `name: review` frontmatter and defaults `agent: plan`. Per the [OpenCode agents docs](https://opencode.ai/docs/agents/), `plan` is a **primary agent**, not a **subagent**. The Task tool can only spawn subagents (`explore`, `general`, `scout`), so the call fails with "Task cancelled" every time.

## What works

Calling the skill directly via the skill tool works fine:

```
skill({ name: "review" })
```

The skill content loads and the workflow executes as expected.

## Proposed fix

During `./setup --host opencode`, also generate `~/.config/opencode/commands/.md` for each skill:

```yaml
---
description:
subtask: false
---
Invoke the `` skill via the skill tool and follow it strictly, including the preamble ceremony.
```

`subtask: false` (per the [commands docs](https://opencode.ai/docs/commands/#subtask)) forces the command to run in the current agent context, which loads the skill via the `skill` tool instead of trying to spawn a `plan` subagent.

## Workaround

I've written a script that does this locally: iterates `~/.config/opencode/skills/gstack-*/SKILL.md`, parses the `name:` and `description:` from frontmatter, and writes matching command files. Happy to contribute it as a PR if that helps.

## Environment

- gstack: latest (symlinked from `~/.claude/skills/gstack/`)
- OpenCode: latest
- macOS Darwin 24.x

Contributor guide

Open the contributing guide

Research direction

Start at ./setup around lines 1186-1194 and review how the OpenCode skill symlinks are created. Generate a command file for each skill using its name and first description line, with subtask: false, then verify that /review runs in the current agent context instead of failing with Task cancelled.

Written by the indexing model from the issue text.

Assessment

Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.