Skip to content

refactor: consolidate OpenCode templates and add support for tasks, tools, and workflows#1556

Merged
bmadcode merged 1 commit intobmad-code-org:mainfrom
dracic:fix/opencode
Feb 6, 2026
Merged

refactor: consolidate OpenCode templates and add support for tasks, tools, and workflows#1556
bmadcode merged 1 commit intobmad-code-org:mainfrom
dracic:fix/opencode

Conversation

@dracic
Copy link
Copy Markdown
Contributor

@dracic dracic commented Feb 6, 2026

Fix OpenCode Agent Discovery

Summary

BMAD agents weren't appearing in OpenCode's Tab-switchable agent list after installation. This PR adds proper OpenCode-specific templates with the required mode: primary frontmatter field.

Problem

After running npx bmad-method install and selecting OpenCode:

  • Only default "build" and "plan" agents appeared in the Tab-switchable list
  • BMAD agents (PM, Architect, Dev, etc.) were missing from the agent selector
  • The /bmad-master command loaded agents but they weren't discoverable via Tab

Root Cause

The template loading flow was broken:

  1. platform-codes.yaml sets template_type: opencode but no header/body overrides
  2. _config-driven.js:loadTemplate() skipped split templates (none configured)
  3. Tried combined/opencode-agent.md - file didn't exist
  4. Fell back to combined/default-agent.md which contains disable-model-invocation: true
  5. OpenCode doesn't recognize disable-model-invocation and requires mode: primary for Tab-switching

Solution

Created OpenCode-specific combined templates with proper frontmatter:

Template Key Fields
opencode-agent.md mode: primary (enables Tab-switching)
opencode-workflow.md description only
opencode-workflow-yaml.md description only
opencode-task.md description only
opencode-tool.md description only

Key Differences from Default Template

Field Default OpenCode
mode Missing primary
name Present Removed (OpenCode derives from filename)
disable-model-invocation true Removed (not recognized)
Path reference Hardcoded _bmad Dynamic {{bmadFolderName}}

Changes

Added

  • tools/cli/installers/lib/ide/templates/combined/opencode-agent.md
  • tools/cli/installers/lib/ide/templates/combined/opencode-workflow.md
  • tools/cli/installers/lib/ide/templates/combined/opencode-workflow-yaml.md
  • tools/cli/installers/lib/ide/templates/combined/opencode-task.md
  • tools/cli/installers/lib/ide/templates/combined/opencode-tool.md

Removed (orphaned files, never used)

  • tools/cli/installers/lib/ide/templates/split/opencode/header.md
  • tools/cli/installers/lib/ide/templates/split/opencode/body.md
  • tools/cli/installers/lib/ide/templates/split/opencode/ directory

Testing

  1. Run npx bmad-method install and select OpenCode
  2. Verify generated files in .opencode/agent/ have mode: primary in frontmatter
  3. Verify NO files contain disable-model-invocation
  4. Open OpenCode and press Tab - BMAD agents should appear in the list

Risk Assessment

  • Low risk: Only adds new template files, no code changes to installer logic
  • No breaking changes: Other IDE installations unaffected
  • Existing installations: Users need to re-run installer to get fixed templates

…ools, and workflows

- Move opencode/body.md to combined/opencode-agent.md with frontmatter
- Add combined templates for tasks, tools, and workflows (both .md and .yaml)
- Replace hardcoded _bmad path with {{bmadFolderName}} variable
- Remove split/opencode/ templates (header.md, body.md)
- Add .gitkeep to preserve empty split/ directory
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

The PR updates IDE templates for OpenCode integration by modifying the agent template to use a configurable folder name placeholder instead of hardcoded _bmad, adding four new template files for tasks, tools, and workflows with standardized YAML front matter and instruction structures, and removing an obsolete header template file.

Changes

Cohort / File(s) Summary
Agent Template Update
tools/cli/installers/lib/ide/templates/combined/opencode-agent.md
Modified to add YAML front matter with mode: primary and description placeholder; updated file path resolution from hardcoded _bmad to configurable {{bmadFolderName}}.
New Task, Tool, Workflow Templates
tools/cli/installers/lib/ide/templates/combined/opencode-task.md, opencode-tool.md, opencode-workflow.md, opencode-workflow-yaml.md
Added four new template files with consistent YAML front matter structure and placeholder variables; each defines execution instructions for BMAD tasks, tools, and workflows with standardized step-by-step procedures.
Removed Legacy Header Template
tools/cli/installers/lib/ide/templates/split/opencode/header.md
Deleted obsolete header template file containing simple YAML field definitions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • bmadcode
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: consolidate OpenCode templates and add support for tasks, tools, and workflows' directly and comprehensively describes the main changes: consolidation of OpenCode templates and addition of new template types (tasks, tools, workflows).
Description check ✅ Passed The description provides detailed context about the OpenCode agent discovery issue, root cause analysis, the solution with new templates, testing instructions, and risk assessment—all clearly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bmadcode bmadcode merged commit f7b5f03 into bmad-code-org:main Feb 6, 2026
7 checks passed
dickymoore pushed a commit to dickymoore/BMAD-METHOD that referenced this pull request Feb 6, 2026
…ools, and workflows (bmad-code-org#1556)

- Move opencode/body.md to combined/opencode-agent.md with frontmatter
- Add combined templates for tasks, tools, and workflows (both .md and .yaml)
- Replace hardcoded _bmad path with {{bmadFolderName}} variable
- Remove split/opencode/ templates (header.md, body.md)
- Add .gitkeep to preserve empty split/ directory
@dracic dracic deleted the fix/opencode branch February 8, 2026 08:46
adambiggs added a commit to adambiggs/BMAD-METHOD that referenced this pull request Feb 13, 2026
…in templates

Remove hallucinated mode: primary from opencode-agent template - OpenCode
defaults to mode: all and mode: primary does not enable Tab-switching as
the original PR bmad-code-org#1556 claimed. Restore the name frontmatter field across
all OpenCode templates to match the standard pattern used by other IDEs.
bmadcode pushed a commit that referenced this pull request Feb 13, 2026
…in templates (#1644)

Remove hallucinated mode: primary from opencode-agent template - OpenCode
defaults to mode: all and mode: primary does not enable Tab-switching as
the original PR #1556 claimed. Restore the name frontmatter field across
all OpenCode templates to match the standard pattern used by other IDEs.
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.

2 participants