fix(opencode): strip tools array from cavecrew agent frontmatter#443
Open
ousamabenyounes wants to merge 1 commit into
Open
fix(opencode): strip tools array from cavecrew agent frontmatter#443ousamabenyounes wants to merge 1 commit into
ousamabenyounes wants to merge 1 commit into
Conversation
OpenCode rejects YAML array form `tools: [Read, Grep, Bash]` on startup (Expected object | undefined). Strip the tools line on copy into ~/.config/opencode/agents/; OpenCode falls back to default tool set and cavecrew subagent prompts already self-restrict in the body. Closes 386 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Author
Verified RED/GREEN proof (run on
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #386
Summary
OpenCode rejects YAML array form
tools: [...]for subagent frontmatter and refuses to boot:installOpencode()inbin/install.jscopiedagents/cavecrew-*.mdverbatim into~/.config/opencode/agents/. Three files affected:cavecrew-investigator.md,cavecrew-builder.md,cavecrew-reviewer.md.Fix
New helper
bin/lib/opencode-agent.jsexportsstripOpencodeAgentTools(content)that removes thetools:line (inline-array form and multi-line YAML list form) from the leading frontmatter block. Installer's section 3 now reads β strips β writes instead ofcopyFileSync.OpenCode allows omitting
toolsentirely; it then falls back to its default tool set. The cavecrew subagent prompts already self-restrict in the body ("Read-only locator", "NoBashavailable", etc.), so dropping the array form is safe.Source files in
agents/are left untouched β they keep the Claude Code schema for the Claude Code plugin path. Transform applies only on the OpenCode copy.Verification
Baseline (main): 47 pass / 4 fail / 51 total β 4 pre-existing opencode failures (caveman-compress.md missing in
src/plugins/opencode/commands/, separate issue).Post-fix: 56 pass / 4 fail / 60 total β 9 new tests, zero regressions, same 4 pre-existing failures.
TDD verification
Logs persisted locally in
~/.claude/contribute/working/caveman/issue_386_{RED,GREEN}.log.Files changed
bin/lib/opencode-agent.jsstripOpencodeAgentTools()helper.bin/install.jsinstallOpencodenow sanitizes on copy.tests/installer/opencode-agent.test.mjsdescription: >, no-frontmatter, no-tools, non-string, real shipped files RED/GREEN, end-to-end installer-equivalent copy.