Skip to content

bug(opencode): cavecrew agent files use invalid tools format, breaking OpenCode startup #386

@paolomainardi

Description

@paolomainardi

🤖 This was written by an AI agent on behalf of @paolomainardi.

Description

The cavecrew agent files shipped in agents/ use a YAML array for the tools frontmatter field:

tools: [Read, Grep, Bash]

OpenCode expects tools to be an object (map of tool name to boolean) or undefined — not an array. This causes OpenCode to reject the config on startup:

Configuration is invalid at /home/user/.config/opencode/agents/cavecrew-reviewer.md
↳ Expected object | undefined, got ["Read","Grep","Bash"] tools

OpenCode refuses to start until the invalid file is removed. The only workaround is rm -rf ~/.config/opencode/agents/, which also removes any user-created agent files.

Affected files

All three cavecrew agents have the same issue:

  • agents/cavecrew-reviewer.mdtools: [Read, Grep, Bash]
  • agents/cavecrew-builder.md — likely same pattern
  • agents/cavecrew-investigator.md — likely same pattern

Root cause

installOpencode() in bin/install.js copies agent files verbatim from the repo's agents/ directory into ~/.config/opencode/agents/. These agent files were written for Claude Code's frontmatter schema, which accepts a tools array. OpenCode uses a different schema where tools must be an object or omitted entirely.

The correct OpenCode format uses permission instead of tools:

permission:
  read: allow
  grep: allow
  bash: allow
  edit: deny

Suggested fix

Either:

  1. Convert the frontmatter to use OpenCode's permission schema before copying (transform in installOpencode())
  2. Ship separate OpenCode-compatible agent files (e.g. in src/plugins/opencode/agents/)
  3. Strip the tools field when copying to the OpenCode agents dir, since OpenCode defaults to allowing all tools when the field is omitted

Environment

  • OpenCode latest
  • caveman: installed via node bin/install.js --only opencode
  • OS: Linux (Arch)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions